index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. <template>
  2. <transition
  3. appear
  4. name="animate__animated animate__move"
  5. enter-active-class="animate__zoomIn"
  6. leave-active-class="animate__zoomOut"
  7. >
  8. <div class="widget-ExcavationAnalysis" v-Gpdrag>
  9. <div class="header">
  10. <div class="wrap">
  11. <div class="title">管道综合开挖分析</div>
  12. <span class="close">
  13. <i class="el-icon-close" @click="close()" />
  14. </span>
  15. </div>
  16. </div>
  17. <el-container>
  18. <el-header>
  19. <el-form :inline="true" :model="pipeInfo" size="mini">
  20. <el-form-item label="选择管段:">
  21. <el-input v-model="pipeInfo.pipe"></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" @click="addRectClickEvent2()">选取</el-button>
  25. </el-form-item>
  26. <el-form-item label="开挖半径:">
  27. <el-input-number v-model="pipeInfo.radius" controls-position="right" :min="0" :max="10"></el-input-number>
  28. </el-form-item>
  29. <el-form-item>
  30. <span>米</span>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="primary" @click="analysisImpact()">分析</el-button>
  34. <el-button type="primary" @click="clear()">清除</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </el-header>
  38. <el-container>
  39. <el-aside>
  40. <crossSectionChart :drawSectionInfo="drawSectionInfo" />
  41. </el-aside>
  42. <el-main>
  43. <detailsTable :detailsData="detailsData" @location="location($event)" v-if="detailsData.length > 0" />
  44. </el-main>
  45. </el-container>
  46. </el-container>
  47. </div>
  48. </transition>
  49. </template>
  50. <script lang="ts">
  51. import _ from 'lodash'
  52. import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
  53. import * as turf from '@turf/turf'
  54. import { createTooltip, CesiumToSuperMap } from '@/utils/mapCommon/tools'
  55. import PipeQueryHelper from '@/utils/mapCommon/PipeQueryHelper'
  56. import PipeAnalysisTool from '@/utils/mapCommon/PipeAnalysisTool'
  57. import crossSectionChart from './crossSectionChart.vue'
  58. import Config from './config.json'
  59. import detailsTable from './detailsTable.vue'
  60. const Cesium = (window as any).Cesium
  61. const SuperMap = (window as any).SuperMap
  62. const queryUrl = 'http://221.182.8.141:8090/iserver/services/map-sxgk_yc/rest/maps/hnyy_geoquery'
  63. const queryDataService = 'http://221.182.8.141:8090/iserver/services/data-sxgk_yc/rest/data'
  64. //管道开挖综合分析
  65. @Component({ name: 'ExcavationAnalysis', components: { crossSectionChart, detailsTable } })
  66. export default class ExcavationAnalysis extends Vue {
  67. //地图参数
  68. viewer
  69. _primitiveCollection
  70. _selectPick //已选中的对象
  71. //
  72. maskLoading = null //加载遮罩
  73. config = Config
  74. //开挖参数
  75. pipeInfo = {
  76. pipe: '',
  77. radius: '3'
  78. }
  79. //服务地址
  80. apiUrls = {
  81. bjsmidfw: '',
  82. sjdt: '',
  83. sjfw: ''
  84. }
  85. handleFlag = null
  86. toolTip = null
  87. excavation = null
  88. _selectFeatures = []
  89. currentSelectPipe = null
  90. pcuniqueField = 'PIPE_ID'
  91. sjuniqueField = 'CODE'
  92. dicIds = {}
  93. dicNotIds = {}
  94. dicTotals = {}
  95. g_crossLinePoints = []
  96. layerOids = null //记录各图层要素的objectid
  97. g_queryIndex = 0
  98. g_crossResult = []
  99. g_crossInfos = []
  100. drawSectionInfo = {} //断面图表信息
  101. detailsData = []
  102. get AppX() {
  103. return this.$store.state.bigScreen.mapConfig
  104. }
  105. mounted() {
  106. if (!(window as any).viewer) return
  107. this.viewer = (window as any).viewer
  108. this.init()
  109. }
  110. init() {
  111. this.apiUrls.sjfw = this.AppX.gisResource.tiplayers.config['sjfw'].url
  112. this.apiUrls.bjsmidfw = this.AppX.gisResource.tiplayers.config['bjsmidfw'].url
  113. this.apiUrls.sjdt = this.AppX.gisResource.maps.config['sjdt'].url
  114. }
  115. //选取事件
  116. addRectClickEvent2() {
  117. this.viewer.enableCursorStyle = false
  118. this.viewer._element.style.cursor = ''
  119. this.clearObjs()
  120. this.toolTip = createTooltip(document.querySelector('#' + this.$store.state.bigScreen.mapContainerId))
  121. const handler = new Cesium.ScreenSpaceEventHandler(this.viewer.canvas)
  122. this.handleFlag = handler
  123. handler.setInputAction((e) => {
  124. const radius = 2
  125. const position = this.viewer.scene.pickPosition(e.position)
  126. const ellpise = new Cesium.Entity({
  127. position: position,
  128. ellipse: {
  129. semiMajorAxis: radius,
  130. semiMinorAxis: radius,
  131. material: Cesium.Color.ORANGERED,
  132. classificationType: Cesium.ClassificationType.TERRAIN
  133. }
  134. })
  135. const positions = PipeQueryHelper.converCesiumToSuperMapEllipse(ellpise)
  136. this.queryForPipeUnitInfoByPolygon(positions.positions)
  137. }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
  138. handler.setInputAction((movement) => {
  139. this.toolTip.showAt(movement.endPosition, '<p>鼠标左键确定缓冲中心,右键单击取消</p>')
  140. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
  141. handler.setInputAction(
  142. function (movement) {
  143. this.clearObjs()
  144. }.bind(this),
  145. Cesium.ScreenSpaceEventType.RIGHT_CLICK
  146. )
  147. }
  148. /**
  149. * 该方法用于空间查询数据服务
  150. * @param {Cesium.Cartesian3[]} positions 多边形顶点
  151. */
  152. queryForPipeUnitInfoByPolygon(positions) {
  153. const geometry = CesiumToSuperMap.convertPolygon(Cesium, SuperMap, { positions: positions })
  154. const layers = this.viewer.scene.layers
  155. const layerList = layers.layerQueue
  156. const pipeInfo = []
  157. const allPipe = PipeQueryHelper.pipe
  158. const filters = []
  159. layerList.forEach((item) => {
  160. if (!item.visible) return false
  161. const pipe = _.find(allPipe, (sjpipe) => {
  162. const isnode = sjpipe.geometryType === 'point' && sjpipe.WELL.indexOf(item.name) > -1
  163. const ispipe = sjpipe.geometryType === 'line' && item.name === sjpipe.name
  164. return (isnode || ispipe) && sjpipe.pipeType === 'SJ' && sjpipe.geometryType === 'line'
  165. })
  166. if (!pipe) return false
  167. let unipipeInfo = { dataset: null }
  168. if (pipe.geometryType === 'line') {
  169. unipipeInfo.dataset = pipe.origindataset
  170. } else if (pipe.geometryType === 'point' && pipe.WELL.indexOf(item.name) > -1) {
  171. unipipeInfo.dataset = pipe.origindataset
  172. }
  173. const isExsit = _.find(pipeInfo, (pipeItem) => {
  174. return pipeItem.dataset === unipipeInfo.dataset
  175. })
  176. if (!isExsit) {
  177. pipeInfo.push(unipipeInfo)
  178. const filter = unipipeInfo.dataset + '@' + pipe.datasource
  179. filters.push(filter)
  180. }
  181. })
  182. if (filters.length === 0) return
  183. const onComplete = function (geoResult) {
  184. if (geoResult.originResult.currentCount === 0) {
  185. this.$message('当前范围内无管网数据')
  186. return
  187. }
  188. if (this.handleFlag && !this.handleFlag.isDestroyed()) {
  189. this.handleFlag.destroy()
  190. this.handleFlag = null
  191. }
  192. this.flashMapService(geoResult.originResult.recordsets)
  193. }.bind(this)
  194. PipeQueryHelper.queryMapByGeometry({
  195. url: this.apiUrls.sjdt,
  196. datasetNames: filters,
  197. geometry: geometry,
  198. completed: onComplete.bind(this),
  199. failed: function (err) {
  200. console.log(err)
  201. }
  202. })
  203. if (!this._primitiveCollection) {
  204. this._primitiveCollection = new Cesium.PrimitiveCollection()
  205. this.viewer.scene.primitives.add(this._primitiveCollection)
  206. }
  207. }
  208. /**
  209. * 该方法用于添加二维管线高亮
  210. * @param records
  211. */
  212. flashMapService(records) {
  213. if (!records || records.length === 0) return
  214. if (!this._primitiveCollection) return
  215. const primtCol = this._primitiveCollection
  216. //保存feature属性信息
  217. const newFeatures = []
  218. records.forEach((record) => {
  219. record.features.forEach((feature) => {
  220. const obj = new Object()
  221. feature.fieldNames.forEach((fieldName, index) => {
  222. obj[fieldName] = feature.fieldValues[index]
  223. })
  224. obj['s3mlayername'] = record.datasetName.split('@')[0]
  225. newFeatures.push(obj)
  226. })
  227. })
  228. this._selectFeatures = newFeatures
  229. records.forEach((record) => {
  230. if (record.features.length == 0) return false
  231. record.features.forEach((feature) => {
  232. const geometry = feature.geometry.points
  233. const geotype = feature.geometry.type.toLowerCase().indexOf('line') > -1 ? 'LINE' : 'POINT'
  234. if (geotype === 'LINE') {
  235. const pointA = Cesium.Cartesian3.fromDegrees(geometry[0].x, geometry[0].y)
  236. const pointB = Cesium.Cartesian3.fromDegrees(geometry[1].x, geometry[1].y)
  237. primtCol.add(this.generaGroundPolyline([pointA, pointB], feature))
  238. }
  239. })
  240. })
  241. if (newFeatures.length === 1) {
  242. this.clearDrawEvent()
  243. this.markPipeLabel(newFeatures[0])
  244. } else {
  245. this.addPrimitiveHandler()
  246. }
  247. }
  248. addPrimitiveHandler() {
  249. if (this.toolTip) {
  250. this.toolTip.remove()
  251. this.toolTip = null
  252. }
  253. this.toolTip = createTooltip(document.querySelector('#' + this.$store.state.bigScreen.mapContainerId))
  254. const handler = new Cesium.ScreenSpaceEventHandler(this.viewer.canvas)
  255. this.handleFlag = handler
  256. const that = this
  257. const fields = this.config.fields
  258. handler.setInputAction(function (movement) {
  259. that.removeHightLight(that._selectPick)
  260. var pick = that.viewer.scene.pick(movement.position)
  261. if (pick) {
  262. that.pickHightLight(pick)
  263. const selecFeature = _.find(that._selectFeatures, (feature) => {
  264. return feature[fields.pbs] === pick.id
  265. })
  266. that.markPipeLabel(selecFeature)
  267. } else {
  268. }
  269. }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
  270. handler.setInputAction(
  271. function (movement) {
  272. that.toolTip.showAt(movement.endPosition, '<p>当前范围内有多条管线,鼠标左键选中目标管线,右键单击取消</p>')
  273. }.bind(this),
  274. Cesium.ScreenSpaceEventType.MOUSE_MOVE
  275. )
  276. handler.setInputAction(
  277. function (movement) {
  278. that.clearObjs()
  279. }.bind(this),
  280. Cesium.ScreenSpaceEventType.RIGHT_CLICK
  281. )
  282. }
  283. //对象高亮
  284. pickHightLight(pick) {
  285. if (pick) {
  286. var attributes = pick.primitive.getGeometryInstanceAttributes(pick.id) //获取某个实例的属性集
  287. attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.fromBytes(255, 125, 0)) //设置其高亮
  288. this._selectPick = pick
  289. }
  290. }
  291. //清除对象高亮
  292. removeHightLight(pick) {
  293. if (pick) {
  294. var attributes = pick.primitive.getGeometryInstanceAttributes(pick.id) //获取某个实例的属性集
  295. attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.fromBytes(0, 255, 255, 100)) //设置其初始颜色
  296. }
  297. }
  298. //该方法用于生成贴地线图元
  299. generaGroundPolyline(positions, feature) {
  300. const fields = this.config.fields
  301. const id = feature.fieldValues[feature.fieldNames.indexOf(fields.id)]
  302. const code = feature.fieldValues[feature.fieldNames.indexOf(fields.pbs)]
  303. const pipeId = feature.fieldValues[feature.fieldNames.indexOf(fields.pipeID)]
  304. const instance = new Cesium.GeometryInstance({
  305. geometry: new Cesium.GroundPolylineGeometry({
  306. positions: positions,
  307. width: 15.0
  308. }),
  309. attributes: {
  310. color: new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)
  311. },
  312. id: code
  313. })
  314. const polyline = new Cesium.GroundPolylinePrimitive({
  315. geometryInstances: instance,
  316. appearance: new Cesium.PolylineColorAppearance(),
  317. classificationType: Cesium.ClassificationType.TERRAIN
  318. })
  319. polyline.custom = { id: id, pipeId: pipeId }
  320. return polyline
  321. }
  322. //标注图层
  323. markPipeLabel(feature) {
  324. if (feature) {
  325. this.currentSelectPipe = feature
  326. this.pipeInfo.pipe = feature[this.config.pipeStartName] + '-' + feature[this.config.pipeEndName]
  327. }
  328. }
  329. //分析
  330. analysisImpact() {
  331. const that = this
  332. const feature = this.currentSelectPipe
  333. const txtRi = this.pipeInfo.radius
  334. this.dicIds = {}
  335. this.dicNotIds = {}
  336. this.dicTotals = {}
  337. if (feature && Number(txtRi) > 0) {
  338. this.clearDrawEvent()
  339. var txtR = parseFloat(txtRi)
  340. var endHeight = parseFloat(feature[this.config.pipeEndHeight])
  341. var startHeight = parseFloat(feature[this.config.pipeStartHeight])
  342. var endLgtd = parseFloat(feature[this.config.latitude2])
  343. var endLttd = parseFloat(feature[this.config.longitude2])
  344. var startLgtd = parseFloat(feature[this.config.latitude])
  345. var startLttd = parseFloat(feature[this.config.longitude])
  346. var pointsList = []
  347. pointsList = [
  348. [startLttd, startLgtd],
  349. [endLttd, endLgtd]
  350. ]
  351. var pipe = turf.lineString(pointsList)
  352. var buffered = turf.buffer(pipe, txtR, { units: 'meters', steps: 16 })
  353. var pts = buffered.geometry.coordinates[0]
  354. var height = Math.min(startHeight, endHeight)
  355. let pipes = []
  356. var positions = []
  357. pts.forEach((item) => {
  358. let point = turf.toMercator(item)
  359. //转为世界坐标
  360. var ellipsoid = this.viewer.scene.globe.ellipsoid
  361. var cartographic = Cesium.Cartographic.fromDegrees(item[0], item[1], height)
  362. var cartesian3 = ellipsoid.cartographicToCartesian(cartographic)
  363. pipes.push(point)
  364. positions.push(cartesian3)
  365. })
  366. pts = pipes
  367. //管线坐标
  368. const crossLineFrom = Cesium.Cartesian3.fromDegrees(startLttd, startLgtd, startHeight)
  369. const crossLineTo = Cesium.Cartesian3.fromDegrees(endLttd, endLgtd, endHeight)
  370. this.g_crossLinePoints = [crossLineFrom, crossLineTo]
  371. if (positions.length >= 3) {
  372. let options = {
  373. name: '多边形',
  374. polygon: {
  375. hierarchy: positions,
  376. perPositionHeight: true,
  377. outline: true,
  378. outlineColor: Cesium.Color.RED,
  379. outlineWidth: 2,
  380. material: Cesium.Color.DARKSEAGREEN.withAlpha(0.3)
  381. }
  382. }
  383. }
  384. const geo = CesiumToSuperMap.convertPolygon(Cesium, SuperMap, { positions: positions })
  385. const linegeo = CesiumToSuperMap.convertPolyline(Cesium, SuperMap, { positions: this.g_crossLinePoints })
  386. this.queryPipesAnalysis(geo)
  387. //横断面分析
  388. this.query(linegeo)
  389. that.addTerrainRegion(positions, 1)
  390. } else {
  391. this.$message('请选取管线或设置参数!')
  392. }
  393. }
  394. //查询管线并分析
  395. queryPipesAnalysis(geo) {
  396. this.maskLoading = this.$loading({
  397. lock: true,
  398. text: '正在执行中,请耐心等待...',
  399. spinner: 'el-icon-loading',
  400. background: 'rgba(0, 0, 0, 0.7)'
  401. })
  402. const url = queryUrl
  403. const layers = this.viewer.scene.layers
  404. const pipes = PipeQueryHelper.pipe.filter((item) => {
  405. const layer = layers.find(item.name)
  406. return layer && layer.visible === true && item.geometryType === 'line'
  407. })
  408. const datasetName = pipes.map((item) => {
  409. return item.mapname
  410. })
  411. const completed = function (result) {
  412. var recordSets = result.result.recordsets
  413. this.onIdentifyFinished(recordSets)
  414. }
  415. const failed = function (error) {
  416. this.maskLoading.close()
  417. this.$message.error('查询数据失败!')
  418. }
  419. PipeQueryHelper.queryMapByGeometry({
  420. url: url,
  421. datasetNames: datasetName,
  422. geometry: geo,
  423. completed: completed.bind(this),
  424. failed: failed.bind(this)
  425. })
  426. }
  427. //根据区域将获取到的管线按照类型分类
  428. onIdentifyFinished(results) {
  429. var rlength = results.length
  430. var polylineTypes = []
  431. for (var i = 0; i < rlength; i++) {
  432. var pipeItem = results[i] //成果数据
  433. var layername = pipeItem.datasetName //图层名称
  434. const pipeType = _.find(PipeQueryHelper.pipe, (item) => {
  435. return item.mapname === layername
  436. })
  437. const uniqueField = pipeType.pipeType === 'SJ' ? this.config.sjuniqueField : this.config.pcuniqueField
  438. var features = pipeItem.features //管线信息集合
  439. if (layername !== undefined && features.length > 0) {
  440. polylineTypes.push({ layername: layername, features: features })
  441. for (var j = 0; j < features.length; j++) {
  442. var feature = features[j]
  443. this.dicIds[feature.attributes[uniqueField]] = { layername: layername, feature: feature, pipeType: pipeType }
  444. }
  445. }
  446. }
  447. this.impactAnalysis(polylineTypes) //执行碰撞分析
  448. }
  449. /**
  450. * 碰撞分析
  451. * @param polylineTypes 类型管线集合
  452. */
  453. impactAnalysis(polylineTypes) {
  454. var notStandards = []
  455. var totalAll = [],
  456. dicTotalAll = {}
  457. for (var i = 0, length = polylineTypes.length; i < length; i++) {
  458. var pipeTypeItem = polylineTypes[i]
  459. var EndAnalysis = {}
  460. var notStandardFeatures = []
  461. //判断是sj还是PC
  462. var slayername = pipeTypeItem.layername
  463. const sourcepipeType = _.find(PipeQueryHelper.pipe, (item) => {
  464. return item.mapname === slayername
  465. })
  466. const sourceuniqueField = sourcepipeType.pipeType === 'SJ' ? this.config.sjuniqueField : this.config.pcuniqueField
  467. EndAnalysis['layername'] = slayername
  468. var SourceFeatures = pipeTypeItem.features
  469. for (var fi = 0, flength = SourceFeatures.length; fi < flength; fi++) {
  470. var sfeature = SourceFeatures[fi]
  471. var sattributes = sfeature.attributes
  472. var compareAnalysiss = []
  473. var sdiameter = sattributes[this.config.analysisFields.DIAMETER]
  474. var soid = sattributes[sourceuniqueField]
  475. if (soid !== this.currentSelectPipe[sourceuniqueField]) {
  476. continue
  477. }
  478. var pipeId = sattributes[this.config.analysisFields.SID]
  479. var sourcegeometry = sfeature.geometry //图形
  480. var sstartid = sattributes[this.config.analysisFields.START_SID]
  481. var sendid = sattributes[this.config.analysisFields.END_SID]
  482. var sStart_Elevation = sattributes[this.config.pipeStartHeight]
  483. var sEnd_Elevation = sattributes[this.config.pipeEndHeight]
  484. for (var ci = 0, clength = polylineTypes.length; ci < clength; ci++) {
  485. var cpipeTypeItem = polylineTypes[ci]
  486. var compareAnalysis = {
  487. sourcelayername: slayername,
  488. sourceobjectid: '',
  489. sourcediameter: '',
  490. comparelayername: '',
  491. sourceobjectid_name: ''
  492. }
  493. var clayername = cpipeTypeItem.layername
  494. compareAnalysis['sourceobjectid'] = soid
  495. compareAnalysis['sourceobjectid_name'] = pipeId
  496. compareAnalysis['sourcediameter'] = sdiameter
  497. compareAnalysis['comparelayername'] = clayername
  498. const cpipeType = _.find(PipeQueryHelper.pipe, (item) => {
  499. return item.mapname === clayername
  500. })
  501. const cuniqueField = cpipeType.pipeType === 'SJ' ? this.config.sjuniqueField : this.config.pcuniqueField
  502. var OnlyCompareAnalysiss = []
  503. var CompareFeatures = cpipeTypeItem.features
  504. for (var cfi = 0, cflength = CompareFeatures.length; cfi < cflength; cfi++) {
  505. var cfeature = CompareFeatures[cfi]
  506. var cattributes = cfeature.attributes
  507. var comparegeometry = cfeature.geometry
  508. var OnlyCompareAnalysis = {}
  509. var cdiameter = cattributes[this.config.analysisFields.DIAMETER]
  510. var coid = cattributes[cuniqueField]
  511. var cpipeId = cattributes[this.config.analysisFields.SID]
  512. if (soid == coid && clayername == slayername) {
  513. continue
  514. }
  515. //过滤同类要素连接关系
  516. var cstartid = cattributes[this.config.analysisFields.START_SID]
  517. var cendid = cattributes[this.config.analysisFields.END_SID]
  518. if (
  519. (sstartid == cendid || sstartid == cstartid || sendid == cstartid || sendid == cendid) &&
  520. clayername == slayername
  521. ) {
  522. continue
  523. }
  524. OnlyCompareAnalysis['compareobjectid'] = coid
  525. OnlyCompareAnalysis['compareobjectid_name'] = cpipeId
  526. OnlyCompareAnalysis['comparediameter'] = cdiameter
  527. var cStart_Elevation = cattributes[this.config.pipeStartHeight]
  528. var cEnd_Elevation = cattributes[this.config.pipeEndHeight]
  529. var disjoint = PipeAnalysisTool.IsOrNotIntersect(sourcegeometry, comparegeometry)
  530. var hdistance = undefined,
  531. vdistance = undefined
  532. const lsDisjoint = this.IsOrNotIntersect(sourcegeometry, comparegeometry)
  533. if (!disjoint.iscross) {
  534. //交点不在线段上执行水平净距分析
  535. hdistance = PipeAnalysisTool.GetShortestDistance(sourcegeometry, comparegeometry, sdiameter, cdiameter) //水平净距
  536. OnlyCompareAnalysis['hdistance'] = hdistance.toFixed(3)
  537. OnlyCompareAnalysis['isCross'] = '否'
  538. } else {
  539. //相交
  540. OnlyCompareAnalysis['isCross'] = '是'
  541. OnlyCompareAnalysis['hdistance'] = 0
  542. hdistance = 0
  543. }
  544. if (disjoint.iscross) {
  545. //相交且交点在线段上执行垂直净距分析
  546. if (disjoint.crossPoint.x != 0 && disjoint.crossPoint.y != 0) {
  547. //获取对象在交点处的埋深
  548. const lonlat = this.getCrossPointAndHeight(
  549. comparegeometry,
  550. lsDisjoint.lerp,
  551. cStart_Elevation,
  552. cEnd_Elevation
  553. )
  554. const sourceLonlat = this.getCrossPointAndHeight(
  555. sourcegeometry,
  556. lsDisjoint.slerp,
  557. sStart_Elevation,
  558. sEnd_Elevation
  559. )
  560. vdistance = PipeAnalysisTool.GetShortestVDistance(
  561. sourceLonlat.height,
  562. lonlat.height,
  563. sdiameter,
  564. cdiameter
  565. )
  566. OnlyCompareAnalysis['vdistance'] = vdistance.toFixed(3)
  567. OnlyCompareAnalysis['x'] = Cesium.Math.toDegrees(lonlat.longitude).toFixed(2)
  568. OnlyCompareAnalysis['y'] = Cesium.Math.toDegrees(lonlat.latitude).toFixed(2)
  569. if (isNaN(cdiameter)) {
  570. OnlyCompareAnalysis['elevation'] = lonlat.height.toFixed(2)
  571. OnlyCompareAnalysis['bottomelevation'] = lonlat.height.toFixed(2)
  572. } else {
  573. OnlyCompareAnalysis['elevation'] = (lonlat.height + parseFloat(cdiameter) / 2000).toFixed(2)
  574. OnlyCompareAnalysis['bottomelevation'] = (lonlat.height - parseFloat(cdiameter) / 2000).toFixed(2)
  575. }
  576. const crossDepth = this.getCrossDepth(
  577. lsDisjoint.lerp,
  578. cattributes[this.config.pipeStartDepth],
  579. cattributes[this.config.pipeEndDepth]
  580. )
  581. OnlyCompareAnalysis['depth'] = crossDepth.toFixed(2)
  582. }
  583. }
  584. if (!this.dicNotIds[soid + '$$' + coid] && !this.dicNotIds[coid + '$$' + soid]) {
  585. if (vdistance <= 0 && hdistance <= 0) {
  586. OnlyCompareAnalysis['isKnock'] = '是'
  587. OnlyCompareAnalysiss.push(OnlyCompareAnalysis)
  588. this.dicNotIds[soid + '$$' + coid] = 1
  589. } else if (hdistance <= 0 && (vdistance > 0 || vdistance === undefined)) {
  590. OnlyCompareAnalysis['isKnock'] = '否'
  591. OnlyCompareAnalysiss.push(OnlyCompareAnalysis)
  592. this.dicNotIds[soid + '$$' + coid] = 1
  593. } else if (vdistance <= 0 && hdistance > 0) {
  594. OnlyCompareAnalysis['isKnock'] = '否'
  595. OnlyCompareAnalysiss.push(OnlyCompareAnalysis)
  596. this.dicNotIds[soid + '$$' + coid] = 1
  597. } else if ((vdistance > 0 || vdistance === undefined) && hdistance > 0) {
  598. OnlyCompareAnalysis['isKnock'] = '否'
  599. OnlyCompareAnalysiss.push(OnlyCompareAnalysis)
  600. this.dicNotIds[soid + '$$' + coid] = 1
  601. }
  602. }
  603. }
  604. if (OnlyCompareAnalysiss.length > 0) {
  605. for (var ri = 0; ri < OnlyCompareAnalysiss.length; ri++) {
  606. var AnalysisReturn = {}
  607. //AnalysisReturn["sourcelayername"] = compareAnalysis.sourcelayername;
  608. //AnalysisReturn["sourceobjectid"] = compareAnalysis.sourceobjectid;
  609. //AnalysisReturn["sourceobjectid_name"] = compareAnalysis.sourceobjectid_name;
  610. //AnalysisReturn["sourcediameter"] = compareAnalysis.sourcediameter;
  611. //AnalysisReturn["order"]=ri+1;
  612. AnalysisReturn['comparelayername'] = compareAnalysis.comparelayername
  613. AnalysisReturn['compareobjectid'] = OnlyCompareAnalysiss[ri].compareobjectid
  614. AnalysisReturn['isCross'] = OnlyCompareAnalysiss[ri]['isCross']
  615. AnalysisReturn['isKnock'] = OnlyCompareAnalysiss[ri]['isKnock']
  616. AnalysisReturn['compareobjectid_name'] = OnlyCompareAnalysiss[ri].compareobjectid_name
  617. AnalysisReturn['comparediameter'] = OnlyCompareAnalysiss[ri].comparediameter
  618. AnalysisReturn['hdistance'] = OnlyCompareAnalysiss[ri].hdistance
  619. AnalysisReturn['vdistance'] = OnlyCompareAnalysiss[ri].vdistance
  620. AnalysisReturn['x'] = OnlyCompareAnalysiss[ri].x
  621. AnalysisReturn['y'] = OnlyCompareAnalysiss[ri].y
  622. AnalysisReturn['elevation'] = OnlyCompareAnalysiss[ri].elevation
  623. AnalysisReturn['bottomelevation'] = OnlyCompareAnalysiss[ri].bottomelevation
  624. AnalysisReturn['depth'] = OnlyCompareAnalysiss[ri]['depth']
  625. //AnalysisReturn["remarks"] = OnlyCompareAnalysiss[ri].remarks;
  626. compareAnalysiss.push(AnalysisReturn)
  627. var slyn = AnalysisReturn['sourcelayername'],
  628. clyn = AnalysisReturn['comparelayername']
  629. var stdicstr = slyn + '$$' + AnalysisReturn['sourceobjectid'],
  630. etdicstr = clyn + '$$' + AnalysisReturn['compareobjectid']
  631. if (!dicTotalAll.hasOwnProperty(slyn)) {
  632. dicTotalAll[slyn] = 0
  633. }
  634. if (!dicTotalAll.hasOwnProperty(clyn)) {
  635. dicTotalAll[clyn] = 0
  636. }
  637. if (totalAll.indexOf(stdicstr) == -1) {
  638. totalAll.push(stdicstr)
  639. dicTotalAll[slyn]++
  640. }
  641. if (totalAll.indexOf(etdicstr) == -1) {
  642. totalAll.push(etdicstr)
  643. dicTotalAll[clyn]++
  644. }
  645. }
  646. }
  647. }
  648. if (compareAnalysiss.length > 0) {
  649. notStandardFeatures.push(compareAnalysiss)
  650. }
  651. }
  652. if (notStandardFeatures.length > 0) {
  653. EndAnalysis['notStandards'] = notStandardFeatures
  654. notStandards.push(EndAnalysis)
  655. }
  656. }
  657. this.layerOids = notStandards
  658. this.dicTotals = dicTotalAll
  659. this.maskLoading.close()
  660. if (notStandards.length > 0) {
  661. this.showDetailInfos() //表格显示
  662. } else {
  663. this.showDetailInfos()
  664. this.$message('区域内管线均不碰撞')
  665. }
  666. }
  667. //相交判断
  668. IsOrNotIntersect(sourcegeometry, comparegeometry) {
  669. const sFrompoint = Cesium.Cartesian3.fromDegrees(sourcegeometry.components[0].x, sourcegeometry.components[0].y, 0)
  670. const sTopoint = Cesium.Cartesian3.fromDegrees(sourcegeometry.components[1].x, sourcegeometry.components[1].y, 0)
  671. const cFromPoint = Cesium.Cartesian3.fromDegrees(
  672. comparegeometry.components[0].x,
  673. comparegeometry.components[0].y,
  674. 0
  675. )
  676. const cToPoint = Cesium.Cartesian3.fromDegrees(comparegeometry.components[1].x, comparegeometry.components[1].y, 0)
  677. const sFrompoint2 = Cesium.Cartesian2.fromCartesian3(sFrompoint)
  678. const sTopoint2 = Cesium.Cartesian2.fromCartesian3(sTopoint)
  679. const cFromPoint2 = Cesium.Cartesian2.fromCartesian3(cFromPoint)
  680. const cToPoint2 = Cesium.Cartesian2.fromCartesian3(cToPoint)
  681. const crossPoint = Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection(
  682. sFrompoint2.x,
  683. sFrompoint2.y,
  684. sTopoint2.x,
  685. sTopoint2.y,
  686. cFromPoint2.x,
  687. cFromPoint2.y,
  688. cToPoint2.x,
  689. cToPoint2.y
  690. )
  691. if (!crossPoint) {
  692. return {
  693. iscross: false
  694. }
  695. }
  696. const t = Cesium.Cartesian2.distance(cFromPoint2, crossPoint) / Cesium.Cartesian2.distance(cFromPoint2, cToPoint2)
  697. const st = Cesium.Cartesian2.distance(sFrompoint2, crossPoint) / Cesium.Cartesian2.distance(sFrompoint2, sTopoint2)
  698. const interop = Cesium.Cartesian3.lerp(cFromPoint, cToPoint, t, new Cesium.Cartesian3())
  699. return {
  700. iscross: true,
  701. crossPoint: interop,
  702. lerp: t,
  703. slerp: st
  704. }
  705. }
  706. //该方法用于计算交点处的埋深
  707. getCrossDepth(lerp, inDeep, outDeep) {
  708. const t = lerp
  709. const depth = parseFloat(inDeep) + t * (parseFloat(outDeep) - parseFloat(inDeep))
  710. return depth
  711. }
  712. /**
  713. * 计算交点坐标和管顶高程
  714. * @param geometry
  715. * @param lerp
  716. * @param inDeep
  717. * @param outDeep
  718. */
  719. getCrossPointAndHeight(geometry, lerp, inHeight, outHeight) {
  720. inHeight = parseFloat(inHeight)
  721. outHeight = parseFloat(outHeight)
  722. const sourcePoint1 = geometry.components[0]
  723. const sourcePoint2 = geometry.components[1]
  724. const fromPoint = Cesium.Cartesian3.fromDegrees(sourcePoint1.x, sourcePoint1.y, inHeight)
  725. const toPoint = Cesium.Cartesian3.fromDegrees(sourcePoint2.x, sourcePoint2.y, outHeight)
  726. const t = lerp
  727. const cross3D = Cesium.Cartesian3.lerp(fromPoint, toPoint, t, new Cesium.Cartesian3())
  728. const lonlat = Cesium.Cartographic.fromCartesian(cross3D)
  729. return lonlat
  730. }
  731. //显示详细信息
  732. showDetailInfos() {
  733. var result = this.layerOids
  734. var datas = []
  735. for (var ri = 0, rlength = result.length; ri < rlength; ri++) {
  736. var data = result[ri].notStandards
  737. for (var ni = 0; ni < data.length; ni++) {
  738. var notStandards = data[ni]
  739. for (var i = 0; i < notStandards.length; i++) {
  740. var info = notStandards[i]
  741. const clayerName = _.find(PipeQueryHelper.pipe, (item) => {
  742. return info['comparelayername'] === item.mapname
  743. })
  744. // info["compareobjectid"] = notStandards[i].compareobjectid;
  745. info['order'] = datas.length + 1
  746. info['comparelayername'] = info['comparelayername'] ? clayerName.title : ''
  747. info['isCross'] = info['isCross'] === '是' ? info['isCross'] : info['isCross']
  748. info['isKnock'] = info['isKnock'] === '是' ? info['isKnock'] : info['isKnock']
  749. info['vdistance'] = info['vdistance'] != undefined ? info['vdistance'] : ''
  750. info['hdistance'] = info['hdistance'] != undefined ? info['hdistance'] : ''
  751. info['x'] = info['x'] != undefined ? info['x'] : ''
  752. info['y'] = info['y'] != undefined ? info['y'] : ''
  753. info['depth'] = info['depth'] != undefined ? info['depth'] : ''
  754. info['elevation'] = info['elevation'] != undefined ? info['elevation'] : ''
  755. info['bottomelevation'] = info['bottomelevation'] != undefined ? info['bottomelevation'] : ''
  756. info['comparediameter'] = info['comparediameter']
  757. ? PipeAnalysisTool.FixedDiameter(info['comparediameter'])
  758. : ''
  759. info['matreial'] = info['matreial'] != undefined ? info['matreial'] : ''
  760. datas.push(info)
  761. }
  762. }
  763. }
  764. this.detailsData = datas
  765. }
  766. location(sid) {
  767. if (!sid || sid.trim() === '') {
  768. this.$message('部件唯一标识不存在,请检查数据')
  769. return
  770. }
  771. var featureinfo = this.dicIds[sid]
  772. if (featureinfo) {
  773. const datasetName = _.find(PipeQueryHelper.pipe, (item) => {
  774. return item.mapname === featureinfo.layername
  775. })
  776. PipeQueryHelper.location(this.viewer, featureinfo.feature, 'line', datasetName)
  777. }
  778. }
  779. /**
  780. * 横断面分析查询
  781. * @param queryType
  782. */
  783. query(geometry) {
  784. const url = queryUrl
  785. const layers = this.viewer.scene.layers
  786. const pipes = PipeQueryHelper.pipe.filter((item) => {
  787. const layer = layers.find(item.name)
  788. return layer && layer.visible === true && item.geometryType === 'line'
  789. })
  790. const datasetName = pipes.map((item) => {
  791. return item.mapname
  792. })
  793. const gl = this
  794. const completed = function (result) {
  795. const crossInfo = gl.drawPolyline(result.originResult.recordsets)
  796. gl.queryForHeight(crossInfo)
  797. }
  798. const failed = function (error) {
  799. console.error(error)
  800. }
  801. PipeQueryHelper.queryMapByGeometry({
  802. url: url,
  803. datasetNames: datasetName,
  804. queryOption: SuperMap.REST.QueryOption.ATTRIBUTEANDGEOMETRY,
  805. spatialMode: SuperMap.REST.SpatialQueryMode.CROSS,
  806. geometry: geometry,
  807. completed: completed.bind(this),
  808. failed: failed.bind(this)
  809. })
  810. }
  811. /**
  812. * 计算横截线与二维管线的交点
  813. * @param recordsets
  814. */
  815. drawPolyline(recordsets) {
  816. const crossPoints = this.g_crossLinePoints
  817. const cartesian2Points = crossPoints.map((point) => {
  818. const carto = Cesium.Cartographic.fromCartesian(point)
  819. const ii = Cesium.Cartographic.fromRadians(carto.longitude, carto.latitude, 0)
  820. return Cesium.Cartesian2.fromCartesian3(Cesium.Cartographic.toCartesian(ii))
  821. })
  822. if (!recordsets) return
  823. let crossInfo = []
  824. recordsets.forEach((recordset) => {
  825. const features = recordset.features
  826. features.forEach((feature) => {
  827. const points = feature.geometry.points
  828. const positions = points.map((point) => {
  829. const geo84 = Cesium.Cartesian3.fromDegrees(point.x, point.y, 0)
  830. return geo84
  831. })
  832. const linePoints = positions.map((position) => {
  833. return Cesium.Cartesian2.fromCartesian3(position)
  834. })
  835. const crossPoint = Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection(
  836. cartesian2Points[0].x,
  837. cartesian2Points[0].y,
  838. cartesian2Points[1].x,
  839. cartesian2Points[1].y,
  840. linePoints[0].x,
  841. linePoints[0].y,
  842. linePoints[1].x,
  843. linePoints[1].y
  844. )
  845. const t =
  846. Cesium.Cartesian2.distance(linePoints[0], crossPoint) /
  847. Cesium.Cartesian2.distance(linePoints[0], linePoints[1])
  848. const interop = Cesium.Cartesian3.lerp(positions[0], positions[1], t, new Cesium.Cartesian3())
  849. crossInfo.push({ mapname: recordset.datasetName, feature: feature, crossPoint: interop, t: t })
  850. })
  851. })
  852. return crossInfo
  853. }
  854. queryForHeight(crossInfos) {
  855. this.g_queryIndex = 0
  856. this.g_crossResult = []
  857. this.g_crossInfos = crossInfos
  858. this.queryFeatureForHeight(crossInfos[this.g_queryIndex])
  859. }
  860. queryFeatureForHeight(crossInfo) {
  861. //无相交管线
  862. if (!crossInfo) {
  863. this.drawSectionPicture()
  864. return
  865. }
  866. const pipe = PipeQueryHelper.pipe.find((pipe) => {
  867. return pipe.mapname === crossInfo.mapname
  868. })
  869. const queryField = pipe.pipeType === 'SJ' ? this.sjuniqueField : this.pcuniqueField
  870. const resultFields = pipe.pipeType === 'SJ' ? this.config.sjFields : this.config.pcFields
  871. if (!pipe) {
  872. return
  873. }
  874. const completed = (result) => {
  875. if (result.originResult.features.length === 0) {
  876. return
  877. }
  878. const feature = result.originResult.features[0]
  879. const fromPoint = Cesium.Cartesian3.fromDegrees(
  880. feature.geometry.points[0].x,
  881. feature.geometry.points[0].y,
  882. parseFloat(feature.fieldValues[feature.fieldNames.indexOf(this.config.pipeStartHeight)])
  883. )
  884. const toPoint = Cesium.Cartesian3.fromDegrees(
  885. feature.geometry.points[1].x,
  886. feature.geometry.points[1].y,
  887. parseFloat(feature.fieldValues[feature.fieldNames.indexOf(this.config.pipeEndHeight)])
  888. )
  889. const points = [fromPoint, toPoint]
  890. const ThreeDPoint = Cesium.Cartesian3.lerp(points[0], points[1], crossInfo.t, new Cesium.Cartesian3())
  891. //点积求投影长度
  892. const fcross = Cesium.Cartographic.fromCartesian(this.g_crossLinePoints[0])
  893. const lcross = Cesium.Cartographic.fromCartesian(this.g_crossLinePoints[1])
  894. const newLcross = Cesium.Cartographic.fromRadians(lcross.longitude, lcross.latitude, fcross.height)
  895. const vectora = Cesium.Cartesian3.subtract(
  896. Cesium.Cartographic.toCartesian(newLcross),
  897. Cesium.Cartographic.toCartesian(fcross),
  898. new Cesium.Cartesian3()
  899. )
  900. const vectorb = Cesium.Cartesian3.subtract(ThreeDPoint, this.g_crossLinePoints[0], new Cesium.Cartesian3())
  901. const projectDistance = Cesium.Cartesian3.dot(vectora, vectorb) / Cesium.Cartesian3.magnitude(vectora)
  902. const depth =
  903. parseFloat(feature.fieldValues[feature.fieldNames.indexOf(resultFields.inDeep)]) +
  904. crossInfo.t *
  905. (parseFloat(feature.fieldValues[feature.fieldNames.indexOf(resultFields.outDeep)]) -
  906. parseFloat(feature.fieldValues[feature.fieldNames.indexOf(resultFields.inDeep)]))
  907. const height = Cesium.Cartographic.fromCartesian(ThreeDPoint).height
  908. const roadHeight = depth + height
  909. const diameter = feature.fieldValues[feature.fieldNames.indexOf(resultFields.diameter)]
  910. let pipeDiameter = 10
  911. let diameterType = 'circle'
  912. if (diameter.indexOf('*') !== -1) {
  913. pipeDiameter = parseFloat(diameter.split('*')[0])
  914. diameterType = 'rect'
  915. } else if (diameter.indexOf('#') !== -1) {
  916. pipeDiameter = parseFloat(diameter.split('#')[0])
  917. diameterType = 'rect'
  918. } else if (diameter.indexOf('X') !== -1) {
  919. pipeDiameter = parseFloat(diameter.split('#')[0])
  920. diameterType = 'rect'
  921. } else if (!isNaN(parseFloat(diameter))) {
  922. pipeDiameter = parseFloat(diameter)
  923. }
  924. this.g_crossResult.push({
  925. mapname: crossInfo.mapname, //地图图层名称
  926. title: pipe.title, //管线名称
  927. feature: feature, //管线要素
  928. position: ThreeDPoint, //交点位置
  929. distance: Math.abs(projectDistance), //与起点的距离
  930. diameter: pipeDiameter, //管径
  931. diameterStr: diameter, //管线管径
  932. pipeType: pipe.pipeType, //管线大类
  933. lineColor: pipe.lineColor, //管线颜色
  934. diameterType: diameterType, //管径类型
  935. height: roadHeight, //地面高程
  936. depth: depth //埋深
  937. })
  938. ++this.g_queryIndex
  939. if (this.g_queryIndex === this.g_crossInfos.length) {
  940. this.drawSectionPicture()
  941. return
  942. }
  943. this.queryFeatureForHeight(this.g_crossInfos[this.g_queryIndex])
  944. }
  945. const failed = (error) => {
  946. console.log(error)
  947. }
  948. const SID = crossInfo.feature.fieldValues[crossInfo.feature.fieldNames.indexOf(queryField)]
  949. PipeQueryHelper.queryByAttribute({
  950. url: queryDataService,
  951. datasetNames: [pipe.datasource + ':' + pipe.origindataset],
  952. whereclause: queryField + "='" + SID + "'",
  953. fields: [],
  954. completed: completed.bind(this),
  955. failed: failed.bind(this)
  956. })
  957. }
  958. //触发断面图表数据更新
  959. drawSectionPicture() {
  960. let crossResult = this.g_crossResult
  961. let SelectPipe = this.currentSelectPipe
  962. let crossLinePoints = this.g_crossLinePoints
  963. this.drawSectionInfo = {
  964. crossResult: crossResult,
  965. SelectPipe: SelectPipe,
  966. crossLinePoints: crossLinePoints
  967. }
  968. }
  969. //地形开挖
  970. addTerrainRegion(posittions, height) {
  971. const that = this
  972. const points = []
  973. posittions.forEach((position) => {
  974. const lonlat = Cesium.Cartographic.fromCartesian(position)
  975. const longitude = Cesium.Math.toDegrees(lonlat.longitude)
  976. const latitude = Cesium.Math.toDegrees(lonlat.latitude)
  977. points.push(longitude)
  978. points.push(latitude)
  979. points.push(lonlat.height)
  980. })
  981. this.excavation = this.viewer.scene.globe.addExcavationRegion({
  982. name: '挖方点',
  983. position: points,
  984. height: height,
  985. transparent: false
  986. })
  987. this.clearPrimitives()
  988. }
  989. //清除绘制对象
  990. clearDrawEvent() {
  991. if (this.toolTip) {
  992. this.toolTip.remove()
  993. this.toolTip = null
  994. }
  995. if (this.handleFlag && !this.handleFlag.isDestroyed()) {
  996. this.handleFlag.destroy()
  997. this.handleFlag = null
  998. }
  999. }
  1000. //清除开挖地形
  1001. removeTerrainRegion() {
  1002. if (this.excavation) {
  1003. this.viewer.scene.globe.removeAllExcavationRegion()
  1004. this.excavation = null
  1005. }
  1006. }
  1007. //清除管段高亮
  1008. clearPrimitives() {
  1009. if (this._primitiveCollection) {
  1010. this._primitiveCollection.removeAll()
  1011. const isDel = this.viewer.scene.primitives.remove(this._primitiveCollection)
  1012. if (isDel) this._primitiveCollection = null
  1013. }
  1014. this._selectPick = null
  1015. }
  1016. //清除临时对象
  1017. clearObjs() {
  1018. if (this.toolTip) {
  1019. this.toolTip.remove()
  1020. this.toolTip = null
  1021. }
  1022. this.viewer.enableCursorStyle = true
  1023. if (this.handleFlag && !this.handleFlag.isDestroyed()) {
  1024. this.handleFlag.destroy()
  1025. this.handleFlag = null
  1026. }
  1027. this.removeTerrainRegion()
  1028. this.clearPrimitives()
  1029. }
  1030. //清除分析操作
  1031. clear() {
  1032. this.clearObjs()
  1033. this.viewer.entities.removeAll()
  1034. //初始化data
  1035. this.pipeInfo = {
  1036. pipe: '',
  1037. radius: '3'
  1038. }
  1039. this.drawSectionInfo = {} //断面图表信息
  1040. this.detailsData = []
  1041. this.init()
  1042. }
  1043. destroyed() {
  1044. this.clear()
  1045. }
  1046. close() {
  1047. this.$store.state.bigScreen.isShowExcavationAnalysis = false
  1048. }
  1049. }
  1050. </script>
  1051. <style lang='scss' scoped>
  1052. .animate__zoomIn,
  1053. .animate__zoomOut {
  1054. animation-duration: 1s; //动画持续时间
  1055. animation-delay: 0s; //动画延迟时间
  1056. }
  1057. .widget-ExcavationAnalysis {
  1058. bottom: 0.052083rem /* 10/192 */;
  1059. left: calc(50% - 2.734375rem /* 525/192 */);
  1060. width: 5.46875rem /* 1050/192 */;
  1061. height: 1.5625rem /* 300/192 */;
  1062. position: absolute;
  1063. font-family: Source Han Sans CN;
  1064. z-index: 999;
  1065. //
  1066. background: rgba(0, 60, 98, 0.7);
  1067. border-radius: 4px;
  1068. .header {
  1069. padding: 0.026042rem /* 5/192 */;
  1070. background: #0ea7ff;
  1071. .wrap {
  1072. width: 100%;
  1073. display: flex;
  1074. justify-content: space-between;
  1075. padding: 0.026042rem /* 5/192 */;
  1076. background: rgba(6, 13, 25, 1);
  1077. box-shadow: 0 0 8px 5px #060d19;
  1078. border-radius: 2px;
  1079. .title {
  1080. font-size: 0.072917rem /* 14/192 */;
  1081. font-family: Source Han Sans CN-HEAVY;
  1082. font-weight: bold;
  1083. color: #0ea7ff;
  1084. background: linear-gradient(0deg, #a3d3ff 0%, #e4f3ff 100%);
  1085. background-clip: text;
  1086. -webkit-text-fill-color: transparent;
  1087. }
  1088. .close {
  1089. position: absolute;
  1090. // top: 0.052083rem /* 10/192 */;
  1091. right: 0.052083rem /* 10/192 */;
  1092. color: #a3d3ff;
  1093. font-size: 0.083333rem /* 16/192 */;
  1094. z-index: 10;
  1095. cursor: pointer;
  1096. }
  1097. }
  1098. }
  1099. .el-header {
  1100. height: fit-content !important;
  1101. padding: 5px 10px;
  1102. margin-bottom: 5px;
  1103. font-size: 0.072917rem /* 14/192 */;
  1104. color: #2ba7ff;
  1105. .el-form-item {
  1106. margin-bottom: 0;
  1107. /deep/ .el-form-item__label {
  1108. font-size: 0.072917rem /* 14/192 */;
  1109. color: #2ba7ff;
  1110. }
  1111. /deep/ .el-form-item__content {
  1112. .el-input__inner {
  1113. color: #eee;
  1114. background-color: #08446c;
  1115. border: none;
  1116. }
  1117. }
  1118. }
  1119. }
  1120. .el-container {
  1121. height: calc(100% - 0.197917rem /* 38/192 */);
  1122. }
  1123. .el-aside {
  1124. flex: 0.4;
  1125. }
  1126. .el-main {
  1127. flex: 0.6;
  1128. padding: 0 !important;
  1129. height: 100%;
  1130. }
  1131. }
  1132. </style>