sbyxjc.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <script setup>
  2. import {
  3. inject
  4. } from "vue";
  5. const getMapInstance = inject("getMapInstance");
  6. jt3d = getMapInstance();
  7. </script>
  8. <template>
  9. <div id="main5">
  10. <div class="chushuikou">
  11. <div class="chushuikou1">
  12. <div class="chushuikou1-1">
  13. <label>区域</label>
  14. <label>水泵电流</label>
  15. <label>机井压力</label>
  16. <label>实时流量</label>
  17. <label>运行状态</label>
  18. </div>
  19. </div>
  20. <div class="chushuikou2">
  21. <div class="chushuikou2-1">
  22. <label>1号机井</label>
  23. <label style="color:'#ecec66';">200A</label>
  24. <label>150kpa</label>
  25. <label>80m³/h</label>
  26. <button @click="flyto(1)"
  27. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  28. </div>
  29. </div>
  30. <div class="chushuikou3">
  31. <div class="chushuikou2-1">
  32. <label>2号机井</label>
  33. <label style="color:'#ecec66';">10A</label>
  34. <label>100kpa</label>
  35. <label>10m³/h</label>
  36. <button @click="flyto(2)"
  37. style="background-color: rgb(238,80,80);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">异常</button>
  38. </div>
  39. </div>
  40. <div class="chushuikou4">
  41. <div class="chushuikou2-1">
  42. <label>3号机井</label>
  43. <label style="color:'#ecec66';">200A</label>
  44. <label>150kpa</label>
  45. <label>80m³/h</label>
  46. <button @click="flyto(3)"
  47. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  48. </div>
  49. </div>
  50. <div class="chushuikou5">
  51. <div class="chushuikou2-1">
  52. <label>4号机井</label>
  53. <label style="color:'#ecec66';">200A</label>
  54. <label>150kpa</label>
  55. <label>80m³/h</label>
  56. <button @click="flyto(4)"
  57. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  58. </div>
  59. </div>
  60. <div class="chushuikou4">
  61. <div class="chushuikou2-1">
  62. <label>5号机井</label>
  63. <label style="color:'#ecec66';">200A</label>
  64. <label>150kpa</label>
  65. <label>80m³/h</label>
  66. <button @click="flyto(5)"
  67. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  68. </div>
  69. </div>
  70. <div class="chushuikou5">
  71. <div class="chushuikou2-1">
  72. <label>6号机井</label>
  73. <label style="color:'#ecec66';">200A</label>
  74. <label>150kpa</label>
  75. <label>80m³/h</label>
  76. <button @click="flyto(6)"
  77. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  78. </div>
  79. </div>
  80. <div class="chushuikou4">
  81. <div class="chushuikou2-1">
  82. <label>7号机井</label>
  83. <label style="color:'#ecec66';">200A</label>
  84. <label>150kpa</label>
  85. <label>80m³/h</label>
  86. <button @click="flyto(7)"
  87. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  88. </div>
  89. </div>
  90. <div class="chushuikou5">
  91. <div class="chushuikou2-1">
  92. <label>8号机井</label>
  93. <label style="color:'#ecec66';">20A</label>
  94. <label>10kpa</label>
  95. <label>10m³/h</label>
  96. <button @click="flyto(8)"
  97. style="background-color: rgb(238,80,80);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">异常</button>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. let jt3d = undefined;
  105. import map_xzqh_zj from '@/assets/dataFile/map_xzqh_zj.json';
  106. export default {
  107. data() {
  108. return {
  109. // viewersName: '', //视角标签名称
  110. // ImgurlList: [], //截图地址列表
  111. entity: '',
  112. }
  113. },
  114. methods: {
  115. flyto(num) {
  116. let terrainProvider = jt3d._viewer.terrainProvider;
  117. //异步函数
  118. let lon = 116.30
  119. let lat = 36.88
  120. let that = this
  121. return new Promise((resolve, reject) => {
  122. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, [Cesium
  123. .Cartographic.fromDegrees(lon, lat)
  124. ]);
  125. promise.then(function(updatedPositions) {
  126. if (that.entity) {
  127. jt3d._viewer.entities.remove(that.entity)
  128. }
  129. // if that.entity && jt3d._viewer.entities.remove(that.entity)
  130. console.log('高度', updatedPositions)
  131. let height = 1000
  132. that.entity = new Cesium.Entity({
  133. name: "add billboard",
  134. //位置
  135. position: Cesium.Cartesian3.fromDegrees(lon, lat, height),
  136. //图片标签
  137. billboard: {
  138. image: 'jt3dSDK/imgs/point/point.png',
  139. horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
  140. verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
  141. // scale: billboard.scale, //尺寸
  142. // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  143. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  144. scale: 1,
  145. scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400,
  146. 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
  147. }
  148. });
  149. jt3d._viewer.entities.add(that.entity, {
  150. range: 1000
  151. });
  152. jt3d.LocateUtil.flyToEntity(that.entity)
  153. })
  154. resolve(true)
  155. })
  156. // let lng = Number(114.22) + Number(num)
  157. // this.entity = new Cesium.Entity({
  158. // name: "add billboard",
  159. // //位置
  160. // position: Cesium.Cartesian3.fromDegrees(116.33, 37.66, 500),
  161. // //图片标签
  162. // billboard: {
  163. // image: 'jt3dSDK/imgs/point/point.png',
  164. // horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
  165. // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
  166. // // scale: billboard.scale, //尺寸
  167. // // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  168. // disableDepthTestDistance: Number.POSITIVE_INFINITY,
  169. // scale: 1,
  170. // scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400, 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
  171. // }
  172. // });
  173. console.log('实体', this.entity)
  174. // jt3d._viewer.entities.add(this.entity, {
  175. // range: 1000
  176. // });
  177. }
  178. },
  179. mounted() {
  180. // jt3d.PolylineObject.drawPolylineByGeoJson(map_xzqh_zj, {
  181. // width: 5,
  182. // color: '#04FFFF',
  183. // isImageAlpha: true, //用图片自带颜色
  184. // duration: 3000,
  185. // imgUrl: "/jt3dSDK/imgs/polylinematerial/spriteline1.png"
  186. // });
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. #main5 {
  192. width: calc(100% - 20rem);
  193. height: calc(100% - 20rem);
  194. margin: 10rem;
  195. .chushuikou {
  196. width: 100%;
  197. height: 175rem;
  198. margin-top: 10rem;
  199. // margin-left: 5rem;
  200. }
  201. .chushuikou1 {
  202. width: 100%;
  203. height: 35rem;
  204. background-color: rgba(61, 198, 255, 0.4);
  205. display: flex;
  206. align-items: center;
  207. }
  208. .chushuikou1-1 {
  209. font-family: SimHei;
  210. font-size: 14rem;
  211. color: #C8daf5;
  212. width: 100%;
  213. height: 13rem;
  214. display: flex;
  215. justify-content: space-around;
  216. margin: auto;
  217. }
  218. .chushuikou2-1 {
  219. font-family: SimHei;
  220. font-size: 13rem;
  221. color: #C8daf5;
  222. width: 100%;
  223. height: 13rem;
  224. display: flex;
  225. justify-content: space-around;
  226. margin: auto;
  227. // margin-left: 30rem;
  228. }
  229. .chushuikou2-2 {
  230. font-family: SimHei;
  231. font-size: 13rem;
  232. color: #C8daf5;
  233. width: 100%;
  234. height: 13rem;
  235. display: flex;
  236. justify-content: space-between;
  237. margin: auto;
  238. // margin-left: 30rem;
  239. }
  240. .chushuikou2 {
  241. width: 100%;
  242. height: 35rem;
  243. display: flex;
  244. align-items: center;
  245. }
  246. .chushuikou3 {
  247. width: 100%;
  248. height: 35rem;
  249. background-color: rgba(0, 37, 98, 0.4);
  250. display: flex;
  251. align-items: center;
  252. }
  253. .chushuikou4 {
  254. width: 100%;
  255. height: 35rem;
  256. display: flex;
  257. align-items: center;
  258. }
  259. .chushuikou5 {
  260. width: 100%;
  261. height: 35rem;
  262. background-color: rgba(0, 37, 98, 0.4);
  263. display: flex;
  264. align-items: center;
  265. }
  266. }
  267. </style>