Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0_new
This commit is contained in:
		| @ -105,7 +105,7 @@ function html(that) { | ||||
|                 </div> | ||||
|               </div> | ||||
|             </div> | ||||
|              | ||||
|  | ||||
|             <div class="row"> | ||||
|               <div class="lable-left-line"> | ||||
|                 <span>缩放</span> | ||||
| @ -177,7 +177,7 @@ function html(that) { | ||||
|                 </div> | ||||
|               </div> | ||||
|             </div> | ||||
|              | ||||
|  | ||||
|           </div> | ||||
|         </DIV-cy-tab-pane> | ||||
|         <DIV-cy-tab-pane label="标注风格"> | ||||
| @ -193,4 +193,4 @@ function html(that) { | ||||
|   ` | ||||
| } | ||||
|  | ||||
| export { html } | ||||
| export { html } | ||||
|  | ||||
| @ -15,7 +15,6 @@ import { setSplitDirection, syncSplitData, setActiveId, getSdk } from '../../../ | ||||
| import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../../Global/global' | ||||
|  | ||||
| class Model extends BaseModel { | ||||
|   #timeoutEventObject = null | ||||
|   /** | ||||
|    * @constructor | ||||
|    * @description 加载模型 | ||||
| @ -88,7 +87,8 @@ class Model extends BaseModel { | ||||
|       console.warn("lat is required!") | ||||
|       return | ||||
|     } | ||||
|     if(this.options.earth) { | ||||
|     this._timeoutEventObject = null | ||||
|     if (this.options.earth) { | ||||
|       delete this.options.earth | ||||
|     } | ||||
|     this.picking = true | ||||
| @ -266,8 +266,8 @@ class Model extends BaseModel { | ||||
|           }, this.entity) | ||||
|         } | ||||
|         this.entity.isMove = true | ||||
|         clearTimeout(this.#timeoutEventObject) | ||||
|         this.#timeoutEventObject = setTimeout(() => { | ||||
|         clearTimeout(this._timeoutEventObject) | ||||
|         this._timeoutEventObject = setTimeout(() => { | ||||
|           this.entity && (this.entity.isMove = false) | ||||
|         }, 500); | ||||
|       }) | ||||
| @ -304,8 +304,8 @@ class Model extends BaseModel { | ||||
|           }, this.entity) | ||||
|         } | ||||
|         this.entity.isMove = true | ||||
|         clearTimeout(this.#timeoutEventObject) | ||||
|         this.#timeoutEventObject = setTimeout(() => { | ||||
|         clearTimeout(this._timeoutEventObject) | ||||
|         this._timeoutEventObject = setTimeout(() => { | ||||
|           this.entity && (this.entity.isMove = false) | ||||
|         }, 500); | ||||
|  | ||||
| @ -321,7 +321,7 @@ class Model extends BaseModel { | ||||
|         this.modelAnimations = this.entity.loader.components.animations | ||||
|       }) | ||||
|     } | ||||
|      | ||||
|  | ||||
|     syncSplitData(this.sdk, this.options.id) | ||||
|   } | ||||
|  | ||||
| @ -462,6 +462,16 @@ class Model extends BaseModel { | ||||
|     this.options.url = this.options.url || "" | ||||
|   } | ||||
|  | ||||
|   get name() { | ||||
|     return this.options.name | ||||
|   } | ||||
|   set name(v) { | ||||
|     console.log(v, 'vvvvvvvvv') | ||||
|     this.options.name = v | ||||
|     this.options.label.text = v | ||||
|     this.label && (this.label.text = v) | ||||
|   } | ||||
|  | ||||
|   get color() { | ||||
|     return this.options.color | ||||
|   } | ||||
| @ -1659,8 +1669,8 @@ class Model extends BaseModel { | ||||
|     this.entity.minimumPixelSize = this.scaleByDistance ? undefined : this.options.minimumPixelSize | ||||
|     this.editObj && this.editObj.update() | ||||
|     this.entity.isMove = true | ||||
|     clearTimeout(this.#timeoutEventObject) | ||||
|     this.#timeoutEventObject = setTimeout(() => { | ||||
|     clearTimeout(this._timeoutEventObject) | ||||
|     this._timeoutEventObject = setTimeout(() => { | ||||
|       this.entity && (this.entity.isMove = false) | ||||
|     }, 500); | ||||
|   } | ||||
|  | ||||
| @ -16,7 +16,7 @@ import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/S | ||||
| class GroundSvg extends Base { | ||||
|   /** | ||||
|    * @constructor | ||||
|    * @param sdk  | ||||
|    * @param sdk | ||||
|    * @description 贴地svg | ||||
|    * @param options {object} 属性 | ||||
|    * @param options.id {string} 唯一标识 | ||||
| @ -60,8 +60,8 @@ class GroundSvg extends Base { | ||||
|    * @param options.customView.relativePosition.lat {number} 纬度 | ||||
|    * @param options.customView.relativePosition.alt {number} 高度 | ||||
|    * */ | ||||
|   #loadEvent = void 0 | ||||
|   #loaded = false | ||||
|   // #loadEvent = void 0 | ||||
|   // #loaded = false | ||||
|   constructor(sdk, options = {}, _Dialog = {}) { | ||||
|     super(sdk, options); | ||||
|     let jsCode = ` | ||||
| @ -79,6 +79,9 @@ class GroundSvg extends Base { | ||||
|     this.loaded = false; | ||||
|     this.ismove = false; | ||||
|  | ||||
|     this._loadEvent = void 0 | ||||
|     this._loaded = false | ||||
|  | ||||
|     if (this.options.position.lat > 83.5) { | ||||
|       this.options.position.lat = 83.5 | ||||
|     } | ||||
| @ -132,23 +135,23 @@ class GroundSvg extends Base { | ||||
|     this._isdrag = false | ||||
|     this._EventBinding = new EventBinding() | ||||
|  | ||||
|     if(this.sdk.entityMap.get(this.options.id)) { | ||||
|     if (this.sdk.entityMap.get(this.options.id)) { | ||||
|       return | ||||
|     } | ||||
|     this.sdk.addIncetance(this.options.id, this) | ||||
|     this.picking = true | ||||
|  | ||||
|      | ||||
|  | ||||
|     if (this.options.show) { | ||||
|       setSplitDirection(0, this.options.id) | ||||
|     } | ||||
|  | ||||
|     this._entityArray = [] | ||||
|      | ||||
|  | ||||
|     this.init() | ||||
|   } | ||||
|  | ||||
|   get type () { | ||||
|   get type() { | ||||
|     return 'GroundSvg' | ||||
|   } | ||||
|  | ||||
| @ -184,15 +187,15 @@ class GroundSvg extends Base { | ||||
|   set show(v) { | ||||
|     if (typeof v === "boolean") { | ||||
|       if (this.options.text && this.options.text.show) { | ||||
|         if(this.text) { | ||||
|           if((!this.showView || this.showView == 3)) { | ||||
|         if (this.text) { | ||||
|           if ((!this.showView || this.showView == 3)) { | ||||
|             this.text.show = v | ||||
|           } | ||||
|           else { | ||||
|             this.text.show = false | ||||
|           } | ||||
|         } | ||||
|          | ||||
|  | ||||
|       } | ||||
|       super.show = v | ||||
|     } else { | ||||
| @ -323,7 +326,7 @@ class GroundSvg extends Base { | ||||
|   } | ||||
|   set textValue(v) { | ||||
|     this.options.text.value = v | ||||
|     if(this.text) { | ||||
|     if (this.text) { | ||||
|       this.text.text = v | ||||
|     } | ||||
|     else { | ||||
| @ -340,7 +343,7 @@ class GroundSvg extends Base { | ||||
|   set textShow(v) { | ||||
|     this.options.text.show = v | ||||
|     if (this.show) { | ||||
|       if((!this.showView || this.showView == 3)) { | ||||
|       if ((!this.showView || this.showView == 3)) { | ||||
|         this.text && (this.text.show = v) | ||||
|       } | ||||
|       else { | ||||
| @ -399,7 +402,7 @@ class GroundSvg extends Base { | ||||
|   } | ||||
|   set textFontSize(v) { | ||||
|     this.options.text.fontSize = v | ||||
|     if(this.text) { | ||||
|     if (this.text) { | ||||
|       this.text.fontSize = v | ||||
|       this.text.pixelOffset = v | ||||
|     } | ||||
| @ -729,7 +732,7 @@ class GroundSvg extends Base { | ||||
|         let position = [] | ||||
|         let geometry = geometryArray[key].geometry; | ||||
|         let array = geometry.attributes.position.array | ||||
|      | ||||
|  | ||||
|         for (let i = 0; i < array.length; i += 3) { | ||||
|           let x = array[i] - (max2 / 2) | ||||
|           let y = array[i + 1] + (max2 / 2) | ||||
| @ -746,8 +749,8 @@ class GroundSvg extends Base { | ||||
|             positions.push([position[i], position[i + 1], position[i + 2]]) | ||||
|           } | ||||
|         } | ||||
|      | ||||
|      | ||||
|  | ||||
|  | ||||
|         let polygons = [] | ||||
|         // 组合多边形 | ||||
|         for (let i = 0; i < positions.length; i++) { | ||||
| @ -756,7 +759,7 @@ class GroundSvg extends Base { | ||||
|             positions[i][0] | ||||
|           ]]); | ||||
|           polygons.push(polygon) | ||||
|      | ||||
|  | ||||
|           if (feature) { | ||||
|             feature = turf.union(feature, polygon); | ||||
|           } | ||||
| @ -856,7 +859,7 @@ class GroundSvg extends Base { | ||||
|           this.hierarchys.push(array) | ||||
|         }); | ||||
|         this.entity = new Cesium.EntityCollection() | ||||
|          | ||||
|  | ||||
|         syncSplitData(this.sdk, this.options.id) | ||||
|         let perPositionHeight = false | ||||
|         if (this.sdk.viewer._element.className === 'cesium-viewer 2d') { | ||||
| @ -866,7 +869,7 @@ class GroundSvg extends Base { | ||||
|           for (let m = 0; m < this.hierarchys[i].length; m++) { | ||||
|             let id = this.options.id + `-${i}_${m}}` | ||||
|             let oldEntity = this.sdk.viewer.entities.getById(id) | ||||
|             if(oldEntity) { | ||||
|             if (oldEntity) { | ||||
|               this.sdk.viewer.entities.remove(oldEntity) | ||||
|             } | ||||
|             let entity = this.sdk.viewer.entities.add({ | ||||
| @ -908,9 +911,9 @@ class GroundSvg extends Base { | ||||
|           } | ||||
|         } | ||||
|         this.loaded = true | ||||
|         this.#loaded = true | ||||
|         if (this.#loadEvent) { | ||||
|           this.#loadEvent() | ||||
|         this._loaded = true | ||||
|         if (this._loadEvent) { | ||||
|           this._loadEvent() | ||||
|         } | ||||
|         this.scale = this.scale | ||||
|         GroundSvg.createText(this) | ||||
| @ -954,7 +957,7 @@ class GroundSvg extends Base { | ||||
|  * @param {boolean} status=false 状态 | ||||
|  */ | ||||
|   async edit(state) { | ||||
|     if (!this.#loaded) { | ||||
|     if (!this._loaded) { | ||||
|       return | ||||
|     } | ||||
|     this.originalOptions = this.deepCopyObj(this.options) | ||||
| @ -1210,7 +1213,7 @@ class GroundSvg extends Base { | ||||
|    * 重置 | ||||
|    */ | ||||
|   reset() { | ||||
|     if (!this.#loaded) { | ||||
|     if (!this._loaded) { | ||||
|       return | ||||
|     } | ||||
|     this.options = this.deepCopyObj(this.originalOptions) | ||||
| @ -1238,7 +1241,7 @@ class GroundSvg extends Base { | ||||
|   * @param {boolean} status=false 状态 | ||||
|   */ | ||||
|   drag(status, cd) { | ||||
|     if (!this.#loaded || !this.sdk || !this.sdk.viewer) { | ||||
|     if (!this._loaded || !this.sdk || !this.sdk.viewer) { | ||||
|       return | ||||
|     } | ||||
|     this.ismove = false | ||||
| @ -1321,26 +1324,26 @@ class GroundSvg extends Base { | ||||
|               angleH = bearing2 - bearingH | ||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||
|                 angleW = angleW + 180 | ||||
|                 flag=true | ||||
|                 flag = true | ||||
|               } | ||||
|               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { | ||||
|                 angleH = angleH + 180 | ||||
|                 flag2=true | ||||
|                 flag2 = true | ||||
|               } | ||||
|               if(flag && flag2) { | ||||
|               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) { | ||||
|                 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) { | ||||
|                 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') | ||||
| @ -1393,26 +1396,26 @@ class GroundSvg extends Base { | ||||
|  | ||||
|               if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) { | ||||
|                 angleW = angleW + 180 | ||||
|                 flag=true | ||||
|                 flag = true | ||||
|               } | ||||
|               if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) { | ||||
|                 angleH = angleH + 180 | ||||
|                 flag2=true | ||||
|                 flag2 = true | ||||
|               } | ||||
|               if(flag && flag2) { | ||||
|               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) { | ||||
|                 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) { | ||||
|                 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') | ||||
| @ -1597,11 +1600,11 @@ class GroundSvg extends Base { | ||||
|  | ||||
|       this.ScreenSpaceEventHandler.setInputAction((movement) => { | ||||
|         this.drag(false) | ||||
|         if (!this._DialogObject) { | ||||
|           cd && cd(this.options) | ||||
|           syncData(this.sdk, this.options.id) | ||||
|           syncSplitData(this.sdk, this.options.id) | ||||
|         } | ||||
|         // if (!this._DialogObject) { | ||||
|         cd && cd(this.options) | ||||
|         syncData(this.sdk, this.options.id) | ||||
|         syncSplitData(this.sdk, this.options.id) | ||||
|         // } | ||||
|       }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) | ||||
|  | ||||
|       this.pointEntityCollection = new Cesium.EntityCollection() | ||||
| @ -1628,7 +1631,7 @@ class GroundSvg extends Base { | ||||
|       controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates | ||||
|  | ||||
|       this.controlPoints = controlPoints | ||||
|       if(!this.sdk || !this.sdk.viewer) { | ||||
|       if (!this.sdk || !this.sdk.viewer) { | ||||
|         return | ||||
|       } | ||||
|       for (let i = 0; i < this.controlPoints.length; i++) { | ||||
| @ -1706,7 +1709,7 @@ class GroundSvg extends Base { | ||||
|   } | ||||
|  | ||||
|   _updateGeojson(data, x, y) { | ||||
|     if (!this.#loaded) { | ||||
|     if (!this._loaded) { | ||||
|       return | ||||
|     } | ||||
|     let width = Math.abs(this.bbox[0] - this.bbox[2]) | ||||
| @ -1727,7 +1730,7 @@ class GroundSvg extends Base { | ||||
|   } | ||||
|  | ||||
|   _update() { | ||||
|     if (!this.#loaded) { | ||||
|     if (!this._loaded) { | ||||
|       return | ||||
|     } | ||||
|     let point = turf.point([this.position.lng, this.position.lat]); | ||||
| @ -2110,22 +2113,22 @@ class GroundSvg extends Base { | ||||
|   } | ||||
|  | ||||
|   load(callback) { | ||||
|     if (this.#loaded) { | ||||
|     if (this._loaded) { | ||||
|       callback(); | ||||
|     } | ||||
|     else { | ||||
|       this.#loadEvent = callback | ||||
|       this._loadEvent = callback | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   async remove() { | ||||
|     this._worker.onmessage = (event) => {} | ||||
|     this._worker.onmessage = (event) => { } | ||||
|     await this.sdk.removeIncetance(this.options.id) | ||||
|     if (!this.entity) { | ||||
|       return | ||||
|     } | ||||
|     this.drag(false) | ||||
|     if(!this.sdk || !this.sdk.viewer) { | ||||
|     if (!this.sdk || !this.sdk.viewer) { | ||||
|       return | ||||
|     } | ||||
|     this.sdk.viewer.entities.remove(this.entity) | ||||
| @ -2137,7 +2140,7 @@ class GroundSvg extends Base { | ||||
|       this._DialogObject.close() | ||||
|       this._DialogObject = null | ||||
|     } | ||||
|      | ||||
|  | ||||
|     await syncData(this.sdk, this.options.id) | ||||
|   } | ||||
|  | ||||
| @ -2235,7 +2238,7 @@ class GroundSvg extends Base { | ||||
|     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 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) | ||||
|       } | ||||
| @ -2252,4 +2255,4 @@ class GroundSvg extends Base { | ||||
|   } | ||||
| } | ||||
|  | ||||
| export default GroundSvg | ||||
| export default GroundSvg | ||||
|  | ||||
		Reference in New Issue
	
	Block a user