Compare commits
47 Commits
5e9ffc5509
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b7b4cfdd80 | |||
| 27543a3eae | |||
| 1e0edcea59 | |||
| 50b4501b7a | |||
| e61afe5c69 | |||
| 3ff8eeda5b | |||
| 61f93a81f2 | |||
| deccdfe061 | |||
| 98143a5b8f | |||
| 9de7ab532d | |||
| cf1b982b33 | |||
| 52f5c653da | |||
| 57ff9ca49f | |||
| 44d9ace1c7 | |||
| 5b200529b5 | |||
| 116245ed6b | |||
| 4622ee736c | |||
| f8df4b73e4 | |||
| 063e22fb6a | |||
| 239fc3ce90 | |||
| b770c5fc7b | |||
| 601642d6ee | |||
| d38b138317 | |||
| 09553840c8 | |||
| dfe7114409 | |||
| d0b58f378b | |||
| 669f2bf908 | |||
| 1fecb7872f | |||
| 6d52711467 | |||
| b51c0a447d | |||
| cff089c777 | |||
| d6b0ed8bc3 | |||
| 80c27d0eef | |||
| cf28e960b8 | |||
| a4edca57f0 | |||
| 75b56f9562 | |||
| 25af7f1d02 | |||
| f1171f5e32 | |||
| 884378390e | |||
| 0a4cd91fe6 | |||
| 29f6f5781b | |||
| ae84184bf8 | |||
| b4fd967930 | |||
| 004c203139 | |||
| 26570d888c | |||
| ba646c1fac | |||
| a1be89ade7 |
@ -17,6 +17,7 @@ class Draw extends Tools {
|
||||
this.viewer = sdk.viewer
|
||||
this.entityHasCreated = false
|
||||
this.event = null
|
||||
this._tipText = options.tipText
|
||||
this.tip = null
|
||||
this.points_ids = []
|
||||
this.color = options.color || 'rgba(185,14,14,0.58)'
|
||||
@ -24,6 +25,17 @@ class Draw extends Tools {
|
||||
this._sdk2D = get2DView()
|
||||
}
|
||||
|
||||
get tipText() {
|
||||
return this._tipText || ''
|
||||
}
|
||||
|
||||
set tipText(text) {
|
||||
this._tipText = text
|
||||
if(this.tip) {
|
||||
this.tip.set_text(text)
|
||||
}
|
||||
}
|
||||
|
||||
create_point(cartesian, viewer = this.viewer) {
|
||||
let id = this.randomString()
|
||||
viewer.entities.add(
|
||||
|
||||
@ -72,7 +72,7 @@ class DrawAssemble extends Draw {
|
||||
// eslint-disable-next-line no-undef
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
let into
|
||||
this.tip = new MouseTip('左键确定,右键取消;', that.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键取消;', that.sdk)
|
||||
this.event = new MouseEvent(that.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -100,6 +100,9 @@ class DrawAssemble extends Draw {
|
||||
cb(null, array)
|
||||
this.end()
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
this.event.mouse_move((movement, cartesian) => {
|
||||
if (into === '2D') {
|
||||
@ -147,6 +150,22 @@ class DrawAssemble extends Draw {
|
||||
this.end()
|
||||
})
|
||||
|
||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
return
|
||||
}
|
||||
if (this.points_ids.length >= 1) {
|
||||
if(this.points_ids.length === 1) {
|
||||
this.viewer.entities.remove(this.assemblePolygon)
|
||||
this.assemblePolygon = undefined
|
||||
}
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
this.anchorpoints.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||
if (into === '2D') {
|
||||
return
|
||||
@ -176,6 +195,7 @@ class DrawAssemble extends Draw {
|
||||
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian))
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -204,6 +224,9 @@ class DrawAssemble extends Draw {
|
||||
cb(null, array)
|
||||
this.end()
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
this.event2D.mouse_move((movement, cartesian) => {
|
||||
if (into === '3D') {
|
||||
@ -250,6 +273,21 @@ class DrawAssemble extends Draw {
|
||||
cb(null)
|
||||
this.end()
|
||||
})
|
||||
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
return
|
||||
}
|
||||
if (this.points_ids.length >= 1) {
|
||||
if(this.points_ids.length === 1) {
|
||||
this.viewer.entities.remove(this.assemblePolygon)
|
||||
this.assemblePolygon = undefined
|
||||
}
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
this.anchorpoints.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
||||
if (into === '3D') {
|
||||
@ -280,6 +318,7 @@ class DrawAssemble extends Draw {
|
||||
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -48,7 +48,7 @@ export default class DrawAttackArrow extends Draw {
|
||||
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -71,6 +71,7 @@ export default class DrawAttackArrow extends Draw {
|
||||
this.points_ids.push(this.create_point(cartesian))
|
||||
cache_positions.push(pos84)
|
||||
isMove = false
|
||||
cb(cache_positions.length)
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
@ -110,6 +111,7 @@ export default class DrawAttackArrow extends Draw {
|
||||
if (this.points_ids.length > 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ export default class DrawCircle extends Draw {
|
||||
super.start()
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键开始,右键取消', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键开始,右键取消', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
let clickNum = 0
|
||||
this.circle_id = this.randomString() //圆id
|
||||
@ -37,7 +37,7 @@ export default class DrawCircle extends Draw {
|
||||
return
|
||||
}
|
||||
into = '3D'
|
||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
||||
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||
clickNum++
|
||||
if (clickNum === 1) {
|
||||
this.point_id = this.create_point(cartesian)
|
||||
@ -45,6 +45,7 @@ export default class DrawCircle extends Draw {
|
||||
positions = this.createCircle(center, 0.01)
|
||||
cache_points.push(cartesian)
|
||||
createCirclePolygon()
|
||||
cb(clickNum)
|
||||
}
|
||||
if (clickNum === 2) {
|
||||
radius_points = cache_points.concat(cartesian)
|
||||
@ -77,7 +78,24 @@ export default class DrawCircle extends Draw {
|
||||
radius = this.computeDistance2([center, endpoint])
|
||||
positions = this.createCircle(center, radius)
|
||||
}
|
||||
})
|
||||
|
||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
return
|
||||
}
|
||||
if (this.point_id) {
|
||||
this.remove_entity(this.circle_id)
|
||||
this.remove_entity(this.point_id)
|
||||
this.point_id = null
|
||||
cache_points = []
|
||||
radius_points = []
|
||||
positions = []
|
||||
center = {}
|
||||
endpoint = null
|
||||
clickNum = 0
|
||||
cb(clickNum)
|
||||
}
|
||||
})
|
||||
|
||||
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||
@ -92,7 +110,7 @@ export default class DrawCircle extends Draw {
|
||||
cb(false)
|
||||
}
|
||||
else {
|
||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
||||
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||
clickNum++
|
||||
if (clickNum === 1) {
|
||||
this.point_id = this.create_point(cartesian)
|
||||
@ -104,6 +122,7 @@ export default class DrawCircle extends Draw {
|
||||
(movement.position1.x + movement.position2.x) / 2,
|
||||
(movement.position1.y + movement.position2.y) / 2
|
||||
)
|
||||
cb(clickNum)
|
||||
}
|
||||
if (clickNum === 2) {
|
||||
radius_points = cache_points.concat(cartesian)
|
||||
@ -124,7 +143,7 @@ export default class DrawCircle extends Draw {
|
||||
return
|
||||
}
|
||||
into = '2D'
|
||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
||||
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||
clickNum++
|
||||
if (clickNum === 1) {
|
||||
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
|
||||
@ -132,6 +151,7 @@ export default class DrawCircle extends Draw {
|
||||
positions = this.createCircle(center, 0.01)
|
||||
cache_points.push(cartesian)
|
||||
createCirclePolygon(this._sdk2D.viewer)
|
||||
cb(clickNum)
|
||||
}
|
||||
if (clickNum === 2) {
|
||||
radius_points = cache_points.concat(cartesian)
|
||||
@ -179,7 +199,7 @@ export default class DrawCircle extends Draw {
|
||||
cb(false)
|
||||
}
|
||||
else {
|
||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
||||
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||
clickNum++
|
||||
if (clickNum === 1) {
|
||||
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
|
||||
@ -191,6 +211,7 @@ export default class DrawCircle extends Draw {
|
||||
((movement.position1.x + movement.position2.x) / 2) + this.viewer.canvas.width,
|
||||
(movement.position1.y + movement.position2.y) / 2
|
||||
)
|
||||
cb(clickNum)
|
||||
}
|
||||
if (clickNum === 2) {
|
||||
radius_points = cache_points.concat(cartesian)
|
||||
@ -203,6 +224,24 @@ export default class DrawCircle extends Draw {
|
||||
}
|
||||
})
|
||||
})
|
||||
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
return
|
||||
}
|
||||
if (this.point_id) {
|
||||
this.remove_entity(this.circle_id)
|
||||
this.remove_entity(this.point_id)
|
||||
this.point_id = null
|
||||
cache_points = []
|
||||
radius_points = []
|
||||
positions = []
|
||||
center = {}
|
||||
endpoint = null
|
||||
clickNum = 0
|
||||
cb(clickNum)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
let that = this
|
||||
|
||||
@ -15,7 +15,7 @@ export default class DrawElliptic extends Draw {
|
||||
let into
|
||||
this.entity_ids = []
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键开始,右键取消', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键开始,右键取消', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
let clickNum = 0
|
||||
this.elliptic_id = this.randomString() //圆id
|
||||
@ -62,6 +62,9 @@ export default class DrawElliptic extends Draw {
|
||||
this.end()
|
||||
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
||||
}
|
||||
else {
|
||||
cb(clickNum)
|
||||
}
|
||||
// if (clickNum === 2) {
|
||||
// radius_points = cache_points.concat(cartesian)
|
||||
// endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
@ -94,6 +97,17 @@ export default class DrawElliptic extends Draw {
|
||||
}
|
||||
|
||||
})
|
||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if (into === '2D') {
|
||||
return
|
||||
}
|
||||
this.remove_entity(this.points_ids.pop())
|
||||
clickNum--
|
||||
cb(clickNum)
|
||||
if(clickNum==0) {
|
||||
this.remove_entity(this.elliptic_id)
|
||||
}
|
||||
})
|
||||
|
||||
if (!this._is2D && this._sdk2D) {
|
||||
this.event2D = new MouseEvent(this._sdk2D)
|
||||
@ -126,6 +140,9 @@ export default class DrawElliptic extends Draw {
|
||||
this.end()
|
||||
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
||||
}
|
||||
else {
|
||||
cb(clickNum)
|
||||
}
|
||||
// if (clickNum === 2) {
|
||||
// radius_points = cache_points.concat(cartesian)
|
||||
// endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
|
||||
@ -47,7 +47,7 @@ export default class DrawPincerArrow extends Draw {
|
||||
super.start()
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确定,右键取消;CTRL+右键撤销', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键取消;CTRL+右键撤销', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -74,6 +74,9 @@ export default class DrawPincerArrow extends Draw {
|
||||
this.end()
|
||||
cb(null, cache_positions, c)
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
@ -102,6 +105,7 @@ export default class DrawPincerArrow extends Draw {
|
||||
if (this.points_ids.length > 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -155,6 +159,9 @@ export default class DrawPincerArrow extends Draw {
|
||||
this.end()
|
||||
cb(null, cache_positions, c)
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -183,6 +190,9 @@ export default class DrawPincerArrow extends Draw {
|
||||
this.end()
|
||||
cb(null, cache_positions, c)
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
this.event2D.mouse_right((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
@ -211,6 +221,7 @@ export default class DrawPincerArrow extends Draw {
|
||||
if (this.points_ids.length > 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -264,6 +275,9 @@ export default class DrawPincerArrow extends Draw {
|
||||
this.end()
|
||||
cb(null, cache_positions, c)
|
||||
}
|
||||
else {
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@ -28,7 +28,7 @@ class DrawPoint extends Draw {
|
||||
} else {
|
||||
let car = undefined
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确定,右键结束;', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键结束;', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.event.mouse_left((movement, cartesian) => {
|
||||
this.end()
|
||||
|
||||
@ -62,7 +62,7 @@ class DrawPolygon extends Draw {
|
||||
super.start()
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
let into
|
||||
this.tip = new MouseTip('左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -88,6 +88,7 @@ class DrawPolygon extends Draw {
|
||||
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian))
|
||||
cb(cache_positions.length)
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
@ -122,6 +123,7 @@ class DrawPolygon extends Draw {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cache_84_position.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -134,6 +136,7 @@ class DrawPolygon extends Draw {
|
||||
cache_positions.pop()
|
||||
cache_84_position.pop()
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -164,6 +167,7 @@ class DrawPolygon extends Draw {
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian))
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -190,6 +194,7 @@ class DrawPolygon extends Draw {
|
||||
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||
cb(cache_positions.length)
|
||||
})
|
||||
this.event2D.mouse_right((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
@ -224,6 +229,7 @@ class DrawPolygon extends Draw {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cache_84_position.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -236,6 +242,7 @@ class DrawPolygon extends Draw {
|
||||
cache_positions.pop()
|
||||
cache_84_position.pop()
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -266,6 +273,7 @@ class DrawPolygon extends Draw {
|
||||
// console.log(this.cartesian3Towgs84(cartesian))
|
||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@ -96,7 +96,7 @@ class DrawPolyline extends Draw {
|
||||
super.start()
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键结束;CTRL+右键撤销', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -120,7 +120,6 @@ class DrawPolyline extends Draw {
|
||||
}
|
||||
cache_positions.push(cartesian)
|
||||
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
||||
|
||||
if (cache_positions.length >= this.options.number) {
|
||||
let positions = []
|
||||
cache_positions.forEach((item) => {
|
||||
@ -137,6 +136,10 @@ class DrawPolyline extends Draw {
|
||||
cb(null, positions, smoothPos)
|
||||
this.end()
|
||||
}
|
||||
else {
|
||||
// cb(cache_positions.length)
|
||||
cb(null, cache_positions)
|
||||
}
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
if (into === '2D') {
|
||||
@ -175,6 +178,7 @@ class DrawPolyline extends Draw {
|
||||
if (this.points_ids.length > 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -186,6 +190,7 @@ class DrawPolyline extends Draw {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -225,6 +230,7 @@ class DrawPolyline extends Draw {
|
||||
cache_positions.push(cartesian)
|
||||
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -287,6 +293,7 @@ class DrawPolyline extends Draw {
|
||||
if (this.points_ids.length > 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
cache_positions.pop()
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
|
||||
@ -337,6 +344,7 @@ class DrawPolyline extends Draw {
|
||||
cache_positions.push(cartesian)
|
||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||
this.positions = cache_positions.concat(cartesian)
|
||||
cb(cache_positions.length)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@ -58,7 +58,7 @@ class DrawRect extends Draw {
|
||||
super.start()
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确定,右键取消', that.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确定,右键取消', that.sdk)
|
||||
this.event = new MouseEvent(that.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -86,10 +86,10 @@ class DrawRect extends Draw {
|
||||
secondtPoint = wgs84
|
||||
this.end()
|
||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
cb(cnt)
|
||||
}
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
@ -113,6 +113,19 @@ class DrawRect extends Draw {
|
||||
}
|
||||
})
|
||||
|
||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
return
|
||||
}
|
||||
if (this.points_ids.length >= 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
this.polygonHasCreated = false
|
||||
this.rect = []
|
||||
cnt--
|
||||
cb(cnt)
|
||||
}
|
||||
})
|
||||
|
||||
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
return
|
||||
@ -145,7 +158,9 @@ class DrawRect extends Draw {
|
||||
secondtPoint = wgs84
|
||||
this.end()
|
||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||
|
||||
}
|
||||
else {
|
||||
cb(cnt)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -172,9 +187,10 @@ class DrawRect extends Draw {
|
||||
secondtPoint = wgs84
|
||||
this.end()
|
||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
cb(cnt)
|
||||
}
|
||||
|
||||
})
|
||||
this.event2D.mouse_right((movement, cartesian) => {
|
||||
@ -199,6 +215,19 @@ class DrawRect extends Draw {
|
||||
}
|
||||
})
|
||||
|
||||
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
return
|
||||
}
|
||||
if (this.points_ids.length >= 1) {
|
||||
this.remove_entity(this.points_ids.pop()) //移除point
|
||||
this.polygonHasCreated = false
|
||||
this.rect = []
|
||||
cnt--
|
||||
cb(cnt)
|
||||
}
|
||||
})
|
||||
|
||||
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
return
|
||||
@ -231,7 +260,9 @@ class DrawRect extends Draw {
|
||||
secondtPoint = wgs84
|
||||
this.end()
|
||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||
|
||||
}
|
||||
else {
|
||||
cb(cnt)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -26,7 +26,7 @@ class DrawSector extends Draw {
|
||||
super.start()
|
||||
let into
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('左键确认,右键取消', that.sdk)
|
||||
this.tip = new MouseTip(this.tipText || '左键确认,右键取消', that.sdk)
|
||||
this.event = new MouseEvent(that.sdk)
|
||||
this._sector_id = null; //扇形
|
||||
this._positions = []; //活动点
|
||||
@ -45,6 +45,7 @@ class DrawSector extends Draw {
|
||||
if (this._positions.length < 3) {
|
||||
this.points_ids.push(this.create_point(cartesian));
|
||||
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
||||
cb(this._positions.length)
|
||||
}
|
||||
else {
|
||||
this.end()
|
||||
@ -90,6 +91,20 @@ class DrawSector extends Draw {
|
||||
this.end()
|
||||
cb(null)
|
||||
})
|
||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '2D') {
|
||||
return
|
||||
}
|
||||
if (this._positions.length >= 1) {
|
||||
this.remove_entity(this.points_ids.pop())
|
||||
this.remove_entity(this.points_ids.pop())
|
||||
this.remove_entity(this._sector_id)
|
||||
this._sector_id = undefined
|
||||
this._positions.pop()
|
||||
this._positions.pop()
|
||||
cb(this._positions.length)
|
||||
}
|
||||
})
|
||||
if (!this._is2D && this._sdk2D) {
|
||||
this.event2D = new MouseEvent(this._sdk2D)
|
||||
this.event2D.mouse_left((movement, cartesian) => {
|
||||
@ -102,6 +117,7 @@ class DrawSector extends Draw {
|
||||
if (this._positions.length < 3) {
|
||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer));
|
||||
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
||||
cb(this._positions.length)
|
||||
}
|
||||
else {
|
||||
this.end()
|
||||
@ -147,6 +163,20 @@ class DrawSector extends Draw {
|
||||
this.end()
|
||||
cb(null)
|
||||
})
|
||||
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||
if(into === '3D') {
|
||||
return
|
||||
}
|
||||
if (this._positions.length >= 1) {
|
||||
this.remove_entity(this.points_ids.pop())
|
||||
this.remove_entity(this.points_ids.pop())
|
||||
this.remove_entity(this._sector_id)
|
||||
this._sector_id = undefined
|
||||
this._positions.pop()
|
||||
this._positions.pop()
|
||||
cb(this._positions.length)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,6 +185,18 @@ export default class MouseEvent {
|
||||
}, Cesium.ScreenSpaceEventType.PINCH_MOVE)
|
||||
}
|
||||
|
||||
keyboard_ctrl_z(cb) {
|
||||
// // this.sdk.viewer.canvas.tabindex = 0
|
||||
// // this.sdk.viewer.canvas.focus()
|
||||
// let mapElm = this.sdk.viewer.canvas
|
||||
// mapElm.addEventListener('keydown', function(e) {
|
||||
// if (e.ctrlKey && e.key === 'z') {
|
||||
// e.preventDefault();
|
||||
// console.log('编辑器内触发 Ctrl + Z');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (this.handler)
|
||||
this.handler.destroy() //关闭事件句柄
|
||||
|
||||
@ -76,6 +76,15 @@ function accordingToCameraHeight() {
|
||||
}
|
||||
|
||||
function startDraw(sdk, showData) {
|
||||
if (!sdk || !sdk.viewer) {
|
||||
return
|
||||
}
|
||||
if (showData) {
|
||||
let terrainAvailability = sdk.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
return '未加载地形数据!'
|
||||
}
|
||||
}
|
||||
show = showData
|
||||
|
||||
Object.keys(paramData).forEach(item => {
|
||||
@ -120,8 +129,28 @@ function reset() {
|
||||
supplementaryContourShow = false
|
||||
supplementaryContourWidth = 1.0
|
||||
supplementaryContourColor = '#d084d1'
|
||||
|
||||
|
||||
}
|
||||
function setVal(data) {
|
||||
secondaryLinesCount = data['secondaryLinesCount']
|
||||
// show = true
|
||||
equalHeightDistance = data['equalHeightDistance']
|
||||
activeColor = rgbaFromObject(data['activeColor'])
|
||||
indexContourShow = data['indexContourShow']
|
||||
indexContourWidth = data['indexContourWidth']
|
||||
indexContourColor = rgbaFromObject(data['indexContourColor'])
|
||||
intermediateContourShow = data['intermediateContourShow']
|
||||
intermediateContourWidth = data['intermediateContourWidth']
|
||||
intermediateContourColor = rgbaFromObject(data['intermediateContourColor'])
|
||||
halfIntervalContourShow = data['halfIntervalContourShow']
|
||||
halfIntervalContourWidth = data['halfIntervalContourWidth']
|
||||
halfIntervalContourColor = rgbaFromObject(data['halfIntervalContourColor'])
|
||||
supplementaryContourShow = data['supplementaryContourShow']
|
||||
supplementaryContourWidth = data['supplementaryContourWidth']
|
||||
supplementaryContourColor = rgbaFromObject(data['supplementaryContourColor'])
|
||||
}
|
||||
function rgbaFromObject(colorObj) {
|
||||
const { red, green, blue, alpha = 1 } = colorObj;
|
||||
return `rgba(${red * 255}, ${green * 255}, ${blue * 255}, ${alpha})`;
|
||||
}
|
||||
async function dialog(sdk) {
|
||||
_sdk = sdk
|
||||
@ -707,4 +736,4 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||
});
|
||||
}
|
||||
|
||||
export { dialog, startDraw, reset }
|
||||
export { dialog, startDraw, reset, setVal }
|
||||
|
||||
@ -18,6 +18,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
if (options.repeat) {
|
||||
repeat = Number(options.repeat)
|
||||
}
|
||||
if (options.defaultTime) {
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
contentElm.querySelector("input[name='defaultTime']").value = options.defaultTime
|
||||
}
|
||||
if (options.totalTime) {
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
contentElm.querySelector("input[name='totalTime']").value = options.totalTime
|
||||
}
|
||||
let viewer = sdk.viewer
|
||||
let tools = new Tools(sdk)
|
||||
let active = 0
|
||||
@ -72,6 +80,23 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
nameElm.value = name
|
||||
nameElm.addEventListener('input', () => {
|
||||
name = nameElm.value
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
let defaultTimeDom = contentElm.querySelector("input[name='defaultTime']")
|
||||
nameElm.addEventListener('input', () => {
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
|
||||
// let addListBtn = document.createElement('button');
|
||||
@ -90,7 +115,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
func({
|
||||
name: name,
|
||||
points: newPoints,
|
||||
repeat: repeat + ''
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
// _Dialog.clickSavePath && _Dialog.clickSavePath(
|
||||
// {
|
||||
@ -117,7 +144,8 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
||||
addBtn.addEventListener('click', () => {
|
||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
||||
let time = 0
|
||||
let defaultTime = Number(contentElm.querySelector("input[name='defaultTime']").value)
|
||||
let time = points.length === active ? 0 : defaultTime
|
||||
let data = {
|
||||
duration: time,
|
||||
position: position,
|
||||
@ -127,9 +155,24 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
}
|
||||
if (points.length === active && active !== 0) {
|
||||
points[points.length - 1].duration = defaultTime
|
||||
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
trList[points.length - 1].querySelector("input[name='time']").value = defaultTime
|
||||
|
||||
}
|
||||
points.splice(active, 0, data)
|
||||
addTrElm(data)
|
||||
i++
|
||||
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
|
||||
// modifyBtn.addEventListener('click', () => {
|
||||
@ -147,17 +190,21 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
// })
|
||||
|
||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
||||
let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
|
||||
// let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
|
||||
let isTotalTimeElm = contentElm.getElementsByClassName('isTotalTime')[0]
|
||||
let repeatElm = contentElm.querySelector("input[name='repeat']")
|
||||
isTotalTimeElm.addEventListener('change', () => {
|
||||
isTotalTimeElm.addEventListener('click', () => {
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
if (isTotalTimeElm.checked && trList.length > 0) {
|
||||
// if (isTotalTimeElm.checked && trList.length > 0) {
|
||||
if (trList.length > 0) {
|
||||
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
|
||||
for (let i = 0; i < trList.length - 1; i++) {
|
||||
points[i].duration = time
|
||||
trList[i].querySelector("input[name='time']").value = time
|
||||
}
|
||||
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
||||
|
||||
totalTimeElm.value = 0//点击应用后默认时间清零
|
||||
}
|
||||
})
|
||||
totalTimeElm.addEventListener('blur', () => {
|
||||
@ -174,6 +221,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
}
|
||||
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
||||
}
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
repeatElm.checked = (repeat === Infinity ? true : false)
|
||||
repeatElm.addEventListener('change', () => {
|
||||
@ -184,6 +238,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
repeat = 0
|
||||
}
|
||||
currentRepeat = repeat
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
_Dialog.changeRepeatStateCallBack && _Dialog.changeRepeatStateCallBack(repeatElm.checked)
|
||||
})
|
||||
|
||||
@ -211,8 +272,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
<input class="input time" type="number" title="" min="0" max="999.99" step="0.01" name="time" value="${data.duration}">
|
||||
</div>
|
||||
<div class="td action">
|
||||
<button class="play">播放</span>
|
||||
<button class="delete">删除</span>
|
||||
<button title="更新视角" class='iconBut'><svg class="icon-resetView modify-point" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-resetView"></use></svg></button>
|
||||
<button title="播放" class='iconBut'><svg class="icon-play play" style='width:15px;height:15px;cursor: pointer;margin-top: -4px;'><use xlink:href="#yj-icon-play"></use></svg></button>
|
||||
<button title="删除" class='iconBut'><svg class="icon-delete delete" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-delete"></use></svg></button>
|
||||
</div>
|
||||
`
|
||||
tr.addEventListener('click', (v) => {
|
||||
@ -245,16 +307,35 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
let e_play = tr.getElementsByClassName('play')[0]
|
||||
let e_delete = tr.getElementsByClassName('delete')[0]
|
||||
let e_time = tr.querySelector("input[name='time']")
|
||||
|
||||
let modifyBtn = tr.getElementsByClassName('modify-point')[0]
|
||||
modifyBtn.addEventListener('click', () => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
|
||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
||||
points[m].position = position
|
||||
points[m].orientation = {
|
||||
heading: viewer.camera.heading,
|
||||
pitch: viewer.camera.pitch,
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
tools.message({ text: '更新视角成功' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
e_play.addEventListener('click', () => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
if (trList[m] === e_play.parentNode.parentNode.parentNode) {
|
||||
flyTo(sdk, points, m)
|
||||
}
|
||||
}
|
||||
})
|
||||
e_delete.addEventListener("click", (v) => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
|
||||
points.splice(m, 1)
|
||||
points[points.length - 1] && (points[points.length - 1].duration = 0)
|
||||
tableBody.removeChild(tr)
|
||||
@ -292,15 +373,21 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
// if (trList.length > 0) {
|
||||
// trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
|
||||
// }
|
||||
|
||||
func({
|
||||
name: name,
|
||||
points: points,
|
||||
repeat: repeat + '',
|
||||
defaultTime: defaultTimeDom.value,
|
||||
totalTime: totalTimeElm.value
|
||||
})
|
||||
})
|
||||
e_time.addEventListener('input', (v) => {
|
||||
console.log(isTotalTimeElm, 'isTotalTimeElm')
|
||||
isTotalTimeElm.checked = false
|
||||
data.duration = Number(e_time.value)
|
||||
if (data.duration < 0) {
|
||||
data.duration = 0
|
||||
}
|
||||
console.log(data.duration, 'duration')
|
||||
})
|
||||
e_time.addEventListener('blur', () => {
|
||||
e_time.value = Number(Number(e_time.value).toFixed(2))
|
||||
@ -335,7 +422,6 @@ const close = () => {
|
||||
}
|
||||
|
||||
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
||||
console.log(noStart, points, 'noStart')
|
||||
if (clickHandler) {
|
||||
clickHandler.destroy()
|
||||
}
|
||||
|
||||
@ -1434,9 +1434,12 @@ class MapPrint {
|
||||
document.body.appendChild(downloadElement);
|
||||
downloadElement.click();
|
||||
document.body.removeChild(downloadElement);
|
||||
}, 'image/png', 0.95);
|
||||
setTimeout(() => {
|
||||
exporting = false;
|
||||
exportBtn.innerHTML = '打印';
|
||||
}, 100);
|
||||
}, 'image/png', 0.95);
|
||||
|
||||
// canvas2.toBlob(function (blob) {
|
||||
// let imgBlobData = URL.createObjectURL(blob);
|
||||
// let downloadElement = document.createElement('a');
|
||||
|
||||
@ -50,7 +50,7 @@ const MouseCoordinate = (sdk, status) => {
|
||||
contentElm = document.createElement('div');
|
||||
contentElm.style.position = 'absolute';
|
||||
contentElm.style['z-index'] = 777;
|
||||
contentElm.style.color = '#ff0000';
|
||||
contentElm.style.color = '#ffffff';
|
||||
contentElm.style.left = '0px';
|
||||
contentElm.style.top = '0px';
|
||||
contentElm.style.width = '100%';
|
||||
@ -172,7 +172,7 @@ const MouseCoordinate = (sdk, status) => {
|
||||
let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||
let coordinateSystem = getCoordinateSystem()
|
||||
let positionType = getDMS()
|
||||
if (coordinateSystem === 'EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
position = {
|
||||
x: degrees.lng,
|
||||
y: degrees.lat,
|
||||
@ -181,13 +181,13 @@ const MouseCoordinate = (sdk, status) => {
|
||||
// contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
|
||||
switch (positionType || '度') {
|
||||
case '度':
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 160px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(8)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(8)}°</p><p style='margin: 0;'>海拔:${Number(degrees.alt.toFixed(2))} m</p></div>`
|
||||
break;
|
||||
case '度分':
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, true)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, true)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, true)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, true)}</p><p style='margin: 0;'>海拔:${Number(degrees.alt.toFixed(2))} m</p></div>`
|
||||
break;
|
||||
case '度分秒':
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, false)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, false)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, false)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, false)}</p><p style='margin: 0;'>海拔:${Number(degrees.alt.toFixed(2))} m</p></div>`
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -197,19 +197,18 @@ const MouseCoordinate = (sdk, status) => {
|
||||
// let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem)
|
||||
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees))
|
||||
position = result.points[0]
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(6)}</p><p style='margin: 0;'>y:${position.y.toFixed(6)}</p><p style='margin: 0;'>z:${position.z.toFixed(6)}</p></div>`
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(2)}</p><p style='margin: 0;'>y:${position.y.toFixed(2)}</p><p style='margin: 0;'>z:${Number(position.z.toFixed(2))}</p></div>`
|
||||
}
|
||||
}
|
||||
else {
|
||||
let coordinateSystem = getCoordinateSystem()
|
||||
if (coordinateSystem === 'EPSG:4326') {
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:-</p><p style='margin: 0;'>维度:-</p><p style='margin: 0;'>海拔:-</p></div>`
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 160px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:-</p><p style='margin: 0;'>维度:-</p><p style='margin: 0;'>海拔:-</p></div>`
|
||||
}
|
||||
else {
|
||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:-</p><p style='margin: 0;'>y:-</p><p style='margin: 0;'>z:-</p></div>`
|
||||
contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:-</p><p style='margin: 0;'>y:-</p><p style='margin: 0;'>z:-</p></div>`
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
animateUpdate()
|
||||
|
||||
@ -11,8 +11,8 @@ import { getLeftClickState, getRightClickState, getMoveState } from "../../Globa
|
||||
import { openLeftClick, openRightClick, openMove } from "./ClickCallback"
|
||||
|
||||
|
||||
let sdk2D
|
||||
let sdk3D
|
||||
let sdk2D = null
|
||||
let sdk3D = null
|
||||
let activeViewer
|
||||
let controlViewer
|
||||
let syncObject = {}
|
||||
@ -434,7 +434,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
||||
sdk2D.viewer.imageryLayers.lowerToBottom(layer2d)
|
||||
}
|
||||
// 移到最高层
|
||||
else if (newindxe === sdk3D.viewer.imageryLayers._layers.length - 1) {
|
||||
else if (newindxe >= sdk3D.viewer.imageryLayers._layers.length - 1) {
|
||||
sdk2D.viewer.imageryLayers.raiseToTop(layer2d)
|
||||
}
|
||||
else {
|
||||
@ -491,18 +491,18 @@ async function syncPrimitives(primitive) {
|
||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||
let flag = false
|
||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||
if (primitives3D[m].id && primitives2D[m].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
if (primitives3D[m].id && primitives2D[i].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
sdk2D.viewer.scene.primitives.remove(primitives2D[i])
|
||||
}
|
||||
// if (!flag) {
|
||||
// sdk2D.viewer.scene.primitives.remove(primitives2D[i])
|
||||
// }
|
||||
}
|
||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||
let flag = false
|
||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||
if (primitives3D[m].id && primitives2D[m].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
if (primitives3D[m].id && primitives2D[i].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
flag = true
|
||||
primitives2D[i].show = primitives3D[m].show
|
||||
primitives2D[i].startColor = primitives3D[m].startColor
|
||||
@ -518,9 +518,9 @@ async function syncPrimitives(primitive) {
|
||||
primitives2D[i].modelMatrix = primitives3D[m].modelMatrix
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
sdk2D.viewer.scene.primitives.add(primitives3D[m])
|
||||
}
|
||||
// if (!flag) {
|
||||
// sdk2D.viewer.scene.primitives.add(primitives3D[m])
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,6 @@ function open(sdk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gridPrimitives) {
|
||||
gridPrimitives = new Cesium.PrimitiveCollection();
|
||||
gridPrimitives.name = 'SheetIndexGridPrimitives';
|
||||
@ -128,7 +127,6 @@ function open(sdk) {
|
||||
labelCollection = new Cesium.LabelCollection();
|
||||
labelCollection.name = 'SheetIndexLabelCollection';
|
||||
}
|
||||
|
||||
let stationaryFrames = 0;
|
||||
let maxRectangle = null;
|
||||
gridPrimitives.postRenderEvent = () => {
|
||||
|
||||
@ -1067,7 +1067,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
||||
sdkD.viewer.imageryLayers.lowerToBottom(layerD)
|
||||
}
|
||||
// 移到最高层
|
||||
else if (newindxe === sdkD.viewer.imageryLayers._layers.length - 1) {
|
||||
else if (newindxe >= sdkD.viewer.imageryLayers._layers.length - 1) {
|
||||
sdkD.viewer.imageryLayers.raiseToTop(layerD)
|
||||
}
|
||||
else {
|
||||
@ -1112,7 +1112,7 @@ async function syncPrimitives(primitive) {
|
||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||
let flag = false
|
||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||
if (primitives3D[m].id && primitives2D[m].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
if (primitives3D[m].id && primitives2D[i].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
@ -1123,7 +1123,7 @@ async function syncPrimitives(primitive) {
|
||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||
let flag = false
|
||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||
if (primitives3D[m].id && primitives2D[m].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
if (primitives3D[m].id && primitives2D[i].id && (primitives3D[m].id === primitives2D[i].id)) {
|
||||
flag = true
|
||||
primitives2D[i].show = primitives3D[m].show
|
||||
primitives2D[i].startColor = primitives3D[m].startColor
|
||||
|
||||
@ -156,19 +156,20 @@ function CesiumContainer(sdk, options) {
|
||||
infoElm.style.color = '#fff';
|
||||
infoElm.style.padding = '4px 10px';
|
||||
infoElm.style['border-radius'] = '18px';
|
||||
infoElm.style.display = 'flex';
|
||||
|
||||
if (coordinateSystem === 'EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>-</span>
|
||||
<span>纬度:</span><span>-</span>
|
||||
<span>海拔高度:</span><span>-</span>
|
||||
<div><span>经度:</span><span>-</span></div>
|
||||
<div><span>纬度:</span><span>-</span></div>
|
||||
<div><span>高程:</span><span>-</span></div>
|
||||
`
|
||||
}
|
||||
else {
|
||||
infoElm.innerHTML = `
|
||||
<span>x:</span><span>-</span>
|
||||
<span>y:</span><span>-</span>
|
||||
<span>z:</span><span>-</span>
|
||||
<div><span>x:</span><span>-</span></div>
|
||||
<div><span>y:</span><span>-</span></div>
|
||||
<div><span>z:</span><span>-</span></div>
|
||||
`
|
||||
}
|
||||
sdk.viewer._element.appendChild(infoElm)
|
||||
@ -197,7 +198,7 @@ function CesiumContainer(sdk, options) {
|
||||
// let pos = sdk.viewer.scene.clampToHeight(_cartesian)
|
||||
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
||||
// position.alt = height
|
||||
if (coordinateSystem === 'EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
// infoElm.innerHTML = `
|
||||
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||
@ -206,23 +207,23 @@ function CesiumContainer(sdk, options) {
|
||||
switch (positionType || '度') {
|
||||
case '度':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${Number(position.lng.toFixed(8))}° </span></div>
|
||||
<div><span>纬度:</span><span>${Number(position.lat.toFixed(8))}° </span></div>
|
||||
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分秒':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
default:
|
||||
@ -232,11 +233,12 @@ function CesiumContainer(sdk, options) {
|
||||
else {
|
||||
// let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem)
|
||||
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||
|
||||
if (result.points.length) {
|
||||
infoElm.innerHTML = `
|
||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
||||
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
||||
<div><span>x:</span><span>${Number(result.points[0].x.toFixed(2))}</span></div>
|
||||
<div><span>y:</span><span>${Number(result.points[0].y.toFixed(2))}</span></div>
|
||||
<div><span>z:</span><span>${Number(result.points[0].z.toFixed(2))}</span></div>
|
||||
`
|
||||
}
|
||||
|
||||
@ -651,7 +653,6 @@ function splitScreen2(sdk, status) {
|
||||
item.entity && (item.entity.splitDirection = value)
|
||||
}
|
||||
}
|
||||
console.log()
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -773,7 +774,7 @@ function setCoordinateSystem(sdk, epsg) {
|
||||
let tools = new Tools()
|
||||
let proj = sdk.proj
|
||||
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
||||
if (coordinateSystem === 'EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
// infoElm.innerHTML = `
|
||||
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||
@ -782,23 +783,23 @@ function setCoordinateSystem(sdk, epsg) {
|
||||
switch (positionType || '度') {
|
||||
case '度':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${Number(position.lng.toFixed(8))}° </span></div>
|
||||
<div><span>纬度:</span><span>${Number(position.lat.toFixed(8))}° </span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分秒':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
default:
|
||||
@ -809,9 +810,9 @@ function setCoordinateSystem(sdk, epsg) {
|
||||
// let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem)
|
||||
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||
infoElm.innerHTML = `
|
||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
||||
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
||||
<div><span>x:</span><span>${Number(result.points[0].x.toFixed(2))}</span></div>
|
||||
<div><span>y:</span><span>${Number(result.points[0].y.toFixed(2))}</span></div>
|
||||
<div><span>z:</span><span>${Number(result.points[0].z.toFixed(2))}</span></div>
|
||||
`
|
||||
}
|
||||
}
|
||||
@ -871,7 +872,7 @@ function getDMS() {
|
||||
return positionType
|
||||
}
|
||||
function setDMS(sdk, type) {
|
||||
if (coordinateSystem !== 'EPSG:4326') {
|
||||
if (coordinateSystem !== 'EPSG:4326' && coordinateSystem !== 'EPSG:4490') {
|
||||
return
|
||||
}
|
||||
positionType = type
|
||||
@ -888,23 +889,23 @@ function setDMS(sdk, type) {
|
||||
switch (type) {
|
||||
case '度':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span></div>
|
||||
<div><span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
case '度分秒':
|
||||
infoElm.innerHTML = `
|
||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
||||
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||
`
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -67,12 +67,13 @@ import {
|
||||
on as multiViewportModeOn,
|
||||
off as multiViewportModeOff,
|
||||
get2DView,
|
||||
getSdk as getSdk2
|
||||
getSdk as getSdk2,
|
||||
syncData
|
||||
} from '../Global/MultiViewportMode'
|
||||
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
||||
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
||||
import { dialog as ContourDialog, startDraw as ContourStartDraw, reset as ContourReset } from '../Global/Contour'
|
||||
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk } from '../Global/SplitScreen'
|
||||
import { dialog as ContourDialog, startDraw as ContourStartDraw, reset as ContourReset, setVal as ContourSetVal } from '../Global/Contour'
|
||||
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk, syncSplitData } from '../Global/SplitScreen'
|
||||
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
||||
|
||||
import { AnalysisClear, SectionClear } from '../Obj/Analysis/clear'
|
||||
@ -313,7 +314,8 @@ if (!window.YJ) {
|
||||
on: multiViewportModeOn,
|
||||
off: multiViewportModeOff,
|
||||
get2DView,
|
||||
getSdk: getSdk2
|
||||
getSdk: getSdk2,
|
||||
syncData: syncData
|
||||
},
|
||||
MouseCoordinate,
|
||||
MouseRightMenu,
|
||||
@ -348,11 +350,13 @@ if (!window.YJ) {
|
||||
on: SplitScreenOn,
|
||||
off: SplitScreenOff,
|
||||
setActiveId: SplitScreenSetActiveId,
|
||||
getSdk
|
||||
getSdk,
|
||||
syncData: syncSplitData
|
||||
},
|
||||
Contour: ContourDialog,
|
||||
ContourStartDraw,
|
||||
ContourReset
|
||||
ContourReset,
|
||||
ContourSetVal
|
||||
}, //测量
|
||||
Measure: {
|
||||
GetMeasureStatus: () => {
|
||||
|
||||
@ -9,7 +9,7 @@ import Measure from "../index";
|
||||
|
||||
class MeasureAngle extends Measure {
|
||||
constructor(sdk) {
|
||||
super(sdk, { text: "左键开始,右键取消" });
|
||||
super(sdk, { text: "左键单击确定起点位置,右键单击取消夹角测量!" });
|
||||
this.cachePositions = []
|
||||
this.positions = []
|
||||
this.arcPositions = []
|
||||
@ -113,6 +113,7 @@ class MeasureAngle extends Measure {
|
||||
if (this.ids.length === 0) {
|
||||
//需要创建一个线
|
||||
this.line_id = this.createPolyline()
|
||||
this.tip.set_text('左键单击确定角点位置,右键单击取消夹角测量!')
|
||||
}
|
||||
|
||||
this.ids.push(this.create_point(car))
|
||||
@ -122,6 +123,7 @@ class MeasureAngle extends Measure {
|
||||
this.positions = this.cachePositions.concat(car)
|
||||
}
|
||||
if (this.ids.length === 2) {
|
||||
this.tip.set_text('左键单击确定终点位置,完成夹角测量!')
|
||||
this.label_id = Cesium.createGuid()
|
||||
this.arc_id = Cesium.createGuid()
|
||||
let p = this.cartesian3Towgs84(car, this.viewer)
|
||||
|
||||
@ -7,7 +7,7 @@ class MeasureAzimuth extends Measure {
|
||||
* @description 方位角测量
|
||||
* */
|
||||
constructor(sdk) {
|
||||
super(sdk, { text: "左键开始,右键取消" });
|
||||
super(sdk, { text: "左键单击确定控制点位置,右键单击取消方位角测量!" });
|
||||
this.cachePositions = []
|
||||
this.positions = []
|
||||
this.arcPositions = []
|
||||
@ -80,6 +80,7 @@ class MeasureAzimuth extends Measure {
|
||||
//需要创建一个线
|
||||
this.line_id = this.createPolyline()
|
||||
}
|
||||
this.tip.set_text('左键单击确定控制点位置,完成方位角测量!')
|
||||
this.tip.setPosition(car, movement.position.x, movement.position.y)
|
||||
if (this.cachePositions.length) {
|
||||
this.positions = this.cachePositions.concat(car)
|
||||
|
||||
@ -216,6 +216,7 @@ class MeasureDistance extends Measure {
|
||||
super.start()
|
||||
this.positions = []
|
||||
this.cachePositions = []
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地距离测量!')
|
||||
|
||||
|
||||
let leftEvent = async (movement, car) => {
|
||||
@ -234,6 +235,7 @@ class MeasureDistance extends Measure {
|
||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
this.cachePositions.push(car)
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地距离测量!')
|
||||
await this.computeDisByTowPoint(pre_p, cur_point)
|
||||
} else {
|
||||
this.cachePositions.push(car)
|
||||
|
||||
@ -14,7 +14,7 @@ class MeasureHeight extends Measure {
|
||||
* @description 高度测量
|
||||
* */
|
||||
constructor(sdk) {
|
||||
super(sdk, {text: "左键开始,右键取消"});
|
||||
super(sdk, {text: "左键单击确定控制点位置,右键单击取消垂直高度测量!"});
|
||||
}
|
||||
|
||||
static create_polygon(that) {
|
||||
@ -120,6 +120,7 @@ class MeasureHeight extends Measure {
|
||||
this.ids.push(MeasureHeight.create_polygon(this))
|
||||
this.ids.push(MeasureHeight.create_point(this, cartesian))
|
||||
}
|
||||
this.tip.set_text('左键单击确定终点位置,完成垂直高度测量!')
|
||||
count++
|
||||
this.tip.setPosition(cartesian, movement.position.x, movement.position.y)
|
||||
if (count === 2) {
|
||||
@ -131,7 +132,7 @@ class MeasureHeight extends Measure {
|
||||
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||
this.text = "相对高度:" + this.height + " 米"
|
||||
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||
// this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||
}
|
||||
this.ids.push(MeasureHeight.create_point(this, cartesian, {label: {text: "半径:" + this.circleRadius + " 米"}}))
|
||||
this.end()
|
||||
@ -148,7 +149,7 @@ class MeasureHeight extends Measure {
|
||||
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||
this.text = "相对高度:" + this.height + " 米"
|
||||
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||
// this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||
}
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
|
||||
@ -108,7 +108,7 @@ class MeasureLocation extends Measure {
|
||||
}
|
||||
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
let coordinateSystem = getCoordinateSystem()
|
||||
if(coordinateSystem==='EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}`
|
||||
}
|
||||
else {
|
||||
@ -131,7 +131,7 @@ class MeasureLocation extends Measure {
|
||||
this.position = cartesian
|
||||
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
let coordinateSystem = getCoordinateSystem()
|
||||
if(coordinateSystem==='EPSG:4326') {
|
||||
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||
this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}`
|
||||
}
|
||||
else {
|
||||
|
||||
@ -158,6 +158,7 @@ class MeasureProjectionDistance extends Measure {
|
||||
super.start()
|
||||
this.positions = []
|
||||
this.cachePositions = []
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影距离测量!')
|
||||
|
||||
let leftEvent = async (movement, car) => {
|
||||
if (this.ids.length === 0) {
|
||||
@ -178,6 +179,7 @@ class MeasureProjectionDistance extends Measure {
|
||||
let text = "投影距离:" + cur_len + " 米"
|
||||
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
||||
this.cachePositions.push(car)
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影距离测量!')
|
||||
} else {
|
||||
this.cachePositions.push(car)
|
||||
this.ids.push(MeasureProjectionDistance.create_point(car, {show: false}, this))
|
||||
@ -212,13 +214,13 @@ class MeasureProjectionDistance extends Measure {
|
||||
this.event.mouse_move((movement, car) => {
|
||||
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
|
||||
this.positions = this.cachePositions.concat(car)
|
||||
if (this.cachePositions.length) {
|
||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||
let text = "当前投影距离:" + cur_len + " 米"
|
||||
this.tip.set_text(text)
|
||||
}
|
||||
// if (this.cachePositions.length) {
|
||||
// let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
// let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||
// let text = "当前投影距离:" + cur_len + " 米"
|
||||
// this.tip.set_text(text)
|
||||
// }
|
||||
})
|
||||
this.event.mouse_right(rightEvent)
|
||||
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
||||
|
||||
@ -160,6 +160,7 @@ class MeasureSlopeDistance extends Measure {
|
||||
super.start()
|
||||
this.positions = []
|
||||
this.cachePositions = []
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消坡度测量!')
|
||||
|
||||
let leftEvent = (movement, car) => {
|
||||
if (this.ids.length === 0) {
|
||||
@ -179,6 +180,7 @@ class MeasureSlopeDistance extends Measure {
|
||||
//计算坡度
|
||||
this.computeAngle(pre_p, cur_point)
|
||||
}
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击完成坡度测量!')
|
||||
} else {
|
||||
this.cachePositions.push(car)
|
||||
this.ids.push(MeasureSlopeDistance.create_point(car, {}, this))
|
||||
@ -232,18 +234,18 @@ class MeasureSlopeDistance extends Measure {
|
||||
}
|
||||
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
|
||||
this.positions = this.cachePositions.concat(cartesian)
|
||||
if (this.cachePositions.length) {
|
||||
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
let d1 = this.computeDistance2([pre_p, cur_point])
|
||||
let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
let cosAlpha = d1 / d3
|
||||
let acos = Math.acos(cosAlpha)
|
||||
let angle = this.radiansToDegrees(acos)
|
||||
let label = "坡度:" + angle.toFixed(2) + "°"
|
||||
this.tip.set_text(label)
|
||||
}
|
||||
// if (this.cachePositions.length) {
|
||||
// let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
// let d1 = this.computeDistance2([pre_p, cur_point])
|
||||
// let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
||||
// let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
// let cosAlpha = d1 / d3
|
||||
// let acos = Math.acos(cosAlpha)
|
||||
// let angle = this.radiansToDegrees(acos)
|
||||
// let label = "坡度:" + angle.toFixed(2) + "°"
|
||||
// this.tip.set_text(label)
|
||||
// }
|
||||
})
|
||||
this.event.mouse_right(rightEvent)
|
||||
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
||||
|
||||
@ -80,6 +80,7 @@ class MeasureTdArea extends Measure {
|
||||
this.text = ""
|
||||
this.center = new Cesium.Cartesian3()
|
||||
this.cachePositions = []
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地面积测量!')
|
||||
let height = 0
|
||||
let text
|
||||
|
||||
@ -96,6 +97,10 @@ class MeasureTdArea extends Measure {
|
||||
|
||||
this.positions = this.cachePositions.concat({ ...car })
|
||||
this.tip.setPosition({ ...car }, movement.position.x, movement.position.y)
|
||||
|
||||
if (this.positions.length > 3) {
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地面积测量!')
|
||||
}
|
||||
}
|
||||
let rightEvent = (movement, car) => {
|
||||
this.positions = this.cachePositions
|
||||
|
||||
@ -14,7 +14,7 @@ class MeasureTriangle extends Measure {
|
||||
* @description 三角测量
|
||||
* */
|
||||
constructor(sdk) {
|
||||
super(sdk);
|
||||
super(sdk, {text: "左键单击确定控制点位置,右键单击取消三角测量!"});
|
||||
}
|
||||
|
||||
cal_center(positions) {
|
||||
@ -170,6 +170,7 @@ class MeasureTriangle extends Measure {
|
||||
let leftEvent = (movement, car) => {
|
||||
xiebian_line_positions.push(car)
|
||||
|
||||
this.tip.set_text('左键单击确定终点位置,完成三角测量!')
|
||||
if (this.ids.length === 0) {//创建三角形
|
||||
first_point = this.cartesian3Towgs84(car, this.viewer)
|
||||
this.createPolyline(shuiping_line_id,)
|
||||
|
||||
@ -85,6 +85,7 @@ class MeasureTyArea extends Measure {
|
||||
this.ids = []
|
||||
this.positions = []
|
||||
this.text = ""
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影面积测量!')
|
||||
this.center = new Cesium.Cartesian3()
|
||||
this.cachePositions = []
|
||||
let height = 0
|
||||
@ -117,6 +118,9 @@ class MeasureTyArea extends Measure {
|
||||
lastcneter = this.center
|
||||
this.text = "投影面积:" + area + " ㎡"
|
||||
}
|
||||
if(this.positions.length > 3) {
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影面积测量!')
|
||||
}
|
||||
}
|
||||
this.event.mouse_left(leftEvent)
|
||||
this.event.mouse_move((movement, car) => {
|
||||
|
||||
@ -38,19 +38,14 @@ class CircleViewShed extends Tools {
|
||||
this.tools = new Tools(sdk)
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
// CircleViewShed.edit(this)
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.tools.message({ type: 'warning', text: '未加载地形数据!' })
|
||||
// window.ELEMENT && window.ELEMENT.Message({
|
||||
// message: '未加载地形数据!',
|
||||
// type: 'warning',
|
||||
// duration: 1500
|
||||
// });
|
||||
return
|
||||
}
|
||||
|
||||
// CircleViewShed.create(this)
|
||||
}
|
||||
draw() {
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
return '未加载地形数据!'
|
||||
}
|
||||
CircleViewShed.create(this)
|
||||
}
|
||||
|
||||
@ -115,13 +110,7 @@ class CircleViewShed extends Tools {
|
||||
static create(that) {
|
||||
let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
that.tools.message({ type: 'warning', text: '未加载地形数据!' })
|
||||
// window.ELEMENT && window.ELEMENT.Message({
|
||||
// message: '未加载地形数据!',
|
||||
// type: 'warning',
|
||||
// duration: 1500
|
||||
// });
|
||||
return
|
||||
return '未加载地形数据!'
|
||||
}
|
||||
let count = 0
|
||||
if (!YJ.Measure.GetMeasureStatus()) {
|
||||
@ -129,10 +118,20 @@ class CircleViewShed extends Tools {
|
||||
that._DialogObject.close()
|
||||
that._DialogObject = null
|
||||
}
|
||||
let Draw = new YJ.Draw.DrawCircle(that.sdk)
|
||||
let Draw = new YJ.Draw.DrawCircle(that.sdk, {
|
||||
tipText: '左键单击确定中心点位置,右键单击取消区域绘制!CTRL+右键单击撤销'
|
||||
})
|
||||
Draw.start(async (a, options) => {
|
||||
// that.center = options.center
|
||||
if (!options) {
|
||||
switch (a) {
|
||||
case 0:
|
||||
Draw.tipText = '左键单击确定中心点位置,右键单击取消区域绘制!CTRL+右键单击撤销'
|
||||
break;
|
||||
case 1:
|
||||
Draw.tipText = '左键单击确定圆形视域半径,完成圆形视域分析!'
|
||||
break;
|
||||
}
|
||||
return
|
||||
}
|
||||
that.radius = options.radius
|
||||
@ -152,47 +151,47 @@ class CircleViewShed extends Tools {
|
||||
}
|
||||
}
|
||||
|
||||
static async edit(that) {
|
||||
if (that._DialogObject && that._DialogObject.close) {
|
||||
that._DialogObject.close()
|
||||
that._DialogObject = null
|
||||
}
|
||||
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
title: '圆形视域分析',
|
||||
left: '180px',
|
||||
top: '100px',
|
||||
closeCallBack: () => {
|
||||
that.Dialog.closeCallBack && that.Dialog.closeCallBack()
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
}
|
||||
})
|
||||
await that._DialogObject.init()
|
||||
that._DialogObject._element.body.className =
|
||||
that._DialogObject._element.body.className + ' circle-view-shed'
|
||||
let contentElm = document.createElement('div')
|
||||
contentElm.innerHTML = html()
|
||||
that._DialogObject.contentAppChild(contentElm)
|
||||
// static async edit(that) {
|
||||
// if (that._DialogObject && that._DialogObject.close) {
|
||||
// that._DialogObject.close()
|
||||
// that._DialogObject = null
|
||||
// }
|
||||
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
// title: '圆形视域分析',
|
||||
// left: '180px',
|
||||
// top: '100px',
|
||||
// closeCallBack: () => {
|
||||
// that.Dialog.closeCallBack && that.Dialog.closeCallBack()
|
||||
// YJ.Measure.SetMeasureStatus(false)
|
||||
// }
|
||||
// })
|
||||
// await that._DialogObject.init()
|
||||
// that._DialogObject._element.body.className =
|
||||
// that._DialogObject._element.body.className + ' circle-view-shed'
|
||||
// let contentElm = document.createElement('div')
|
||||
// contentElm.innerHTML = html()
|
||||
// that._DialogObject.contentAppChild(contentElm)
|
||||
|
||||
let drawElm = document.createElement('button')
|
||||
drawElm.innerHTML = '绘制'
|
||||
drawElm.addEventListener('click', () => {
|
||||
let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '未加载地形数据!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
return
|
||||
}
|
||||
CircleViewShed.create(that)
|
||||
})
|
||||
that._DialogObject.footAppChild(drawElm)
|
||||
// let drawElm = document.createElement('button')
|
||||
// drawElm.innerHTML = '绘制'
|
||||
// drawElm.addEventListener('click', () => {
|
||||
// let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||
// if (!terrainAvailability) {
|
||||
// window.ELEMENT && window.ELEMENT.Message({
|
||||
// message: '未加载地形数据!',
|
||||
// type: 'warning',
|
||||
// duration: 1500
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
// CircleViewShed.create(that)
|
||||
// })
|
||||
// that._DialogObject.footAppChild(drawElm)
|
||||
|
||||
let all_elm = contentElm.getElementsByTagName('*')
|
||||
that._EventBinding.on(that, all_elm)
|
||||
that._elms = that._EventBinding.element
|
||||
}
|
||||
// let all_elm = contentElm.getElementsByTagName('*')
|
||||
// that._EventBinding.on(that, all_elm)
|
||||
// that._elms = that._EventBinding.element
|
||||
// }
|
||||
|
||||
analyse() {
|
||||
// this.destroy()
|
||||
|
||||
@ -12,7 +12,7 @@ class ContourAnalysis {
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
this.tools.message({ type: 'warning', text: this.error })
|
||||
// this.tools.message({ type: 'warning', text: this.error })
|
||||
return
|
||||
}
|
||||
this.positions = options.positions
|
||||
|
||||
@ -28,7 +28,7 @@ class CutFillAnalysis {
|
||||
}
|
||||
this.entities = []
|
||||
this.tools = new Tools(this.sdk)
|
||||
this.Draw = new DrawPolygon(this.sdk)
|
||||
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
// CutFillAnalysis.EditBox(this)
|
||||
}
|
||||
@ -37,11 +37,12 @@ class CutFillAnalysis {
|
||||
this.clean()
|
||||
this.Draw.start((a, positions) => {
|
||||
if (!positions || positions.length < 3) {
|
||||
let _error = '最少需要三个坐标!'
|
||||
this.tools.message({
|
||||
text: _error,
|
||||
type: 'warning',
|
||||
});
|
||||
if (a >= 3) {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
|
||||
}
|
||||
else {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
|
||||
}
|
||||
return
|
||||
}
|
||||
let fromDegreesArray = []
|
||||
|
||||
@ -26,7 +26,7 @@ class Profile extends Draw {
|
||||
console.warn('上一次测量未结束')
|
||||
} else {
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
that.tip = new MouseTip('左键确定,右键取消', that.sdk)
|
||||
that.tip = new MouseTip('左键点击确定起点位置,右键点击取消绘制!', that.sdk)
|
||||
that.event = new MouseEvent(that.sdk)
|
||||
that.positions = []
|
||||
that.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
@ -35,6 +35,7 @@ class Profile extends Draw {
|
||||
let car = undefined
|
||||
that.event.mouse_left(async (movement, cartesian) => {
|
||||
try {
|
||||
that.tip.set_text('左键点击确定终点位置,右键点击取消绘制!')
|
||||
if (!that.entityHasCreated) {
|
||||
Profile.create_polyline(that)
|
||||
}
|
||||
|
||||
@ -10,20 +10,18 @@ class SlopeAspect extends Tools {
|
||||
constructor(sdk) {
|
||||
super(sdk)
|
||||
this.viewer = sdk.viewer;
|
||||
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
return
|
||||
}
|
||||
this.event
|
||||
this.result = []; //存储创建的坡度分析结果,primitive集合
|
||||
this.handler = undefined;
|
||||
this.toolTip = "";
|
||||
this.tools = new Tools(sdk)
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
this.tools.message({ type: 'warning', text: this.error })
|
||||
return
|
||||
}
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
this.Draw = new DrawPolygon(this.sdk)
|
||||
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点' })
|
||||
// this.createNew4Distance()
|
||||
this.createNew4Num(50)
|
||||
}
|
||||
@ -36,8 +34,13 @@ class SlopeAspect extends Tools {
|
||||
const $this = this;
|
||||
const viewer = this.viewer;
|
||||
this.Draw.start((e, positions) => {
|
||||
if (!positions || positions.length <= 2) {
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
if (!positions || positions.length < 3) {
|
||||
if (e >= 3) {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
|
||||
}
|
||||
else {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
|
||||
}
|
||||
return
|
||||
}
|
||||
let boundary = [];
|
||||
@ -66,8 +69,13 @@ class SlopeAspect extends Tools {
|
||||
createNew4Num(n) {
|
||||
let num = n
|
||||
this.Draw.start((e, positions) => {
|
||||
if (!positions || positions.length <= 2) {
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
if (!positions || positions.length < 3) {
|
||||
if (e >= 3) {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
|
||||
}
|
||||
else {
|
||||
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
|
||||
}
|
||||
return
|
||||
}
|
||||
let boundary = [];
|
||||
|
||||
@ -9,7 +9,7 @@ class Submerge extends Tools {
|
||||
* @param sdk
|
||||
* @description 淹没效果
|
||||
* */
|
||||
constructor(sdk, options = {}, _Dialog = {}) {
|
||||
constructor(sdk, options = {}, _Dialog = {}, callback) {
|
||||
super(sdk, options);
|
||||
this.sdk = sdk
|
||||
this.options = {}
|
||||
@ -21,37 +21,30 @@ class Submerge extends Tools {
|
||||
this.currentWaterLaver
|
||||
this.color = '#00d9ff66'
|
||||
this.Dialog = _Dialog
|
||||
this.Draw = new DrawPolygon(this.sdk)
|
||||
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
|
||||
this.positions
|
||||
this.status = true
|
||||
this.area = 0
|
||||
this._elms = {};
|
||||
this.tools = new Tools(this.sdk)
|
||||
this.callback = callback
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
// Submerge.EditBox(this)
|
||||
// Submerge.create(this)
|
||||
}
|
||||
|
||||
static create(that) {
|
||||
static create(that, func) {
|
||||
that.Draw.start((a, positions) => {
|
||||
if (!positions || positions.length < 3) {
|
||||
let _error = '至少需要三个坐标!'
|
||||
that.tools.message({
|
||||
text: _error,
|
||||
type: 'warning',
|
||||
});
|
||||
if (a >= 3) {
|
||||
that.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
|
||||
}
|
||||
else {
|
||||
that.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
|
||||
}
|
||||
return
|
||||
}
|
||||
that.destroy()
|
||||
if (!positions || positions.length == 0) {
|
||||
that.positions = []
|
||||
that._positions = []
|
||||
that.options.minWaterLevel = 0
|
||||
that.options.maxWaterLevel = 0
|
||||
that.options.waterVolume = 0
|
||||
that.area = 0
|
||||
return
|
||||
}
|
||||
let fromDegreesArray = []
|
||||
that.positions = positions
|
||||
that._positions = positions
|
||||
@ -99,7 +92,7 @@ class Submerge extends Tools {
|
||||
|
||||
that.waterLevel = that.options.maxWaterLevel - that.options.minWaterLevel
|
||||
that.options.waterVolume = Number((that.waterLevel * that.area).toFixed(4))
|
||||
|
||||
func && func(that.options.waterVolume)
|
||||
that.clickCallBack(that.area, that._positions)
|
||||
// let contentElm = that._DialogObject._element.body
|
||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
@ -110,8 +103,8 @@ class Submerge extends Tools {
|
||||
// Submerge.EditBox(that)
|
||||
})
|
||||
}
|
||||
draw() {
|
||||
Submerge.create(this)
|
||||
draw(func) {
|
||||
Submerge.create(this, func)
|
||||
}
|
||||
|
||||
static async EditBox(that) {
|
||||
@ -276,6 +269,7 @@ class Submerge extends Tools {
|
||||
value = 0
|
||||
}
|
||||
that.options.waterVolume = Math.floor(value * 10000) / 10000;
|
||||
|
||||
if (that.area) {
|
||||
that.waterLevel = Number((that.options.waterVolume / that.area).toFixed(4))
|
||||
that.options.maxWaterLevel = that.options.minWaterLevel + that.waterLevel
|
||||
@ -338,7 +332,6 @@ class Submerge extends Tools {
|
||||
}
|
||||
set onEnd(val) {
|
||||
if (val && typeof val !== 'function') {
|
||||
console.error('val:', val, '不是一个function')
|
||||
} else {
|
||||
this.clickCallBack = val
|
||||
}
|
||||
@ -384,13 +377,21 @@ class Submerge extends Tools {
|
||||
|
||||
|
||||
move() {
|
||||
if (this.TweenAnimate) {
|
||||
TWEEN.remove(this.TweenAnimate)
|
||||
}
|
||||
// if (this.TweenAnimate) {
|
||||
// TWEEN.remove(this.TweenAnimate)
|
||||
// }
|
||||
let that = this
|
||||
if (!this.TweenAnimate && this.options.risingSpeed) {
|
||||
let totalTime = ((this.options.maxWaterLevel - this.options.minWaterLevel) / this.options.risingSpeed) * 1000
|
||||
this.TweenAnimate = new TWEEN.Tween({ waterLevel: this.options.minWaterLevel }).to({ waterLevel: this.options.maxWaterLevel }, totalTime).delay(this.delay).easing(TWEEN.Easing.Linear.None).onUpdate(async (r, a) => {
|
||||
this.currentWaterLaver = r.waterLevel
|
||||
}).onComplete(() => {
|
||||
that.callback()
|
||||
// 在这里执行动画结束后的逻辑
|
||||
}).start()
|
||||
} else if (!this.options.risingSpeed) {
|
||||
that.callback()
|
||||
}
|
||||
// let contentElm = this._DialogObject._element.body
|
||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
// let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||
@ -401,6 +402,7 @@ class Submerge extends Tools {
|
||||
restart() {
|
||||
this.currentWaterLaver = this.options.minWaterLevel
|
||||
let isPaused = false
|
||||
let that = this
|
||||
if (this.TweenAnimate) {
|
||||
isPaused = this.TweenAnimate._isPaused
|
||||
TWEEN.remove(this.TweenAnimate)
|
||||
@ -408,10 +410,13 @@ class Submerge extends Tools {
|
||||
let totalTime = ((this.options.maxWaterLevel - this.options.minWaterLevel) / this.options.risingSpeed) * 1000
|
||||
this.TweenAnimate = new TWEEN.Tween({ waterLevel: this.options.minWaterLevel }).to({ waterLevel: this.options.maxWaterLevel }, totalTime).delay(this.delay).easing(TWEEN.Easing.Linear.None).onUpdate(async (r, a) => {
|
||||
this.currentWaterLaver = r.waterLevel
|
||||
}).onComplete(() => {
|
||||
that.callback()
|
||||
// 在这里执行动画结束后的逻辑
|
||||
}).start()
|
||||
if (isPaused) {
|
||||
// if (isPaused) {
|
||||
this.pause()
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@ -182,7 +182,7 @@ class ViewShedStage extends Tools {
|
||||
return pitch
|
||||
}
|
||||
|
||||
static create(that) {
|
||||
static create(that, callBack) {
|
||||
that.destroy()
|
||||
let count = 0;
|
||||
if (!YJ.Measure.GetMeasureStatus()) {
|
||||
@ -201,6 +201,7 @@ class ViewShedStage extends Tools {
|
||||
that.ids.push(ViewShedStage.create_point(that, cartesian))
|
||||
that.end()
|
||||
that.update()
|
||||
callBack(true)
|
||||
}
|
||||
})
|
||||
that.event.mouse_move((movement, cartesian) => {
|
||||
@ -212,6 +213,7 @@ class ViewShedStage extends Tools {
|
||||
})
|
||||
that.ids = []
|
||||
that.end()
|
||||
callBack(false)
|
||||
})
|
||||
that.event.gesture_pinck_start((movement, cartesian) => {
|
||||
let startTime = new Date()
|
||||
@ -223,6 +225,7 @@ class ViewShedStage extends Tools {
|
||||
})
|
||||
that.ids = []
|
||||
that.end()
|
||||
callBack(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -232,6 +235,7 @@ class ViewShedStage extends Tools {
|
||||
text: '上一次测量未结束',
|
||||
type: 'warning',
|
||||
});
|
||||
callBack(false)
|
||||
}
|
||||
|
||||
|
||||
@ -247,8 +251,8 @@ class ViewShedStage extends Tools {
|
||||
this.tip = null
|
||||
this.event = null
|
||||
}
|
||||
draw() {
|
||||
ViewShedStage.create(this)
|
||||
draw(callBack) {
|
||||
ViewShedStage.create(this, callBack)
|
||||
}
|
||||
|
||||
static create_point(that, cartesian) {
|
||||
|
||||
@ -1644,6 +1644,7 @@ class AssembleObject extends Base {
|
||||
let polygon = turf.polygon(points)
|
||||
let centroid = turf.pointOnFeature(polygon)
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
setTimeout(() => {
|
||||
this
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
@ -1656,6 +1657,7 @@ class AssembleObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
@ -1757,6 +1757,7 @@ class AttackArrowObject extends Base {
|
||||
let polygon = turf.polygon(points)
|
||||
let centroid = turf.pointOnFeature(polygon)
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
setTimeout(() => {
|
||||
this
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
@ -1769,6 +1770,7 @@ class AttackArrowObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
|
||||
setTimeout(() => {
|
||||
this.event.mouse_left(leftEvent)
|
||||
|
||||
@ -53,7 +53,7 @@ class ArcgisLayer extends BaseLayer {
|
||||
class ArcgisWXImagery extends ArcgisLayer {
|
||||
constructor(sdk, options) {
|
||||
super(sdk, options);
|
||||
this.createArcGis("https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer")
|
||||
this.createArcGis("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer")
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ class ArcgisBLUEImagery extends ArcgisLayer {
|
||||
class ArcgisLWImagery extends ArcgisLayer {
|
||||
constructor(sdk, options) {
|
||||
super(sdk, options);
|
||||
this.createArcGis("https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer")
|
||||
this.createArcGis("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,17 +16,13 @@ class Layer extends BaseLayer {
|
||||
super(sdk, options)
|
||||
this.object = {}
|
||||
this.options.host = this.options.host || getHost()
|
||||
this.on()
|
||||
this.loadLayer(this.options)
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "layer"
|
||||
}
|
||||
|
||||
on() {
|
||||
return this.loadLayer(this.options)
|
||||
}
|
||||
|
||||
async loadLayer(data) {
|
||||
this.object = { ...data }
|
||||
let url = ""
|
||||
|
||||
@ -466,7 +466,6 @@ class Model extends BaseModel {
|
||||
return this.options.name
|
||||
}
|
||||
set name(v) {
|
||||
console.log(v, 'vvvvvvvvv')
|
||||
this.options.name = v
|
||||
this.options.label.text = v
|
||||
this.label && (this.label.text = v)
|
||||
@ -506,14 +505,14 @@ class Model extends BaseModel {
|
||||
|
||||
set lng(v) {
|
||||
this.options.position = {
|
||||
lng: v,
|
||||
lng: Number(Number(v).toFixed(8)),
|
||||
lat: this.options.position.lat,
|
||||
alt: this.options.position.alt
|
||||
}
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
|
||||
this._elms.lng && this._elms.lng.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.position.lng
|
||||
})
|
||||
}
|
||||
|
||||
@ -524,13 +523,13 @@ class Model extends BaseModel {
|
||||
set lat(v) {
|
||||
this.options.position = {
|
||||
lng: this.options.position.lng,
|
||||
lat: v,
|
||||
lat: Number(Number(v).toFixed(8)),
|
||||
alt: this.options.position.alt
|
||||
}
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
|
||||
this._elms.lat && this._elms.lat.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.position.lat
|
||||
})
|
||||
}
|
||||
|
||||
@ -542,12 +541,12 @@ class Model extends BaseModel {
|
||||
this.options.position = {
|
||||
lng: this.options.position.lng,
|
||||
lat: this.options.position.lat,
|
||||
alt: v
|
||||
alt: Number(Number(v).toFixed(2))
|
||||
}
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this.label && (this.label.position = [Number(this.options.position.lng), Number(this.options.position.lat), Number(this.options.position.alt)])
|
||||
this._elms.alt && this._elms.alt.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.position.alt
|
||||
})
|
||||
}
|
||||
|
||||
@ -593,10 +592,10 @@ class Model extends BaseModel {
|
||||
}
|
||||
|
||||
set rotateX(v) {
|
||||
this.options.rotate.x = v
|
||||
this.options.rotate.x = Number(Number(v).toFixed(2))
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this._elms.rotateX && this._elms.rotateX.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.rotate.x
|
||||
})
|
||||
}
|
||||
|
||||
@ -605,10 +604,10 @@ class Model extends BaseModel {
|
||||
}
|
||||
|
||||
set rotateY(v) {
|
||||
this.options.rotate.y = v
|
||||
this.options.rotate.y = Number(Number(v).toFixed(2))
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this._elms.rotateY && this._elms.rotateY.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.rotate.y
|
||||
})
|
||||
}
|
||||
|
||||
@ -617,10 +616,10 @@ class Model extends BaseModel {
|
||||
}
|
||||
|
||||
set rotateZ(v) {
|
||||
this.options.rotate.z = v
|
||||
this.options.rotate.z = Number(Number(v).toFixed(2))
|
||||
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
|
||||
this._elms.rotateZ && this._elms.rotateZ.forEach((item) => {
|
||||
item.value = v
|
||||
item.value = this.options.rotate.z
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,8 @@ class BaseTileset extends BaseSource {
|
||||
progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
|
||||
dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
|
||||
dynamicScreenSpaceErrorFactor: 1,
|
||||
dynamicScreenSpaceError: true // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
|
||||
dynamicScreenSpaceError: true, // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
|
||||
backFaceCulling: false, // 开启后,会剔除掉模型的背面,提升性能体验
|
||||
}
|
||||
let tileset
|
||||
if (Number(Cesium.VERSION.split('.')[1]) >= 107) {
|
||||
@ -488,14 +489,6 @@ class BaseTileset extends BaseSource {
|
||||
* */
|
||||
set rotationEditing(status) {
|
||||
if (!this.tileset.root.transform) {
|
||||
if (window.ELEMENT) {
|
||||
window.ELEMENT.Message.closeAll();
|
||||
window.ELEMENT.Message({
|
||||
message: '该模型不支持移动和旋转!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
console.warn('该模型不支持移动和旋转!')
|
||||
return
|
||||
}
|
||||
@ -534,14 +527,6 @@ class BaseTileset extends BaseSource {
|
||||
return
|
||||
}
|
||||
if (!this.tileset.root.transform) {
|
||||
if (window.ELEMENT) {
|
||||
window.ELEMENT.Message.closeAll();
|
||||
window.ELEMENT.Message({
|
||||
message: '该模型不支持移动和旋转!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
console.warn('该模型不支持移动和旋转!')
|
||||
return
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class BatchModel extends Base {
|
||||
let tools = new Tools(sdk)
|
||||
// BatchModel.computeDis(this)
|
||||
// if (this.options.positions.length > 0 || this.options.positions.lng) {
|
||||
if (this.options.spacing < 0 || options.spacing * 1 === 0) {
|
||||
if (options.type != '点' && (this.options.spacing < 0 || options.spacing * 1 === 0)) {
|
||||
tools.message({ type: 'warning', text: '请输入正确的间距!' })
|
||||
return;
|
||||
}
|
||||
@ -72,6 +72,9 @@ class BatchModel extends Base {
|
||||
break;
|
||||
}
|
||||
Draw && Draw.start((a, positions) => {
|
||||
if(!positions) {
|
||||
return
|
||||
}
|
||||
this.options.positions = positions;
|
||||
//判断范围是否过大
|
||||
if (options.type == '面') {
|
||||
@ -156,8 +159,8 @@ class BatchModel extends Base {
|
||||
})
|
||||
})
|
||||
} else if (that.options.type == '点') {
|
||||
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
||||
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
|
||||
// let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
||||
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: that.options.positions.alt }]
|
||||
// posiArr = [that.options.positions]
|
||||
that.pointArr = posiArr
|
||||
}
|
||||
|
||||
@ -166,6 +166,8 @@ class BillboardObject extends Base {
|
||||
this.options.attribute.link.content || []
|
||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
||||
this.options.attribute.rtmp = this.options.attribute.rtmp || {}
|
||||
this.options.attribute.rtmp.content = this.options.attribute.rtmp.content || []
|
||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
||||
this.options.attribute.camera.content =
|
||||
this.options.attribute.camera.content || []
|
||||
@ -245,6 +247,12 @@ class BillboardObject extends Base {
|
||||
let font = getFontFamily(that.labelFontFamily) || 'Helvetica'
|
||||
let url = that.replaceHost(that.options.billboard.image, that.options.host)
|
||||
that._frameImages = []
|
||||
if(url) {
|
||||
that.options.billboard.image = url
|
||||
}
|
||||
else {
|
||||
that.options.billboard.image = that.getSourceRootPath() + '/img/A-ablu-blank.png'
|
||||
}
|
||||
if (url && url.endsWith('gif')) {
|
||||
isGlf = true
|
||||
switch (that.options.heightMode) {
|
||||
@ -480,6 +488,11 @@ class BillboardObject extends Base {
|
||||
// value: '传感器',
|
||||
// key: 'sensor'
|
||||
// },
|
||||
{
|
||||
name: 'rtmp',
|
||||
value: 'rtmp',
|
||||
key: 'rtmp'
|
||||
},
|
||||
{
|
||||
name: '全景图',
|
||||
value: '全景图',
|
||||
@ -591,7 +604,12 @@ class BillboardObject extends Base {
|
||||
return this.options.position.lng
|
||||
}
|
||||
set lng(v) {
|
||||
if(v===null || v===undefined || v==='') {
|
||||
this.options.position.lng = v
|
||||
}
|
||||
else {
|
||||
this.options.position.lng = Number(Number(v).toFixed(8))
|
||||
}
|
||||
// this.scan && (this.scan.lng = v)
|
||||
// this.diffuse && (this.diffuse.lng = v)
|
||||
this.renewPoint()
|
||||
@ -607,7 +625,12 @@ class BillboardObject extends Base {
|
||||
return this.options.position.lat
|
||||
}
|
||||
set lat(v) {
|
||||
if(v===null || v===undefined || v==='') {
|
||||
this.options.position.lat = v
|
||||
}
|
||||
else {
|
||||
this.options.position.lat = Number(Number(v).toFixed(8))
|
||||
}
|
||||
// this.scan && (this.scan.lat = v)
|
||||
// this.diffuse && (this.diffuse.lat = v)
|
||||
this.renewPoint()
|
||||
@ -623,7 +646,12 @@ class BillboardObject extends Base {
|
||||
return this.options.position.alt
|
||||
}
|
||||
set alt(v) {
|
||||
if(v===null || v===undefined || v==='') {
|
||||
this.options.position.alt = v
|
||||
}
|
||||
else {
|
||||
this.options.position.alt = Number(Number(v).toFixed(2))
|
||||
}
|
||||
// this.scan && (this.scan.alt = v)
|
||||
// this.diffuse && (this.diffuse.alt = v)
|
||||
this.renewPoint()
|
||||
@ -1420,6 +1448,170 @@ class BillboardObject extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
get attributeRtmp() {
|
||||
return this.options.attribute.rtmp.content
|
||||
}
|
||||
|
||||
set attributeRtmp(v) {
|
||||
this.options.attribute.rtmp.content = v
|
||||
if (
|
||||
!this._DialogObject ||
|
||||
!this._DialogObject._element ||
|
||||
!this._DialogObject._element.content ||
|
||||
this._DialogObject._element.content.getElementsByClassName(
|
||||
'attribute-content-rtmp'
|
||||
).length == 0
|
||||
) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content
|
||||
.getElementsByClassName('attribute-content-rtmp')[1]
|
||||
.getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.rtmp.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.rtmp.content.length; i++) {
|
||||
let tr =
|
||||
`
|
||||
<div class="tr">
|
||||
<div class="td">` +
|
||||
this.options.attribute.rtmp.content[i].name +
|
||||
`</div>
|
||||
<div class="td">` +
|
||||
this.options.attribute.rtmp.content[i].url +
|
||||
`</div>
|
||||
<div class="td">
|
||||
<button @click="rtmpEdit">编辑</button>
|
||||
<button @click="rtmpDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
rtmpEdit: async index => {
|
||||
this.attributeRtmp = await this.options.attribute.rtmp.content
|
||||
let table = this._DialogObject._element.content
|
||||
.getElementsByClassName('attribute-content-rtmp')[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.rtmp.content[index].name
|
||||
td[1].getElementsByClassName(
|
||||
'input'
|
||||
)[0].value = this.options.attribute.rtmp.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
|
||||
}
|
||||
}
|
||||
},
|
||||
rtmpDelete: i => {
|
||||
this.options.attribute.rtmp.content.splice(i, 1)
|
||||
this.attributeRtmp = this.options.attribute.rtmp.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.rtmp.content[i] = value
|
||||
} else {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeRtmp = this.options.attribute.rtmp.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
|
||||
}
|
||||
@ -2135,11 +2327,12 @@ class BillboardObject extends Base {
|
||||
this.labelShow = this.originalOptions.label.show
|
||||
this.labelFontSize = this.originalOptions.label.fontSize
|
||||
this.labelColor = this.originalOptions.label.color
|
||||
this.lng = this.originalOptions.position.lng
|
||||
this.lat = this.originalOptions.position.lat
|
||||
this.alt = this.originalOptions.position.alt
|
||||
this.lng = this.originalOptions.position.lng || 0
|
||||
this.lat = this.originalOptions.position.lat || 0
|
||||
this.alt = this.originalOptions.position.alt || 0
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
this.attributeCamera = this.options.attribute.camera.content
|
||||
this.attributeGoods = this.options.attribute.goods.content
|
||||
this.attributeISC = this.options.attribute.isc.content
|
||||
@ -2198,7 +2391,7 @@ class BillboardObject extends Base {
|
||||
10000000000000
|
||||
)
|
||||
|
||||
let objectsToExclude = []
|
||||
let objectsToExclude = [this.entity]
|
||||
for (let [key, value] of this.sdk.entityMap) {
|
||||
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||
objectsToExclude.push(value.entity)
|
||||
|
||||
@ -299,8 +299,9 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
this.event.mouse_move((movement, cartesian) => {
|
||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||
this.options.lng = positions.lng
|
||||
this.options.lat = positions.lat
|
||||
this.lng = positions.lng
|
||||
this.lat = positions.lat
|
||||
this.tip.setPosition(
|
||||
cartesian,
|
||||
movement.endPosition.x,
|
||||
@ -309,8 +310,9 @@ class CircleDiffuse extends Base {
|
||||
})
|
||||
this.event.mouse_left((movement, cartesian) => {
|
||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||
this.options.lng = positions.lng
|
||||
this.options.lat = positions.lat
|
||||
this.lng = positions.lng
|
||||
this.lat = positions.lat
|
||||
this.event.mouse_move(() => { })
|
||||
this.event.mouse_left(() => { })
|
||||
this.event.mouse_right(() => { })
|
||||
@ -337,8 +339,9 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
else {
|
||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||
this.options.lng = positions.lng
|
||||
this.options.lat = positions.lat
|
||||
this.lng = positions.lng
|
||||
this.lat = positions.lat
|
||||
this.event.mouse_move(() => { })
|
||||
this.event.mouse_left(() => { })
|
||||
this.event.mouse_right(() => { })
|
||||
@ -364,8 +367,9 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
this.tip && this.tip.destroy()
|
||||
if (this.lastOptions) {
|
||||
this.options.lng = this.lastOptions.lng
|
||||
this.options.lat = this.lastOptions.lat
|
||||
this.lng = this.lastOptions.lng
|
||||
this.lat = this.lastOptions.lat
|
||||
}
|
||||
this.lastOptions = undefined
|
||||
}
|
||||
@ -385,7 +389,13 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
set lng(v) {
|
||||
this.options.lng = v
|
||||
this.label.position = [v, this.lat]
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
this.getClampToHeight({
|
||||
lng: this.options.lng,
|
||||
lat: this.options.lat
|
||||
}, objectsToExclude).then(height => {
|
||||
this.label.position = [this.options.lng, this.options.lat, height]
|
||||
})
|
||||
this._elms.lng && this._elms.lng.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
@ -395,7 +405,13 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
set lat(v) {
|
||||
this.options.lat = v
|
||||
this.label.position = [this.lng, v]
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
this.getClampToHeight({
|
||||
lng: this.options.lng,
|
||||
lat: this.options.lat
|
||||
}, objectsToExclude).then(height => {
|
||||
this.label.position = [this.options.lng, this.options.lat, height]
|
||||
})
|
||||
this._elms.lat && this._elms.lat.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
|
||||
@ -1509,7 +1509,7 @@ class CircleObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 50);
|
||||
}, 200);
|
||||
|
||||
setTimeout(() => {
|
||||
this.event.mouse_left((movement, cartesian) => {
|
||||
|
||||
@ -84,7 +84,7 @@ class CurvelineObject extends Base {
|
||||
this.options.noseToTail = options.noseToTail || false
|
||||
this.options.extend = options.extend || false
|
||||
this.options.rotate = (options.rotate || options.rotate === false) ? options.rotate : true
|
||||
this.options.space = options.space || 1
|
||||
this.options.space = (options.space || options.space === 0) ? options.space : 1
|
||||
this.options.speed = options.speed || 10
|
||||
// this.options.dashSize = options.dashSize || 0.03
|
||||
this.options.wordsName = options.wordsName || 0
|
||||
@ -239,7 +239,9 @@ class CurvelineObject extends Base {
|
||||
})
|
||||
|
||||
this.options.rotate = v
|
||||
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
|
||||
let params = { ...this.options }
|
||||
params.speed = this.inputSpeed
|
||||
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
|
||||
}
|
||||
|
||||
get space() {
|
||||
@ -480,6 +482,9 @@ class CurvelineObject extends Base {
|
||||
return this.options.heightMode ? this.options.heightMode : 0
|
||||
}
|
||||
set heightMode(v) {
|
||||
if (!this._isNodeEdit) {
|
||||
this._lastHeightMode = null
|
||||
}
|
||||
this.positionEditing = false
|
||||
this.options.heightMode = (v || v == 0) ? v : 2
|
||||
let heightModeName = ''
|
||||
@ -554,7 +559,7 @@ class CurvelineObject extends Base {
|
||||
alt: fromDegreesArray[2]
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
get extend() {
|
||||
@ -2049,7 +2054,11 @@ class CurvelineObject extends Base {
|
||||
}
|
||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||
let ground
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
ground = false
|
||||
@ -2590,10 +2599,20 @@ class CurvelineObject extends Base {
|
||||
// }
|
||||
|
||||
nodeEdit(cd) {
|
||||
if(this._isNodeEdit) {
|
||||
return
|
||||
}
|
||||
this.closeNodeEdit()
|
||||
let lastHeightMode = this.heightMode
|
||||
this._isNodeEdit = true
|
||||
this.positionEditing = false
|
||||
this.heightMode = 0
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
} else {
|
||||
this.closeNodeEdit()
|
||||
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||
this._lastHeightMode = lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.ControllerObject = new Controller(this.sdk)
|
||||
@ -2643,6 +2662,11 @@ class CurvelineObject extends Base {
|
||||
})
|
||||
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if (_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
this.heightMode = _lastHeightMode
|
||||
}
|
||||
for (let i = 0; i < this.nodePoints.length; i++) {
|
||||
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
||||
}
|
||||
@ -2668,7 +2692,7 @@ class CurvelineObject extends Base {
|
||||
|
||||
this.entity.polyline.positions = new Cesium.CallbackProperty( () => {
|
||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
||||
this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
this._nodeEditCallback && this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||
}, false)
|
||||
|
||||
@ -2691,10 +2715,18 @@ class CurvelineObject extends Base {
|
||||
})
|
||||
this.nodePoints.push(entity)
|
||||
}
|
||||
this._isNodeEdit = true
|
||||
}
|
||||
}
|
||||
|
||||
closeNodeEdit() {
|
||||
this._isNodeEdit = false
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if(_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
this.heightMode = _lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
this.ControllerObject && this.ControllerObject.destroy()
|
||||
this.event && this.event.destroy()
|
||||
this.tip && this.tip.destroy()
|
||||
@ -2919,7 +2951,11 @@ class CurvelineObject extends Base {
|
||||
)
|
||||
this.renewPolygon(fromDegreesArray)
|
||||
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
case 1:
|
||||
|
||||
@ -1575,6 +1575,7 @@ class EllipseObject extends Base {
|
||||
})
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
that.getClampToHeight({
|
||||
lng: that.center.lng,
|
||||
lat: that.center.lat
|
||||
@ -1585,6 +1586,7 @@ class EllipseObject extends Base {
|
||||
height
|
||||
])
|
||||
})
|
||||
}, 200);
|
||||
createNodePoints(positions[0], 'semiMajorAxis')
|
||||
createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis')
|
||||
createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis')
|
||||
|
||||
@ -96,17 +96,13 @@ class GeoJson extends Base {
|
||||
})
|
||||
let json = await rsp.json()
|
||||
this.geojson = json
|
||||
// this.sdk.addIncetance(this.options.id, this)
|
||||
return GeoJson.addDataToGlobe(this, json.features)
|
||||
}
|
||||
|
||||
/*geojosn暂时只用线的形式*/
|
||||
static addDataToGlobe(that) {
|
||||
const geoJsonDataSource = new Cesium.GeoJsonDataSource();
|
||||
let geojson = that.deepCopyObj(that.geojson)
|
||||
let geojson = this.deepCopyObj(this.geojson)
|
||||
for (let i = 0; i < geojson.features.length; i++) {
|
||||
if (!geojson.features[i].id) {
|
||||
geojson.features[i].id = that.options.id + '_' + i
|
||||
geojson.features[i].id = this.options.id + '_' + i
|
||||
}
|
||||
}
|
||||
// console.log(geojson)
|
||||
@ -114,13 +110,13 @@ class GeoJson extends Base {
|
||||
clampToGround: true,
|
||||
});
|
||||
return promise.then(datasource => {
|
||||
that.entity = datasource
|
||||
this.entity = datasource
|
||||
datasource.entities.values.forEach(enetity => {
|
||||
// console.log(enetity)
|
||||
let color = Cesium.Color.fromCssColorString(that.options.color)
|
||||
let color = Cesium.Color.fromCssColorString(this.options.color)
|
||||
let colorPolygon = color.withAlpha(0.2)
|
||||
enetity.show = that.options.show
|
||||
that.sdk.viewer.entities.add(enetity)
|
||||
enetity.show = this.options.show
|
||||
this.sdk.viewer.entities.add(enetity)
|
||||
if (enetity.billboard) {
|
||||
enetity.billboard.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND
|
||||
enetity.point = new Cesium.PointGraphics({
|
||||
@ -134,26 +130,26 @@ class GeoJson extends Base {
|
||||
|
||||
if (enetity.polyline) {
|
||||
enetity.polyline.material = color
|
||||
enetity.polyline.zIndex = that.sdk._entityZIndex
|
||||
that.sdk._entityZIndex++
|
||||
enetity.polyline.zIndex = this.sdk._entityZIndex
|
||||
this.sdk._entityZIndex++
|
||||
}
|
||||
|
||||
if (enetity.polygon) {
|
||||
enetity.polygon.perPositionHeight = false
|
||||
enetity.polygon.material = colorPolygon
|
||||
enetity.polygon.zIndex = that.sdk._entityZIndex
|
||||
enetity.polygon.zIndex = this.sdk._entityZIndex
|
||||
|
||||
enetity.polyline = new Cesium.PolylineGraphics({
|
||||
positions: enetity.polygon.hierarchy._value.positions,
|
||||
width: 1,
|
||||
clampToGround: true,
|
||||
material: color,
|
||||
zIndex: that.sdk._entityZIndex
|
||||
zIndex: this.sdk._entityZIndex
|
||||
})
|
||||
that.sdk._entityZIndex++
|
||||
this.sdk._entityZIndex++
|
||||
}
|
||||
})
|
||||
that.loading = false
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -125,13 +125,14 @@ class Graffiti extends Draw {
|
||||
start() {
|
||||
let _this = this
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
|
||||
this._error = '上一次测量未结束'
|
||||
} else {
|
||||
this._error = null
|
||||
let viewer = this.sdk.viewer
|
||||
CameraController(this.sdk, false)
|
||||
super.start()
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('长按左键,拖动鼠标进行涂鸦,右键结束涂鸦', this.sdk)
|
||||
this.tip = new MouseTip('左键按下开始,松开完成,右键单击完成绘制', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.positions = []
|
||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||
|
||||
@ -1240,7 +1240,7 @@ class GroundSvg extends Base {
|
||||
* 拖动
|
||||
* @param {boolean} status=false 状态
|
||||
*/
|
||||
drag(status, cd) {
|
||||
drag(status, dragCallback, endCallback) {
|
||||
if (!this._loaded || !this.sdk || !this.sdk.viewer) {
|
||||
return
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ class GroundSvg extends Base {
|
||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||
angleW = bearing2 - bearingW
|
||||
angleH = bearing2 - bearingH
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
if ((angleW > -270 && angleW < -90) || (angleW < 270 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
flag = true
|
||||
}
|
||||
@ -1370,8 +1370,7 @@ class GroundSvg extends Base {
|
||||
case 'svg-control-points_8':
|
||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||
angleH = bearing2 - bearingH
|
||||
|
||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
||||
if ((angleH > -270 && angleH < -90) || (angleH < 270 && angleH > 90)) {
|
||||
angleH = angleH + 180
|
||||
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
@ -1534,7 +1533,7 @@ class GroundSvg extends Base {
|
||||
}
|
||||
|
||||
this.scale = { ...scale }
|
||||
|
||||
dragCallback && dragCallback(this.options)
|
||||
}
|
||||
else {
|
||||
let pickedObjectArray = this.sdk.viewer.scene.drillPick(movement.endPosition);
|
||||
@ -1601,7 +1600,7 @@ class GroundSvg extends Base {
|
||||
this.ScreenSpaceEventHandler.setInputAction((movement) => {
|
||||
this.drag(false)
|
||||
// if (!this._DialogObject) {
|
||||
cd && cd(this.options)
|
||||
endCallback && endCallback(this.options)
|
||||
syncData(this.sdk, this.options.id)
|
||||
syncSplitData(this.sdk, this.options.id)
|
||||
// }
|
||||
|
||||
@ -178,8 +178,10 @@ class LabelObject extends Base {
|
||||
lng: v[0],
|
||||
lat: v[1]
|
||||
}, objectsToExclude).then(height => {
|
||||
if(this.ground) {
|
||||
v[2] = height
|
||||
this.options.position = [...v]
|
||||
}
|
||||
})
|
||||
// let point1 = Cesium.Cartesian3.fromDegrees(this.options.position[0], this.options.position[1], 0);
|
||||
// let point2 = Cesium.Cartesian3.fromDegrees(this.options.position[0], this.options.position[1], 10000000);
|
||||
@ -275,7 +277,9 @@ class LabelObject extends Base {
|
||||
lng: this.options.position[0],
|
||||
lat: this.options.position[1]
|
||||
}, objectsToExclude).then(height => {
|
||||
if(this.ground) {
|
||||
this.options.position[2] = height
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -494,6 +498,7 @@ class LabelObject extends Base {
|
||||
const ctx = this._canvas.getContext('2d')
|
||||
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
ctx.font = this.options.fontSize + 'px ' + this.font
|
||||
this.options.outlineWidth = 0
|
||||
let texts = this.options.text.split('\n')
|
||||
let canvasWidth = 0
|
||||
let canvasHeight = 0
|
||||
@ -503,7 +508,7 @@ class LabelObject extends Base {
|
||||
if (width > canvasWidth) {
|
||||
canvasWidth = width
|
||||
}
|
||||
canvasHeight += this.options.fontSize
|
||||
canvasHeight += (this.options.fontSize + (this.options.outlineWidth * 2))
|
||||
}
|
||||
canvasHeight = canvasHeight + 20 + (texts.length - 1) * 5
|
||||
canvasWidth = canvasWidth + 30
|
||||
@ -526,7 +531,7 @@ class LabelObject extends Base {
|
||||
ctx.font = this.options.fontSize + 'px ' + this.font
|
||||
let maxWidth = 0
|
||||
for (let i = 0; i < texts.length; i++) {
|
||||
let width = ctx.measureText(texts[i]).width
|
||||
let width = ctx.measureText(texts[i]).width + (this.options.outlineWidth * 2)
|
||||
if (maxWidth < width) {
|
||||
maxWidth = width
|
||||
}
|
||||
@ -535,15 +540,25 @@ class LabelObject extends Base {
|
||||
let centerDistance = (canvasWidth - maxWidth) / 2
|
||||
for (let i = 0; i < texts.length; i++) {
|
||||
const text = texts[i]
|
||||
ctx.strokeStyle = this.options.outlineColor; // 边框颜色
|
||||
ctx.lineWidth = this.options.outlineWidth * 2; // 边框粗细
|
||||
if (this.options.fontSize < 10) {
|
||||
ctx.fillText(text, 15 + centerDistance, this.options.fontSize * (i + 1) + 10 + i * 5)
|
||||
ctx.strokeText(text, 15 + centerDistance + this.options.outlineWidth, this.options.fontSize * (i + 1) + 10 + (i * 5) + this.options.outlineWidth);
|
||||
ctx.fillText(text, 15 + centerDistance + this.options.outlineWidth, this.options.fontSize * (i + 1) + 10 + (i * 5) + this.options.outlineWidth)
|
||||
} else {
|
||||
ctx.strokeText(
|
||||
text,
|
||||
15 + centerDistance + this.options.outlineWidth,
|
||||
(this.options.fontSize * (i + 1)) +
|
||||
((10 * 10) / this.options.fontSize) +
|
||||
(i * 5) + (this.options.outlineWidth / 2)
|
||||
);
|
||||
ctx.fillText(
|
||||
text,
|
||||
15 + centerDistance,
|
||||
this.options.fontSize * (i + 1) +
|
||||
(10 * 10) / this.options.fontSize +
|
||||
i * 5
|
||||
15 + centerDistance + this.options.outlineWidth,
|
||||
(this.options.fontSize * (i + 1)) +
|
||||
((10 * 10) / this.options.fontSize) +
|
||||
(i * 5) + (this.options.outlineWidth / 2)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,7 +585,7 @@ class Flame extends Base {
|
||||
this.lng = this.originalOptions.lng
|
||||
this.lat = this.originalOptions.lat
|
||||
this.alt = this.originalOptions.alt
|
||||
syncPrimitives(this.entity)
|
||||
// syncPrimitives(this.entity)
|
||||
}
|
||||
|
||||
async remove() {
|
||||
|
||||
@ -1686,6 +1686,7 @@ class PincerArrowObject extends Base {
|
||||
let polygon = turf.polygon(points)
|
||||
let centroid = turf.pointOnFeature(polygon)
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
setTimeout(() => {
|
||||
this
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
@ -1698,6 +1699,7 @@ class PincerArrowObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
createNodePoints()
|
||||
}, 200);
|
||||
async function createNodePoints() {
|
||||
|
||||
@ -1683,6 +1683,7 @@ class PolygonObject extends Base {
|
||||
_this.previous.positions[0],
|
||||
_this.previous.positions[1]
|
||||
]
|
||||
this.previous = null
|
||||
}
|
||||
}
|
||||
|
||||
@ -1706,12 +1707,13 @@ class PolygonObject extends Base {
|
||||
nodeEdit(cb = () => { }) {
|
||||
this.positionEditing = false
|
||||
setTimeout(() => {
|
||||
let previous = [...this.options.positions]
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
cb('上一次测量未结束')
|
||||
} else {
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.picking = false
|
||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||
this.tip = new MouseTip('左键单击选择控制点,右键单击取消编辑', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
this.nodePoints = []
|
||||
let _this = this
|
||||
@ -1729,6 +1731,7 @@ class PolygonObject extends Base {
|
||||
|
||||
let added = false
|
||||
let leftEvent = async (movement, cartesian) => {
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
if (selectPoint) {
|
||||
this.options.positions[selectPoint.index] = this.cartesian3Towgs84(
|
||||
cartesian,
|
||||
@ -1737,7 +1740,7 @@ class PolygonObject extends Base {
|
||||
originalPosition = this.options.positions[selectPoint.index]
|
||||
added = true
|
||||
let potHeight = await this.getClampToHeight(
|
||||
this.options.positions[selectPoint.index]
|
||||
this.options.positions[selectPoint.index], objectsToExclude
|
||||
)
|
||||
let entity = this.sdk.viewer.entities.add({
|
||||
name: 'node-secondary-edit-point',
|
||||
@ -1771,7 +1774,6 @@ class PolygonObject extends Base {
|
||||
)
|
||||
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
if (this.options.positions.length < 3) {
|
||||
this
|
||||
.getClampToHeight({
|
||||
@ -1847,7 +1849,7 @@ class PolygonObject extends Base {
|
||||
selectPoint = pick.id
|
||||
this.nodePoints.splice(pick.id.index, 1)
|
||||
this.sdk.viewer.entities.remove(pick.id)
|
||||
this.tip.set_text('左键开始,右键结束,CTRL+右键撤销')
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击结束编辑! CTRL+右键单击撤销上一个控制点')
|
||||
originalPosition = this.cartesian3Towgs84(
|
||||
selectPoint.position.getValue(),
|
||||
this.sdk.viewer
|
||||
@ -1862,6 +1864,51 @@ class PolygonObject extends Base {
|
||||
if (added) {
|
||||
this.options.positions.splice(selectPoint.index, 1)
|
||||
}
|
||||
if (this.options.positions.length < 3) {
|
||||
this.options.positions = [...previous]
|
||||
let positions = this.options.positions
|
||||
let fromDegreesArray = []
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||
}
|
||||
this.positions = Cesium.Cartesian3.fromDegreesArray(
|
||||
fromDegreesArray
|
||||
)
|
||||
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||
this.previous = {
|
||||
positions: [...this.positions]
|
||||
}
|
||||
|
||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||
let positions2 = [[]]
|
||||
for (let i = 0; i < this.options.positions.length; i++) {
|
||||
positions2[0].push([
|
||||
this.options.positions[i].lng,
|
||||
this.options.positions[i].lat
|
||||
])
|
||||
}
|
||||
positions2[0].push([
|
||||
this.options.positions[0].lng,
|
||||
this.options.positions[0].lat
|
||||
])
|
||||
let polygon = turf.polygon(positions2)
|
||||
let centroid = turf.centroid(polygon)
|
||||
this
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
lat: centroid.geometry.coordinates[1]
|
||||
}, objectsToExclude)
|
||||
.then(height => {
|
||||
this.label.position = [
|
||||
centroid.geometry.coordinates[0],
|
||||
centroid.geometry.coordinates[1],
|
||||
height
|
||||
]
|
||||
})
|
||||
|
||||
this.areaByMeter = this.computeArea(this.options.positions)
|
||||
this.areaChangeCallBack && this.areaChangeCallBack()
|
||||
}
|
||||
cb(null, this.options.positions)
|
||||
}
|
||||
|
||||
@ -1919,6 +1966,7 @@ class PolygonObject extends Base {
|
||||
])
|
||||
let polygon = turf.polygon(positions)
|
||||
let centroid = turf.centroid(polygon)
|
||||
setTimeout(() => {
|
||||
this
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
@ -1931,6 +1979,7 @@ class PolygonObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
@ -2017,6 +2066,9 @@ class PolygonObject extends Base {
|
||||
}
|
||||
}
|
||||
this.nodePoints.pop()
|
||||
if(this.options.positions.length < 3) {
|
||||
this.tip.set_text('左键单击确定控制点位置,右键单击取消编辑! CTRL+右键单击撤销上一个控制点')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ class PolylineObject extends Base {
|
||||
this.options.smooth = options.smooth || false
|
||||
this.options.extend = options.extend || false
|
||||
this.options.rotate = (options.rotate || options.rotate === false) ? options.rotate : true
|
||||
this.options.space = options.space || 1
|
||||
this.options.space = (options.space || options.space === 0) ? options.space : 1
|
||||
this.options.speed = options.speed || 10
|
||||
// this.options.dashSize = options.dashSize || 0.03
|
||||
this.options.wordsName = options.wordsName || 0
|
||||
@ -514,6 +514,9 @@ class PolylineObject extends Base {
|
||||
return this.options.heightMode ? this.options.heightMode : 0
|
||||
}
|
||||
set heightMode(v) {
|
||||
if (!this._isNodeEdit) {
|
||||
this._lastHeightMode = null
|
||||
}
|
||||
this.positionEditing = false
|
||||
this.options.heightMode = (v || v == 0) ? v : 2
|
||||
let heightModeName = ''
|
||||
@ -548,6 +551,7 @@ class PolylineObject extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
if (ground) {
|
||||
this.label.ground = ground
|
||||
@ -570,7 +574,7 @@ class PolylineObject extends Base {
|
||||
alt: fromDegreesArray[2]
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
get extend() {
|
||||
@ -2077,7 +2081,11 @@ class PolylineObject extends Base {
|
||||
}
|
||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||
let ground
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
ground = false
|
||||
@ -2587,13 +2595,21 @@ class PolylineObject extends Base {
|
||||
// }
|
||||
|
||||
nodeEdit(cb) {
|
||||
if(this._isNodeEdit) {
|
||||
return
|
||||
}
|
||||
this.closeNodeEdit()
|
||||
let lastHeightMode = this.heightMode
|
||||
this._isNodeEdit = true
|
||||
this.positionEditing = false
|
||||
this.noseToTail = false
|
||||
// this.smooth = false
|
||||
this.heightMode = 0
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
} else {
|
||||
this.closeNodeEdit()
|
||||
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||
this._lastHeightMode = lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this._nodeEditCallback = cb
|
||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||
@ -2644,6 +2660,11 @@ class PolylineObject extends Base {
|
||||
})
|
||||
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if (_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
this.heightMode = _lastHeightMode
|
||||
}
|
||||
for (let i = 0; i < this.nodePoints.length; i++) {
|
||||
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
||||
}
|
||||
@ -2669,7 +2690,7 @@ class PolylineObject extends Base {
|
||||
|
||||
this.entity.polyline.positions = new Cesium.CallbackProperty(() => {
|
||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
||||
this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
this._nodeEditCallback && this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||
}, false)
|
||||
|
||||
@ -2692,10 +2713,17 @@ class PolylineObject extends Base {
|
||||
})
|
||||
this.nodePoints.push(entity)
|
||||
}
|
||||
this._isNodeEdit = true
|
||||
}
|
||||
}
|
||||
|
||||
closeNodeEdit() {
|
||||
this._isNodeEdit = false
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if (_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
this.heightMode = _lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
this.ControllerObject && this.ControllerObject.destroy()
|
||||
this.event && this.event.destroy()
|
||||
@ -2913,7 +2941,11 @@ class PolylineObject extends Base {
|
||||
)
|
||||
this.renewPolygon(fromDegreesArray)
|
||||
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
case 1:
|
||||
|
||||
@ -30,7 +30,7 @@ class RadarScanStereoscopic extends Base {
|
||||
* @param options.colorOut=rgba(255,255,0,0.3){string} 范围颜色
|
||||
* @param options.colorIn=rgba(255,0,0,0.3){string} 扫描颜色
|
||||
* @param options.radius=10 {number} 半径
|
||||
* @param options.duration=2000 {number} 持续时间
|
||||
* @param options.speed=1 {number} 扫描速度(倍)
|
||||
* @param options.label {object} 标签对象
|
||||
* @param options.label.show {string} 标签显隐
|
||||
* @param options.label.position {string} 标签位置
|
||||
@ -75,7 +75,7 @@ class RadarScanStereoscopic extends Base {
|
||||
if(this.options.radius > 999999) {
|
||||
this.options.radius = 999999
|
||||
}
|
||||
this.options.duration = options.duration || 2000
|
||||
this.options.speed = options.speed || 1
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
options.label = options.label || {}
|
||||
this.options.label = {
|
||||
@ -117,7 +117,7 @@ class RadarScanStereoscopic extends Base {
|
||||
let height = options.alt;
|
||||
|
||||
|
||||
let heading = that.options.duration ? 360 / that.options.duration * Cesium.getTimestamp() : 0;
|
||||
let heading = that.options.speed ? (360 / that.duration * Cesium.getTimestamp() * that.options.speed) : 0;
|
||||
let arr = calculatePane(that.options, that.options.radius, heading);
|
||||
let _time = new Date().getTime();
|
||||
|
||||
@ -129,7 +129,7 @@ class RadarScanStereoscopic extends Base {
|
||||
// _time = tempTime
|
||||
// heading += speed;
|
||||
|
||||
heading = that.options.duration ? 360 / that.options.duration * Cesium.getTimestamp() : 0;
|
||||
heading = that.options.speed ? (360 / that.duration * Cesium.getTimestamp() * that.options.speed) : 0;
|
||||
arr = calculatePane(that.options, that.options.radius, heading);
|
||||
});
|
||||
that.entity = viewer.entities.add({
|
||||
@ -384,11 +384,14 @@ class RadarScanStereoscopic extends Base {
|
||||
}
|
||||
|
||||
get duration() {
|
||||
return this.options.duration
|
||||
return 1000
|
||||
}
|
||||
set duration(v) {
|
||||
this.options.duration = v
|
||||
this._elms.duration && this._elms.duration.forEach((item) => {
|
||||
get speed() {
|
||||
return this.options.speed
|
||||
}
|
||||
set speed(v) {
|
||||
this.options.speed = v
|
||||
this._elms.speed && this._elms.speed.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
RadarScanStereoscopic.changeParam(this)
|
||||
@ -1028,7 +1031,7 @@ class RadarScanStereoscopic extends Base {
|
||||
this.colorOut = this.originalOptions.colorOut
|
||||
this.colorIn = this.originalOptions.colorIn
|
||||
this.radius = this.originalOptions.radius
|
||||
this.duration = this.originalOptions.duration
|
||||
this.speed = this.originalOptions.speed
|
||||
this.labelShow = this.originalOptions.label.show
|
||||
this.labelColor = this.originalOptions.label.color
|
||||
this.labelFontSize = this.originalOptions.label.fontSize
|
||||
|
||||
@ -36,7 +36,6 @@ class SectorObject extends Base {
|
||||
* @param options.line.width=3 {number} 边框宽
|
||||
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||
* @param options.areaUnit='平方米' {string} 面积单位
|
||||
* @param options.label {object} 标签对象
|
||||
* @param options.label.text {string} 标签文本
|
||||
* @param options.label.show {string} 标签显隐
|
||||
@ -82,7 +81,6 @@ class SectorObject extends Base {
|
||||
this.options.line = options.line || {}
|
||||
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
|
||||
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||
options.label = options.label || {}
|
||||
this._elms = {};
|
||||
this.options.label = {
|
||||
@ -103,13 +101,10 @@ class SectorObject extends Base {
|
||||
this.options.attribute = options.attribute || {}
|
||||
this.options.attribute.link = this.options.attribute.link || {}
|
||||
this.options.attribute.link.content = this.options.attribute.link.content || []
|
||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
||||
this.options.attribute.camera.content = this.options.attribute.camera.content || []
|
||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||
this.options.attributeType = options.attributeType || 'richText'
|
||||
|
||||
delete this.options.attribute.camera
|
||||
delete this.options.attribute.vr
|
||||
delete this.options.attribute.goods
|
||||
|
||||
this.options.richTextContent = options.richTextContent || ''
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
@ -136,7 +131,7 @@ class SectorObject extends Base {
|
||||
return
|
||||
}
|
||||
let heightModeName = ''
|
||||
SectorObject.closeNodeEdit(this)
|
||||
this.closeNodeEdit()
|
||||
let ground = false
|
||||
let disabled = false
|
||||
this.renewPositions()
|
||||
@ -336,45 +331,6 @@ class SectorObject extends Base {
|
||||
})
|
||||
}
|
||||
|
||||
get area() {
|
||||
return this.options.area
|
||||
}
|
||||
|
||||
set area(v) {
|
||||
this.options.area = v
|
||||
this._elms.area && this._elms.area.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
}
|
||||
|
||||
get areaUnit() {
|
||||
return this.options['area-unit']
|
||||
}
|
||||
set areaUnit(v) {
|
||||
this.options['area-unit'] = v
|
||||
this._elms.areaUnit && this._elms.areaUnit.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
if (this.options.areaByMeter) {
|
||||
switch (v) {
|
||||
case '平方米':
|
||||
this.area = this.options.areaByMeter
|
||||
break;
|
||||
case '平方千米':
|
||||
this.area = Number((this.options.areaByMeter / 1000000).toFixed(8))
|
||||
break;
|
||||
case '亩':
|
||||
this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4))
|
||||
break;
|
||||
case '公顷':
|
||||
this.area = Number((this.options.areaByMeter / 10000).toFixed(6))
|
||||
break;
|
||||
default:
|
||||
this.area = this.options.areaByMeter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get labelShow() {
|
||||
return this.options.label.show
|
||||
}
|
||||
@ -586,320 +542,6 @@ class SectorObject extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
get attributeType() {
|
||||
return this.options.attributeType
|
||||
}
|
||||
|
||||
set attributeType(v) {
|
||||
this.options.attributeType = v
|
||||
this._elms.attributeType && this._elms.attributeType.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
let attributeContent = this._DialogObject._element.content.getElementsByClassName('attribute-content')
|
||||
for (let i = 0; i < attributeContent.length; i++) {
|
||||
if (attributeContent[i].className.indexOf('attribute-content-' + v) > -1) {
|
||||
attributeContent[i].style.display = 'block';
|
||||
}
|
||||
else {
|
||||
attributeContent[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get attributeLink() {
|
||||
return this.options.attribute.link.content
|
||||
}
|
||||
|
||||
set attributeLink(v) {
|
||||
this.options.attribute.link.content = v
|
||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-link').length == 0) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.link.content.length > 0) {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
||||
}
|
||||
else {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
||||
}
|
||||
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
|
||||
let tr = `
|
||||
<div class="tr">
|
||||
<div class="td">` + this.options.attribute.link.content[i].name + `</div>
|
||||
<div class="td">` + this.options.attribute.link.content[i].url + `</div>
|
||||
<div class="td">
|
||||
<button @click="linkEdit">编辑</button>
|
||||
<button @click="linkDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
linkEdit: async (index) => {
|
||||
this.attributeLink = await this.options.attribute.link.content
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
if (index === i) {
|
||||
let height = item[i].offsetHeight
|
||||
let html = `
|
||||
<div class="td">
|
||||
<input class="input" type="text">
|
||||
</div>
|
||||
<div class="td">
|
||||
<textarea class="input link-edit" type="text"></textarea>
|
||||
</div>
|
||||
<div class="td">
|
||||
<button @click="confirmEdit">确认</button>
|
||||
<button @click="cancelEdit">取消</button>
|
||||
</div>`
|
||||
item[i].innerHTML = html
|
||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
||||
textareaElm.style.height = (height - 10) + 'px'
|
||||
let td = item[i].getElementsByClassName('td')
|
||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].name
|
||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].url
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
linkDelete: (i) => {
|
||||
this.options.attribute.link.content.splice(i, 1)
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
|
||||
confirmEdit: (value, i) => {
|
||||
let name = value.name && value.name.replace(/\s/g, "")
|
||||
let url = value.url && value.url.replace(/\s/g, "")
|
||||
if (name && url) {
|
||||
this.options.attribute.link.content[i] = value
|
||||
}
|
||||
else {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
fileSelect: (value, i) => {
|
||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
||||
fileElm.click()
|
||||
fileElm.removeEventListener('change', fileSelect)
|
||||
fileElm.addEventListener('change', fileSelect)
|
||||
}
|
||||
}
|
||||
let fileSelect = (event) => {
|
||||
if (event.target.value) {
|
||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
||||
event.target.value = null
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value](i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
get attributeCamera() {
|
||||
return this.options.attribute.camera.content
|
||||
}
|
||||
|
||||
set attributeCamera(v) {
|
||||
this.options.attribute.camera.content = v
|
||||
}
|
||||
|
||||
get attributeVr() {
|
||||
return this.options.attribute.vr.content
|
||||
}
|
||||
|
||||
set attributeVr(v) {
|
||||
this.options.attribute.vr.content = v
|
||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-vr').length == 0) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.vr.content.length > 0) {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
||||
}
|
||||
else {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
||||
}
|
||||
for (let i = 0; i < this.options.attribute.vr.content.length; i++) {
|
||||
let tr = `
|
||||
<div class="tr">
|
||||
<div class="td">` + this.options.attribute.vr.content[i].name + `</div>
|
||||
<div class="td">` + this.options.attribute.vr.content[i].url + `</div>
|
||||
<div class="td">
|
||||
<button @click="vrEdit">编辑</button>
|
||||
<button @click="vrDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
vrEdit: async (index) => {
|
||||
this.attributeVr = await this.options.attribute.vr.content
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
if (index === i) {
|
||||
let height = item[i].offsetHeight
|
||||
let html = `
|
||||
<div class="td">
|
||||
<input class="input" type="text">
|
||||
</div>
|
||||
<div class="td">
|
||||
<textarea class="input link-edit" type="text"></textarea>
|
||||
</div>
|
||||
<div class="td">
|
||||
<button @click="confirmEdit">确认</button>
|
||||
<button @click="cancelEdit">取消</button>
|
||||
</div>`
|
||||
item[i].innerHTML = html
|
||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
||||
textareaElm.style.height = (height - 10) + 'px'
|
||||
let td = item[i].getElementsByClassName('td')
|
||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].name
|
||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].url
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
vrDelete: (i) => {
|
||||
this.options.attribute.vr.content.splice(i, 1)
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
|
||||
confirmEdit: (value, i) => {
|
||||
let name = value.name && value.name.replace(/\s/g, "")
|
||||
let url = value.url && value.url.replace(/\s/g, "")
|
||||
if (name && url) {
|
||||
this.options.attribute.vr.content[i] = value
|
||||
}
|
||||
else {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
fileSelect: (value, i) => {
|
||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
||||
fileElm.click()
|
||||
fileElm.removeEventListener('change', fileSelect)
|
||||
fileElm.addEventListener('change', fileSelect)
|
||||
}
|
||||
}
|
||||
let fileSelect = (event) => {
|
||||
if (event.target.value) {
|
||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
||||
event.target.value = null
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value](i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get attributeGoods() {
|
||||
return this.options.attribute.goods.content
|
||||
}
|
||||
|
||||
set attributeGoods(v) {
|
||||
this.options.attribute.goods.content = v
|
||||
}
|
||||
|
||||
static create(that) {
|
||||
let fromDegreesArray = that.calSector(that.options.center, that.options.radius, that.options.startAngle, that.options.endAngle, 360, true)
|
||||
let ground = true
|
||||
@ -973,23 +615,8 @@ class SectorObject extends Base {
|
||||
if (angle < 0) {
|
||||
angle = 360 + angle
|
||||
}
|
||||
that.options.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius * (angle / 360)).toFixed(2));
|
||||
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
|
||||
}
|
||||
that.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius * (angle / 360)).toFixed(2));
|
||||
that.areaChangeCallBack && that.areaChangeCallBack()
|
||||
|
||||
syncData(that.sdk, that.options.id)
|
||||
if (that.options.show) {
|
||||
@ -1021,6 +648,7 @@ class SectorObject extends Base {
|
||||
|
||||
// 编辑框
|
||||
async edit(state) {
|
||||
return
|
||||
let _this = this
|
||||
this.originalOptions = this.deepCopyObj(this.options)
|
||||
|
||||
@ -1511,8 +1139,6 @@ class SectorObject extends Base {
|
||||
this.name = this.originalOptions.name
|
||||
this.radius = this.originalOptions.radius
|
||||
this.color = this.originalOptions.color
|
||||
this.area = this.originalOptions.area
|
||||
this.areaUnit = this.originalOptions['area-unit']
|
||||
this.labelShow = this.originalOptions.label.show
|
||||
this.labelFontSize = this.originalOptions.label.fontSize
|
||||
this.labelFontFamily = this.originalOptions.label.fontFamily
|
||||
@ -1525,12 +1151,6 @@ class SectorObject extends Base {
|
||||
this.lineColor = this.originalOptions.line.color
|
||||
this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0]
|
||||
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
this.attributeCamera = this.options.attribute.camera.content
|
||||
this.attributeGoods = this.options.attribute.goods.content
|
||||
this.cameraSelect && this.cameraSelect()
|
||||
this.goodsSelect && this.goodsSelect()
|
||||
|
||||
this.heightMode = this.originalOptions.heightMode
|
||||
|
||||
@ -1820,6 +1440,10 @@ class SectorObject extends Base {
|
||||
center: this.deepCopyObj(this.options.center)
|
||||
}
|
||||
this.positionEditing = false
|
||||
if (this._positionEditingCallback) {
|
||||
this._positionEditingCallback()
|
||||
this._positionEditingCallback = null
|
||||
}
|
||||
})
|
||||
this.event.mouse_right((movement, cartesian) => {
|
||||
this.positionEditing = false
|
||||
@ -1887,7 +1511,21 @@ class SectorObject extends Base {
|
||||
return this.operate.positionEditing
|
||||
}
|
||||
|
||||
static nodeEdit(that, cb = () => { }) {
|
||||
openPositionEditing(cd) {
|
||||
this.positionEditing = true
|
||||
this._positionEditingCallback = cd
|
||||
}
|
||||
|
||||
get areaChangeCallBack() {
|
||||
return this._areaChangeCallBack
|
||||
}
|
||||
|
||||
set areaChangeCallBack(cd) {
|
||||
this._areaChangeCallBack = cd
|
||||
}
|
||||
|
||||
nodeEdit(cb = () => { }) {
|
||||
let that = this
|
||||
that.positionEditing = false
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
} else {
|
||||
@ -1959,6 +1597,7 @@ class SectorObject extends Base {
|
||||
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
|
||||
]
|
||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
||||
setTimeout(() => {
|
||||
that
|
||||
.getClampToHeight({
|
||||
lng: that.options.center.lng,
|
||||
@ -1971,6 +1610,7 @@ class SectorObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
setTimeout(() => {
|
||||
createNodePoints(positions[1], 'sector-start')
|
||||
createNodePoints(positions[positions.length - 4], 'sector-end')
|
||||
@ -2042,6 +1682,8 @@ class SectorObject extends Base {
|
||||
that.tip = null
|
||||
|
||||
that.heightMode = that.heightMode
|
||||
|
||||
cb('', { ...that.options.center })
|
||||
})
|
||||
}, 200);
|
||||
async function createNodePoints(pos, type) {
|
||||
@ -2064,17 +1706,17 @@ class SectorObject extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
static closeNodeEdit(that) {
|
||||
closeNodeEdit() {
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
that.event && that.event.destroy()
|
||||
that.tip && that.tip.destroy()
|
||||
that.tip = null
|
||||
this.event && this.event.destroy()
|
||||
this.tip && this.tip.destroy()
|
||||
this.tip = null
|
||||
|
||||
for (let i = 0; i < that.nodePoints.length; i++) {
|
||||
that.sdk.viewer.entities.remove(that.nodePoints[i])
|
||||
for (let i = 0; i < this.nodePoints.length; i++) {
|
||||
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
||||
}
|
||||
that.nodePoints = []
|
||||
that.picking = true
|
||||
this.nodePoints = []
|
||||
this.picking = true
|
||||
}
|
||||
|
||||
static EventBinding(that, elements) {
|
||||
@ -2259,8 +1901,8 @@ class SectorObject extends Base {
|
||||
if (angle < 0) {
|
||||
angle = 360 + angle
|
||||
}
|
||||
this.options.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius * (angle / 360)).toFixed(2));
|
||||
this.areaUnit = this.areaUnit
|
||||
this.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius * (angle / 360)).toFixed(2));
|
||||
this.areaChangeCallBack && this.areaChangeCallBack()
|
||||
return fromDegreesArray
|
||||
}
|
||||
}
|
||||
|
||||
@ -2191,6 +2191,7 @@ class StraightArrowObject extends Base {
|
||||
let polygon = turf.polygon(points)
|
||||
let centroid = turf.pointOnFeature(polygon)
|
||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
||||
setTimeout(() => {
|
||||
that
|
||||
.getClampToHeight({
|
||||
lng: centroid.geometry.coordinates[0],
|
||||
@ -2203,6 +2204,7 @@ class StraightArrowObject extends Base {
|
||||
height
|
||||
]
|
||||
})
|
||||
}, 200);
|
||||
createNodePoints()
|
||||
}, 200);
|
||||
async function createNodePoints() {
|
||||
|
||||
@ -595,7 +595,7 @@ class StandText extends Base {
|
||||
selectPoint = pick.id
|
||||
this.nodePoints.splice(pick.id.index, 1)
|
||||
this.sdk.viewer.entities.remove(pick.id)
|
||||
this.tip.set_text('左键开始,右键结束,CTRL+右键撤销')
|
||||
this.tip.set_text('左键单击确认顶点位置,右键单击结束,CTRL+右键撤销')
|
||||
originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||
this.entity.wall.positions = new Cesium.CallbackProperty(function () {
|
||||
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||
@ -615,6 +615,15 @@ class StandText extends Base {
|
||||
if(isAdd) {
|
||||
this.options.positions.splice(selectPoint.index, 1)
|
||||
}
|
||||
if (!this.options.positions || this.options.positions.length < 2) {
|
||||
console.warn('最少需要两个坐标!')
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '最少需要两个坐标!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
this.options.positions = [...previous]
|
||||
}
|
||||
cb(null, this.options.positions)
|
||||
}
|
||||
let positions = this.options.positions
|
||||
|
||||
@ -95,6 +95,7 @@ class TrajectoryMotion extends Base {
|
||||
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
|
||||
this.positions_smooth = []
|
||||
this.options.ground = options.ground || false
|
||||
this.options.reverse = options.reverse || false
|
||||
this.options.state = (options.state || options.state === false) ? options.state : true
|
||||
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
|
||||
this.keyPoints = []
|
||||
@ -618,20 +619,30 @@ class TrajectoryMotion extends Base {
|
||||
set delay(v) {
|
||||
this.options.delay = v
|
||||
if (this.TweenAnimate && this.TweenAnimate._isPlaying) {
|
||||
this.TweenAnimate.delay(this.delay)
|
||||
this.TweenAnimate.delay(this.delay*1000)
|
||||
}
|
||||
this._elms.delay && this._elms.delay.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
}
|
||||
|
||||
get reverse() {
|
||||
return this.options.reverse
|
||||
}
|
||||
|
||||
set reverse(v) {
|
||||
this.lineEdit = false
|
||||
this.options.reverse = v
|
||||
this.smooth = this.smooth
|
||||
}
|
||||
|
||||
get state() {
|
||||
return this.options.state
|
||||
}
|
||||
set state(v) {
|
||||
this.options.state = v
|
||||
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||
if (this.editObj) {
|
||||
if (this.options.state && this.editObj) {
|
||||
this.editObj.destroy()
|
||||
this.editObj = null
|
||||
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
|
||||
@ -646,10 +657,10 @@ class TrajectoryMotion extends Base {
|
||||
if (this.TweenAnimate.isPlaying()) {
|
||||
this.TweenAnimate.timeout = setTimeout(() => {
|
||||
this.TweenAnimate.resume()
|
||||
}, this.options.delay);
|
||||
}, this.options.delay*1000);
|
||||
}
|
||||
else {
|
||||
this.TweenAnimate.delay(this.delay).start()
|
||||
this.TweenAnimate.delay(this.delay*1000).start()
|
||||
}
|
||||
this.speed = this.speed
|
||||
}
|
||||
@ -1513,7 +1524,7 @@ class TrajectoryMotion extends Base {
|
||||
let HeadingPitchRoll2
|
||||
let previous = {}
|
||||
let m = 0
|
||||
this.TweenAnimate = new TWEEN.Tween({ distance: startDistance }).to({ distance: this.distance }, (totalTime - time) * 1000).delay(this.delay).easing(TWEEN.Easing.Linear.None).repeat(this.options.loop ? Infinity : 0).onRepeat(() => {
|
||||
this.TweenAnimate = new TWEEN.Tween({ distance: startDistance }).to({ distance: this.distance }, (totalTime - time) * 1000).delay(this.delay*1000).easing(TWEEN.Easing.Linear.None).repeat(this.options.loop ? Infinity : 0).onRepeat(() => {
|
||||
if (time || startDistance) {
|
||||
this.modelMove(positions)
|
||||
}
|
||||
@ -1562,11 +1573,15 @@ class TrajectoryMotion extends Base {
|
||||
animateUpdate
|
||||
)
|
||||
if (_this.options.firstPersonView) {
|
||||
let targetHeading = _this.model.heading + 90 + _this.firstPersonHeadingPitch.heading
|
||||
if(!_this.routeDirection) {
|
||||
targetHeading = 180 - targetHeading
|
||||
}
|
||||
let positionCamera = { ..._this.sdk.viewer.camera._position }
|
||||
_this.sdk.viewer.camera.setView({
|
||||
destination: positionCamera,
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(_this.model.heading + 90 + _this.firstPersonHeadingPitch.heading),
|
||||
heading: Cesium.Math.toRadians(targetHeading),
|
||||
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
||||
roll: 0
|
||||
}
|
||||
@ -1794,10 +1809,14 @@ class TrajectoryMotion extends Base {
|
||||
if (_this.viewFollow) {
|
||||
// console.log(Cesium.Math.toDegrees(_this.sdk.viewer.camera.pitch))
|
||||
if (_this.options.firstPersonView) {
|
||||
let targetHeading = heading + 90 + _this.firstPersonHeadingPitch.heading
|
||||
if(!_this.routeDirection) {
|
||||
targetHeading = 180 - targetHeading
|
||||
}
|
||||
_this.sdk.viewer.camera.setView({
|
||||
destination: positionCamera,
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(heading + 90 + _this.firstPersonHeadingPitch.heading),
|
||||
heading: Cesium.Math.toRadians(targetHeading),
|
||||
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
||||
roll: 0
|
||||
}
|
||||
@ -2285,6 +2304,7 @@ class TrajectoryMotion extends Base {
|
||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '开始调整'
|
||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
|
||||
}
|
||||
return false
|
||||
}
|
||||
else {
|
||||
if (this.viewFollow) {
|
||||
@ -2333,6 +2353,8 @@ class TrajectoryMotion extends Base {
|
||||
Cesium.Matrix4.multiply(originalMatrix, rotationY, originalMatrix)
|
||||
Cesium.Matrix4.multiply(originalMatrix, rotationZ, this.entity.modelMatrix)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@ -2373,7 +2395,7 @@ class TrajectoryMotion extends Base {
|
||||
// maximumScale: 100000,
|
||||
}
|
||||
const getAnimationsList = () => {
|
||||
if (this.options.model.url === this.originalOptions.model.url) {
|
||||
if (this.originalOptions && this.options.model.url === this.originalOptions.model.url) {
|
||||
this.modelAnimate = this.originalOptions.model.animate
|
||||
}
|
||||
else {
|
||||
@ -2457,10 +2479,13 @@ class TrajectoryMotion extends Base {
|
||||
|
||||
// 更新坐标
|
||||
renewLinePositions(pos) {
|
||||
let positions = pos
|
||||
let positions = [...pos]
|
||||
if (this.noseToTail) {
|
||||
positions = [...pos, pos[0]]
|
||||
}
|
||||
if(this.reverse) {
|
||||
positions.reverse()
|
||||
}
|
||||
let fromDegreesArrayHeights = []
|
||||
let time = []
|
||||
let positions_smooth = []
|
||||
|
||||
@ -45,11 +45,11 @@ class Vector extends Base {
|
||||
this.options.headTables = options.headTables || []
|
||||
this.options.name = options.name || '未命名对象'
|
||||
|
||||
if (!this.options.path.endsWith('.kml')) {
|
||||
; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
||||
(this.options.opacity =
|
||||
options.opacity || options.opacity === 0 ? options.opacity : 1)
|
||||
}
|
||||
// if (!this.options.path.endsWith('.kml')) {
|
||||
// ; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
||||
// (this.options.opacity =
|
||||
// options.opacity || options.opacity === 0 ? options.opacity : 1)
|
||||
// }
|
||||
|
||||
this.options.show =
|
||||
options.show || options.show === false ? options.show : true
|
||||
@ -620,16 +620,26 @@ class Vector extends Base {
|
||||
}
|
||||
})
|
||||
if (!that.options.field) {
|
||||
const properties = ['id', 'Id', 'ID', 'name', 'Name', 'NAME', 'address', 'Address', 'ADDRESS', 'text', 'Text', 'TEXT', 'label', 'Label', 'LABEL'];
|
||||
const properties = ['name', 'Name', 'NAME'];
|
||||
const field = properties.find(prop => that.geojson.features[0].properties[prop] !== undefined);
|
||||
if (field) {
|
||||
that.options.field = field;
|
||||
}
|
||||
else {
|
||||
for (let key in that.geojson.features[0].properties) {
|
||||
that.options.field = key;
|
||||
break;
|
||||
}
|
||||
const isChinese = (str) => /[\u4e00-\u9fa5]/.test(str);
|
||||
const sortedKeys = Object.keys(that.geojson.features[0].properties || {}).sort((a, b) => {
|
||||
const aIsCN = isChinese(a);
|
||||
const bIsCN = isChinese(b);
|
||||
|
||||
if (!aIsCN && bIsCN) return -1;
|
||||
if (aIsCN && !bIsCN) return 1;
|
||||
|
||||
// 非中文:纯字母序(不区分大小写);中文:拼音序
|
||||
return aIsCN
|
||||
? a.localeCompare(b, 'zh-CN')
|
||||
: a.toUpperCase().localeCompare(b.toUpperCase());
|
||||
});
|
||||
that.options.field = sortedKeys[0]
|
||||
}
|
||||
}
|
||||
// for (let i = 0; i < that.#textEntity.length; i++) {
|
||||
|
||||
@ -1342,7 +1342,7 @@ class WallRealStereoscopic extends Base {
|
||||
}
|
||||
|
||||
material = new Cesium.CustomMaterialSource({
|
||||
image: this.getSourceRootPath() + `/img/material/${img}.png`,
|
||||
image: this.getSourceRootPath() + `/img/material/${img}.jpg`,
|
||||
color: this.options.color,
|
||||
is2D: false,
|
||||
repeats: new Cesium.CallbackProperty(() => {
|
||||
|
||||
@ -8,7 +8,7 @@ let fontData = [
|
||||
{
|
||||
name: '思源黑体',
|
||||
value: '思源黑体',
|
||||
font: 'SourceHanSansTi',
|
||||
font: 'SourceHanSansTiM',
|
||||
key: '1'
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm']
|
||||
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm', 'icon-delete', 'icon-resetView']
|
||||
function setSvg() {
|
||||
let svgElm = document.createElement('svg');
|
||||
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
import md5 from 'js-md5'
|
||||
import { Proj } from './proj'
|
||||
import { open as projConvertOpen, close as projConvertClose } from './projConvert'
|
||||
import { open as projectionConvertOpen, close as projectionConvertClose } from './projectionConvert'
|
||||
import { open as projectionConvertOpen, close as projectionConvertClose, updateCoordinates } from './projectionConvert'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../Global/global'
|
||||
import FlowPictureMaterialProperty from '../Obj/Materail/FlowPictureMaterialProperty'
|
||||
import { syncData, get3DView } from '../Global/MultiViewportMode'
|
||||
@ -709,7 +709,8 @@ class Tools {
|
||||
color: color,
|
||||
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
||||
space: newParam.space,
|
||||
speed: newParam.speed
|
||||
speed: newParam.speed,
|
||||
rotate: newParam.rotate
|
||||
}
|
||||
|
||||
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
||||
@ -733,11 +734,11 @@ class Tools {
|
||||
myImg.src = options.image
|
||||
myImg.onload = function () {
|
||||
options.space = Math.max(0.1, options.space);
|
||||
if (options.speed > 0 || options.speed == 0) {
|
||||
if (options.speed > 0 || (options.speed == 0 && options.rotate)) {
|
||||
canvasEle.width = myImg.width * (options.space + 1)
|
||||
canvasEle.height = myImg.height
|
||||
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
|
||||
} else {
|
||||
} else if (options.speed < 0 || (options.speed == 0 && !options.rotate)) {
|
||||
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
|
||||
canvasEle.width = myImg.width * (options.space + 1)
|
||||
canvasEle.height = myImg.height
|
||||
@ -1220,7 +1221,7 @@ class Tools {
|
||||
let pos3 = new Cesium.Cartesian3.fromDegrees(position.lng, position.lat);
|
||||
let position1
|
||||
try {
|
||||
position1 = await this.sdk.viewer.scene.clampToHeight(pos3, objectsToExclude) || pos3
|
||||
position1 = await this.sdk.viewer.scene.clampToHeight({ x: pos3.x, y: pos3.y, z: pos3.z }, objectsToExclude) || pos3
|
||||
} catch (error) {
|
||||
position1 = pos3
|
||||
}
|
||||
@ -1297,6 +1298,9 @@ class Tools {
|
||||
projectionConvertClose()
|
||||
}
|
||||
}
|
||||
updateCoordinates(date1, date2) {
|
||||
updateCoordinates(date1, date2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc 导出excel
|
||||
@ -1541,10 +1545,111 @@ class Tools {
|
||||
/**两点之间的距离 */
|
||||
pointDistance(p1, p2) {
|
||||
let centerDegress = Cesium.Cartesian3.fromDegrees(p1.lng, p1.lat)
|
||||
let point = Cesium.Cartesian3.fromDegrees(p2, p2)
|
||||
let point = Cesium.Cartesian3.fromDegrees(p2.lng, p2.lat)
|
||||
let distance = Cesium.Cartesian3.distance(point, centerDegress)
|
||||
return distance
|
||||
}
|
||||
|
||||
/**
|
||||
* Web墨卡托坐标转WGS84经纬度
|
||||
* @param {number} x - 墨卡托X坐标
|
||||
* @param {number} y - 墨卡托Y坐标
|
||||
* @returns {Array} [经度, 纬度]
|
||||
*/
|
||||
mercatorToWGS84(x, y) {
|
||||
// 地球周长的一半
|
||||
const earthHalfCircumference = 20037508.34
|
||||
|
||||
// 计算经度
|
||||
const lon = (x / earthHalfCircumference) * 180
|
||||
|
||||
// 计算纬度(包含反双曲正切变换)
|
||||
let lat = (y / earthHalfCircumference) * 180
|
||||
lat = (180 / Math.PI) * (2 * Math.atan(Math.exp((lat * Math.PI) / 180)) - Math.PI / 2)
|
||||
|
||||
return [lon, lat]
|
||||
}
|
||||
/**
|
||||
* CGCS2000 3度带坐标转WGS84经纬度
|
||||
* @param {number} x - CGCS2000 X坐标(不含带号)
|
||||
* @param {number} y - CGCS2000 Y坐标
|
||||
* @param {number} centralMeridian - 中央经线(如120)
|
||||
* @returns {Array} [经度, 纬度]
|
||||
*/
|
||||
convertCGCStoWGS84(x, y, centralMeridian) {
|
||||
// 定义坐标系参数
|
||||
const wgs84 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
|
||||
const cgcs2000 =
|
||||
'+proj=tmerc +lat_0=0 +lon_0=' +
|
||||
centralMeridian +
|
||||
' +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs'
|
||||
|
||||
// 执行坐标转换
|
||||
const point = proj4(cgcs2000, wgs84, [x, y]);
|
||||
return point;
|
||||
}
|
||||
/**
|
||||
* 提取带号并转换CGCS2000坐标到WGS84
|
||||
* @param {number} xWithZone - 带代号的X坐标(如40543210)
|
||||
* @param {number} y - Y坐标
|
||||
* @returns {Array} [经度, 纬度]
|
||||
*/
|
||||
convertCGCSToWGS84WithZone(xWithZone, y) {
|
||||
// 将X坐标转为字符串以提取带号
|
||||
const xStr = xWithZone.toString();
|
||||
|
||||
// 提取带号(前2位)和实际X坐标
|
||||
const zoneNumber = parseInt(xStr.substring(0, 2));
|
||||
const actualX = parseInt(xStr.substring(2));
|
||||
|
||||
// 计算中央经线:3° × 带号
|
||||
const centralMeridian = zoneNumber * 3;
|
||||
|
||||
// 定义坐标系参数
|
||||
const wgs84 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs';
|
||||
const cgcs2000 = `+proj=tmerc +lat_0=0 +lon_0=${centralMeridian} +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs`;
|
||||
|
||||
// 执行坐标转换
|
||||
const point = proj4(cgcs2000, wgs84, [actualX, y]);
|
||||
return point;
|
||||
}
|
||||
/**
|
||||
* CGCS2000六度带坐标转WGS84经纬度
|
||||
* @param {number} x - CGCS2000 X坐标(无带号)
|
||||
* @param {number} y - CGCS2000 Y坐标
|
||||
* @param {number} centralMeridian - 中央经线(如117)
|
||||
* @returns {Array} [经度, 纬度]
|
||||
*/
|
||||
convertCGCS2000_6ToWGS84(x, y, centralMeridian) {
|
||||
// 定义坐标系参数
|
||||
const wgs84 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs';
|
||||
const cgcs2000_6 = '+proj=tmerc +lat_0=0 +lon_0=' + centralMeridian + ' +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs';
|
||||
|
||||
// 执行坐标转换
|
||||
const point = proj4(cgcs2000_6, wgs84, [x, y]);
|
||||
return point;
|
||||
}
|
||||
convertCGCS2000_6ToWGS84WithZone(xWithZone, y) {
|
||||
// 将X坐标转为字符串以提取带号
|
||||
const xStr = xWithZone.toString();
|
||||
|
||||
// 提取带号(前2位)
|
||||
const zoneNumber = parseInt(xStr.substring(0, 2));
|
||||
|
||||
// 计算中央经线:六度带中央经线 = 带号 × 6 - 3
|
||||
const centralMeridian = zoneNumber * 6 - 3;
|
||||
|
||||
// 实际X坐标(去除带号)
|
||||
const actualX = parseInt(xStr.substring(2));
|
||||
|
||||
// 定义坐标系参数
|
||||
const wgs84 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs';
|
||||
const cgcs2000_6 = '+proj=tmerc +lat_0=0 +lon_0=' + centralMeridian + ' +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs';
|
||||
|
||||
// 执行坐标转换
|
||||
const point = proj4(cgcs2000_6, wgs84, [actualX, y]);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
export default Tools
|
||||
|
||||
@ -1021,18 +1021,26 @@ class Proj {
|
||||
function tenToThePowerOfN(n) {
|
||||
return Math.pow(10, n);
|
||||
}
|
||||
let isF = false
|
||||
if(degrees<0) {
|
||||
isF = true
|
||||
}
|
||||
degrees = Math.abs(degrees)
|
||||
let d = Math.floor(degrees); // 获取整度
|
||||
let pow1 = tenToThePowerOfN(getDecimalPlaces(degrees))
|
||||
let x = Math.floor((degrees - d) * pow1 * 60) / pow1; // 获取秒(3600分之一度)
|
||||
let m = Math.floor(x);
|
||||
|
||||
if(isF) {
|
||||
d = -d
|
||||
}
|
||||
let pow = tenToThePowerOfN(getDecimalPlaces(x))
|
||||
let s = Math.floor((x - m) * pow) / pow * 60; // 获取秒(3600分之一度)
|
||||
if (isDM) {
|
||||
return d + "°" + Number(x.toFixed(4)) + "'"; // 返回度分格式
|
||||
return d + "°" + (Math.floor(x * 10000) / 10000) + "'"; // 返回度分格式
|
||||
}
|
||||
else {
|
||||
return d + "°" + m + "'" + s.toFixed(2) + '"'; // 返回度分秒格式
|
||||
return d + "°" + m + "'" + Math.floor(s * 100) / 100 + '"'; // 返回度分秒格式
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import { Proj } from './proj'
|
||||
import { legp } from '../Obj/Element/datalist';
|
||||
import Tools from "../Tools";
|
||||
let _DialogObject
|
||||
let Draw
|
||||
const open = async (sdk, closeCallBack) => {
|
||||
let proj = new Proj()
|
||||
let tools = new Tools(sdk)
|
||||
@ -139,6 +140,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let type = items[i].getAttribute('data-type')
|
||||
let convertElm = items[i].getElementsByClassName('convert')[0]
|
||||
let pickUpElm = items[i].getElementsByClassName('pickUp')[0]
|
||||
let copyElm = items[i].getElementsByClassName('icon-copy-box')[0]
|
||||
let clipboard = new ClipboardJS(copyElm, {
|
||||
text: (trigger) => {
|
||||
@ -191,6 +193,54 @@ const open = async (sdk, closeCallBack) => {
|
||||
clipboard.on('error', function (e) {
|
||||
tools.message({ type: 'warning', text: '复制失败' })
|
||||
});
|
||||
let DrawPoint = require('../Draw/drawPoint').default
|
||||
pickUpElm.addEventListener('click', () => {
|
||||
Draw = new DrawPoint(sdk)
|
||||
Draw.start((a, positions) => {
|
||||
switch (type * 1) {
|
||||
case 0:
|
||||
items[i].getElementsByClassName('lng')[0].value = positions.lng
|
||||
items[i].getElementsByClassName('lat')[0].value = positions.lat
|
||||
break;
|
||||
case 1:
|
||||
let lngDM = proj.degreesToDMS(positions.lng, true)
|
||||
let latDM = proj.degreesToDMS(positions.lat, true)
|
||||
let lngdnArr1 = lngDM.split('°')
|
||||
let lngdnArr2 = lngdnArr1[1].split("'")
|
||||
let latdnArr1 = latDM.split('°')
|
||||
let latdnArr2 = latdnArr1[1].split("'")
|
||||
contentElm.getElementsByClassName('lng-dm-d')[0].value = lngdnArr1[0]
|
||||
contentElm.getElementsByClassName('lng-dm-m')[0].value = lngdnArr2[0]
|
||||
contentElm.getElementsByClassName('lat-dm-d')[0].value = latdnArr1[0]
|
||||
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
|
||||
break
|
||||
case 2:
|
||||
let lngDMS = proj.degreesToDMS(positions.lng)
|
||||
let latDMS = proj.degreesToDMS(positions.lat)
|
||||
let lngdnsArr1 = lngDMS.split('°')
|
||||
let lngdnsArr2 = lngdnsArr1[1].split("'")
|
||||
let lngdnsArr3 = lngdnsArr2[1].split('"')
|
||||
let latdnsArr1 = latDMS.split('°')
|
||||
let latdnsArr2 = latdnsArr1[1].split("'")
|
||||
let latdnsArr3 = latdnsArr2[1].split('"')
|
||||
contentElm.getElementsByClassName('lng-dms-d')[0].value =
|
||||
lngdnsArr1[0]
|
||||
contentElm.getElementsByClassName('lng-dms-m')[0].value =
|
||||
lngdnsArr2[0]
|
||||
contentElm.getElementsByClassName('lng-dms-s')[0].value =
|
||||
lngdnsArr3[0]
|
||||
contentElm.getElementsByClassName('lat-dms-d')[0].value =
|
||||
latdnsArr1[0]
|
||||
contentElm.getElementsByClassName('lat-dms-m')[0].value =
|
||||
latdnsArr2[0]
|
||||
contentElm.getElementsByClassName('lat-dms-s')[0].value =
|
||||
latdnsArr3[0]
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
})
|
||||
convertElm.addEventListener('click', () => {
|
||||
// let a = proj.degreesToDMS(100.345546743)
|
||||
let lng,
|
||||
@ -319,10 +369,12 @@ const open = async (sdk, closeCallBack) => {
|
||||
items[i].style.order = 0
|
||||
items[i].style.display = 'block'
|
||||
convertElm.style.display = 'inline-block'
|
||||
pickUpElm.style.display = 'inline-block'
|
||||
} else {
|
||||
items[i].style.order = 1
|
||||
items[i].style.display = 'none'
|
||||
convertElm.style.display = 'none'
|
||||
pickUpElm.style.display = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,10 +422,12 @@ const open = async (sdk, closeCallBack) => {
|
||||
if (selectData[i].value === selectDataLegpElm.value) {
|
||||
for (let m = 0; m < items.length; m++) {
|
||||
let convertElm = items[m].getElementsByClassName('convert')[0]
|
||||
let pickUpElm = items[m].getElementsByClassName('pickUp')[0]
|
||||
if (m == selectData[i].key) {
|
||||
items[m].style.order = 0
|
||||
items[m].style.display = 'block'
|
||||
convertElm.style.display = 'inline-block'
|
||||
pickUpElm.style.display = 'inline-block'
|
||||
} else {
|
||||
if (m === 0) {
|
||||
items[m].style.order = 2
|
||||
@ -383,6 +437,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
}
|
||||
items[m].style.display = 'none'
|
||||
convertElm.style.display = 'none'
|
||||
pickUpElm.style.display = 'none'
|
||||
}
|
||||
}
|
||||
break
|
||||
@ -397,6 +452,7 @@ const close = () => {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
Draw && Draw.end()
|
||||
}
|
||||
|
||||
export { open, close }
|
||||
|
||||
@ -7,6 +7,7 @@ import Tools from '../Tools'
|
||||
let _DialogObject
|
||||
let tip
|
||||
let event
|
||||
let datalistLeftInput, datalistRightInput
|
||||
const open = async (sdk, closeCallBack) => {
|
||||
let topls = new Tools()
|
||||
let proj = new Proj()
|
||||
@ -89,23 +90,23 @@ const open = async (sdk, closeCallBack) => {
|
||||
}
|
||||
)
|
||||
})
|
||||
let legpObjectLeft = legp(contentElm.getElementsByClassName('left')[0], ".datalist_left")
|
||||
legpObjectLeft.legp_search(tagData, true)
|
||||
let legpObjectRight = legp(contentElm.getElementsByClassName('right')[0], ".datalist_right")
|
||||
legpObjectRight.legp_search(tagData, true)
|
||||
// let legpObjectLeft = legp(contentElm.getElementsByClassName('left')[0], ".datalist_left")
|
||||
// legpObjectLeft.legp_search(tagData, true)
|
||||
// let legpObjectRight = legp(contentElm.getElementsByClassName('right')[0], ".datalist_right")
|
||||
// legpObjectRight.legp_search(tagData, true)
|
||||
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
||||
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
||||
let sourceCopyElm = contentElm.getElementsByClassName('sourceCopy')[0]
|
||||
let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
||||
datalistLeftInput.value = tagData[0].value
|
||||
legpObjectLeft.legp_searchActive(tagData[0].value)
|
||||
// let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
||||
// datalistLeftInput.value = tagData[0].value
|
||||
// legpObjectLeft.legp_searchActive(tagData[0].value)
|
||||
|
||||
|
||||
|
||||
|
||||
let datalistRightInput = contentElm.getElementsByClassName('datalist_right')[0].getElementsByTagName('input')[0]
|
||||
datalistRightInput.value = tagData[0].value
|
||||
legpObjectRight.legp_searchActive(tagData[0].value)
|
||||
// let datalistRightInput = contentElm.getElementsByClassName('datalist_right')[0].getElementsByTagName('input')[0]
|
||||
// datalistRightInput.value = tagData[0].value
|
||||
// legpObjectRight.legp_searchActive(tagData[0].value)
|
||||
|
||||
|
||||
|
||||
@ -119,35 +120,35 @@ const open = async (sdk, closeCallBack) => {
|
||||
let beforeleftVal = 'EPSG:4326'
|
||||
let beforerightVal = 'EPSG:4326'
|
||||
// 监听输入事件(实时触发)
|
||||
datalistLeftInput.addEventListener('input', (e) => {
|
||||
const newValue = e.target.value;
|
||||
if (leftXElm.value && leftYElm.value) {
|
||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], beforeleftVal, newValue)
|
||||
if (result.code === 0) {
|
||||
leftXElm.value = result.points[0].x
|
||||
leftYElm.value = result.points[0].y
|
||||
}
|
||||
}
|
||||
beforeleftVal = newValue
|
||||
// datalistLeftInput.addEventListener('input', (e) => {
|
||||
// const newValue = e.target.value;
|
||||
// if (leftXElm.value && leftYElm.value) {
|
||||
// let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], beforeleftVal, newValue)
|
||||
// if (result.code === 0) {
|
||||
// leftXElm.value = result.points[0].x
|
||||
// leftYElm.value = result.points[0].y
|
||||
// }
|
||||
// }
|
||||
// beforeleftVal = newValue
|
||||
|
||||
// 可以在这里调用legp_searchActive方法
|
||||
legpObjectLeft.legp_searchActive(newValue);
|
||||
});
|
||||
// // 可以在这里调用legp_searchActive方法
|
||||
// // legpObjectLeft.legp_searchActive(newValue);
|
||||
// });
|
||||
|
||||
datalistRightInput.addEventListener('input', (e) => {
|
||||
const newValue = e.target.value;
|
||||
if (rightXElm.value && rightYElm.value) {
|
||||
let result = proj.convert([{ x: Number(rightXElm.value), y: Number(rightYElm.value) }], beforerightVal, newValue)
|
||||
if (result.code === 0) {
|
||||
rightXElm.value = result.points[0].x
|
||||
rightYElm.value = result.points[0].y
|
||||
}
|
||||
}
|
||||
// datalistRightInput.addEventListener('input', (e) => {
|
||||
// const newValue = e.target.value;
|
||||
// if (rightXElm.value && rightYElm.value) {
|
||||
// let result = proj.convert([{ x: Number(rightXElm.value), y: Number(rightYElm.value) }], beforerightVal, newValue)
|
||||
// if (result.code === 0) {
|
||||
// rightXElm.value = result.points[0].x
|
||||
// rightYElm.value = result.points[0].y
|
||||
// }
|
||||
// }
|
||||
|
||||
beforerightVal = datalistRightInput.value
|
||||
// 可以在这里调用legp_searchActive方法
|
||||
legpObjectRight.legp_searchActive(newValue);
|
||||
});
|
||||
// beforerightVal = datalistRightInput.value
|
||||
// // 可以在这里调用legp_searchActive方法
|
||||
// // legpObjectRight.legp_searchActive(newValue);
|
||||
// });
|
||||
|
||||
pickElm.addEventListener('click', () => {
|
||||
tip && tip.destroy()
|
||||
@ -165,7 +166,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
let pos84 = topls.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||
tip && tip.destroy()
|
||||
event && event.destroy()
|
||||
let result = proj.convert([{ x: Number(pos84.lng), y: Number(pos84.lat) }], 'EPSG:4326', datalistLeftInput.value)
|
||||
let result = proj.convert([{ x: Number(pos84.lng), y: Number(pos84.lat) }], 'EPSG:4326', datalistLeftInput)
|
||||
if (result.code === 0) {
|
||||
leftXElm.value = result.points[0].x
|
||||
leftYElm.value = result.points[0].y
|
||||
@ -183,7 +184,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
topls.message({ type: 'warning', text: '请输入源坐标' })
|
||||
return
|
||||
}
|
||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], datalistLeftInput.value, datalistRightInput.value)
|
||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], datalistLeftInput, datalistRightInput)
|
||||
if (result.code === 0) {
|
||||
rightXElm.value = result.points[0].x
|
||||
rightYElm.value = result.points[0].y
|
||||
@ -240,4 +241,9 @@ const close = () => {
|
||||
event && event.destroy()
|
||||
}
|
||||
|
||||
export { open, close }
|
||||
const updateCoordinates = (select1, select2) => {
|
||||
datalistLeftInput = select1
|
||||
datalistRightInput = select2
|
||||
}
|
||||
|
||||
export { open, close, updateCoordinates }
|
||||
|
||||
@ -200,7 +200,7 @@ class YJEarth {
|
||||
let fontData = [
|
||||
{
|
||||
name: '思源黑体',
|
||||
value: 'SourceHanSansTi',
|
||||
value: 'SourceHanSansTiM',
|
||||
url: tools.getSourceRootPath() + '/custom/fonts/SourceHanSansCN-Medium.otf',
|
||||
format: 'opentype'
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
static/custom/img/icon-delete.svg
Normal file
1
static/custom/img/icon-delete.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15.65869140625" height="16" viewBox="0 0 15.65869140625 16" fill="none"><path d="M14.9742 4.33334L0.682905 4.33334C0.308133 4.33334 0 4.03334 0 3.66666C0 3.3 0.308133 3 0.682905 3L14.9742 3C15.349 3 15.6571 3.3 15.6571 3.66666C15.6571 4.03334 15.349 4.33334 14.9742 4.33334Z" fill="#FFFFFF" ></path><path d="M6.02972 3.48334C6.01307 3.38334 6.00474 3.275 6.00474 3.16666C6.00474 2.15834 6.82924 1.33334 7.83697 1.33334C8.84469 1.33334 9.66919 2.15834 9.66919 3.16666C9.66919 3.275 9.66086 3.375 9.64421 3.48334L10.9851 3.48334C10.9934 3.38334 11.0017 3.275 11.0017 3.16666C11.0017 1.41666 9.5859 0 7.83697 0C6.08803 0 4.67223 1.41666 4.67223 3.16666C4.67223 3.275 4.68054 3.375 4.68888 3.48334L6.02972 3.48334ZM12.4925 3.64166L12.4925 14.6667L3.16481 14.6667L3.16481 3.64166L1.83228 3.64166L1.83228 14.9583C1.83228 15.5333 2.29867 16 2.87332 16L12.784 16C13.3586 16 13.825 15.5333 13.825 14.9583L13.825 3.64166L12.4925 3.64166Z" fill="#FFFFFF" ></path><path d="M5.50491 12.4834L5.48826 12.4834C5.12182 12.4834 4.83032 12.1917 4.83032 11.8251L4.83032 7.14172C4.83032 6.77506 5.12182 6.4834 5.48826 6.4834L5.50491 6.4834C5.87137 6.4834 6.16285 6.77506 6.16285 7.14172L6.16285 11.8334C6.16285 12.1917 5.87137 12.4834 5.50491 12.4834ZM7.83683 12.4834L7.82018 12.4834C7.45373 12.4834 7.16224 12.1917 7.16224 11.8251L7.16224 7.14172C7.16224 6.77506 7.45373 6.4834 7.82018 6.4834L7.83683 6.4834C8.20327 6.4834 8.49477 6.77506 8.49477 7.14172L8.49477 11.8334C8.49477 12.1917 8.20327 12.4834 7.83683 12.4834ZM10.1688 12.4834L10.1521 12.4834C9.78565 12.4834 9.49417 12.1917 9.49417 11.8251L9.49417 7.14172C9.49417 6.77506 9.78565 6.4834 10.1521 6.4834L10.1688 6.4834C10.5352 6.4834 10.8267 6.77506 10.8267 7.14172L10.8267 11.8334C10.8267 12.1917 10.5352 12.4834 10.1688 12.4834Z" fill="#FFFFFF" ></path></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
1
static/custom/img/icon-resetView.svg
Normal file
1
static/custom/img/icon-resetView.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 5.1 KiB |
BIN
static/img/cross_black.png
Normal file
BIN
static/img/cross_black.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@ -15,7 +15,7 @@ function resolve(dir) {
|
||||
|
||||
// let buildPath = 'F:\\workspace\\code\\electronic-sand-table-3.0\\static\\lib'
|
||||
// let buildPath = 'E:\\sourceCode\\单机版-网络版共享后台\\gisWeb4.0\\static\\lib'
|
||||
let buildPath = 'D:\\project\\sdk4_demo - 副本\\sdk4_demo\\sdk'
|
||||
let buildPath = 'D:\\project\\4.0_new\\sdk4_demo_new\\sdk'
|
||||
// let buildPath = 'G:\\fs2\\yj\\4.0\\static\\sdk'
|
||||
// let buildPath = 'D:\\project\\sdk_vue2\\public\\sdk'
|
||||
// let buildPath = 'D:\\ProgramFiles\\dazugaj_platform\\resources\\app\\dist\\electron\\static\\lib'
|
||||
|
||||
Reference in New Issue
Block a user