椭圆
This commit is contained in:
		| @ -35,7 +35,6 @@ class EllipseObject extends Base { | |||||||
|    * @param options.line.width=2 {string} 边框宽 |    * @param options.line.width=2 {string} 边框宽 | ||||||
|    * @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色 |    * @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色 | ||||||
|    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) |    * @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式) | ||||||
|    * @param options.areaUnit='平方米' {string} 面积单位 |  | ||||||
|    * @param options.label {object} 标签对象 |    * @param options.label {object} 标签对象 | ||||||
|    * @param options.label.text {string} 标签文本 |    * @param options.label.text {string} 标签文本 | ||||||
|    * @param options.label.show {string} 标签显隐 |    * @param options.label.show {string} 标签显隐 | ||||||
| @ -82,7 +81,6 @@ class EllipseObject extends Base { | |||||||
|     this.options.line = options.line || {} |     this.options.line = options.line || {} | ||||||
|     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) |     this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) | ||||||
|     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' |     this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' | ||||||
|     this.options['area-unit'] = options['area-unit'] || '平方米' |  | ||||||
|     options.label = options.label || {} |     options.label = options.label || {} | ||||||
|     this._elms = {}; |     this._elms = {}; | ||||||
|     this.options.label = { |     this.options.label = { | ||||||
| @ -103,13 +101,6 @@ class EllipseObject extends Base { | |||||||
|     this.options.attribute = options.attribute || {} |     this.options.attribute = options.attribute || {} | ||||||
|     this.options.attribute.link = this.options.attribute.link || {} |     this.options.attribute.link = this.options.attribute.link || {} | ||||||
|     this.options.attribute.link.content = this.options.attribute.link.content || [] |     this.options.attribute.link.content = this.options.attribute.link.content || [] | ||||||
|     this.options.attribute.vr = this.options.attribute.vr || {} |  | ||||||
|     this.options.attribute.vr.content = this.options.attribute.vr.content || [] |  | ||||||
|     this.options.attribute.camera = this.options.attribute.camera || {} |  | ||||||
|     this.options.attribute.camera.content = this.options.attribute.camera.content || [] |  | ||||||
|     this.options.attribute.goods = this.options.attribute.goods || {} |  | ||||||
|     this.options.attribute.goods.content = this.options.attribute.goods.content || [] |  | ||||||
|     this.options.attributeType = options.attributeType || 'richText' |  | ||||||
|  |  | ||||||
|     this.options.richTextContent = options.richTextContent || '' |     this.options.richTextContent = options.richTextContent || '' | ||||||
|     this.event = new MouseEvent(this.sdk) |     this.event = new MouseEvent(this.sdk) | ||||||
| @ -136,7 +127,7 @@ class EllipseObject extends Base { | |||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       let heightModeName = '' |       let heightModeName = '' | ||||||
|       EllipseObject.closeNodeEdit(this) |       this.closeNodeEdit() | ||||||
|       let ground = false |       let ground = false | ||||||
|       let disabled = false |       let disabled = false | ||||||
|       this.renewPositions() |       this.renewPositions() | ||||||
| @ -339,45 +330,6 @@ class EllipseObject extends Base { | |||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get area() { |  | ||||||
|     return this.options.area |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set area(v) { |  | ||||||
|     this.options.area = v |  | ||||||
|     this._elms.area && this._elms.area.forEach((item) => { |  | ||||||
|       item.value = v |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get areaUnit() { |  | ||||||
|     return this.options['area-unit'] |  | ||||||
|   } |  | ||||||
|   set areaUnit(v) { |  | ||||||
|     this.options['area-unit'] = v |  | ||||||
|     this._elms.areaUnit && this._elms.areaUnit.forEach((item) => { |  | ||||||
|       item.value = v |  | ||||||
|     }) |  | ||||||
|     if (this.options.areaByMeter) { |  | ||||||
|       switch (v) { |  | ||||||
|         case '平方米': |  | ||||||
|           this.area = this.options.areaByMeter |  | ||||||
|           break; |  | ||||||
|         case '平方千米': |  | ||||||
|           this.area = Number((this.options.areaByMeter / 1000000).toFixed(8)) |  | ||||||
|           break; |  | ||||||
|         case '亩': |  | ||||||
|           this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4)) |  | ||||||
|           break; |  | ||||||
|         case '公顷': |  | ||||||
|           this.area = Number((this.options.areaByMeter / 10000).toFixed(6)) |  | ||||||
|           break; |  | ||||||
|         default: |  | ||||||
|           this.area = this.options.areaByMeter |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get labelShow() { |   get labelShow() { | ||||||
|     return this.options.label.show |     return this.options.label.show | ||||||
|   } |   } | ||||||
| @ -589,318 +541,12 @@ class EllipseObject extends Base { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get attributeType() { |   get areaChangeCallBack() { | ||||||
|     return this.options.attributeType |     return this._areaChangeCallBack | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   set attributeType(v) { |   set areaChangeCallBack (cd) { | ||||||
|     this.options.attributeType = v |     this._areaChangeCallBack = cd | ||||||
|     this._elms.attributeType && this._elms.attributeType.forEach((item) => { |  | ||||||
|       item.value = v |  | ||||||
|     }) |  | ||||||
|     let attributeContent = this._DialogObject._element.content.getElementsByClassName('attribute-content') |  | ||||||
|     for (let i = 0; i < attributeContent.length; i++) { |  | ||||||
|       if (attributeContent[i].className.indexOf('attribute-content-' + v) > -1) { |  | ||||||
|         attributeContent[i].style.display = 'block'; |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         attributeContent[i].style.display = 'none'; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get attributeLink() { |  | ||||||
|     return this.options.attribute.link.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set attributeLink(v) { |  | ||||||
|     this.options.attribute.link.content = v |  | ||||||
|     if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-link').length == 0) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0] |  | ||||||
|     let tableContent = table.getElementsByClassName('table-body')[0] |  | ||||||
|     tableContent.innerHTML = '' |  | ||||||
|     if (this.options.attribute.link.content.length > 0) { |  | ||||||
|       table.getElementsByClassName('table-empty')[0].style.display = 'none' |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       table.getElementsByClassName('table-empty')[0].style.display = 'flex' |  | ||||||
|     } |  | ||||||
|     for (let i = 0; i < this.options.attribute.link.content.length; i++) { |  | ||||||
|       let tr = ` |  | ||||||
|       <div class="tr"> |  | ||||||
|           <div class="td">` + this.options.attribute.link.content[i].name + `</div> |  | ||||||
|           <div class="td">` + this.options.attribute.link.content[i].url + `</div> |  | ||||||
|           <div class="td"> |  | ||||||
|               <button @click="linkEdit">编辑</button> |  | ||||||
|               <button @click="linkDelete">删除</button> |  | ||||||
|           </div> |  | ||||||
|       </div>` |  | ||||||
|       let trElm = document.createRange().createContextualFragment(tr) |  | ||||||
|       tableContent.appendChild(trElm) |  | ||||||
|     } |  | ||||||
|     let item = tableContent.getElementsByClassName('tr') |  | ||||||
|     let fun = { |  | ||||||
|       linkEdit: async (index) => { |  | ||||||
|         this.attributeLink = await this.options.attribute.link.content |  | ||||||
|         let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0] |  | ||||||
|         let tableContent = table.getElementsByClassName('table-body')[0] |  | ||||||
|         let item = tableContent.getElementsByClassName('tr') |  | ||||||
|         for (let i = 0; i < item.length; i++) { |  | ||||||
|           if (index === i) { |  | ||||||
|             let height = item[i].offsetHeight |  | ||||||
|             let html = ` |  | ||||||
|               <div class="td"> |  | ||||||
|                 <input class="input" type="text"> |  | ||||||
|               </div> |  | ||||||
|               <div class="td"> |  | ||||||
|                 <textarea class="input link-edit" type="text"></textarea> |  | ||||||
|               </div> |  | ||||||
|               <div class="td"> |  | ||||||
|                   <button @click="confirmEdit">确认</button> |  | ||||||
|                   <button @click="cancelEdit">取消</button> |  | ||||||
|               </div>` |  | ||||||
|             item[i].innerHTML = html |  | ||||||
|             let textareaElm = item[i].getElementsByClassName('link-edit')[0] |  | ||||||
|             textareaElm.style.height = (height - 10) + 'px' |  | ||||||
|             let td = item[i].getElementsByClassName('td') |  | ||||||
|             td[0].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].name |  | ||||||
|             td[1].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].url |  | ||||||
|             let btn = item[i].getElementsByTagName('button') |  | ||||||
|             for (let n = 0; n < btn.length; n++) { |  | ||||||
|               if (!btn[n] || !btn[n].attributes) { |  | ||||||
|                 continue |  | ||||||
|               } |  | ||||||
|               for (let m of btn[n].attributes) { |  | ||||||
|                 if (m.name === '@click') { |  | ||||||
|                   btn[n].addEventListener('click', (e) => { |  | ||||||
|                     if (typeof (fun[m.value]) === 'function') { |  | ||||||
|                       fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i) |  | ||||||
|                     } |  | ||||||
|                   }); |  | ||||||
|                   btn[n].attributes.removeNamedItem(m.name) |  | ||||||
|                   break |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             break |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       }, |  | ||||||
|       linkDelete: (i) => { |  | ||||||
|         this.options.attribute.link.content.splice(i, 1) |  | ||||||
|         this.attributeLink = this.options.attribute.link.content |  | ||||||
|       }, |  | ||||||
|  |  | ||||||
|       confirmEdit: (value, i) => { |  | ||||||
|         let name = value.name && value.name.replace(/\s/g, "") |  | ||||||
|         let url = value.url && value.url.replace(/\s/g, "") |  | ||||||
|         if (name && url) { |  | ||||||
|           this.options.attribute.link.content[i] = value |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|           window.ELEMENT && window.ELEMENT.Message({ |  | ||||||
|             message: '名称或链接不能为空!', |  | ||||||
|             type: 'warning', |  | ||||||
|             duration: 1500 |  | ||||||
|           }); |  | ||||||
|         } |  | ||||||
|         this.attributeLink = this.options.attribute.link.content |  | ||||||
|       }, |  | ||||||
|       cancelEdit: () => { |  | ||||||
|         this.attributeLink = this.options.attribute.link.content |  | ||||||
|       }, |  | ||||||
|       fileSelect: (value, i) => { |  | ||||||
|         let fileElm = item[i].getElementsByClassName('file-select')[0] |  | ||||||
|         fileElm.click() |  | ||||||
|         fileElm.removeEventListener('change', fileSelect) |  | ||||||
|         fileElm.addEventListener('change', fileSelect) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     let fileSelect = (event) => { |  | ||||||
|       if (event.target.value) { |  | ||||||
|         let td = item[event.target.getAttribute('index')].getElementsByClassName('td') |  | ||||||
|         td[1].getElementsByClassName('input')[0].value = event.target.value |  | ||||||
|         event.target.value = null |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     for (let i = 0; i < item.length; i++) { |  | ||||||
|       let btn = item[i].getElementsByTagName('button') |  | ||||||
|       for (let n = 0; n < btn.length; n++) { |  | ||||||
|         if (!btn[n] || !btn[n].attributes) { |  | ||||||
|           continue |  | ||||||
|         } |  | ||||||
|         for (let m of btn[n].attributes) { |  | ||||||
|           if (m.name === '@click') { |  | ||||||
|             btn[n].addEventListener('click', (e) => { |  | ||||||
|               if (typeof (fun[m.value]) === 'function') { |  | ||||||
|                 fun[m.value](i) |  | ||||||
|               } |  | ||||||
|             }); |  | ||||||
|             btn[n].attributes.removeNamedItem(m.name) |  | ||||||
|             break |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get attributeCamera() { |  | ||||||
|     return this.options.attribute.camera.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set attributeCamera(v) { |  | ||||||
|     this.options.attribute.camera.content = v |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get attributeVr() { |  | ||||||
|     return this.options.attribute.vr.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set attributeVr(v) { |  | ||||||
|     this.options.attribute.vr.content = v |  | ||||||
|     if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-vr').length == 0) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0] |  | ||||||
|     let tableContent = table.getElementsByClassName('table-body')[0] |  | ||||||
|     tableContent.innerHTML = '' |  | ||||||
|     if (this.options.attribute.vr.content.length > 0) { |  | ||||||
|       table.getElementsByClassName('table-empty')[0].style.display = 'none' |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       table.getElementsByClassName('table-empty')[0].style.display = 'flex' |  | ||||||
|     } |  | ||||||
|     for (let i = 0; i < this.options.attribute.vr.content.length; i++) { |  | ||||||
|       let tr = ` |  | ||||||
|       <div class="tr"> |  | ||||||
|           <div class="td">` + this.options.attribute.vr.content[i].name + `</div> |  | ||||||
|           <div class="td">` + this.options.attribute.vr.content[i].url + `</div> |  | ||||||
|           <div class="td"> |  | ||||||
|               <button @click="vrEdit">编辑</button> |  | ||||||
|               <button @click="vrDelete">删除</button> |  | ||||||
|           </div> |  | ||||||
|       </div>` |  | ||||||
|       let trElm = document.createRange().createContextualFragment(tr) |  | ||||||
|       tableContent.appendChild(trElm) |  | ||||||
|     } |  | ||||||
|     let item = tableContent.getElementsByClassName('tr') |  | ||||||
|     let fun = { |  | ||||||
|       vrEdit: async (index) => { |  | ||||||
|         this.attributeVr = await this.options.attribute.vr.content |  | ||||||
|         let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0] |  | ||||||
|         let tableContent = table.getElementsByClassName('table-body')[0] |  | ||||||
|         let item = tableContent.getElementsByClassName('tr') |  | ||||||
|         for (let i = 0; i < item.length; i++) { |  | ||||||
|           if (index === i) { |  | ||||||
|             let height = item[i].offsetHeight |  | ||||||
|             let html = ` |  | ||||||
|               <div class="td"> |  | ||||||
|                 <input class="input" type="text"> |  | ||||||
|               </div> |  | ||||||
|               <div class="td"> |  | ||||||
|               <textarea class="input link-edit" type="text"></textarea> |  | ||||||
|               </div> |  | ||||||
|               <div class="td"> |  | ||||||
|                   <button @click="confirmEdit">确认</button> |  | ||||||
|                   <button @click="cancelEdit">取消</button> |  | ||||||
|               </div>` |  | ||||||
|             item[i].innerHTML = html |  | ||||||
|             let textareaElm = item[i].getElementsByClassName('link-edit')[0] |  | ||||||
|             textareaElm.style.height = (height - 10) + 'px' |  | ||||||
|             let td = item[i].getElementsByClassName('td') |  | ||||||
|             td[0].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].name |  | ||||||
|             td[1].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].url |  | ||||||
|             let btn = item[i].getElementsByTagName('button') |  | ||||||
|             for (let n = 0; n < btn.length; n++) { |  | ||||||
|               if (!btn[n] || !btn[n].attributes) { |  | ||||||
|                 continue |  | ||||||
|               } |  | ||||||
|               for (let m of btn[n].attributes) { |  | ||||||
|                 if (m.name === '@click') { |  | ||||||
|                   btn[n].addEventListener('click', (e) => { |  | ||||||
|                     if (typeof (fun[m.value]) === 'function') { |  | ||||||
|                       fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i) |  | ||||||
|                     } |  | ||||||
|                   }); |  | ||||||
|                   btn[n].attributes.removeNamedItem(m.name) |  | ||||||
|                   break |  | ||||||
|                 } |  | ||||||
|               } |  | ||||||
|             } |  | ||||||
|             break |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       }, |  | ||||||
|       vrDelete: (i) => { |  | ||||||
|         this.options.attribute.vr.content.splice(i, 1) |  | ||||||
|         this.attributeVr = this.options.attribute.vr.content |  | ||||||
|       }, |  | ||||||
|  |  | ||||||
|       confirmEdit: (value, i) => { |  | ||||||
|         let name = value.name && value.name.replace(/\s/g, "") |  | ||||||
|         let url = value.url && value.url.replace(/\s/g, "") |  | ||||||
|         if (name && url) { |  | ||||||
|           this.options.attribute.vr.content[i] = value |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|           window.ELEMENT && window.ELEMENT.Message({ |  | ||||||
|             message: '名称或链接不能为空!', |  | ||||||
|             type: 'warning', |  | ||||||
|             duration: 1500 |  | ||||||
|           }); |  | ||||||
|         } |  | ||||||
|         this.attributeVr = this.options.attribute.vr.content |  | ||||||
|       }, |  | ||||||
|       cancelEdit: () => { |  | ||||||
|         this.attributeVr = this.options.attribute.vr.content |  | ||||||
|       }, |  | ||||||
|       fileSelect: (value, i) => { |  | ||||||
|         let fileElm = item[i].getElementsByClassName('file-select')[0] |  | ||||||
|         fileElm.click() |  | ||||||
|         fileElm.removeEventListener('change', fileSelect) |  | ||||||
|         fileElm.addEventListener('change', fileSelect) |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     let fileSelect = (event) => { |  | ||||||
|       if (event.target.value) { |  | ||||||
|         let td = item[event.target.getAttribute('index')].getElementsByClassName('td') |  | ||||||
|         td[1].getElementsByClassName('input')[0].value = event.target.value |  | ||||||
|         event.target.value = null |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     for (let i = 0; i < item.length; i++) { |  | ||||||
|       let btn = item[i].getElementsByTagName('button') |  | ||||||
|       for (let n = 0; n < btn.length; n++) { |  | ||||||
|         if (!btn[n] || !btn[n].attributes) { |  | ||||||
|           continue |  | ||||||
|         } |  | ||||||
|         for (let m of btn[n].attributes) { |  | ||||||
|           if (m.name === '@click') { |  | ||||||
|             btn[n].addEventListener('click', (e) => { |  | ||||||
|               if (typeof (fun[m.value]) === 'function') { |  | ||||||
|                 fun[m.value](i) |  | ||||||
|               } |  | ||||||
|             }); |  | ||||||
|             btn[n].attributes.removeNamedItem(m.name) |  | ||||||
|             break |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   get attributeGoods() { |  | ||||||
|     return this.options.attribute.goods.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   set attributeGoods(v) { |  | ||||||
|     this.options.attribute.goods.content = v |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static create(that) { |   static create(that) { | ||||||
| @ -932,7 +578,6 @@ class EllipseObject extends Base { | |||||||
|         color: that.options.color |         color: that.options.color | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|     that.options.label.ground = ground |  | ||||||
|  |  | ||||||
|     let positions = that.createEllipse(that.options.center, { bearing: that.options.bearing, semiMinorAxis: that.options.semiMinorAxis, semiMajorAxis: that.options.semiMajorAxis, height: that.options.center.alt + height }) |     let positions = that.createEllipse(that.options.center, { bearing: that.options.bearing, semiMinorAxis: that.options.semiMinorAxis, semiMajorAxis: that.options.semiMajorAxis, height: that.options.center.alt + height }) | ||||||
|  |  | ||||||
| @ -958,23 +603,8 @@ class EllipseObject extends Base { | |||||||
|     }) |     }) | ||||||
|     that.sdk._entityZIndex++ |     that.sdk._entityZIndex++ | ||||||
|     EllipseObject.createLabel(that) |     EllipseObject.createLabel(that) | ||||||
|     that.options.areaByMeter = Number((Cesium.Math.PI * that.options.semiMinorAxis * that.options.semiMajorAxis).toFixed(2)); |     that.areaByMeter = Number((Cesium.Math.PI * that.options.semiMajorAxis * that.options.semiMinorAxis).toFixed(2)); | ||||||
|     switch (that.options['area-unit']) { |     that.areaChangeCallBack && that.areaChangeCallBack() | ||||||
|       case '平方米': |  | ||||||
|         that.options.area = that.options.areaByMeter |  | ||||||
|         break; |  | ||||||
|       case '平方千米': |  | ||||||
|         that.options.area = Number((that.options.areaByMeter / 1000000).toFixed(8)) |  | ||||||
|         break; |  | ||||||
|       case '亩': |  | ||||||
|         that.options.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4)) |  | ||||||
|         break; |  | ||||||
|       case '公顷': |  | ||||||
|         that.options.area = Number((that.options.areaByMeter / 10000).toFixed(6)) |  | ||||||
|         break; |  | ||||||
|       default: |  | ||||||
|         that.options.area = that.options.areaByMeter |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     syncData(that.sdk, that.options.id) |     syncData(that.sdk, that.options.id) | ||||||
|     if (that.options.show) { |     if (that.options.show) { | ||||||
| @ -1006,6 +636,7 @@ class EllipseObject extends Base { | |||||||
|  |  | ||||||
|   // 编辑框 |   // 编辑框 | ||||||
|   async edit(state) { |   async edit(state) { | ||||||
|  |     return | ||||||
|     let _this = this |     let _this = this | ||||||
|     this.originalOptions = this.deepCopyObj(this.options) |     this.originalOptions = this.deepCopyObj(this.options) | ||||||
|  |  | ||||||
| @ -1191,7 +822,6 @@ class EllipseObject extends Base { | |||||||
|       let contentElm = document.createElement('div'); |       let contentElm = document.createElement('div'); | ||||||
|       contentElm.innerHTML = html(this) |       contentElm.innerHTML = html(this) | ||||||
|       this._DialogObject.contentAppChild(contentElm) |       this._DialogObject.contentAppChild(contentElm) | ||||||
|       this.attributeType = this.options.attributeType |  | ||||||
|       this.attributeCamera = this.options.attribute.camera.content |       this.attributeCamera = this.options.attribute.camera.content | ||||||
|  |  | ||||||
|       // 创建标签页 |       // 创建标签页 | ||||||
| @ -1495,13 +1125,10 @@ class EllipseObject extends Base { | |||||||
|     this.options = this.deepCopyObj(this.originalOptions) |     this.options = this.deepCopyObj(this.originalOptions) | ||||||
|     this.name = this.originalOptions.name |     this.name = this.originalOptions.name | ||||||
|  |  | ||||||
|     this.radius = this.originalOptions.radius |  | ||||||
|     this.semiMinorAxis = this.originalOptions.semiMinorAxis |     this.semiMinorAxis = this.originalOptions.semiMinorAxis | ||||||
|     this.semiMajorAxis = this.originalOptions.semiMajorAxis |     this.semiMajorAxis = this.originalOptions.semiMajorAxis | ||||||
|     this.bearing = this.originalOptions.bearing |     this.bearing = this.originalOptions.bearing | ||||||
|     this.color = this.originalOptions.color |     this.color = this.originalOptions.color | ||||||
|     this.area = this.originalOptions.area |  | ||||||
|     this.areaUnit = this.originalOptions['area-unit'] |  | ||||||
|     this.labelShow = this.originalOptions.label.show |     this.labelShow = this.originalOptions.label.show | ||||||
|     this.labelFontSize = this.originalOptions.label.fontSize |     this.labelFontSize = this.originalOptions.label.fontSize | ||||||
|     this.labelFontFamily = this.originalOptions.label.fontFamily |     this.labelFontFamily = this.originalOptions.label.fontFamily | ||||||
| @ -1515,9 +1142,6 @@ class EllipseObject extends Base { | |||||||
|     this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] |     this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] | ||||||
|     this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] |     this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] | ||||||
|     this.attributeLink = this.options.attribute.link.content |     this.attributeLink = this.options.attribute.link.content | ||||||
|     this.attributeVr = this.options.attribute.vr.content |  | ||||||
|     this.attributeCamera = this.options.attribute.camera.content |  | ||||||
|     this.attributeGoods = this.options.attribute.goods.content |  | ||||||
|     this.cameraSelect && this.cameraSelect() |     this.cameraSelect && this.cameraSelect() | ||||||
|     this.goodsSelect && this.goodsSelect() |     this.goodsSelect && this.goodsSelect() | ||||||
|  |  | ||||||
| @ -1559,51 +1183,6 @@ class EllipseObject extends Base { | |||||||
|     await syncData(this.sdk, this.options.id) |     await syncData(this.sdk, this.options.id) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   _addLink() { |  | ||||||
|     // document.getElementsByClassName |  | ||||||
|     if (this._DialogObject._element.content.getElementsByClassName('link_add')[0].value) { |  | ||||||
|       this.options.attribute.link.content.push({ |  | ||||||
|         name: '链接', |  | ||||||
|         url: this._DialogObject._element.content.getElementsByClassName('link_add')[0].value |  | ||||||
|       }) |  | ||||||
|       this._DialogObject._element.content.getElementsByClassName('link_add')[0].value = '' |  | ||||||
|       this.attributeLink = this.options.attribute.link.content |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       this.Dialog.clickAddLink && this.Dialog.clickAddLink() |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   addAttributeLink(link) { |  | ||||||
|     this.options.attribute.link.content.push({ |  | ||||||
|       name: '链接', |  | ||||||
|       url: link |  | ||||||
|     }) |  | ||||||
|     this.attributeLink = this.options.attribute.link.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   _addRr() { |  | ||||||
|     if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) { |  | ||||||
|       this.options.attribute.vr.content.push({ |  | ||||||
|         name: '全景图' , |  | ||||||
|         url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value |  | ||||||
|       }) |  | ||||||
|       this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = '' |  | ||||||
|       this.attributeVr = this.options.attribute.vr.content |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       this.Dialog.clickAddVr && this.Dialog.clickAddVr() |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   addAttributeRr(vr) { |  | ||||||
|     this.options.attribute.vr.content.push({ |  | ||||||
|       name: '全景图' , |  | ||||||
|       url: vr |  | ||||||
|     }) |  | ||||||
|     this.attributeVr = this.options.attribute.vr.content |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 飞到 |    * 飞到 | ||||||
|   */ |   */ | ||||||
| @ -1765,6 +1344,10 @@ class EllipseObject extends Base { | |||||||
|           center: this.deepCopyObj(this.options.center) |           center: this.deepCopyObj(this.options.center) | ||||||
|         } |         } | ||||||
|         this.positionEditing = false |         this.positionEditing = false | ||||||
|  |         if(this._positionEditingCallback) { | ||||||
|  |           this._positionEditingCallback() | ||||||
|  |           this._positionEditingCallback = null | ||||||
|  |         } | ||||||
|       }) |       }) | ||||||
|       this.event.mouse_right((movement, cartesian) => { |       this.event.mouse_right((movement, cartesian) => { | ||||||
|         this.positionEditing = false |         this.positionEditing = false | ||||||
| @ -1825,7 +1408,13 @@ class EllipseObject extends Base { | |||||||
|     return this.operate.positionEditing |     return this.operate.positionEditing | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static nodeEdit(that, cb = () => { }) { |   openPositionEditing(cd) { | ||||||
|  |     this.positionEditing = true | ||||||
|  |     this._positionEditingCallback = cd | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   nodeEdit(cb = () => { }) { | ||||||
|  |     let that = this | ||||||
|     that.positionEditing = false |     that.positionEditing = false | ||||||
|     if (YJ.Measure.GetMeasureStatus()) { |     if (YJ.Measure.GetMeasureStatus()) { | ||||||
|     } else { |     } else { | ||||||
| @ -1981,6 +1570,8 @@ class EllipseObject extends Base { | |||||||
|           that.tip = null |           that.tip = null | ||||||
|  |  | ||||||
|           that.heightMode = that.heightMode |           that.heightMode = that.heightMode | ||||||
|  |  | ||||||
|  |           cb('', {...this.options.center}) | ||||||
|         }) |         }) | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -2020,17 +1611,17 @@ class EllipseObject extends Base { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static closeNodeEdit(that) { |    closeNodeEdit() { | ||||||
|     YJ.Measure.SetMeasureStatus(false) |     YJ.Measure.SetMeasureStatus(false) | ||||||
|     that.event && that.event.destroy() |     this.event && this.event.destroy() | ||||||
|     that.tip && that.tip.destroy() |     this.tip && this.tip.destroy() | ||||||
|     that.tip = null |     this.tip = null | ||||||
|  |  | ||||||
|     for (let i = 0; i < that.nodePoints.length; i++) { |     for (let i = 0; i < this.nodePoints.length; i++) { | ||||||
|       that.sdk.viewer.entities.remove(that.nodePoints[i]) |       this.sdk.viewer.entities.remove(this.nodePoints[i]) | ||||||
|     } |     } | ||||||
|     that.nodePoints = [] |     this.nodePoints = [] | ||||||
|     that.picking = true |     this.picking = true | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static EventBinding(that, elements) { |   static EventBinding(that, elements) { | ||||||
| @ -2198,8 +1789,8 @@ class EllipseObject extends Base { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // 计算投影面积 |     // 计算投影面积 | ||||||
|     this.options.areaByMeter = Number((Cesium.Math.PI * this.options.semiMinorAxis * this.options.semiMajorAxis).toFixed(2)); |     this.areaByMeter = Number((Cesium.Math.PI * this.options.semiMinorAxis * this.options.semiMajorAxis).toFixed(2)); | ||||||
|     this.areaUnit = this.areaUnit |     this.areaChangeCallBack && this.areaChangeCallBack() | ||||||
|     return this.positions |     return this.positions | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user