合并
This commit is contained in:
@ -16,7 +16,7 @@ class Layer extends BaseLayer {
|
|||||||
super(sdk, options)
|
super(sdk, options)
|
||||||
this.object = {}
|
this.object = {}
|
||||||
this.options.host = this.options.host || getHost()
|
this.options.host = this.options.host || getHost()
|
||||||
|
this.on()
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
@ -24,21 +24,7 @@ class Layer extends BaseLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
on() {
|
on() {
|
||||||
return this.add()
|
return this.loadLayer(this.options)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async add() {
|
|
||||||
let res = await this.requestResource()
|
|
||||||
let text = await res.text()
|
|
||||||
text = JSON.parse(text)
|
|
||||||
if ([0, 200].includes(text.code)) {
|
|
||||||
return this.loadLayer(text.data)
|
|
||||||
} else {
|
|
||||||
return new Promise((res, reject) => {
|
|
||||||
reject(text.msg || text.message)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadLayer(data) {
|
async loadLayer(data) {
|
||||||
@ -64,11 +50,11 @@ class Layer extends BaseLayer {
|
|||||||
Cesium.Math.toRadians(this.object.north)
|
Cesium.Math.toRadians(this.object.north)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
// if (this.object.scheme_name === "GeographicTilingScheme") {
|
// if (this.object.schemaName === "GeographicTilingScheme") {
|
||||||
// console.log("添加GeographicTilingScheme")
|
// console.log("添加GeographicTilingScheme")
|
||||||
// params.tilingScheme = new Cesium.GeographicTilingScheme()
|
// params.tilingScheme = new Cesium.GeographicTilingScheme()
|
||||||
// }
|
// }
|
||||||
// if (this.object.scheme_name === "amapMercatorTilingScheme") {
|
// if (this.object.schemaName === "amapMercatorTilingScheme") {
|
||||||
// console.log("添加amapMercatorTilingScheme")
|
// console.log("添加amapMercatorTilingScheme")
|
||||||
// params.tilingScheme = this.amapMercatorTilingScheme()
|
// params.tilingScheme = this.amapMercatorTilingScheme()
|
||||||
// }
|
// }
|
||||||
@ -80,19 +66,19 @@ class Layer extends BaseLayer {
|
|||||||
// } else {
|
// } else {
|
||||||
// tms = new Cesium.UrlTemplateImageryProvider(params)
|
// tms = new Cesium.UrlTemplateImageryProvider(params)
|
||||||
// }
|
// }
|
||||||
switch (this.object.scheme_name) {
|
switch (this.object.schemaName) {
|
||||||
case "amapMercatorTilingScheme":
|
case "amapMercatorTilingScheme":
|
||||||
params.tilingScheme = this.amapMercatorTilingScheme()
|
params.tilingScheme = this.amapMercatorTilingScheme()
|
||||||
break;
|
break;
|
||||||
case "":
|
case "":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
params.tilingScheme = new Cesium[this.object.scheme_name]()
|
params.tilingScheme = new Cesium[this.object.schemaName]()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (this.object.load_method) {
|
switch (this.object.load_method) {
|
||||||
case "tms":
|
case "tms":
|
||||||
if(this.object.url.endsWith("tilemapresource.xml")){
|
if (this.object.url.endsWith("tilemapresource.xml")) {
|
||||||
let arr = this.object.url.split("/")
|
let arr = this.object.url.split("/")
|
||||||
arr.pop()
|
arr.pop()
|
||||||
let url = arr.join("/")
|
let url = arr.join("/")
|
||||||
@ -116,7 +102,7 @@ class Layer extends BaseLayer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.sdk || !this.sdk.viewer) {
|
if (!this.sdk || !this.sdk.viewer) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.options.hasOwnProperty("layer_index")) {
|
if (this.options.hasOwnProperty("layer_index")) {
|
||||||
@ -137,7 +123,7 @@ class Layer extends BaseLayer {
|
|||||||
this.alpha = this.options.alpha
|
this.alpha = this.options.alpha
|
||||||
this.brightness = this.options.brightness
|
this.brightness = this.options.brightness
|
||||||
|
|
||||||
if(this.options.show) {
|
if (this.options.show) {
|
||||||
setSplitDirection(0, this.options.id)
|
setSplitDirection(0, this.options.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ class BIM extends BaseTileset {
|
|||||||
this.exportProperty(this.exportStateArray)
|
this.exportProperty(this.exportStateArray)
|
||||||
}
|
}
|
||||||
this.features = new Map()
|
this.features = new Map()
|
||||||
|
this.on()
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
|
@ -32,6 +32,7 @@ class Tileset extends BaseTileset {
|
|||||||
constructor(earth, options = {}, _Dialog = {}) {
|
constructor(earth, options = {}, _Dialog = {}) {
|
||||||
super(earth, options)
|
super(earth, options)
|
||||||
this.picking = false
|
this.picking = false
|
||||||
|
this.on()
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
@ -42,7 +43,7 @@ class Tileset extends BaseTileset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
on() {
|
on() {
|
||||||
return this.add()
|
return this.loadTileset(this.options)
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
|
@ -74,31 +74,6 @@ class BaseTileset extends BaseSource {
|
|||||||
this.editObj.controllerCallBack = this.rotationEditingCallBack
|
this.editObj.controllerCallBack = this.rotationEditingCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
async add() {
|
|
||||||
if (this.options.url) {
|
|
||||||
return this.loadTileset({
|
|
||||||
url: this.options.url
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
let res = await this.requestResource()
|
|
||||||
let text = await res.text()
|
|
||||||
text = JSON.parse(text)
|
|
||||||
if ([0, 200].includes(text.code)) {
|
|
||||||
if (text.data.url.length)
|
|
||||||
return this.loadTileset(text.data)
|
|
||||||
else
|
|
||||||
return new Promise((res, reject) => {
|
|
||||||
reject('资源不存在')
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return new Promise((res, reject) => {
|
|
||||||
reject(text.msg || text.message)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
loadSceneTree() {
|
loadSceneTree() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -469,7 +444,7 @@ class BaseTileset extends BaseSource {
|
|||||||
|
|
||||||
|
|
||||||
on() {
|
on() {
|
||||||
return this.add()
|
return this.loadTileset(this.options)
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultValue() {
|
setDefaultValue() {
|
||||||
|
@ -33,7 +33,6 @@ class CircleObject extends Base {
|
|||||||
* @param options.line.width=3 {number} 边框宽
|
* @param options.line.width=3 {number} 边框宽
|
||||||
* @param options.line.color="#ff000080" {string} 边框颜色
|
* @param options.line.color="#ff000080" {string} 边框颜色
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param options.areaUnit='平方米' {string} 面积单位
|
|
||||||
* @param options.customView {object} 默认视角
|
* @param options.customView {object} 默认视角
|
||||||
* @param options.customView.orientation {object} 默认视角方位
|
* @param options.customView.orientation {object} 默认视角方位
|
||||||
* @param options.customView.orientation.heading {number} 航向角
|
* @param options.customView.orientation.heading {number} 航向角
|
||||||
@ -87,7 +86,6 @@ class CircleObject 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 = {
|
||||||
@ -108,13 +106,13 @@ class CircleObject 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 || []
|
delete this.options.attribute.camera
|
||||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
delete this.options.attribute.vr
|
||||||
this.options.attribute.camera.content = this.options.attribute.camera.content || []
|
delete this.options.attribute.goods
|
||||||
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.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
@ -140,7 +138,7 @@ class CircleObject extends Base {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let heightModeName = ''
|
let heightModeName = ''
|
||||||
CircleObject.closeNodeEdit(this)
|
this.closeNodeEdit()
|
||||||
let ground = false
|
let ground = false
|
||||||
let disabled = false
|
let disabled = false
|
||||||
this.renewPositions()
|
this.renewPositions()
|
||||||
@ -330,45 +328,6 @@ class CircleObject 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
|
||||||
}
|
}
|
||||||
@ -580,320 +539,6 @@ class CircleObject extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get attributeType() {
|
|
||||||
return this.options.attributeType
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeType(v) {
|
|
||||||
this.options.attributeType = v
|
|
||||||
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) {
|
||||||
let fromDegreesArray = that.createCircle(that.options.center, that.options.radius)
|
let fromDegreesArray = that.createCircle(that.options.center, that.options.radius)
|
||||||
let ground
|
let ground
|
||||||
@ -914,9 +559,10 @@ class CircleObject extends Base {
|
|||||||
ground = true
|
ground = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (!that.options.label.position) {
|
// if (!that.options.label.position) {
|
||||||
|
// that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height }
|
||||||
|
// }
|
||||||
that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height }
|
that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height }
|
||||||
}
|
|
||||||
|
|
||||||
let material = Cesium.Color.fromCssColorString(that.options.color)
|
let material = Cesium.Color.fromCssColorString(that.options.color)
|
||||||
if (that.sdk.viewer.scene.mode === 2) {
|
if (that.sdk.viewer.scene.mode === 2) {
|
||||||
@ -930,7 +576,7 @@ class CircleObject extends Base {
|
|||||||
for (let i = 0; i < fromDegreesArray.length; i += 2) {
|
for (let i = 0; i < fromDegreesArray.length; i += 2) {
|
||||||
fromDegreesArray2.push(fromDegreesArray[i], fromDegreesArray[i + 1], that.options.center.alt + height)
|
fromDegreesArray2.push(fromDegreesArray[i], fromDegreesArray[i + 1], that.options.center.alt + height)
|
||||||
}
|
}
|
||||||
that.options.label.ground = ground
|
// that.options.label.ground = ground
|
||||||
that.positions = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2)
|
that.positions = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2)
|
||||||
positionsA = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
positionsA = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||||
that.entity = that.sdk.viewer.entities.add({
|
that.entity = that.sdk.viewer.entities.add({
|
||||||
@ -953,23 +599,8 @@ class CircleObject extends Base {
|
|||||||
})
|
})
|
||||||
that.sdk._entityZIndex++
|
that.sdk._entityZIndex++
|
||||||
CircleObject.createLabel(that)
|
CircleObject.createLabel(that)
|
||||||
that.options.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius).toFixed(2));
|
that.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius).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) {
|
||||||
@ -995,12 +626,12 @@ class CircleObject extends Base {
|
|||||||
scaleByDistance: that.options.label.scaleByDistance,
|
scaleByDistance: that.options.label.scaleByDistance,
|
||||||
near: that.options.label.near,
|
near: that.options.label.near,
|
||||||
far: that.options.label.far,
|
far: that.options.label.far,
|
||||||
ground: that.options.label.ground,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
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)
|
||||||
|
|
||||||
@ -1492,8 +1123,6 @@ class CircleObject extends Base {
|
|||||||
this.name = this.originalOptions.name
|
this.name = this.originalOptions.name
|
||||||
this.radius = this.originalOptions.radius
|
this.radius = this.originalOptions.radius
|
||||||
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
|
||||||
@ -1509,12 +1138,6 @@ class CircleObject extends Base {
|
|||||||
this.lineColor = this.originalOptions.line.color
|
this.lineColor = this.originalOptions.line.color
|
||||||
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.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.goodsSelect && this.goodsSelect()
|
|
||||||
|
|
||||||
this.heightMode = this.originalOptions.heightMode
|
this.heightMode = this.originalOptions.heightMode
|
||||||
|
|
||||||
@ -1554,51 +1177,6 @@ class CircleObject 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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 飞到
|
* 飞到
|
||||||
*/
|
*/
|
||||||
@ -1803,6 +1381,11 @@ class CircleObject extends Base {
|
|||||||
positions: { ...this.options.center }
|
positions: { ...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
|
||||||
@ -1866,88 +1449,104 @@ class CircleObject extends Base {
|
|||||||
return this.operate.positionEditing
|
return this.operate.positionEditing
|
||||||
}
|
}
|
||||||
|
|
||||||
static nodeEdit(that, cb = () => { }) {
|
openPositionEditing(cd) {
|
||||||
that.positionEditing = false
|
this.positionEditing = true
|
||||||
|
this._positionEditingCallback = cd
|
||||||
|
}
|
||||||
|
|
||||||
|
get areaChangeCallBack() {
|
||||||
|
return this._areaChangeCallBack
|
||||||
|
}
|
||||||
|
|
||||||
|
set areaChangeCallBack (cd) {
|
||||||
|
this._areaChangeCallBack = cd
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeEdit(cb = () => { }) {
|
||||||
|
this.positionEditing = false
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
} else {
|
} else {
|
||||||
that.event && that.event.destroy()
|
let _this = this
|
||||||
that.event = new MouseEvent(that.sdk)
|
this.event && this.event.destroy()
|
||||||
|
this.event = new MouseEvent(this.sdk)
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
that.tip = new MouseTip('左键确认,右键取消', that.sdk)
|
this.tip = new MouseTip('左键确认,右键取消', this.sdk)
|
||||||
that.event = new MouseEvent(that.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
that.nodePoints = []
|
this.nodePoints = []
|
||||||
let selectPoint
|
let selectPoint
|
||||||
let originalPosition
|
let originalPosition
|
||||||
let newpositions = []
|
let newpositions = []
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
let endpoint = { ...that.options.center }
|
let endpoint = { ...this.options.center }
|
||||||
let moveRadius = null
|
let moveRadius = null
|
||||||
let entity
|
let entity
|
||||||
fromDegreesArray = that.createCircle(that.options.center, that.options.radius)
|
fromDegreesArray = this.createCircle(this.options.center, this.options.radius)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
that.entity.polyline.clampToGround = true
|
this.entity.polyline.clampToGround = true
|
||||||
that.entity.polyline.arcType = Cesium.ArcType.GEODESIC
|
this.entity.polyline.arcType = Cesium.ArcType.GEODESIC
|
||||||
that.entity.polygon.perPositionHeight = false
|
this.entity.polygon.perPositionHeight = false
|
||||||
that.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
|
this.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
|
||||||
return new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray))
|
return new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray))
|
||||||
}, false)
|
}, false)
|
||||||
that.entity.polyline.positions = new Cesium.CallbackProperty(function () {
|
this.entity.polyline.positions = new Cesium.CallbackProperty(function () {
|
||||||
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||||
}, false)
|
}, false)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||||
that
|
this
|
||||||
.getClampToHeight({
|
.getClampToHeight({
|
||||||
lng: that.options.center.lng,
|
lng: this.options.center.lng,
|
||||||
lat: that.options.center.lat
|
lat: this.options.center.lat
|
||||||
}, objectsToExclude)
|
}, objectsToExclude)
|
||||||
.then(height => {
|
.then(height => {
|
||||||
that.label.position = [
|
this.label.position = [
|
||||||
that.options.center.lng,
|
this.options.center.lng,
|
||||||
that.options.center.lat,
|
this.options.center.lat,
|
||||||
height
|
height
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
that.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
if (entity) {
|
if (entity) {
|
||||||
that.sdk.viewer.entities.remove(entity)
|
this.sdk.viewer.entities.remove(entity)
|
||||||
entity = null
|
entity = null
|
||||||
}
|
}
|
||||||
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
let radius = that.computeDistance2([that.options.center, endpoint])
|
let radius = this.computeDistance2([this.options.center, endpoint])
|
||||||
that.radius = radius
|
this.radius = radius
|
||||||
|
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
that.event.destroy()
|
this.event.destroy()
|
||||||
that.tip.destroy()
|
this.tip.destroy()
|
||||||
|
|
||||||
that.heightMode = that.heightMode
|
this.heightMode = this.heightMode
|
||||||
|
|
||||||
|
cb('', {...this.options.center})
|
||||||
})
|
})
|
||||||
|
|
||||||
that.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if (entity) {
|
if (entity) {
|
||||||
that.sdk.viewer.entities.remove(entity)
|
this.sdk.viewer.entities.remove(entity)
|
||||||
entity = null
|
entity = null
|
||||||
}
|
}
|
||||||
|
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
that.event.destroy()
|
this.event.destroy()
|
||||||
that.tip.destroy()
|
this.tip.destroy()
|
||||||
|
|
||||||
that.heightMode = that.heightMode
|
this.heightMode = this.heightMode
|
||||||
})
|
})
|
||||||
|
|
||||||
that.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
entity && (entity.show = true)
|
entity && (entity.show = true)
|
||||||
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
moveRadius = that.computeDistance2([that.options.center, endpoint])
|
moveRadius = this.computeDistance2([this.options.center, endpoint])
|
||||||
fromDegreesArray = that.createCircle(that.options.center, moveRadius)
|
fromDegreesArray = this.createCircle(this.options.center, moveRadius)
|
||||||
that.tip.setPosition(
|
this.tip.setPosition(
|
||||||
cartesian,
|
cartesian,
|
||||||
movement.endPosition.x,
|
movement.endPosition.x,
|
||||||
movement.endPosition.y
|
movement.endPosition.y
|
||||||
@ -1956,28 +1555,28 @@ class CircleObject extends Base {
|
|||||||
createNodePoints()
|
createNodePoints()
|
||||||
}, 200);
|
}, 200);
|
||||||
async function createNodePoints() {
|
async function createNodePoints() {
|
||||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
let objectsToExclude = [..._this.sdk.viewer.entities.values]
|
||||||
let height = await that.getClampToHeight(that.options.center, objectsToExclude)
|
let height = await _this.getClampToHeight(_this.options.center, objectsToExclude)
|
||||||
let entity = that.sdk.viewer.entities.add({
|
let entity = _this.sdk.viewer.entities.add({
|
||||||
name: 'node-secondary-edit-point',
|
name: 'node-secondary-edit-point',
|
||||||
position: Cesium.Cartesian3.fromDegrees(that.options.center.lng, that.options.center.lat, height),
|
position: Cesium.Cartesian3.fromDegrees(_this.options.center.lng, _this.options.center.lat, height),
|
||||||
billboard: {
|
billboard: {
|
||||||
image: that.getSourceRootPath() + '/img/point.png',
|
image: _this.getSourceRootPath() + '/img/point.png',
|
||||||
width: 15,
|
width: 15,
|
||||||
height: 15,
|
height: 15,
|
||||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||||
color: Cesium.Color.WHITE.withAlpha(0.99)
|
color: Cesium.Color.WHITE.withAlpha(0.99)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
that.nodePoints.push(entity)
|
_this.nodePoints.push(entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
entity = that.sdk.viewer.entities.add(
|
entity = this.sdk.viewer.entities.add(
|
||||||
new Cesium.Entity({
|
new Cesium.Entity({
|
||||||
show: false,
|
show: false,
|
||||||
position: new Cesium.CallbackProperty((e) => {
|
position: new Cesium.CallbackProperty((e) => {
|
||||||
if (endpoint) {
|
if (endpoint) {
|
||||||
let c = that.computeMidpoint(that.options.center, endpoint)
|
let c = this.computeMidpoint(this.options.center, endpoint)
|
||||||
return Cesium.Cartesian3.fromDegrees(c.lng, c.lat, endpoint.alt)
|
return Cesium.Cartesian3.fromDegrees(c.lng, c.lat, endpoint.alt)
|
||||||
} else {
|
} else {
|
||||||
return Cesium.Cartesian3()
|
return Cesium.Cartesian3()
|
||||||
@ -2000,7 +1599,7 @@ class CircleObject extends Base {
|
|||||||
},
|
},
|
||||||
polyline: {
|
polyline: {
|
||||||
positions: new Cesium.CallbackProperty((e) => {
|
positions: new Cesium.CallbackProperty((e) => {
|
||||||
return Cesium.Cartesian3.fromDegreesArray([that.options.center.lng, that.options.center.lat, endpoint.lng, endpoint.lat])
|
return Cesium.Cartesian3.fromDegreesArray([this.options.center.lng, this.options.center.lat, endpoint.lng, endpoint.lat])
|
||||||
}, false),
|
}, false),
|
||||||
width: 2,
|
width: 2,
|
||||||
material:
|
material:
|
||||||
@ -2010,22 +1609,22 @@ class CircleObject extends Base {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
that.nodePoints.push(entity)
|
this.nodePoints.push(entity)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2205,8 +1804,8 @@ class CircleObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 计算投影面积
|
// 计算投影面积
|
||||||
this.options.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius).toFixed(2))
|
this.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius).toFixed(2))
|
||||||
this.areaUnit = this.areaUnit
|
this.areaChangeCallBack && this.areaChangeCallBack()
|
||||||
return fromDegreesArray
|
return fromDegreesArray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,10 @@ 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.options.customView = options.customView ||{
|
||||||
|
relativePosition: undefined,
|
||||||
|
orientation: undefined
|
||||||
|
}
|
||||||
// this._showView = this.options.showView || 0
|
// this._showView = this.options.showView || 0
|
||||||
this.setDefaultValue()
|
this.setDefaultValue()
|
||||||
this._showView
|
this._showView
|
||||||
@ -501,7 +505,10 @@ class Base extends Tools {
|
|||||||
|
|
||||||
// 重置视角
|
// 重置视角
|
||||||
resetCustomView() {
|
resetCustomView() {
|
||||||
this.options.customView = undefined
|
this.options.customView = {
|
||||||
|
relativePosition: undefined,
|
||||||
|
orientation: undefined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ import YJColorPicker from "../Obj/Element/yj-color-picker";
|
|||||||
|
|
||||||
class YJEarth {
|
class YJEarth {
|
||||||
#_requestAnimationFrameEventId = undefined
|
#_requestAnimationFrameEventId = undefined
|
||||||
|
#_BillboardCollection
|
||||||
|
#_LabelCollection
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param div_id {string} 地球所在的dom id
|
* @param div_id {string} 地球所在的dom id
|
||||||
@ -272,6 +274,34 @@ class YJEarth {
|
|||||||
this.viewer.scene.fxaa = true
|
this.viewer.scene.fxaa = true
|
||||||
this.viewer.scene.postProcessStages.fxaa.enabled = true
|
this.viewer.scene.postProcessStages.fxaa.enabled = true
|
||||||
this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = true //true 禁止 false 允许
|
this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = true //true 禁止 false 允许
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const BillboardCollection = this.viewer.scene.primitives.add(new Cesium.BillboardCollection({
|
||||||
|
scene: this.viewer.scene,
|
||||||
|
}));
|
||||||
|
const labelCollection = this.viewer.scene.primitives.add(new Cesium.LabelCollection({
|
||||||
|
scene: this.viewer.scene,
|
||||||
|
}));
|
||||||
|
|
||||||
|
this.#_BillboardCollection = BillboardCollection
|
||||||
|
this.#_LabelCollection = labelCollection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createCluster(this.viewer)
|
createCluster(this.viewer)
|
||||||
keyboardMapRoamingInit(this.viewer)
|
keyboardMapRoamingInit(this.viewer)
|
||||||
let a = Cesium.viewerCesiumNavigationMixin(this.viewer, {
|
let a = Cesium.viewerCesiumNavigationMixin(this.viewer, {
|
||||||
@ -522,6 +552,13 @@ class YJEarth {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get collection() {
|
||||||
|
return {
|
||||||
|
billboard: this.#_BillboardCollection,
|
||||||
|
label: this.#_LabelCollection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
||||||
for (let [id, obj] of this.entityMap) {
|
for (let [id, obj] of this.entityMap) {
|
||||||
|
Reference in New Issue
Block a user