Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop
This commit is contained in:
		| @ -59,12 +59,17 @@ export default class DrawAttackArrow extends Draw { | |||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         into = '3D' |         into = '3D' | ||||||
|  |         let pos84 = this.cartesian3Towgs84(cartesian, this.viewer) | ||||||
|  |         let lastPos84 = cache_positions[cache_positions.length - 1] | ||||||
|  |         if(lastPos84 && (lastPos84.lng === pos84.lng && lastPos84.lat === pos84.lat)) { | ||||||
|  |           return | ||||||
|  |         } | ||||||
|         if (!this.entityHasCreated) { |         if (!this.entityHasCreated) { | ||||||
|           let polyline_id = DrawAttackArrow.create_arrow_polygon(this) |           let polyline_id = DrawAttackArrow.create_arrow_polygon(this) | ||||||
|           this.points_ids.push(polyline_id) |           this.points_ids.push(polyline_id) | ||||||
|         } |         } | ||||||
|         this.points_ids.push(this.create_point(cartesian)) |         this.points_ids.push(this.create_point(cartesian)) | ||||||
|         cache_positions.push(this.cartesian3Towgs84(cartesian, this.viewer)) |         cache_positions.push(pos84) | ||||||
|         isMove = false |         isMove = false | ||||||
|       }) |       }) | ||||||
|       this.event.mouse_right((movement, cartesian) => { |       this.event.mouse_right((movement, cartesian) => { | ||||||
|  | |||||||
| @ -124,7 +124,7 @@ function syncViewer() { | |||||||
|   if (height > 9000000) { |   if (height > 9000000) { | ||||||
|     height = 9000000 |     height = 9000000 | ||||||
|   } |   } | ||||||
|   if (height < 100000) { |   if (height < 400000) { | ||||||
|     this.entity.billboard.show = true |     this.entity.billboard.show = true | ||||||
|     this.entity.rectangle.show = false |     this.entity.rectangle.show = false | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -4,18 +4,38 @@ | |||||||
| import Tools from "../../Tools"; | import Tools from "../../Tools"; | ||||||
| import { getCoordinateSystem } from "../../Global/global"; | import { getCoordinateSystem } from "../../Global/global"; | ||||||
| import MouseEvent from '../../Event/index' | import MouseEvent from '../../Event/index' | ||||||
|  | import { getSdk as get2DSdk } from '../../Global/MultiViewportMode' | ||||||
|  | import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen"; | ||||||
|  |  | ||||||
| let event | let event | ||||||
|  | let event2 | ||||||
| let MouseCoordinateElm | let MouseCoordinateElm | ||||||
| let requestAnimationFrameEventId | let requestAnimationFrameEventId | ||||||
|  | let tmovement | ||||||
|  | let targetSdk | ||||||
|  | let sdkD | ||||||
|  |  | ||||||
| const MouseCoordinate = (sdk, status) => { | const MouseCoordinate = (sdk, status) => { | ||||||
|  |   if (!sdk || !sdk.viewer) { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|  |   targetSdk = sdk | ||||||
|  |   sdkD = get2DSdk().sdkD | ||||||
|  |   if(!sdkD) { | ||||||
|  |     sdkD = getSplitScreenSdk().sdkD | ||||||
|  |   } | ||||||
|  |  | ||||||
|   let tools = new Tools(sdk) |   let tools = new Tools(sdk) | ||||||
|   if (status) { |   if (status) { | ||||||
|     if (event) { |     if (event) { | ||||||
|       event.destroy() |       event.destroy() | ||||||
|     } |     } | ||||||
|  |     if (event2) { | ||||||
|  |       event2.destroy() | ||||||
|  |       event2 = undefined | ||||||
|  |     } | ||||||
|     event = new MouseEvent(sdk) |     event = new MouseEvent(sdk) | ||||||
|  |     tmovement = null | ||||||
|     let position = { |     let position = { | ||||||
|       x: '', |       x: '', | ||||||
|       y: '', |       y: '', | ||||||
| @ -40,22 +60,60 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|       contentElm.style['background-size'] = `200% 200%`; |       contentElm.style['background-size'] = `200% 200%`; | ||||||
|       MouseCoordinateElm = contentElm |       MouseCoordinateElm = contentElm | ||||||
|     } |     } | ||||||
|     sdk.viewer._element.appendChild(contentElm) |     sdk.viewer.container.appendChild(contentElm) | ||||||
|     let tmovement |  | ||||||
|     event.mouse_move((movement, cartesian) => { |     event.mouse_move((movement, cartesian) => { | ||||||
|       tmovement = { ...movement } |       targetSdk = sdk | ||||||
|  |       tmovement = { ...movement.endPosition } | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|     const getPosition = () => { |     const getPosition = () => { | ||||||
|       if(!tmovement) { |       if (!targetSdk) { | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] |       let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0] | ||||||
|       let left = tmovement.endPosition.x; |       sdkD = get2DSdk().sdkD | ||||||
|       let top = tmovement.endPosition.y; |       if(!sdkD) { | ||||||
|       let cartesian = event.getcartesian(tmovement) |         sdkD = getSplitScreenSdk().sdkD | ||||||
|       contentElm.style['background-position-x'] = `${-canvas.width + left + 4}px`; |       } | ||||||
|       contentElm.style['background-position-y'] = `${-canvas.height + top - 2}px`; |       if (!event2 && sdkD) { | ||||||
|  |         event2 = new MouseEvent(sdkD) | ||||||
|  |         event2.mouse_move((movement, cartesian) => { | ||||||
|  |           targetSdk = sdkD | ||||||
|  |           tmovement = { x: movement.endPosition.x, y: movement.endPosition.y } | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |       if (!tmovement) { | ||||||
|  |         return | ||||||
|  |       } | ||||||
|  |       let left = tmovement.x; | ||||||
|  |       let top = tmovement.y; | ||||||
|  |       let cartesian | ||||||
|  |       if (targetSdk.viewer.scene.mode === 2) { | ||||||
|  |         left = left + canvas.width | ||||||
|  |         cartesian = targetSdk.viewer.camera.pickEllipsoid(tmovement, targetSdk.viewer.scene.globe.ellipsoid) | ||||||
|  |       } | ||||||
|  |       else { | ||||||
|  |         cartesian = targetSdk.viewer.scene.pickPosition(tmovement) | ||||||
|  |         if (!cartesian) { | ||||||
|  |           const ray = targetSdk.viewer.camera.getPickRay(position); //相交的射线 | ||||||
|  |           let pickedObjects = targetSdk.viewer.scene.drillPickFromRay(ray, 10); | ||||||
|  |           let result = {} | ||||||
|  |           for (let i = 0; i < pickedObjects.length; i++) { | ||||||
|  |             if (pickedObjects[i].position) { | ||||||
|  |               result = pickedObjects[i] | ||||||
|  |               break | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |           cartesian = result.position | ||||||
|  |           if (!cartesian) { | ||||||
|  |             cartesian = targetSdk.viewer.scene.globe.pick(ray, targetSdk.viewer.scene); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       contentElm.style['background-position-x'] = `${-sdk.viewer.container.clientWidth + left + 4}px`; | ||||||
|  |  | ||||||
|  |       contentElm.style['background-position-y'] = `${-sdk.viewer.container.clientHeight + top - 2}px`; | ||||||
|       // this.entity.position = cartesian |       // this.entity.position = cartesian | ||||||
|       if (cartesian) { |       if (cartesian) { | ||||||
|         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) |         let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) | ||||||
| @ -97,10 +155,13 @@ const MouseCoordinate = (sdk, status) => { | |||||||
|   else { |   else { | ||||||
|     if (event) { |     if (event) { | ||||||
|       event.destroy() |       event.destroy() | ||||||
|       event = undefined |     } | ||||||
|  |     if (event2) { | ||||||
|  |       event2.destroy() | ||||||
|  |       event2 = undefined | ||||||
|     } |     } | ||||||
|     if (MouseCoordinateElm) { |     if (MouseCoordinateElm) { | ||||||
|       sdk.viewer._element.removeChild(MouseCoordinateElm) |       sdk.viewer.container.removeChild(MouseCoordinateElm) | ||||||
|       MouseCoordinateElm = undefined |       MouseCoordinateElm = undefined | ||||||
|     } |     } | ||||||
|     if (requestAnimationFrameEventId) { |     if (requestAnimationFrameEventId) { | ||||||
|  | |||||||
| @ -50,6 +50,11 @@ async function init(sdk) { | |||||||
|   for (let i = 0; i < imageryLayers.length; i++) { |   for (let i = 0; i < imageryLayers.length; i++) { | ||||||
|     let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex) |     let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex) | ||||||
|     entity.show = imageryLayers[i].show |     entity.show = imageryLayers[i].show | ||||||
|  |     if (imageryLayers[i]._objectState) { | ||||||
|  |       if (imageryLayers[i]._showView == 3) { | ||||||
|  |         entity.show = false | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|   // sdk.viewer.entities.collectionChanged.addEventListener(syncEntities) |   // sdk.viewer.entities.collectionChanged.addEventListener(syncEntities) | ||||||
|   // sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources) |   // sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources) | ||||||
| @ -61,6 +66,12 @@ async function init(sdk) { | |||||||
|     JwwStatusSwitch(sdk2, true) |     JwwStatusSwitch(sdk2, true) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   sdk.entityMap.forEach((item, key) => { | ||||||
|  |     if (item.showView == 2) { | ||||||
|  |       item.showView = 2 | ||||||
|  |     } | ||||||
|  |   }) | ||||||
|  |  | ||||||
| } | } | ||||||
| async function on(sdk) { | async function on(sdk) { | ||||||
|   if (sdk2D) { |   if (sdk2D) { | ||||||
| @ -95,9 +106,10 @@ function off(sdk) { | |||||||
|     syncObject = {} |     syncObject = {} | ||||||
|   } |   } | ||||||
|   sdk.entityMap.forEach((item, key) => { |   sdk.entityMap.forEach((item, key) => { | ||||||
|     item.showView = undefined |     if (item.showView) { | ||||||
|  |       item.show = item.show | ||||||
|  |     } | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| async function syncData2(sdk, id, entityId) { | async function syncData2(sdk, id, entityId) { | ||||||
| @ -125,8 +137,8 @@ async function syncData2(sdk, id, entityId) { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) { |       if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) { | ||||||
|         if(that.showView==3) { |         if (that.showView == 3) { | ||||||
|           options.show=false |           options.show = false | ||||||
|         } |         } | ||||||
|         let newObject = await new that.constructor(sdk2D, options) |         let newObject = await new that.constructor(sdk2D, options) | ||||||
|         newObject.onClick = that.onClick |         newObject.onClick = that.onClick | ||||||
| @ -216,7 +228,14 @@ async function syncData2(sdk, id, entityId) { | |||||||
|       } |       } | ||||||
|       let options = syncObject.tools.deepCopyObj(obj.options) |       let options = syncObject.tools.deepCopyObj(obj.options) | ||||||
|       if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) { |       if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) { | ||||||
|         let target = await new obj.constructor(sdk2D, options) |         if (obj.showView == 3) { | ||||||
|  |           options.show = false | ||||||
|  |         } | ||||||
|  |         let target = await sdk2D.entityMap.get(options.id) | ||||||
|  |         if(target) { | ||||||
|  |           await target.remove() | ||||||
|  |         } | ||||||
|  |         target = await new obj.constructor(sdk2D, options) | ||||||
|         target.onClick = obj.onClick |         target.onClick = obj.onClick | ||||||
|         target.onRightClick = obj.onRightClick |         target.onRightClick = obj.onRightClick | ||||||
|         target.onMouseMove = obj.onMouseMove |         target.onMouseMove = obj.onMouseMove | ||||||
| @ -409,11 +428,25 @@ function syncImageryLayerRemoved(layer, index) { | |||||||
|   sdk2D.viewer.imageryLayers.remove(layer2d) |   sdk2D.viewer.imageryLayers.remove(layer2d) | ||||||
| } | } | ||||||
| function syncImageryLayerShownOrHidden(layer, index, state) { | function syncImageryLayerShownOrHidden(layer, index, state) { | ||||||
|  |   return | ||||||
|   let layer2d = sdk2D.viewer.imageryLayers._layers[index] |   let layer2d = sdk2D.viewer.imageryLayers._layers[index] | ||||||
|  |   let layer3d = sdk3D.viewer.imageryLayers._layers[index] | ||||||
|  |   console.log('layer2d', layer2d, sdk2D, layer3d) | ||||||
|  |  | ||||||
|   if (!layer2d) { |   if (!layer2d) { | ||||||
|     return |     return | ||||||
|   } |   } | ||||||
|  |   if (layer3d._objectState) { | ||||||
|  |     if (!layer3d._showView || layer3d._showView == 2) { | ||||||
|  |       layer2d.show = true | ||||||
|  |     } | ||||||
|  |     if (layer3d._showView == 3) { | ||||||
|  |       layer2d.show = false | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|     layer2d.show = state |     layer2d.show = state | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| async function syncPrimitives(primitive) { | async function syncPrimitives(primitive) { | ||||||
| @ -543,6 +576,7 @@ function syncViewer() { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function get2DView() { | function get2DView() { | ||||||
|   return sdk2D |   return sdk2D | ||||||
| } | } | ||||||
|  | |||||||
| @ -121,6 +121,9 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> |         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> | ||||||
|           <li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li> |           <li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li> | ||||||
|         </ul> |         </ul> | ||||||
|  |         <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> | ||||||
|  |           <li style="padding: 3px 10px;cursor: pointer;">文本框</li> | ||||||
|  |         </ul> | ||||||
|         ${addedMenu} |         ${addedMenu} | ||||||
|       ` |       ` | ||||||
|         _element.appendChild(menuElm) |         _element.appendChild(menuElm) | ||||||
| @ -175,6 +178,7 @@ function MouseRightMenu(sdk, status, callBack) { | |||||||
|                 break |                 break | ||||||
|               case '文本框': |               case '文本框': | ||||||
|                 object.position = position |                 object.position = position | ||||||
|  |                 key = 'textBox' | ||||||
|                 break |                 break | ||||||
|             } |             } | ||||||
|             eventListener[sdk.div_id].callBack(key, object) |             eventListener[sdk.div_id].callBack(key, object) | ||||||
|  | |||||||
| @ -91,7 +91,7 @@ class MeasureDistance extends Measure { | |||||||
|  |  | ||||||
|  |  | ||||||
|     //暂时固定取20个点 |     //暂时固定取20个点 | ||||||
|     if (d > 20) {//大于20m时,固定取20个点 |     if (d > 2) {//大于20m时,固定取20个点 | ||||||
|       meters = d / 20 |       meters = d / 20 | ||||||
|       await start(meters) |       await start(meters) | ||||||
|     } else if (d < 1) { |     } else if (d < 1) { | ||||||
| @ -106,8 +106,8 @@ class MeasureDistance extends Measure { | |||||||
|  |  | ||||||
|  |  | ||||||
|   async sampleHeight(p1, index) { |   async sampleHeight(p1, index) { | ||||||
|     let p2 = await this.sampleHeightMostDetailed([p1]) |     let height = await this.getClampToHeight(p1, [...this.sdk.viewer.entities.values]) | ||||||
|     p1.alt = p2[0].height |     p1.alt = height | ||||||
|     return {position: p1, index} |     return {position: p1, index} | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -63,11 +63,15 @@ class VisibilityAnalysis extends Tools { | |||||||
|         that.tip.set_text("左键创建视角终点,右键结束通视分析") |         that.tip.set_text("左键创建视角终点,右键结束通视分析") | ||||||
|         if (!that.resultObject.viewPoint) { |         if (!that.resultObject.viewPoint) { | ||||||
|           let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) |           let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) | ||||||
|           let positions = await Cesium.sampleTerrainMostDetailed( |           let positions | ||||||
|  |           if(that.sdk.viewer.terrainProvider.availability) | ||||||
|  |           { | ||||||
|  |             positions = await Cesium.sampleTerrainMostDetailed( | ||||||
|               that.sdk.viewer.terrainProvider, |               that.sdk.viewer.terrainProvider, | ||||||
|               [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] |               [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] | ||||||
|             ); |             ); | ||||||
|           if (positions[0].height > pos84.alt) { |           } | ||||||
|  |           if (positions && positions[0].height > pos84.alt) { | ||||||
|             pos84.alt = positions[0].height |             pos84.alt = positions[0].height | ||||||
|           } |           } | ||||||
|           pos84.alt = pos84.alt + that.viewPointHeight |           pos84.alt = pos84.alt + that.viewPointHeight | ||||||
|  | |||||||
| @ -548,11 +548,11 @@ class BillboardObject extends Base { | |||||||
|         value: '链接', |         value: '链接', | ||||||
|         key: 'link' |         key: 'link' | ||||||
|       }, |       }, | ||||||
|       // { |       { | ||||||
|       //   name: 'IP摄像头', |         name: 'IP摄像头', | ||||||
|       //   value: 'IP摄像头', |         value: 'IP摄像头', | ||||||
|       //   key: 'camera' |         key: 'camera' | ||||||
|       // }, |       }, | ||||||
|       // { |       // { | ||||||
|       //   name: 'ISC摄像头', |       //   name: 'ISC摄像头', | ||||||
|       //   value: 'ISC摄像头', |       //   value: 'ISC摄像头', | ||||||
| @ -563,16 +563,16 @@ class BillboardObject extends Base { | |||||||
|       //   value: '传感器', |       //   value: '传感器', | ||||||
|       //   key: 'sensor' |       //   key: 'sensor' | ||||||
|       // }, |       // }, | ||||||
|       // { |       { | ||||||
|       //   name: '全景图', |         name: '全景图', | ||||||
|       //   value: '全景图', |         value: '全景图', | ||||||
|       //   key: 'vr' |         key: 'vr' | ||||||
|       // }, |       }, | ||||||
|       // { |       { | ||||||
|       //   name: '物资', |         name: '物资', | ||||||
|       //   value: '物资', |         value: '物资', | ||||||
|       //   key: 'goods' |         key: 'goods' | ||||||
|       // } |       } | ||||||
|     ] |     ] | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding'; | |||||||
| import richText from "../../Element/richText"; | import richText from "../../Element/richText"; | ||||||
| import MouseEvent from '../../../Event/index' | import MouseEvent from '../../../Event/index' | ||||||
| import LabelObject from '../LabelObject' | import LabelObject from '../LabelObject' | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { legp } from '../../Element/datalist'; | import { legp } from '../../Element/datalist'; | ||||||
| import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||||
| import MouseTip from '../../../MouseTip' | import MouseTip from '../../../MouseTip' | ||||||
| @ -223,10 +223,11 @@ class CircleDiffuse extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         this.entity.show = this.options.show  |         this.entity.show = this.options.show  | ||||||
|         if (this.options.label.show) { |         if (this.options.label.show) { | ||||||
|           this.label.show = this.options.show  |           this.label.show = this.options.show  | ||||||
| @ -442,8 +443,9 @@ class CircleDiffuse extends Base { | |||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|  |     let sdkD = get2DSdk().sdkD | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && (!this.showView || this.showView == 3)) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -1336,7 +1338,7 @@ class CircleDiffuse extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async remove() { |   async remove() { | ||||||
|     this.label.remove() |     this.label && this.label.remove() | ||||||
|     this.entity && this.sdk.viewer.entities.remove(this.entity) |     this.entity && this.sdk.viewer.entities.remove(this.entity) | ||||||
|     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) |     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) | ||||||
|     this.entity = null |     this.entity = null | ||||||
|  | |||||||
| @ -8,6 +8,8 @@ | |||||||
| import { getHost, getToken } from "../../../on"; | import { getHost, getToken } from "../../../on"; | ||||||
| import Base from '../index' | import Base from '../index' | ||||||
| import Tools from '../../../Tools' | import Tools from '../../../Tools' | ||||||
|  | import { syncSplitData } from "../../../Global/SplitScreen"; | ||||||
|  | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global' | ||||||
|  |  | ||||||
| class GeoJson extends Base { | class GeoJson extends Base { | ||||||
| @ -27,6 +29,7 @@ class GeoJson extends Base { | |||||||
|     this.primitive = undefined |     this.primitive = undefined | ||||||
|     this.positions = [] |     this.positions = [] | ||||||
|      |      | ||||||
|  |  | ||||||
|     this.loading = true |     this.loading = true | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -48,6 +51,27 @@ class GeoJson extends Base { | |||||||
|     return this.options.show |     return this.options.show | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   // set show(status) { | ||||||
|  |   //   let sdkD = get2DSdk().sdkD | ||||||
|  |   //   if (!this.isShowView || !sdkD) { | ||||||
|  |   //     this.options.show = status | ||||||
|  |   //   } | ||||||
|  |   //   if (this.entity) { | ||||||
|  |   //     if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|  |   //       for (let i = 0; i < this.entity.entities.values.length; i++) { | ||||||
|  |   //         this.entity.entities.values[i].show = this.options.show | ||||||
|  |   //       } | ||||||
|  |   //     } | ||||||
|  |   //     else { | ||||||
|  |   //       for (let i = 0; i < this.entity.entities.values.length; i++) { | ||||||
|  |   //         this.entity.entities.values[i].show = false | ||||||
|  |   //       } | ||||||
|  |   //     } | ||||||
|  |   //   } | ||||||
|  |   //   syncData(this.sdk, this.options.id) | ||||||
|  |   //   syncSplitData(this.sdk, this.options.id) | ||||||
|  |   //   this.isShowView = false | ||||||
|  |   // } | ||||||
|   set show(status) { |   set show(status) { | ||||||
|     this.options.show = status |     this.options.show = status | ||||||
|     if (this.entity) { |     if (this.entity) { | ||||||
| @ -74,6 +98,7 @@ class GeoJson extends Base { | |||||||
|     }) |     }) | ||||||
|     let json = await rsp.json() |     let json = await rsp.json() | ||||||
|     this.geojson = json |     this.geojson = json | ||||||
|  |     // this.sdk.addIncetance(this.options.id, this) | ||||||
|     return GeoJson.addDataToGlobe(this, json.features) |     return GeoJson.addDataToGlobe(this, json.features) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -7,14 +7,21 @@ function html() { | |||||||
|             <span class="label">名称</span> |             <span class="label">名称</span> | ||||||
|             <input class="input" maxlength="40" type="text" @model="name"> |             <input class="input" maxlength="40" type="text" @model="name"> | ||||||
|         </div> |         </div> | ||||||
|         <div class="col"> |         <div class="col"></div> | ||||||
|             <button class="anchor btn">调整锚点</button> |  | ||||||
|         </div> |  | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|   <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|   <div class="div-item"> |   <div class="div-item"> | ||||||
|     <div class="row"> |     <div class="row"> | ||||||
|  |         <div class="col"> | ||||||
|  |             <button class="anchor btn">调整锚点</button> | ||||||
|  |         </div> | ||||||
|  |         <div class="col mode-box"> | ||||||
|  |             <span class="label" style="flex: unset;">军标模式</span> | ||||||
|  |             <div class="mode"></div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  |     <div class="row" mode="0"> | ||||||
|         <div class="col"> |         <div class="col"> | ||||||
|             <span class="label">旋转角度</span> |             <span class="label">旋转角度</span> | ||||||
|             <input type="range" max="360" min="0" step="0.1" @model="angle"> |             <input type="range" max="360" min="0" step="0.1" @model="angle"> | ||||||
| @ -25,7 +32,7 @@ function html() { | |||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="row"> |     <div class="row" mode="0"> | ||||||
|         <div class="col"> |         <div class="col"> | ||||||
|             <span class="label">调整大小</span> |             <span class="label">调整大小</span> | ||||||
|             <input type="range" max="40000" min="0" step="0.1" @model="scale"> |             <input type="range" max="40000" min="0" step="0.1" @model="scale"> | ||||||
| @ -35,6 +42,75 @@ function html() { | |||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|  |         <div class="row" mode="1"> | ||||||
|  |             <div class="col height-mode-box" style="flex: 0 0 155px;margin-right: 10px;"> | ||||||
|  |                 <span class="label" style="flex: 0 0 56px;">高度模式</span> | ||||||
|  |                 <div class="height-mode"></div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;"> | ||||||
|  |                 <div class="height-box" style="display: flex; align-items: center;"> | ||||||
|  |                     <span class="label" style="flex: 0 0 56px;">高度</span> | ||||||
|  |                     <div class="input-number input-number-unit-1"> | ||||||
|  |                         <input class="input height" type="number" title="" min="-9999999" max="999999999"> | ||||||
|  |                         <span class="unit">m</span> | ||||||
|  |                         <span class="arrow"></span> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin-left: 10px;"> | ||||||
|  |                 <span class="label">图标倍数</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" data-min="0.1" max="99" @model="billboardScale"> | ||||||
|  |                     <span class="unit">倍</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="row" mode="1"> | ||||||
|  |             <div class="col" style="flex: 0 0 155px;margin-right: 10px;"> | ||||||
|  |                 <span class="label">视野缩放</span> | ||||||
|  |                 <input class="btn-switch" type="checkbox" @model="billboardScaleByDistance"> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin: 0 10px;"> | ||||||
|  |                 <span class="label">最近距离</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" min="1" max="99999999" @model="billboardNear"> | ||||||
|  |                     <span class="unit">m</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |             <div class="col" style="margin-left: 10px;"> | ||||||
|  |                 <span class="label">最远距离</span> | ||||||
|  |                 <div class="input-number input-number-unit-1"> | ||||||
|  |                     <input class="input" type="number" title="" min="1" max="99999999" @model="billboardFar"> | ||||||
|  |                     <span class="unit">m</span> | ||||||
|  |                     <span class="arrow"></span> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |                 <h4 mode="1">文字设置</h4> | ||||||
|  |                     <div class="row"  mode="1"> | ||||||
|  |                         <div class="col" style="flex: 0 0 80px;margin: 0 10px;"> | ||||||
|  |                             <span class="label" style="flex: none;">显隐</span> | ||||||
|  |                             <input class="btn-switch" type="checkbox" @model="labelShow"> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col font-select-box" style="margin: 0 0px;flex: 0 0 150px;"> | ||||||
|  |                             <span class="label" style="flex: none;">字体选择</span> | ||||||
|  |                             <div class="input input-select font-select"></div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="margin: 0 10px;"> | ||||||
|  |                             <span class="label">文字大小</span> | ||||||
|  |                             <div class="input-number input-number-unit-2"> | ||||||
|  |                                 <input class="input" type="number" title="" min="1" max="99" @model="labelFontSize" style="width: 70px;"> | ||||||
|  |                                 <span class="unit">px</span> | ||||||
|  |                                 <span class="arrow"></span> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                         <div class="col" style="margin-left: 10px;"> | ||||||
|  |                             <span class="label">文字颜色</span> | ||||||
|  |                             <div class="labelColor"></div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|   </div> |   </div> | ||||||
|   <span class="custom-divider"></span> |   <span class="custom-divider"></span> | ||||||
|   ` |   ` | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -54,7 +54,7 @@ function html(that) { | |||||||
|         <div class="row"> |         <div class="row"> | ||||||
|             <div class="col" style="flex: 5;"> |             <div class="col" style="flex: 5;"> | ||||||
|                 <span class="label">文字内容</span> |                 <span class="label">文字内容</span> | ||||||
|                 <input class="input" type="text" @model="textValue"> |                 <input class="input" type="text" @model="textValue" maxlength="30"> | ||||||
|             </div> |             </div> | ||||||
|             <div class="col"> |             <div class="col"> | ||||||
|                 <button class="btn" @click="textPosPick">设置位置</span> |                 <button class="btn" @click="textPosPick">设置位置</span> | ||||||
|  | |||||||
| @ -10,6 +10,7 @@ import { FontLoader } from '../../../../static/3rdparty/three/jsm/loaders/FontLo | |||||||
| import { TextGeometry } from '../../../../static/3rdparty/three/jsm/geometries/TextGeometry.js'; | import { TextGeometry } from '../../../../static/3rdparty/three/jsm/geometries/TextGeometry.js'; | ||||||
| import * as variable from '../../../../static/3rdparty/three/fonts/FZZongYi-M05S_regular.typeface.json' | import * as variable from '../../../../static/3rdparty/three/fonts/FZZongYi-M05S_regular.typeface.json' | ||||||
| import Base from "../index"; | import Base from "../index"; | ||||||
|  | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen' | ||||||
|  |  | ||||||
| class GroundSvg extends Base { | class GroundSvg extends Base { | ||||||
| @ -1212,7 +1213,7 @@ class GroundSvg extends Base { | |||||||
|   * @param {boolean} status=false 状态 |   * @param {boolean} status=false 状态 | ||||||
|   */ |   */ | ||||||
|   drag(status, cd) { |   drag(status, cd) { | ||||||
|     if (!this.#loaded) { |     if (!this.#loaded || !this.sdk || !this.sdk.viewer) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.ismove = false |     this.ismove = false | ||||||
| @ -1279,6 +1280,9 @@ class GroundSvg extends Base { | |||||||
|           // 中心点到鼠标的距离 |           // 中心点到鼠标的距离 | ||||||
|           let distance = turf.rhumbDistance(pointC, point2, options); |           let distance = turf.rhumbDistance(pointC, point2, options); | ||||||
|  |  | ||||||
|  |           let flag = false | ||||||
|  |           let flag2 = false | ||||||
|  |  | ||||||
|           switch (this.pickPoint.id) { |           switch (this.pickPoint.id) { | ||||||
|             case 'svg-control-points_0': |             case 'svg-control-points_0': | ||||||
|               angle = bearing2_0 - bearing1 |               angle = bearing2_0 - bearing1 | ||||||
| @ -1290,12 +1294,39 @@ class GroundSvg extends Base { | |||||||
|               bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360) |               bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360) | ||||||
|               angleW = bearing2 - bearingW |               angleW = bearing2 - bearingW | ||||||
|               angleH = bearing2 - bearingH |               angleH = bearing2 - bearingH | ||||||
|  |  | ||||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { |               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||||
|                 angleW = angleW + 180 |                 angleW = angleW + 180 | ||||||
|  |                 flag=true | ||||||
|               } |               } | ||||||
|               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { |               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { | ||||||
|                 angleH = angleH + 180 |                 angleH = angleH + 180 | ||||||
|  |                 flag2=true | ||||||
|  |               } | ||||||
|  |               if(flag && flag2) { | ||||||
|  |                 this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |               } | ||||||
|  |               else { | ||||||
|  |                 if(flag) { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 } | ||||||
|  |                 else if(flag2) { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 } | ||||||
|  |                 else { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 } | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               radiansW = (Math.PI / 180) * angleW |               radiansW = (Math.PI / 180) * angleW | ||||||
| @ -1314,6 +1345,12 @@ class GroundSvg extends Base { | |||||||
|  |  | ||||||
|               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { |               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { | ||||||
|                 angleH = angleH + 180 |                 angleH = angleH + 180 | ||||||
|  |                 this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |               } | ||||||
|  |               else { | ||||||
|  |                 this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                 this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               radiansH = (Math.PI / 180) * angleH |               radiansH = (Math.PI / 180) * angleH | ||||||
| @ -1331,9 +1368,37 @@ class GroundSvg extends Base { | |||||||
|  |  | ||||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { |               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||||
|                 angleW = angleW + 180 |                 angleW = angleW + 180 | ||||||
|  |                 flag=true | ||||||
|               } |               } | ||||||
|               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { |               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { | ||||||
|                 angleH = angleH + 180 |                 angleH = angleH + 180 | ||||||
|  |                 flag2=true | ||||||
|  |               } | ||||||
|  |               if(flag && flag2) { | ||||||
|  |                 this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                 this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |               } | ||||||
|  |               else { | ||||||
|  |                 if(flag) { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 } | ||||||
|  |                 else if(flag2) { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                 } | ||||||
|  |                 else { | ||||||
|  |                   this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |                   this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                   this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 } | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               radiansW = (Math.PI / 180) * angleW |               radiansW = (Math.PI / 180) * angleW | ||||||
| @ -1351,6 +1416,12 @@ class GroundSvg extends Base { | |||||||
|  |  | ||||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { |               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||||
|                 angleW = angleW + 180 |                 angleW = angleW + 180 | ||||||
|  |                 this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |               } | ||||||
|  |               else { | ||||||
|  |                 this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               radiansW = (Math.PI / 180) * angleW |               radiansW = (Math.PI / 180) * angleW | ||||||
| @ -1381,6 +1452,12 @@ class GroundSvg extends Base { | |||||||
|  |  | ||||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { |               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||||
|                 angleW = angleW + 180 |                 angleW = angleW + 180 | ||||||
|  |                 this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|  |               } | ||||||
|  |               else { | ||||||
|  |                 this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a') | ||||||
|  |                 this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000') | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               radiansW = (Math.PI / 180) * angleW |               radiansW = (Math.PI / 180) * angleW | ||||||
| @ -1526,6 +1603,9 @@ class GroundSvg extends Base { | |||||||
|       controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates |       controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates | ||||||
|  |  | ||||||
|       this.controlPoints = controlPoints |       this.controlPoints = controlPoints | ||||||
|  |       if(!this.sdk || !this.sdk.viewer) { | ||||||
|  |         return | ||||||
|  |       } | ||||||
|       for (let i = 0; i < this.controlPoints.length; i++) { |       for (let i = 0; i < this.controlPoints.length; i++) { | ||||||
|         let color = '#00ff0a' |         let color = '#00ff0a' | ||||||
|         if (i === 5) { |         if (i === 5) { | ||||||
| @ -2020,6 +2100,9 @@ class GroundSvg extends Base { | |||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.drag(false) |     this.drag(false) | ||||||
|  |     if(!this.sdk || !this.sdk.viewer) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|     this.sdk.viewer.entities.remove(this.entity) |     this.sdk.viewer.entities.remove(this.entity) | ||||||
|     this.text && this.text.remove() |     this.text && this.text.remove() | ||||||
|     for (let i = this.entity.values.length; i >= 0; i--) { |     for (let i = this.entity.values.length; i >= 0; i--) { | ||||||
| @ -2089,6 +2172,59 @@ class GroundSvg extends Base { | |||||||
|     } |     } | ||||||
|     this._update() |     this._update() | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   async flyTo(options = {}) { | ||||||
|  |     if (this._error) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     setActiveViewer(0) | ||||||
|  |     closeRotateAround(this.sdk) | ||||||
|  |     closeViewFollow(this.sdk) | ||||||
|  |  | ||||||
|  |     if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) { | ||||||
|  |       let orientation = { | ||||||
|  |         heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0), | ||||||
|  |         pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0), | ||||||
|  |         roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0) | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       let lng = this.options.customView.relativePosition.lng | ||||||
|  |       let lat = this.options.customView.relativePosition.lat | ||||||
|  |       let alt = this.options.customView.relativePosition.alt | ||||||
|  |       let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) | ||||||
|  |  | ||||||
|  |       let position = { ...this.options.position } | ||||||
|  |       // 如果没有高度值,则获取紧贴高度计算 | ||||||
|  |       if (!position.hasOwnProperty('alt')) { | ||||||
|  |         position.alt = await this.getClampToHeight(position) | ||||||
|  |       } | ||||||
|  |       lng = this.options.customView.relativePosition.lng + position.lng | ||||||
|  |       lat = this.options.customView.relativePosition.lat + position.lat | ||||||
|  |       alt = this.options.customView.relativePosition.alt + position.alt | ||||||
|  |       destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt) | ||||||
|  |       this.sdk.viewer.camera.flyTo({ | ||||||
|  |         destination: destination, | ||||||
|  |         orientation: orientation | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       let array = [] | ||||||
|  |       for (let i = 0; i < this.controlPoints.length; i++) { | ||||||
|  |         let height = await this.getClampToHeight({lng: this.controlPoints[i][0], lat: this.controlPoints[i][1]}) | ||||||
|  |         let cartesian = Cesium.Cartesian3.fromDegrees(this.controlPoints[i][0], this.controlPoints[i][1], height) | ||||||
|  |         array.push(cartesian.x, cartesian.y, cartesian.z) | ||||||
|  |       } | ||||||
|  |       let BoundingSphere = Cesium.BoundingSphere.fromVertices(array) | ||||||
|  |  | ||||||
|  |       this.sdk.viewer.camera.flyToBoundingSphere(BoundingSphere, { | ||||||
|  |         offset: options.orientation || { | ||||||
|  |           heading: Cesium.Math.toRadians(0.0), | ||||||
|  |           pitch: Cesium.Math.toRadians(-60.0), | ||||||
|  |           roll: Cesium.Math.toRadians(0.0) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default GroundSvg | export default GroundSvg | ||||||
| @ -7,7 +7,7 @@ import EventBinding from './eventBinding' | |||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncPrimitives } from '../../../../Global/MultiViewportMode' | import { syncPrimitives } from '../../../../Global/MultiViewportMode' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -82,10 +82,11 @@ class Flame extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|           this.entity.show = this.options.show |           this.entity.show = this.options.show | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import { html } from "./_element"; | |||||||
| import EventBinding from './eventBinding' | import EventBinding from './eventBinding' | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -83,10 +83,11 @@ class Fountain extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|           this.entity.show = this.options.show |           this.entity.show = this.options.show | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import { html, css } from "./_element"; | |||||||
| import EventBinding from './eventBinding' | import EventBinding from './eventBinding' | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global' | ||||||
| @ -81,10 +81,11 @@ class Smoke extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|           this.entity.show = this.options.show |           this.entity.show = this.options.show | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ import Dialog from '../../../Element/Dialog'; | |||||||
| import { html, css } from "./_element"; | import { html, css } from "./_element"; | ||||||
| import Base from "../../index"; | import Base from "../../index"; | ||||||
| import MouseEvent from '../../../../Event/index' | import MouseEvent from '../../../../Event/index' | ||||||
| import { syncData } from '../../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode' | ||||||
| import MouseTip from '../../../../MouseTip' | import MouseTip from '../../../../MouseTip' | ||||||
| import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen' | ||||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global' | ||||||
| @ -84,10 +84,11 @@ class Spout extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { |         if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) { | ||||||
|           this.entity.show = this.options.show |           this.entity.show = this.options.show | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1216,7 +1216,6 @@ class PolygonObject extends Base { | |||||||
|             alt: this.label.position[2] |             alt: this.label.position[2] | ||||||
|           } |           } | ||||||
|           this.originalOptions = this.deepCopyObj(this.options) |           this.originalOptions = this.deepCopyObj(this.options) | ||||||
|           console.log('000000000000',this.options.label.scaleByDistance) |  | ||||||
|           this._DialogObject.close() |           this._DialogObject.close() | ||||||
|           this.Dialog.confirmCallBack && |           this.Dialog.confirmCallBack && | ||||||
|             this.Dialog.confirmCallBack(this.originalOptions) |             this.Dialog.confirmCallBack(this.originalOptions) | ||||||
|  | |||||||
| @ -61,7 +61,7 @@ class eventBinding { | |||||||
|               }) |               }) | ||||||
|               blurEvent = (e) => { |               blurEvent = (e) => { | ||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { |                 if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) { | ||||||
|                   value = Number(value) |                   value = Number(value) | ||||||
|                   if ((e.target.max) && value > Number(e.target.max)) { |                   if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|                     value = Number(e.target.max) |                     value = Number(e.target.max) | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding'; | |||||||
| import richText from "../../Element/richText"; | import richText from "../../Element/richText"; | ||||||
| import MouseEvent from '../../../Event/index' | import MouseEvent from '../../../Event/index' | ||||||
| import LabelObject from '../LabelObject' | import LabelObject from '../LabelObject' | ||||||
| import { syncData } from '../../../Global/MultiViewportMode' | import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode' | ||||||
| import { legp } from '../../Element/datalist'; | import { legp } from '../../Element/datalist'; | ||||||
| import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | import { getFontList, getFontFamilyName } from '../../Element/fontSelect' | ||||||
| import MouseTip from '../../../MouseTip' | import MouseTip from '../../../MouseTip' | ||||||
| @ -246,10 +246,11 @@ class RadarScan extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         this.entity.show = this.options.show |         this.entity.show = this.options.show | ||||||
|         if (this.options.label.show && this.label) { |         if (this.options.label.show && this.label) { | ||||||
|           this.label.show = this.options.show |           this.label.show = this.options.show | ||||||
| @ -460,8 +461,9 @@ class RadarScan extends Base { | |||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|  |     let sdkD = get2DSdk().sdkD | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|     if (this.show && (!this.showView || this.showView == 3)) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       this.label.show = v |       this.label.show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -1386,7 +1388,7 @@ class RadarScan extends Base { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async remove() { |   async remove() { | ||||||
|     this.label.remove() |     this.label && this.label.remove() | ||||||
|     this.entity && this.sdk.viewer.entities.remove(this.entity) |     this.entity && this.sdk.viewer.entities.remove(this.entity) | ||||||
|     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) |     this.entity2 && this.sdk.viewer.entities.remove(this.entity2) | ||||||
|     this.entity = null |     this.entity = null | ||||||
|  | |||||||
| @ -1560,7 +1560,7 @@ class SectorObject extends Base { | |||||||
|   _addRr() { |   _addRr() { | ||||||
|     if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) { |     if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) { | ||||||
|       this.options.attribute.vr.content.push({ |       this.options.attribute.vr.content.push({ | ||||||
|         name: '全景图' , |         name: '全景图', | ||||||
|         url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value |         url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value | ||||||
|       }) |       }) | ||||||
|       this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = '' |       this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = '' | ||||||
| @ -1573,7 +1573,7 @@ class SectorObject extends Base { | |||||||
|  |  | ||||||
|   addAttributeRr(vr) { |   addAttributeRr(vr) { | ||||||
|     this.options.attribute.vr.content.push({ |     this.options.attribute.vr.content.push({ | ||||||
|       name: '全景图' , |       name: '全景图', | ||||||
|       url: vr |       url: vr | ||||||
|     }) |     }) | ||||||
|     this.attributeVr = this.options.attribute.vr.content |     this.attributeVr = this.options.attribute.vr.content | ||||||
| @ -1922,6 +1922,19 @@ class SectorObject extends Base { | |||||||
|         that.cartesian3Towgs84(positions[1], that.sdk.viewer), |         that.cartesian3Towgs84(positions[1], that.sdk.viewer), | ||||||
|         that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer) |         that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer) | ||||||
|       ] |       ] | ||||||
|  |       let objectsToExclude = [...that.sdk.viewer.entities.values] | ||||||
|  |       that | ||||||
|  |         .getClampToHeight({ | ||||||
|  |           lng: that.options.center.lng, | ||||||
|  |           lat: that.options.center.lat | ||||||
|  |         }, objectsToExclude) | ||||||
|  |         .then(height => { | ||||||
|  |           that.label.position = [ | ||||||
|  |             that.options.center.lng, | ||||||
|  |             that.options.center.lat, | ||||||
|  |             height | ||||||
|  |           ] | ||||||
|  |         }) | ||||||
|       setTimeout(() => { |       setTimeout(() => { | ||||||
|         createNodePoints(positions[1], 'sector-start') |         createNodePoints(positions[1], 'sector-start') | ||||||
|         createNodePoints(positions[positions.length - 4], 'sector-end') |         createNodePoints(positions[positions.length - 4], 'sector-end') | ||||||
|  | |||||||
| @ -145,7 +145,8 @@ class TrajectoryMotion extends Base { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DView() | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|         if (this.originalOptions) { |         if (this.originalOptions) { | ||||||
|           this.originalOptions.show = v |           this.originalOptions.show = v | ||||||
| @ -156,10 +157,10 @@ class TrajectoryMotion extends Base { | |||||||
|           this.model.show = false |           this.model.show = false | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           this.model.show = (!this.showView || this.showView == 3) ? this.modelShow : false |           this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.modelShow : false | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ((!this.showView || this.showView == 3)) { |         if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|           this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({ |           this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({ | ||||||
|             color: new Cesium.Color.fromCssColorString('#00ffff'), |             color: new Cesium.Color.fromCssColorString('#00ffff'), | ||||||
|             dashLength: 20, |             dashLength: 20, | ||||||
| @ -175,18 +176,18 @@ class TrajectoryMotion extends Base { | |||||||
|           }) |           }) | ||||||
|         } |         } | ||||||
|         for (let i = 0; i < this.keyPoints.length; i++) { |         for (let i = 0; i < this.keyPoints.length; i++) { | ||||||
|           this.keyPoints[i].show = (!this.showView || this.showView == 3) ? this.keyPointShow : false |           this.keyPoints[i].show = (!this.showView || this.showView == 3 || !sdkD) ? this.keyPointShow : false | ||||||
|         } |         } | ||||||
|         if (this.realTimeRoute) { |         if (this.realTimeRoute) { | ||||||
|           this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3) ? true : false) |           this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false) | ||||||
|         } |         } | ||||||
|         this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false) |         this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false) | ||||||
|         this.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false) |         this.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false) | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         this.model.show = (!this.showView || this.showView == 3) ? this.options.show : false |         this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false | ||||||
|         let show = this.options.show |         let show = this.options.show | ||||||
|         if ((!this.showView || this.showView == 3)) { |         if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|           show = this.options.show |           show = this.options.show | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
| @ -660,7 +661,7 @@ class TrajectoryMotion extends Base { | |||||||
|         }) |         }) | ||||||
|         this.TweenAnimate.pause() |         this.TweenAnimate.pause() | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           _this.model.isMove = false |           _this.model && (_this.model.isMove = false) | ||||||
|         }, 200); |         }, 200); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -679,9 +680,10 @@ class TrajectoryMotion extends Base { | |||||||
|     return this.options.model.show |     return this.options.model.show | ||||||
|   } |   } | ||||||
|   set modelShow(v) { |   set modelShow(v) { | ||||||
|  |     let sdkD = get2DView() | ||||||
|     this.options.model.show = v |     this.options.model.show = v | ||||||
|     let show = v |     let show = v | ||||||
|     if (this.show && (!this.showView || this.showView == 3)) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       show = v |       show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -755,7 +757,8 @@ class TrajectoryMotion extends Base { | |||||||
|     } |     } | ||||||
|     this.options.line.show = v |     this.options.line.show = v | ||||||
|     let show = v |     let show = v | ||||||
|     if ((!this.showView || this.showView == 3)) { |     let sdkD = get2DView() | ||||||
|  |     if ((!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       show = v |       show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @ -979,6 +982,7 @@ class TrajectoryMotion extends Base { | |||||||
|  |  | ||||||
|   set firstPersonView(v) { |   set firstPersonView(v) { | ||||||
|     // this.state = true |     // this.state = true | ||||||
|  |     let sdkD = get2DView() | ||||||
|     let splitSdk = getSdk() |     let splitSdk = getSdk() | ||||||
|     if (get2DView() || splitSdk.sdkD || !this.show) { |     if (get2DView() || splitSdk.sdkD || !this.show) { | ||||||
|       v = false |       v = false | ||||||
| @ -1033,7 +1037,7 @@ class TrajectoryMotion extends Base { | |||||||
|       CameraController(this.sdk, true) |       CameraController(this.sdk, true) | ||||||
|       if (this.model && this.modelShow && this.show) { |       if (this.model && this.modelShow && this.show) { | ||||||
|         let show = true |         let show = true | ||||||
|         if (this.show && (!this.showView || this.showView == 3)) { |         if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|           show = true |           show = true | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
| @ -1161,8 +1165,9 @@ class TrajectoryMotion extends Base { | |||||||
|   } |   } | ||||||
|   set labelShow(v) { |   set labelShow(v) { | ||||||
|     this.options.label.show = v |     this.options.label.show = v | ||||||
|  |     let sdkD = get2DView() | ||||||
|     let show = v |     let show = v | ||||||
|     if (this.show && (!this.showView || this.showView == 3)) { |     if (this.show && (!this.showView || this.showView == 3 || !sdkD)) { | ||||||
|       show = v |       show = v | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|  | |||||||
| @ -57,7 +57,7 @@ class eventBinding { | |||||||
|               }) |               }) | ||||||
|               blurEvent = (e) => { |               blurEvent = (e) => { | ||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { |                 if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) { | ||||||
|                   value = Number(value) |                   value = Number(value) | ||||||
|                   if ((e.target.max) && value > Number(e.target.max)) { |                   if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|                     value = Number(e.target.max) |                     value = Number(e.target.max) | ||||||
|  | |||||||
| @ -54,7 +54,7 @@ class eventBinding { | |||||||
|               }) |               }) | ||||||
|               blurEvent = (e) => { |               blurEvent = (e) => { | ||||||
|                 let value = e.target.value |                 let value = e.target.value | ||||||
|                 if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { |                 if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) { | ||||||
|                   value = Number(value) |                   value = Number(value) | ||||||
|                   if ((e.target.max) && value > Number(e.target.max)) { |                   if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|                     value = Number(e.target.max) |                     value = Number(e.target.max) | ||||||
|  | |||||||
| @ -31,6 +31,7 @@ class Base extends Tools { | |||||||
|     this.rightClickCallBack = null |     this.rightClickCallBack = null | ||||||
|     this.picking = true |     this.picking = true | ||||||
|     this.options.host = this.options.host || getHost() |     this.options.host = this.options.host || getHost() | ||||||
|  |     // this.#_showView = this.options.showView || 0 | ||||||
|     this.setDefaultValue() |     this.setDefaultValue() | ||||||
|  |  | ||||||
|     // this.sdk.addIncetance(this.options.id, this) |     // this.sdk.addIncetance(this.options.id, this) | ||||||
| @ -62,9 +63,19 @@ class Base extends Tools { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   set showView(v) { |   set showView(v) { | ||||||
|  |  | ||||||
|  |  | ||||||
|     let sdk2D = get2DSdk().sdkD |     let sdk2D = get2DSdk().sdkD | ||||||
|     if(!sdk2D) { |     if (!sdk2D) { | ||||||
|       v=0 |       this.#_showView = v | ||||||
|  |       if(this.entity) { | ||||||
|  |         this.entity._showView = v | ||||||
|  |       } | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (this.sdk === sdk2D) { | ||||||
|  |       this.#_showView = 0 | ||||||
|  |       return | ||||||
|     } |     } | ||||||
|     if (!this.#_showView && !this.show) { |     if (!this.#_showView && !this.show) { | ||||||
|       return |       return | ||||||
| @ -118,13 +129,20 @@ class Base extends Tools { | |||||||
|  |  | ||||||
|   set show(v) { |   set show(v) { | ||||||
|     if (typeof v === "boolean") { |     if (typeof v === "boolean") { | ||||||
|       if (!this.isShowView) { |       let sdkD = get2DSdk().sdkD | ||||||
|  |       if (!this.isShowView || !sdkD) { | ||||||
|         this.options.show = v |         this.options.show = v | ||||||
|         if (this.originalOptions) { |         if (this.originalOptions) { | ||||||
|           this.originalOptions.show = v |           this.originalOptions.show = v | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       if (!this.showView || this.showView == 3) { |       this.entity._showView = this.showView | ||||||
|  |       if (this.type == 'layer') { | ||||||
|  |         if (this.entity) { | ||||||
|  |           this.entity._objectState = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       if (!this.showView || this.showView == 3 || !sdkD) { | ||||||
|         this.entity && (this.entity.show = this.options.show) |         this.entity && (this.entity.show = this.options.show) | ||||||
|         if (this.options.label && this.options.label.show && this.label) { |         if (this.options.label && this.options.label.show && this.label) { | ||||||
|           this.label.show = this.options.show |           this.label.show = this.options.show | ||||||
| @ -141,9 +159,30 @@ class Base extends Tools { | |||||||
|         this._DialogObject.showBtn.checked = this.options.show |         this._DialogObject.showBtn.checked = this.options.show | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |  | ||||||
|       syncData(this.sdk, this.options.id) |       syncData(this.sdk, this.options.id) | ||||||
|       syncSplitData(this.sdk, this.options.id) |       syncSplitData(this.sdk, this.options.id) | ||||||
|       this.isShowView = false |       this.isShowView = false | ||||||
|  |  | ||||||
|  |       if (this.type == 'layer' && sdkD) { | ||||||
|  |         let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex] | ||||||
|  |         let layer3d = this.entity | ||||||
|  |  | ||||||
|  |         if (!layer2d) { | ||||||
|  |           return | ||||||
|  |         } | ||||||
|  |         if (layer3d._objectState) { | ||||||
|  |           if (!layer3d._showView || layer3d._showView == 2) { | ||||||
|  |             layer2d.show = true | ||||||
|  |           } | ||||||
|  |           if (layer3d._showView == 3) { | ||||||
|  |             layer2d.show = false | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           layer2d.show = this.options.show | ||||||
|  |         } | ||||||
|  |       } | ||||||
|     } else { |     } else { | ||||||
|       console.error("参数必须为boolean") |       console.error("参数必须为boolean") | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -160,6 +160,64 @@ class YJColorPicker { | |||||||
|       let dropbtns = picker.getElementsByClassName('ew-color-dropbtns')[0] |       let dropbtns = picker.getElementsByClassName('ew-color-dropbtns')[0] | ||||||
|       picker.insertBefore(colorInputBox, dropbtns) |       picker.insertBefore(colorInputBox, dropbtns) | ||||||
|  |  | ||||||
|  |       RInput.addEventListener('blur', (e) => { | ||||||
|  |         let value = e.target.value | ||||||
|  |         if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { | ||||||
|  |           value = Number(value) | ||||||
|  |           if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|  |             value = Number(e.target.max) | ||||||
|  |           } | ||||||
|  |           if ((e.target.min) && value < Number(e.target.min)) { | ||||||
|  |             value = Number(e.target.min) | ||||||
|  |           } | ||||||
|  |           if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { | ||||||
|  |             value = Number(e.target.dataset.min) | ||||||
|  |           } | ||||||
|  |           RInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |       GInput.addEventListener('blur', (e) => { | ||||||
|  |         let value = e.target.value | ||||||
|  |         if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { | ||||||
|  |           value = Number(value) | ||||||
|  |           if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|  |             value = Number(e.target.max) | ||||||
|  |           } | ||||||
|  |           if ((e.target.min) && value < Number(e.target.min)) { | ||||||
|  |             value = Number(e.target.min) | ||||||
|  |           } | ||||||
|  |           if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { | ||||||
|  |             value = Number(e.target.dataset.min) | ||||||
|  |           } | ||||||
|  |           GInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |       BInput.addEventListener('blur', (e) => { | ||||||
|  |         let value = e.target.value | ||||||
|  |         if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) { | ||||||
|  |           value = Number(value) | ||||||
|  |           if ((e.target.max) && value > Number(e.target.max)) { | ||||||
|  |             value = Number(e.target.max) | ||||||
|  |           } | ||||||
|  |           if ((e.target.min) && value < Number(e.target.min)) { | ||||||
|  |             value = Number(e.target.min) | ||||||
|  |           } | ||||||
|  |           if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) { | ||||||
|  |             value = Number(e.target.dataset.min) | ||||||
|  |           } | ||||||
|  |           BInput.value = parseInt(value) | ||||||
|  |           _this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`) | ||||||
|  |           _this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|       if (options.alpha) { |       if (options.alpha) { | ||||||
|         Inputs[0].style.width = '52px' |         Inputs[0].style.width = '52px' | ||||||
|         Inputs[1].style.width = '52px' |         Inputs[1].style.width = '52px' | ||||||
| @ -170,7 +228,6 @@ class YJColorPicker { | |||||||
|         <input class="input" type="number" title="" step="0.01" min="0" max="1"> |         <input class="input" type="number" title="" step="0.01" min="0" max="1"> | ||||||
|         <span class="arrow"></span>` |         <span class="arrow"></span>` | ||||||
|         pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling) |         pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling) | ||||||
|         pickerInput.style.width = '106px' |  | ||||||
|         pickAlpha.style.width = '66px' |         pickAlpha.style.width = '66px' | ||||||
|         pickAlpha.style.margin = '0 6px 0 0' |         pickAlpha.style.margin = '0 6px 0 0' | ||||||
|         AInput = pickAlpha.getElementsByClassName('input')[0] |         AInput = pickAlpha.getElementsByClassName('input')[0] | ||||||
| @ -202,7 +259,7 @@ class YJColorPicker { | |||||||
|           AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100 |           AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100 | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           AInput.value = CesiumColor ? parseInt(CesiumColor.alpha * 100) / 100 : 1 |           AInput.value = CesiumColor ? parseInt(Number(CesiumColor.alpha.toFixed(2)) * 100) / 100 : 1 | ||||||
|         } |         } | ||||||
|         _this.pickAlphaInputValue = AInput.value |         _this.pickAlphaInputValue = AInput.value | ||||||
|         box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(AInput.value).toCssColorString() |         box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(AInput.value).toCssColorString() | ||||||
| @ -374,7 +431,7 @@ class YJColorPicker { | |||||||
|     function clickDefineColor(color) { |     function clickDefineColor(color) { | ||||||
|       if (AInput) { |       if (AInput) { | ||||||
|         let c = Cesium.Color.fromCssColorString(color) |         let c = Cesium.Color.fromCssColorString(color) | ||||||
|         AInput.value = parseInt(c.alpha * 100) / 100 |         AInput.value = parseInt(Number(c.alpha.toFixed(2)) * 100) / 100 | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @ -459,6 +516,44 @@ class YJColorPicker { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     function colorRgbaToHsba(e) { | ||||||
|  |       var t = e.slice(e.indexOf("(") + 1, e.lastIndexOf(")")).split(",") | ||||||
|  |         , r = t.length < 4 ? 1 : Number(t[3]) | ||||||
|  |         , n = Number(t[0]) / 255 | ||||||
|  |         , o = Number(t[1]) / 255 | ||||||
|  |         , i = Number(t[2]) / 255 | ||||||
|  |         , a = void 0 | ||||||
|  |         , s = void 0 | ||||||
|  |         , l = void 0 | ||||||
|  |         , c = Math.min(n, o, i) | ||||||
|  |         , d = l = Math.max(n, o, i) | ||||||
|  |         , u = d - c; | ||||||
|  |       if (d === c) | ||||||
|  |           a = 0; | ||||||
|  |       else { | ||||||
|  |           switch (d) { | ||||||
|  |           case n: | ||||||
|  |               a = (o - i) / u + (o < i ? 6 : 0); | ||||||
|  |               break; | ||||||
|  |           case o: | ||||||
|  |               a = 2 + (i - n) / u; | ||||||
|  |               break; | ||||||
|  |           case i: | ||||||
|  |               a = 4 + (n - o) / u | ||||||
|  |           } | ||||||
|  |           a = Math.round(60 * a) | ||||||
|  |       } | ||||||
|  |       s = 0 === d ? 0 : 1 - c / d; | ||||||
|  |       return s = Math.round(100 * s), | ||||||
|  |       l = Math.round(100 * l), | ||||||
|  |       { | ||||||
|  |           h: a, | ||||||
|  |           s: s, | ||||||
|  |           b: l, | ||||||
|  |           a: r | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  |  | ||||||
|     function pickerInputChange(v) { |     function pickerInputChange(v) { | ||||||
|       if (_this.colorPicker && _this.colorPicker.pickerInput) { |       if (_this.colorPicker && _this.colorPicker.pickerInput) { | ||||||
|         let rgbaColor = colorHexToRgba(v || _this.colorPicker.pickerInput.value) |         let rgbaColor = colorHexToRgba(v || _this.colorPicker.pickerInput.value) | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								static/3rdparty/ewPlugins.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								static/3rdparty/ewPlugins.min.js
									
									
									
									
										vendored
									
									
								
							| @ -810,6 +810,7 @@ | |||||||
|             else |             else | ||||||
|                 this.init(o, this.config) |                 this.init(o, this.config) | ||||||
|         } |         } | ||||||
|  |         this.changeColor = g | ||||||
|         this.close = () => { |         this.close = () => { | ||||||
|           this.pickerFlag = !this.pickerFlag, |           this.pickerFlag = !this.pickerFlag, | ||||||
|           this.picker.style.opacity = 0 |           this.picker.style.opacity = 0 | ||||||
|  | |||||||
| @ -3157,7 +3157,7 @@ | |||||||
|  |  | ||||||
| /* 贴地图片 */ | /* 贴地图片 */ | ||||||
| .YJ-custom-base-dialog.ground-image>.content { | .YJ-custom-base-dialog.ground-image>.content { | ||||||
|   width: 500px; |   width: 560px; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* 模型 */ | /* 模型 */ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user