提交
This commit is contained in:
@ -103,6 +103,7 @@ class AssembleObject 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.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
delete this.options.attribute.camera
|
delete this.options.attribute.camera
|
||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
|
|||||||
@ -116,6 +116,8 @@ class AttackArrowObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
if (!this.options.positions || this.options.positions.length < 3) {
|
if (!this.options.positions || this.options.positions.length < 3) {
|
||||||
this._error = '箭头面最少需要三个坐标!'
|
this._error = '箭头面最少需要三个坐标!'
|
||||||
|
|||||||
@ -40,8 +40,8 @@ class BaseLayer extends BaseSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set brightness(v) {
|
set brightness(v) {
|
||||||
this.options.brightness = v
|
this.options.brightness = Number(v)
|
||||||
this.entity.brightness = v
|
this.entity.brightness = Number(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
get alpha() {
|
get alpha() {
|
||||||
@ -50,8 +50,9 @@ class BaseLayer extends BaseSource {
|
|||||||
|
|
||||||
|
|
||||||
set alpha(v) {
|
set alpha(v) {
|
||||||
if (Number(v) > 1) v = 1
|
v = Number(v)
|
||||||
if (Number(v) < 0) v = 0
|
if (v > 1) v = 1
|
||||||
|
if (v < 0) v = 0
|
||||||
this.entity.alpha = v
|
this.entity.alpha = v
|
||||||
this.options.alpha = v
|
this.options.alpha = v
|
||||||
this._elms.alpha && this._elms.alpha.forEach((item) => {
|
this._elms.alpha && this._elms.alpha.forEach((item) => {
|
||||||
|
|||||||
@ -238,6 +238,7 @@ class BaseTerrain extends BaseSource {
|
|||||||
* @param state=false {boolean} 状态: true打开, false关闭
|
* @param state=false {boolean} 状态: true打开, false关闭
|
||||||
*/
|
*/
|
||||||
async edit(state = false) {
|
async edit(state = false) {
|
||||||
|
return
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
if (this._DialogObject && this._DialogObject.close) {
|
if (this._DialogObject && this._DialogObject.close) {
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
@ -287,6 +288,11 @@ class BaseTerrain extends BaseSource {
|
|||||||
this._elms.name = [nameElm]
|
this._elms.name = [nameElm]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
this.options = this.deepCopyObj(this.originalOptions)
|
||||||
|
this.name = this.options.name
|
||||||
|
}
|
||||||
|
|
||||||
flicker() { }
|
flicker() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -164,6 +164,7 @@ class Tileset extends BaseTileset {
|
|||||||
* @param state=false {boolean} 状态: true打开, false关闭
|
* @param state=false {boolean} 状态: true打开, false关闭
|
||||||
*/
|
*/
|
||||||
async edit(state = false) {
|
async edit(state = false) {
|
||||||
|
return
|
||||||
let _this = this
|
let _this = this
|
||||||
this._element_style = null
|
this._element_style = null
|
||||||
|
|
||||||
|
|||||||
@ -552,6 +552,7 @@ class BaseTileset extends BaseSource {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.editObj.destroy()
|
this.editObj.destroy()
|
||||||
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,12 +563,13 @@ class BaseTileset extends BaseSource {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
//平移时,坐标信息变化的回调
|
openPositionEditing(cd) {
|
||||||
set positionEditingCallBack(callback) {
|
this.positionEditing = true
|
||||||
return
|
this._positionEditingCallback = cd
|
||||||
}
|
}
|
||||||
|
closePositionEditing() {
|
||||||
get positionEditingCallBack() {
|
this.positionEditing = false
|
||||||
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
|
|
||||||
//旋转时,坐标信息变化的回调
|
//旋转时,坐标信息变化的回调
|
||||||
@ -583,6 +585,9 @@ class BaseTileset extends BaseSource {
|
|||||||
this.roll = params.rotate.x
|
this.roll = params.rotate.x
|
||||||
this.heading = params.rotate.y
|
this.heading = params.rotate.y
|
||||||
this.pitch = params.rotate.z
|
this.pitch = params.rotate.z
|
||||||
|
if(this._positionEditingCallback) {
|
||||||
|
this._positionEditingCallback()
|
||||||
|
}
|
||||||
// this._rotationEditingCallBack && this._rotationEditingCallBack(this.editObj._params)
|
// this._rotationEditingCallBack && this._rotationEditingCallBack(this.editObj._params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,6 +175,8 @@ class BillboardObject extends Base {
|
|||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||||
this.options.attribute.goods.content =
|
this.options.attribute.goods.content =
|
||||||
this.options.attribute.goods.content || []
|
this.options.attribute.goods.content || []
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
// this.options.coordinate = options.coordinate || ''
|
// this.options.coordinate = options.coordinate || ''
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
this._elms = {}
|
this._elms = {}
|
||||||
@ -2390,7 +2392,7 @@ class BillboardObject extends Base {
|
|||||||
this.entity.position = new Cesium.CallbackProperty(function () {
|
this.entity.position = new Cesium.CallbackProperty(function () {
|
||||||
return cartesian
|
return cartesian
|
||||||
}, false)
|
}, false)
|
||||||
if(this.#_positionEditingCallback) {
|
if (this.#_positionEditingCallback) {
|
||||||
this.#_positionEditingCallback()
|
this.#_positionEditingCallback()
|
||||||
this.#_positionEditingCallback = null
|
this.#_positionEditingCallback = null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/S
|
|||||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
|
|
||||||
class CircleDiffuse extends Base {
|
class CircleDiffuse extends Base {
|
||||||
|
#_positionEditingCallback = null
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @description 扩散圆
|
* @description 扩散圆
|
||||||
@ -24,7 +25,7 @@ class CircleDiffuse extends Base {
|
|||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.lng {number} 经度
|
* @param options.lng {number} 经度
|
||||||
* @param options.lat {number} 维度
|
* @param options.lat {number} 维度
|
||||||
* @param options.color=#1FA8E3 {string} 基础颜色
|
* @param options.color=#ff0000 {string} 基础颜色
|
||||||
* @param options.speed=5 {number} 速度
|
* @param options.speed=5 {number} 速度
|
||||||
* @param options.count=3 {number} 波纹数量
|
* @param options.count=3 {number} 波纹数量
|
||||||
* @param options.circle=[]] {array} 圆属性
|
* @param options.circle=[]] {array} 圆属性
|
||||||
@ -84,7 +85,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.options.count = 3
|
this.options.count = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options.circle = options.circle || [{ radius: 10 }]
|
this.options.circle = options.circle || [{ radius: 10, color: this.options.color }]
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if (this.options.circle[i].radius > 999999) {
|
if (this.options.circle[i].radius > 999999) {
|
||||||
this.options.circle[i].radius = 999999
|
this.options.circle[i].radius = 999999
|
||||||
@ -93,7 +94,6 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.options.positionEditin = false
|
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
@ -110,8 +110,6 @@ class CircleDiffuse extends Base {
|
|||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
}
|
}
|
||||||
this.options.instruct = options.instruct || ''
|
|
||||||
this.options.operatingPoint = options.operatingPoint || ''
|
|
||||||
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 || []
|
||||||
@ -120,6 +118,8 @@ class CircleDiffuse extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
let radius = 0
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if (Number(this.options.circle[i].radius) > radius) {
|
if (Number(this.options.circle[i].radius) > radius) {
|
||||||
@ -128,6 +128,8 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
this._radius = radius
|
this._radius = radius
|
||||||
|
|
||||||
|
this.operate = {}
|
||||||
|
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
this.sdk.addIncetance(this.options.id, this)
|
this.sdk.addIncetance(this.options.id, this)
|
||||||
@ -213,10 +215,8 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async createLabel(that) {
|
static async createLabel(that) {
|
||||||
if (!that.options.label.position) {
|
let height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat })
|
||||||
let height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat })
|
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
||||||
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
|
||||||
}
|
|
||||||
// 标签
|
// 标签
|
||||||
that.label = new LabelObject(that.sdk, {
|
that.label = new LabelObject(that.sdk, {
|
||||||
id: that.options.id,
|
id: that.options.id,
|
||||||
@ -287,7 +287,7 @@ class CircleDiffuse extends Base {
|
|||||||
if (!this.sdk || !this.sdk.viewer || !this.entity) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.options.positionEditing = status
|
this.operate.positionEditing = status
|
||||||
if (status === true) {
|
if (status === true) {
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
||||||
@ -316,6 +316,10 @@ class CircleDiffuse extends Base {
|
|||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
this.event.gesture_pinck_start(() => { })
|
this.event.gesture_pinck_start(() => { })
|
||||||
this.event.gesture_pinck_end(() => { })
|
this.event.gesture_pinck_end(() => { })
|
||||||
|
if (this.#_positionEditingCallback) {
|
||||||
|
this.#_positionEditingCallback()
|
||||||
|
this.#_positionEditingCallback = null
|
||||||
|
}
|
||||||
this.lastOptions = undefined
|
this.lastOptions = undefined
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
})
|
})
|
||||||
@ -368,7 +372,12 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get positionEditing() {
|
get positionEditing() {
|
||||||
return this.options.positionEditing
|
return this.operate.positionEditing
|
||||||
|
}
|
||||||
|
|
||||||
|
openPositionEditing(cd) {
|
||||||
|
this.positionEditing = true
|
||||||
|
this.#_positionEditingCallback = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
get lng() {
|
get lng() {
|
||||||
@ -400,7 +409,7 @@ class CircleDiffuse extends Base {
|
|||||||
return this.options.circle
|
return this.options.circle
|
||||||
}
|
}
|
||||||
set circle(v) {
|
set circle(v) {
|
||||||
this.options.circle = v || [{ radius: 10 }]
|
this.options.circle = v || [{ radius: 10, color: this.options.color }]
|
||||||
let radius = 0
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if (Number(this.options.circle[i].radius) > 999999) {
|
if (Number(this.options.circle[i].radius) > 999999) {
|
||||||
@ -433,7 +442,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.options.transparency = 1
|
this.options.transparency = 1
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.options.transparency = v
|
this.options.transparency = Number(v)
|
||||||
}
|
}
|
||||||
CircleDiffuse.create(this)
|
CircleDiffuse.create(this)
|
||||||
this._elms.transparency && this._elms.transparency.forEach((item) => {
|
this._elms.transparency && this._elms.transparency.forEach((item) => {
|
||||||
@ -980,7 +989,6 @@ class CircleDiffuse extends Base {
|
|||||||
this.name = this.originalOptions.name
|
this.name = this.originalOptions.name
|
||||||
this.lng = this.originalOptions.lng
|
this.lng = this.originalOptions.lng
|
||||||
this.lat = this.originalOptions.lat
|
this.lat = this.originalOptions.lat
|
||||||
this.color = this.originalOptions.color
|
|
||||||
this.duration = this.originalOptions.duration
|
this.duration = this.originalOptions.duration
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
@ -994,8 +1002,6 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelLineColor = this.originalOptions.label.lineColor
|
this.labelLineColor = this.originalOptions.label.lineColor
|
||||||
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.instruct = this.originalOptions.instruct
|
|
||||||
this.operatingPoint = this.originalOptions.operatingPoint
|
|
||||||
|
|
||||||
let radius = 0
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
|
|||||||
@ -111,6 +111,8 @@ class CircleObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
|
|||||||
@ -147,6 +147,8 @@ class CurvelineObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
|
|||||||
@ -110,6 +110,8 @@ class EllipseObject extends Base {
|
|||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
this.options.attributeType = options.attributeType || 'richText'
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
|
|||||||
@ -116,6 +116,8 @@ class PincerArrowObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
if (!this.options.positions || this.options.positions.length < 5) {
|
if (!this.options.positions || this.options.positions.length < 5) {
|
||||||
this._error = '双箭头最少需要五个坐标!'
|
this._error = '双箭头最少需要五个坐标!'
|
||||||
console.warn(this._error)
|
console.warn(this._error)
|
||||||
|
|||||||
@ -142,6 +142,8 @@ class PolygonObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
if (!this.options.positions || this.options.positions.length < 3) {
|
if (!this.options.positions || this.options.positions.length < 3) {
|
||||||
this._error = '多边形最少需要三个坐标!'
|
this._error = '多边形最少需要三个坐标!'
|
||||||
|
|||||||
@ -78,7 +78,6 @@ class PolyhedronObject extends Base {
|
|||||||
this.entity
|
this.entity
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
text: this.options.name,
|
||||||
@ -98,13 +97,8 @@ class PolyhedronObject 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.camera = this.options.attribute.camera || {}
|
|
||||||
this.options.attribute.camera.content = this.options.attribute.camera.content || []
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.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._elms = {};
|
this._elms = {};
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
if (!this.options.positions || this.options.positions.length < 3) {
|
if (!this.options.positions || this.options.positions.length < 3) {
|
||||||
@ -191,23 +185,7 @@ class PolyhedronObject extends Base {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
PolyhedronObject.createLabel(that)
|
PolyhedronObject.createLabel(that)
|
||||||
that.options.areaByMeter = that.computeArea(positions);
|
that.areaByMeter = that.computeArea(positions);
|
||||||
switch (that.options['area-unit']) {
|
|
||||||
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) {
|
||||||
|
|
||||||
@ -315,6 +293,11 @@ class PolyhedronObject extends Base {
|
|||||||
}
|
}
|
||||||
this.positions = newpositions
|
this.positions = newpositions
|
||||||
this.previous.positions = newpositions
|
this.previous.positions = newpositions
|
||||||
|
|
||||||
|
if(this._positionEditingCallback) {
|
||||||
|
this._positionEditingCallback()
|
||||||
|
this._positionEditingCallback = null
|
||||||
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
@ -412,6 +395,19 @@ class PolyhedronObject extends Base {
|
|||||||
return this.operate.positionEditing
|
return this.operate.positionEditing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openPositionEditing(cd) {
|
||||||
|
this.positionEditing = true
|
||||||
|
this._positionEditingCallback = cd
|
||||||
|
}
|
||||||
|
|
||||||
|
get areaChangeCallBack() {
|
||||||
|
return this._areaChangeCallBack
|
||||||
|
}
|
||||||
|
|
||||||
|
set areaChangeCallBack (cd) {
|
||||||
|
this._areaChangeCallBack = cd
|
||||||
|
}
|
||||||
|
|
||||||
get color() {
|
get color() {
|
||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
@ -519,34 +515,6 @@ class PolyhedronObject extends Base {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
@ -758,322 +726,9 @@ class PolyhedronObject 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
async edit(state) {
|
async edit(state) {
|
||||||
|
return
|
||||||
if (this._error) {
|
if (this._error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1134,8 +789,6 @@ class PolyhedronObject 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
|
|
||||||
|
|
||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
||||||
@ -1337,7 +990,6 @@ class PolyhedronObject extends Base {
|
|||||||
this.height = this.originalOptions.height
|
this.height = this.originalOptions.height
|
||||||
this.extrudedHeight = this.originalOptions.extrudedHeight
|
this.extrudedHeight = this.originalOptions.extrudedHeight
|
||||||
this.area = this.originalOptions.area
|
this.area = this.originalOptions.area
|
||||||
this.areaUnit = this.originalOptions['area-unit']
|
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
@ -1350,12 +1002,6 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelLineColor = this.originalOptions.label.lineColor
|
this.labelLineColor = this.originalOptions.label.lineColor
|
||||||
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.attributeCamera = this.options.attribute.camera.content
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
this.attributeGoods = this.options.attribute.goods.content
|
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
|
|
||||||
let positions = this.options.positions
|
let positions = this.options.positions
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
@ -1399,63 +1045,10 @@ class PolyhedronObject extends Base {
|
|||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
_addLink() {
|
nodeEdit(cb = () => { }) {
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开富文本框
|
|
||||||
*/
|
|
||||||
openRichTextEditor(e) {
|
|
||||||
richText.open(this.options.id, this.options.name, this.options.richTextContent)
|
|
||||||
richText.primaryCallBack = (content) => {
|
|
||||||
this.options.richTextContent = content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static nodeEdit(that, cb = () => { }) {
|
|
||||||
// that.positionEditing = false
|
// that.positionEditing = false
|
||||||
// that.event && that.event.destroy()
|
// that.event && that.event.destroy()
|
||||||
|
let that = this
|
||||||
that.positionEditing = false
|
that.positionEditing = false
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
cb('上一次测量未结束')
|
cb('上一次测量未结束')
|
||||||
@ -1486,7 +1079,8 @@ class PolyhedronObject extends Base {
|
|||||||
})
|
})
|
||||||
that.nodePoints.splice(selectPoint.index, 0, entity)
|
that.nodePoints.splice(selectPoint.index, 0, entity)
|
||||||
that.options.positions.splice(selectPoint.index, 0, that.options.positions[selectPoint.index])
|
that.options.positions.splice(selectPoint.index, 0, that.options.positions[selectPoint.index])
|
||||||
that.options.areaByMeter = that.computeArea(that.options.positions);
|
that.areaByMeter = that.computeArea(that.options.positions);
|
||||||
|
that.areaChangeCallBack && that.areaChangeCallBack()
|
||||||
let labelPositions = [[]]
|
let labelPositions = [[]]
|
||||||
for (let i = 0; i < that.options.positions.length; i++) {
|
for (let i = 0; i < that.options.positions.length; i++) {
|
||||||
labelPositions[0].push([that.options.positions[i].lng, that.options.positions[i].lat])
|
labelPositions[0].push([that.options.positions[i].lng, that.options.positions[i].lat])
|
||||||
@ -1497,22 +1091,6 @@ class PolyhedronObject extends Base {
|
|||||||
let centroid = turf.centroid(polygon);
|
let centroid = turf.centroid(polygon);
|
||||||
that.label.position = [centroid.geometry.coordinates[0], centroid.geometry.coordinates[1], that.options.height + that.options.extrudedHeight]
|
that.label.position = [centroid.geometry.coordinates[0], centroid.geometry.coordinates[1], that.options.height + that.options.extrudedHeight]
|
||||||
}
|
}
|
||||||
switch (that.options['area-unit']) {
|
|
||||||
case '平方米':
|
|
||||||
that.area = that.options.areaByMeter
|
|
||||||
break;
|
|
||||||
case '平方千米':
|
|
||||||
that.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
|
|
||||||
break;
|
|
||||||
case '亩':
|
|
||||||
that.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
|
|
||||||
break;
|
|
||||||
case '公顷':
|
|
||||||
that.area = Number((that.options.areaByMeter / 10000).toFixed(6))
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
that.area = that.options.areaByMeter
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var pick = that.sdk.viewer.scene.pick(movement.position);
|
var pick = that.sdk.viewer.scene.pick(movement.position);
|
||||||
@ -1531,23 +1109,8 @@ class PolyhedronObject extends Base {
|
|||||||
if(added) {
|
if(added) {
|
||||||
that.options.positions.splice(selectPoint.index, 1)
|
that.options.positions.splice(selectPoint.index, 1)
|
||||||
}
|
}
|
||||||
that.options.areaByMeter = that.computeArea(that.options.positions);
|
that.areaByMeter = that.computeArea(that.options.positions);
|
||||||
switch (that.options['area-unit']) {
|
that.areaChangeCallBack && that.areaChangeCallBack()
|
||||||
case '平方米':
|
|
||||||
that.area = that.options.areaByMeter
|
|
||||||
break;
|
|
||||||
case '平方千米':
|
|
||||||
that.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
|
|
||||||
break;
|
|
||||||
case '亩':
|
|
||||||
that.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
|
|
||||||
break;
|
|
||||||
case '公顷':
|
|
||||||
that.area = Number((that.options.areaByMeter / 10000).toFixed(6))
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
that.area = that.options.areaByMeter
|
|
||||||
}
|
|
||||||
let positions = that.options.positions
|
let positions = that.options.positions
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
|
|||||||
@ -145,6 +145,8 @@ class PolylineObject extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/S
|
|||||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
||||||
|
|
||||||
class RadarScan extends Base {
|
class RadarScan extends Base {
|
||||||
|
#_positionEditingCallback = null
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @description 雷达扫描
|
* @description 雷达扫描
|
||||||
@ -23,7 +24,7 @@ class RadarScan extends Base {
|
|||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.lng {number} 经度
|
* @param options.lng {number} 经度
|
||||||
* @param options.lat {number} 维度
|
* @param options.lat {number} 维度
|
||||||
* @param options.color=#FFEB3B {string} 颜色
|
* @param options.color=#ff0000 {string} 颜色
|
||||||
* @param options.radius=10 {number} 半径
|
* @param options.radius=10 {number} 半径
|
||||||
* @param options.speed=20 {number} 速度
|
* @param options.speed=20 {number} 速度
|
||||||
* @param options.label {object} 标签对象
|
* @param options.label {object} 标签对象
|
||||||
@ -63,7 +64,7 @@ class RadarScan extends Base {
|
|||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.lng = options.lng
|
this.options.lng = options.lng
|
||||||
this.options.lat = options.lat
|
this.options.lat = options.lat
|
||||||
this.options.color = options.color || '#FFEB3B'
|
this.options.color = options.color || '#ff0000'
|
||||||
this.options.radius = options.radius || 10
|
this.options.radius = options.radius || 10
|
||||||
if(this.options.radius > 999999) {
|
if(this.options.radius > 999999) {
|
||||||
this.options.radius = 999999
|
this.options.radius = 999999
|
||||||
@ -71,13 +72,11 @@ class RadarScan extends Base {
|
|||||||
this.options.speed = (options.speed || options.speed === 0) ? options.speed : 20
|
this.options.speed = (options.speed || options.speed === 0) ? options.speed : 20
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.options.positionEditin = false
|
this.operate = {}
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
|
||||||
show: options.label.show || false,
|
show: options.label.show || false,
|
||||||
position: options.label.position,
|
|
||||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||||
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
@ -89,20 +88,11 @@ class RadarScan extends Base {
|
|||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
}
|
}
|
||||||
this.options.instruct = options.instruct || ''
|
|
||||||
this.options.operatingPoint = options.operatingPoint || ''
|
|
||||||
this.options.attribute = options.attribute || {}
|
this.options.attribute = options.attribute || {}
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
|
||||||
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.camera = this.options.attribute.camera || {}
|
|
||||||
this.options.attribute.camera = this.options.attribute.camera.content || []
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.options.attribute.ISC = this.options.attribute.ISC || {}
|
|
||||||
this.options.attribute.ISC.content = this.options.attribute.ISC.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.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
// if(this.sdk.viewer.scene.mode === 2) {
|
// if(this.sdk.viewer.scene.mode === 2) {
|
||||||
@ -180,9 +170,10 @@ class RadarScan extends Base {
|
|||||||
|
|
||||||
static async createLabel(that) {
|
static async createLabel(that) {
|
||||||
let height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat })
|
let height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat })
|
||||||
if (!that.options.label.position) {
|
// if (!that.options.label.position) {
|
||||||
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
// that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
||||||
}
|
// }
|
||||||
|
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
||||||
// 标签
|
// 标签
|
||||||
that.label = new LabelObject(that.sdk, {
|
that.label = new LabelObject(that.sdk, {
|
||||||
id: that.options.id,
|
id: that.options.id,
|
||||||
@ -212,7 +203,7 @@ class RadarScan extends Base {
|
|||||||
// 每一帧刷新时调用
|
// 每一帧刷新时调用
|
||||||
that.viewer.clock.onTick.addEventListener(() => {
|
that.viewer.clock.onTick.addEventListener(() => {
|
||||||
let tempTime = new Date().getTime()
|
let tempTime = new Date().getTime()
|
||||||
let everyTime = that.options.duration ? 360 / that.options.duration : 0
|
let everyTime = 0
|
||||||
let speed = (tempTime - _time) * everyTime
|
let speed = (tempTime - _time) * everyTime
|
||||||
_time = tempTime
|
_time = tempTime
|
||||||
heading += speed;
|
heading += speed;
|
||||||
@ -314,7 +305,7 @@ class RadarScan extends Base {
|
|||||||
if (YJ.Measure.GetMeasureStatus() || !this.sdk || !this.sdk.viewer || !this.entity) {
|
if (YJ.Measure.GetMeasureStatus() || !this.sdk || !this.sdk.viewer || !this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.options.positionEditing = status
|
this.operate.positionEditing = status
|
||||||
if (status === true) {
|
if (status === true) {
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
||||||
@ -343,6 +334,10 @@ class RadarScan extends Base {
|
|||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
this.event.gesture_pinck_start(() => { })
|
this.event.gesture_pinck_start(() => { })
|
||||||
this.event.gesture_pinck_end(() => { })
|
this.event.gesture_pinck_end(() => { })
|
||||||
|
if (this.#_positionEditingCallback) {
|
||||||
|
this.#_positionEditingCallback()
|
||||||
|
this.#_positionEditingCallback = null
|
||||||
|
}
|
||||||
this.lastOptions = undefined
|
this.lastOptions = undefined
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
})
|
})
|
||||||
@ -398,7 +393,12 @@ class RadarScan extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get positionEditing() {
|
get positionEditing() {
|
||||||
return this.options.positionEditing
|
return this.operate.positionEditing
|
||||||
|
}
|
||||||
|
|
||||||
|
openPositionEditing(cd) {
|
||||||
|
this.positionEditing = true
|
||||||
|
this.#_positionEditingCallback = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
get lng() {
|
get lng() {
|
||||||
@ -699,348 +699,6 @@ class RadarScan extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get instruct() {
|
|
||||||
return this.options.instruct
|
|
||||||
}
|
|
||||||
set instruct(v) {
|
|
||||||
this.options.instruct = v
|
|
||||||
this._elms.instruct && this._elms.instruct.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
get operatingPoint() {
|
|
||||||
return this.options.operatingPoint
|
|
||||||
}
|
|
||||||
set operatingPoint(v) {
|
|
||||||
this.options.operatingPoint = v
|
|
||||||
this._elms.operatingPoint && this._elms.operatingPoint.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
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 attributeISC() {
|
|
||||||
return this.options.attribute.ISC.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeISC(v) {
|
|
||||||
this.options.attribute.ISC.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
|
|
||||||
}
|
|
||||||
|
|
||||||
async flyTo(options = {}) {
|
async flyTo(options = {}) {
|
||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
@ -1111,6 +769,7 @@ class RadarScan 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)
|
||||||
|
|
||||||
@ -1161,9 +820,6 @@ class RadarScan 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.attributeISC = this.options.attribute.ISC.content
|
|
||||||
|
|
||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
@ -1393,7 +1049,6 @@ class RadarScan extends Base {
|
|||||||
this.lat = this.originalOptions.lat
|
this.lat = this.originalOptions.lat
|
||||||
this.color = this.originalOptions.color
|
this.color = this.originalOptions.color
|
||||||
this.radius = this.originalOptions.radius
|
this.radius = this.originalOptions.radius
|
||||||
this.duration = this.originalOptions.duration
|
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
@ -1406,15 +1061,6 @@ class RadarScan extends Base {
|
|||||||
this.labelLineColor = this.originalOptions.label.lineColor
|
this.labelLineColor = this.originalOptions.label.lineColor
|
||||||
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.instruct = this.originalOptions.instruct
|
|
||||||
this.operatingPoint = this.originalOptions.operatingPoint
|
|
||||||
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.attributeISC = this.options.attribute.ISC.content
|
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
@ -1433,16 +1079,6 @@ class RadarScan extends Base {
|
|||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
instructSubmit() {
|
|
||||||
this.Dialog.instructSubmit && this.Dialog.instructSubmit(this.options.id, this.options.label.text, this.instruct)
|
|
||||||
this.originalOptions.instruct = this.instruct
|
|
||||||
}
|
|
||||||
|
|
||||||
operatingPointSubmit() {
|
|
||||||
this.Dialog.operatingPointSubmit && this.Dialog.operatingPointSubmit(this.options.id, this.options.label.text, this.operatingPoint)
|
|
||||||
this.originalOptions.operatingPoint = this.operatingPoint
|
|
||||||
}
|
|
||||||
|
|
||||||
changeMaterial() {
|
changeMaterial() {
|
||||||
// 提取颜色透明度
|
// 提取颜色透明度
|
||||||
function extractRGBA(rgbaString) {
|
function extractRGBA(rgbaString) {
|
||||||
@ -1475,61 +1111,6 @@ class RadarScan extends Base {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
_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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开富文本框
|
|
||||||
*/
|
|
||||||
openRichTextEditor(e) {
|
|
||||||
richText.open(this.options.id, this.options.name, this.options.richTextContent)
|
|
||||||
richText.primaryCallBack = (content) => {
|
|
||||||
this.options.richTextContent = content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
||||||
options.x = (options.x || options.x === 0) ? options.x : 10
|
options.x = (options.x || options.x === 0) ? options.x : 10
|
||||||
options.y = (options.y || options.y === 0) ? options.y : 10
|
options.y = (options.y || options.y === 0) ? options.y : 10
|
||||||
|
|||||||
@ -77,12 +77,9 @@ class RadarScanStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
this.options.duration = options.duration || 2000
|
this.options.duration = options.duration || 2000
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.options.positionEditin = false
|
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
|
||||||
show: options.label.show || false,
|
show: options.label.show || false,
|
||||||
position: options.label.position,
|
|
||||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||||
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
@ -94,20 +91,11 @@ class RadarScanStereoscopic extends Base {
|
|||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
}
|
}
|
||||||
this.options.instruct = options.instruct || ""
|
|
||||||
this.options.operatingPoint = options.operatingPoint || ""
|
|
||||||
this.options.attribute = options.attribute || {}
|
this.options.attribute = options.attribute || {}
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
|
||||||
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.camera = this.options.attribute.camera || {}
|
|
||||||
this.options.attribute.camera = this.options.attribute.camera.content || []
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.options.attribute.ISC = this.options.attribute.ISC || {}
|
|
||||||
this.options.attribute.ISC.content = this.options.attribute.ISC.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._elms = {};
|
this._elms = {};
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
@ -235,9 +223,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
||||||
height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat }, objectsToExclude)
|
height = await that.getClampToHeight({ lng: that.options.lng, lat: that.options.lat }, objectsToExclude)
|
||||||
}
|
}
|
||||||
if (!that.options.label.position) {
|
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
||||||
that.options.label.position = { lng: that.options.lng, lat: that.options.lat, alt: height }
|
|
||||||
}
|
|
||||||
// 标签
|
// 标签
|
||||||
that.label = new LabelObject(that.sdk, {
|
that.label = new LabelObject(that.sdk, {
|
||||||
id: that.options.id,
|
id: that.options.id,
|
||||||
@ -276,6 +262,9 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.lng = params.position.lng
|
this.lng = params.position.lng
|
||||||
this.lat = params.position.lat
|
this.lat = params.position.lat
|
||||||
this.alt = params.position.alt
|
this.alt = params.position.alt
|
||||||
|
if(this._positionEditingCallback) {
|
||||||
|
this._positionEditingCallback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -283,6 +272,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.picking = true
|
this.picking = true
|
||||||
}, 500);
|
}, 500);
|
||||||
this.ControllerObject.destroy()
|
this.ControllerObject.destroy()
|
||||||
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
// this.options.positionEditing = status
|
// this.options.positionEditing = status
|
||||||
// if (status === true) {
|
// if (status === true) {
|
||||||
@ -322,6 +312,16 @@ class RadarScanStereoscopic extends Base {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openPositionEditing(cd) {
|
||||||
|
this.positionEditing = true
|
||||||
|
this._positionEditingCallback = cd
|
||||||
|
}
|
||||||
|
|
||||||
|
closePositionEditing() {
|
||||||
|
this.positionEditing = false
|
||||||
|
this._positionEditingCallback = null
|
||||||
|
}
|
||||||
|
|
||||||
get lng() {
|
get lng() {
|
||||||
return this.options.lng
|
return this.options.lng
|
||||||
}
|
}
|
||||||
@ -660,346 +660,9 @@ class RadarScanStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get instruct() {
|
|
||||||
return this.options.instruct
|
|
||||||
}
|
|
||||||
set instruct(v) {
|
|
||||||
this.options.instruct = v
|
|
||||||
this._elms.instruct && this._elms.instruct.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
get operatingPoint() {
|
|
||||||
return this.options.operatingPoint
|
|
||||||
}
|
|
||||||
set operatingPoint(v) {
|
|
||||||
this.options.operatingPoint = v
|
|
||||||
this._elms.operatingPoint && this._elms.operatingPoint.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
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 attributeISC() {
|
|
||||||
return this.options.attribute.ISC.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeISC(v) {
|
|
||||||
this.options.attribute.ISC.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
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
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)
|
||||||
|
|
||||||
@ -1053,9 +716,6 @@ class RadarScanStereoscopic 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.attributeISC = this.options.attribute.ISC.content
|
|
||||||
|
|
||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
@ -1188,11 +848,6 @@ class RadarScanStereoscopic extends Base {
|
|||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
this.ISCSelect && this.ISCSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
let tagData = this.attributeSelect
|
let tagData = this.attributeSelect
|
||||||
let attributeElm = this._DialogObject._element.content.getElementsByClassName('attribute-select-box')[0]
|
let attributeElm = this._DialogObject._element.content.getElementsByClassName('attribute-select-box')[0]
|
||||||
if (attributeElm) {
|
if (attributeElm) {
|
||||||
@ -1386,16 +1041,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.labelLineColor = this.originalOptions.label.lineColor
|
this.labelLineColor = this.originalOptions.label.lineColor
|
||||||
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.instruct = this.originalOptions.instruct
|
|
||||||
this.operatingPoint = this.originalOptions.operatingPoint
|
|
||||||
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.attributeISC = this.options.attribute.ISC.content
|
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
@ -1410,70 +1056,6 @@ class RadarScanStereoscopic extends Base {
|
|||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
instructSubmit() {
|
|
||||||
this.Dialog.instructSubmit && this.Dialog.instructSubmit(this.options.id, this.options.label.text, this.instruct)
|
|
||||||
this.originalOptions.instruct = this.instruct
|
|
||||||
}
|
|
||||||
|
|
||||||
operatingPointSubmit() {
|
|
||||||
this.Dialog.operatingPointSubmit && this.Dialog.operatingPointSubmit(this.options.id, this.options.label.text, this.operatingPoint)
|
|
||||||
this.originalOptions.operatingPoint = this.operatingPoint
|
|
||||||
}
|
|
||||||
|
|
||||||
_addLink() {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开富文本框
|
|
||||||
*/
|
|
||||||
openRichTextEditor(e) {
|
|
||||||
richText.open(this.options.id, this.options.name, this.options.richTextContent)
|
|
||||||
richText.primaryCallBack = (content) => {
|
|
||||||
this.options.richTextContent = content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
||||||
options.x = (options.x || options.x === 0) ? options.x : 10
|
options.x = (options.x || options.x === 0) ? options.x : 10
|
||||||
options.y = (options.y || options.y === 0) ? options.y : 10
|
options.y = (options.y || options.y === 0) ? options.y : 10
|
||||||
|
|||||||
@ -110,6 +110,8 @@ class SectorObject extends Base {
|
|||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
this.options.attributeType = options.attributeType || 'richText'
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
|
|||||||
@ -118,6 +118,8 @@ class StraightArrowObject extends Base {
|
|||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
this.options.attributeType = options.attributeType || 'richText'
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
if (!this.options.positions || this.options.positions.length < 2) {
|
if (!this.options.positions || this.options.positions.length < 2) {
|
||||||
this._error = '直线箭头需要两个坐标!'
|
this._error = '直线箭头需要两个坐标!'
|
||||||
|
|||||||
@ -114,6 +114,8 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
this.options.attributeType = options.attributeType || 'richText'
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
|
|
||||||
if (!this.options.positions || this.options.positions.length < 2) {
|
if (!this.options.positions || this.options.positions.length < 2) {
|
||||||
|
|||||||
@ -99,6 +99,8 @@ class WallStereoscopic extends Base {
|
|||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
if (!this.options.positions || this.options.positions.length < 2) {
|
if (!this.options.positions || this.options.positions.length < 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user