Compare commits
44 Commits
26570d888c
...
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 |
@ -17,6 +17,7 @@ class Draw extends Tools {
|
|||||||
this.viewer = sdk.viewer
|
this.viewer = sdk.viewer
|
||||||
this.entityHasCreated = false
|
this.entityHasCreated = false
|
||||||
this.event = null
|
this.event = null
|
||||||
|
this._tipText = options.tipText
|
||||||
this.tip = null
|
this.tip = null
|
||||||
this.points_ids = []
|
this.points_ids = []
|
||||||
this.color = options.color || 'rgba(185,14,14,0.58)'
|
this.color = options.color || 'rgba(185,14,14,0.58)'
|
||||||
@ -24,6 +25,17 @@ class Draw extends Tools {
|
|||||||
this._sdk2D = get2DView()
|
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) {
|
create_point(cartesian, viewer = this.viewer) {
|
||||||
let id = this.randomString()
|
let id = this.randomString()
|
||||||
viewer.entities.add(
|
viewer.entities.add(
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class DrawAssemble extends Draw {
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
let into
|
let into
|
||||||
this.tip = new MouseTip('左键确定,右键取消;', that.sdk)
|
this.tip = new MouseTip(this.tipText || '左键确定,右键取消;', that.sdk)
|
||||||
this.event = new MouseEvent(that.sdk)
|
this.event = new MouseEvent(that.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -100,6 +100,9 @@ class DrawAssemble extends Draw {
|
|||||||
cb(null, array)
|
cb(null, array)
|
||||||
this.end()
|
this.end()
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
if (into === '2D') {
|
if (into === '2D') {
|
||||||
@ -147,6 +150,22 @@ class DrawAssemble extends Draw {
|
|||||||
this.end()
|
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) => {
|
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||||
if (into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
@ -176,6 +195,7 @@ class DrawAssemble extends Draw {
|
|||||||
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian))
|
this.points_ids.push(this.create_point(cartesian))
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -204,6 +224,9 @@ class DrawAssemble extends Draw {
|
|||||||
cb(null, array)
|
cb(null, array)
|
||||||
this.end()
|
this.end()
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event2D.mouse_move((movement, cartesian) => {
|
this.event2D.mouse_move((movement, cartesian) => {
|
||||||
if (into === '3D') {
|
if (into === '3D') {
|
||||||
@ -250,6 +273,21 @@ class DrawAssemble extends Draw {
|
|||||||
cb(null)
|
cb(null)
|
||||||
this.end()
|
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) => {
|
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
||||||
if (into === '3D') {
|
if (into === '3D') {
|
||||||
@ -280,6 +318,7 @@ class DrawAssemble extends Draw {
|
|||||||
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
cache_positions.push(this.cartesian3Towgs84(cartesian))
|
||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
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
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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.event = new MouseEvent(this.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -71,6 +71,7 @@ export default class DrawAttackArrow extends Draw {
|
|||||||
this.points_ids.push(this.create_point(cartesian))
|
this.points_ids.push(this.create_point(cartesian))
|
||||||
cache_positions.push(pos84)
|
cache_positions.push(pos84)
|
||||||
isMove = false
|
isMove = false
|
||||||
|
cb(cache_positions.length)
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if(into === '2D') {
|
||||||
@ -110,6 +111,7 @@ export default class DrawAttackArrow extends Draw {
|
|||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export default class DrawCircle extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
let into
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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 = new MouseEvent(this.sdk)
|
||||||
let clickNum = 0
|
let clickNum = 0
|
||||||
this.circle_id = this.randomString() //圆id
|
this.circle_id = this.randomString() //圆id
|
||||||
@ -37,7 +37,7 @@ export default class DrawCircle extends Draw {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '3D'
|
into = '3D'
|
||||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||||
clickNum++
|
clickNum++
|
||||||
if (clickNum === 1) {
|
if (clickNum === 1) {
|
||||||
this.point_id = this.create_point(cartesian)
|
this.point_id = this.create_point(cartesian)
|
||||||
@ -45,6 +45,7 @@ export default class DrawCircle extends Draw {
|
|||||||
positions = this.createCircle(center, 0.01)
|
positions = this.createCircle(center, 0.01)
|
||||||
cache_points.push(cartesian)
|
cache_points.push(cartesian)
|
||||||
createCirclePolygon()
|
createCirclePolygon()
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
@ -77,7 +78,24 @@ export default class DrawCircle extends Draw {
|
|||||||
radius = this.computeDistance2([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
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) => {
|
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||||
@ -92,7 +110,7 @@ export default class DrawCircle extends Draw {
|
|||||||
cb(false)
|
cb(false)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||||
clickNum++
|
clickNum++
|
||||||
if (clickNum === 1) {
|
if (clickNum === 1) {
|
||||||
this.point_id = this.create_point(cartesian)
|
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.x + movement.position2.x) / 2,
|
||||||
(movement.position1.y + movement.position2.y) / 2
|
(movement.position1.y + movement.position2.y) / 2
|
||||||
)
|
)
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
@ -124,7 +143,7 @@ export default class DrawCircle extends Draw {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '2D'
|
into = '2D'
|
||||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||||
clickNum++
|
clickNum++
|
||||||
if (clickNum === 1) {
|
if (clickNum === 1) {
|
||||||
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
|
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)
|
positions = this.createCircle(center, 0.01)
|
||||||
cache_points.push(cartesian)
|
cache_points.push(cartesian)
|
||||||
createCirclePolygon(this._sdk2D.viewer)
|
createCirclePolygon(this._sdk2D.viewer)
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
@ -179,7 +199,7 @@ export default class DrawCircle extends Draw {
|
|||||||
cb(false)
|
cb(false)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.tip.set_text('再次左键,完成绘制;右键取消')
|
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
|
||||||
clickNum++
|
clickNum++
|
||||||
if (clickNum === 1) {
|
if (clickNum === 1) {
|
||||||
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
|
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.x + movement.position2.x) / 2) + this.viewer.canvas.width,
|
||||||
(movement.position1.y + movement.position2.y) / 2
|
(movement.position1.y + movement.position2.y) / 2
|
||||||
)
|
)
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
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
|
let that = this
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default class DrawElliptic extends Draw {
|
|||||||
let into
|
let into
|
||||||
this.entity_ids = []
|
this.entity_ids = []
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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 = new MouseEvent(this.sdk)
|
||||||
let clickNum = 0
|
let clickNum = 0
|
||||||
this.elliptic_id = this.randomString() //圆id
|
this.elliptic_id = this.randomString() //圆id
|
||||||
@ -34,7 +34,7 @@ export default class DrawElliptic extends Draw {
|
|||||||
let bearing = 0
|
let bearing = 0
|
||||||
|
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '3D'
|
into = '3D'
|
||||||
@ -59,8 +59,11 @@ export default class DrawElliptic extends Draw {
|
|||||||
cache_84_position[2] = pos84
|
cache_84_position[2] = pos84
|
||||||
}
|
}
|
||||||
if (clickNum >= 3) {
|
if (clickNum >= 3) {
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
// if (clickNum === 2) {
|
// if (clickNum === 2) {
|
||||||
// radius_points = cache_points.concat(cartesian)
|
// radius_points = cache_points.concat(cartesian)
|
||||||
@ -72,14 +75,14 @@ export default class DrawElliptic extends Draw {
|
|||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.end()
|
this.end()
|
||||||
cb(false)
|
cb(false)
|
||||||
})
|
})
|
||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.tip.setPosition(
|
this.tip.setPosition(
|
||||||
@ -94,11 +97,22 @@ 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) {
|
if (!this._is2D && this._sdk2D) {
|
||||||
this.event2D = new MouseEvent(this._sdk2D)
|
this.event2D = new MouseEvent(this._sdk2D)
|
||||||
this.event2D.mouse_left((movement, cartesian) => {
|
this.event2D.mouse_left((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '2D'
|
into = '2D'
|
||||||
@ -123,8 +137,11 @@ export default class DrawElliptic extends Draw {
|
|||||||
cache_84_position[2] = pos84
|
cache_84_position[2] = pos84
|
||||||
}
|
}
|
||||||
if (clickNum >= 3) {
|
if (clickNum >= 3) {
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb(clickNum)
|
||||||
}
|
}
|
||||||
// if (clickNum === 2) {
|
// if (clickNum === 2) {
|
||||||
// radius_points = cache_points.concat(cartesian)
|
// radius_points = cache_points.concat(cartesian)
|
||||||
@ -136,14 +153,14 @@ export default class DrawElliptic extends Draw {
|
|||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right((movement, cartesian) => {
|
this.event2D.mouse_right((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.end()
|
this.end()
|
||||||
cb(false)
|
cb(false)
|
||||||
})
|
})
|
||||||
this.event2D.mouse_move((movement, cartesian) => {
|
this.event2D.mouse_move((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.tip.setPosition(
|
this.tip.setPosition(
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
let into
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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.event = new MouseEvent(this.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -74,6 +74,9 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null, cache_positions, c)
|
cb(null, cache_positions, c)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if(into === '2D') {
|
||||||
@ -102,6 +105,7 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -155,6 +159,9 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null, cache_positions, c)
|
cb(null, cache_positions, c)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -183,6 +190,9 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null, cache_positions, c)
|
cb(null, cache_positions, c)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right((movement, cartesian) => {
|
this.event2D.mouse_right((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if(into === '3D') {
|
||||||
@ -211,6 +221,7 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -264,6 +275,9 @@ export default class DrawPincerArrow extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null, cache_positions, c)
|
cb(null, cache_positions, c)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class DrawPoint extends Draw {
|
|||||||
} else {
|
} else {
|
||||||
let car = undefined
|
let car = undefined
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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 = new MouseEvent(this.sdk)
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
this.end()
|
this.end()
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class DrawPolygon extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
let into
|
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.event = new MouseEvent(this.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -88,6 +88,7 @@ class DrawPolygon extends Draw {
|
|||||||
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
|
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
|
||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian))
|
this.points_ids.push(this.create_point(cartesian))
|
||||||
|
cb(cache_positions.length)
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if(into === '2D') {
|
||||||
@ -122,6 +123,7 @@ class DrawPolygon extends Draw {
|
|||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
cache_84_position.pop()
|
cache_84_position.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -134,6 +136,7 @@ class DrawPolygon extends Draw {
|
|||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
cache_84_position.pop()
|
cache_84_position.pop()
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -164,6 +167,7 @@ class DrawPolygon extends Draw {
|
|||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian))
|
this.points_ids.push(this.create_point(cartesian))
|
||||||
this.positions = cache_positions.concat(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))
|
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
|
||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||||
|
cb(cache_positions.length)
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right((movement, cartesian) => {
|
this.event2D.mouse_right((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if(into === '3D') {
|
||||||
@ -224,6 +229,7 @@ class DrawPolygon extends Draw {
|
|||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
cache_84_position.pop()
|
cache_84_position.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -236,6 +242,7 @@ class DrawPolygon extends Draw {
|
|||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
cache_84_position.pop()
|
cache_84_position.pop()
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -266,6 +273,7 @@ class DrawPolygon extends Draw {
|
|||||||
// console.log(this.cartesian3Towgs84(cartesian))
|
// console.log(this.cartesian3Towgs84(cartesian))
|
||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class DrawPolyline extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
let into
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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.event = new MouseEvent(this.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -104,7 +104,7 @@ class DrawPolyline extends Draw {
|
|||||||
let cache_positions = []
|
let cache_positions = []
|
||||||
let car = undefined
|
let car = undefined
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '3D'
|
into = '3D'
|
||||||
@ -120,7 +120,6 @@ class DrawPolyline extends Draw {
|
|||||||
}
|
}
|
||||||
cache_positions.push(cartesian)
|
cache_positions.push(cartesian)
|
||||||
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
||||||
|
|
||||||
if (cache_positions.length >= this.options.number) {
|
if (cache_positions.length >= this.options.number) {
|
||||||
let positions = []
|
let positions = []
|
||||||
cache_positions.forEach((item) => {
|
cache_positions.forEach((item) => {
|
||||||
@ -137,9 +136,13 @@ class DrawPolyline extends Draw {
|
|||||||
cb(null, positions, smoothPos)
|
cb(null, positions, smoothPos)
|
||||||
this.end()
|
this.end()
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// cb(cache_positions.length)
|
||||||
|
cb(null, cache_positions)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let positions = []
|
let positions = []
|
||||||
@ -158,7 +161,7 @@ class DrawPolyline extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
})
|
})
|
||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
@ -169,28 +172,30 @@ class DrawPolyline extends Draw {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.event.gesture_pinck_start_keyboard_ctrl(() => {
|
this.event.gesture_pinck_start_keyboard_ctrl(() => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.event.gesture_pinck_start((movement, cartesian) => {
|
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if (into === '2D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let startTime = new Date()
|
let startTime = new Date()
|
||||||
@ -225,6 +230,7 @@ class DrawPolyline extends Draw {
|
|||||||
cache_positions.push(cartesian)
|
cache_positions.push(cartesian)
|
||||||
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
this.points_ids.push(this.create_point(cartesian, this.viewer))
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -233,7 +239,7 @@ class DrawPolyline extends Draw {
|
|||||||
if (!this._is2D && this._sdk2D) {
|
if (!this._is2D && this._sdk2D) {
|
||||||
this.event2D = new MouseEvent(this._sdk2D)
|
this.event2D = new MouseEvent(this._sdk2D)
|
||||||
this.event2D.mouse_left((movement, cartesian) => {
|
this.event2D.mouse_left((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
into = '2D'
|
into = '2D'
|
||||||
@ -251,7 +257,7 @@ class DrawPolyline extends Draw {
|
|||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right((movement, cartesian) => {
|
this.event2D.mouse_right((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let positions = []
|
let positions = []
|
||||||
@ -270,7 +276,7 @@ class DrawPolyline extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
})
|
})
|
||||||
this.event2D.mouse_move((movement, cartesian) => {
|
this.event2D.mouse_move((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
@ -281,17 +287,18 @@ class DrawPolyline extends Draw {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
this.remove_entity(this.points_ids.pop()) //移除point
|
this.remove_entity(this.points_ids.pop()) //移除point
|
||||||
cache_positions.pop()
|
cache_positions.pop()
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.event2D.gesture_pinck_start_keyboard_ctrl(() => {
|
this.event2D.gesture_pinck_start_keyboard_ctrl(() => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.points_ids.length > 1) {
|
if (this.points_ids.length > 1) {
|
||||||
@ -302,7 +309,7 @@ class DrawPolyline extends Draw {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if (into === '3D') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let startTime = new Date()
|
let startTime = new Date()
|
||||||
@ -337,6 +344,7 @@ class DrawPolyline extends Draw {
|
|||||||
cache_positions.push(cartesian)
|
cache_positions.push(cartesian)
|
||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
|
||||||
this.positions = cache_positions.concat(cartesian)
|
this.positions = cache_positions.concat(cartesian)
|
||||||
|
cb(cache_positions.length)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class DrawRect extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
let into
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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.event = new MouseEvent(that.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -86,10 +86,10 @@ class DrawRect extends Draw {
|
|||||||
secondtPoint = wgs84
|
secondtPoint = wgs84
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cnt)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
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) => {
|
this.event.gesture_pinck_start((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if(into === '2D') {
|
||||||
return
|
return
|
||||||
@ -145,7 +158,9 @@ class DrawRect extends Draw {
|
|||||||
secondtPoint = wgs84
|
secondtPoint = wgs84
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb(cnt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -172,9 +187,10 @@ class DrawRect extends Draw {
|
|||||||
secondtPoint = wgs84
|
secondtPoint = wgs84
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cnt)
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
this.event2D.mouse_right((movement, cartesian) => {
|
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) => {
|
this.event2D.gesture_pinck_start((movement, cartesian) => {
|
||||||
if(into === '3D') {
|
if(into === '3D') {
|
||||||
return
|
return
|
||||||
@ -231,7 +260,9 @@ class DrawRect extends Draw {
|
|||||||
secondtPoint = wgs84
|
secondtPoint = wgs84
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
cb(null, that.rectObj, [firstPoint, secondtPoint])
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb(cnt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class DrawSector extends Draw {
|
|||||||
super.start()
|
super.start()
|
||||||
let into
|
let into
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
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.event = new MouseEvent(that.sdk)
|
||||||
this._sector_id = null; //扇形
|
this._sector_id = null; //扇形
|
||||||
this._positions = []; //活动点
|
this._positions = []; //活动点
|
||||||
@ -45,6 +45,7 @@ class DrawSector extends Draw {
|
|||||||
if (this._positions.length < 3) {
|
if (this._positions.length < 3) {
|
||||||
this.points_ids.push(this.create_point(cartesian));
|
this.points_ids.push(this.create_point(cartesian));
|
||||||
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
||||||
|
cb(this._positions.length)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.end()
|
this.end()
|
||||||
@ -90,6 +91,20 @@ class DrawSector extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null)
|
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) {
|
if (!this._is2D && this._sdk2D) {
|
||||||
this.event2D = new MouseEvent(this._sdk2D)
|
this.event2D = new MouseEvent(this._sdk2D)
|
||||||
this.event2D.mouse_left((movement, cartesian) => {
|
this.event2D.mouse_left((movement, cartesian) => {
|
||||||
@ -102,6 +117,7 @@ class DrawSector extends Draw {
|
|||||||
if (this._positions.length < 3) {
|
if (this._positions.length < 3) {
|
||||||
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer));
|
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer));
|
||||||
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
|
||||||
|
cb(this._positions.length)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.end()
|
this.end()
|
||||||
@ -147,6 +163,20 @@ class DrawSector extends Draw {
|
|||||||
this.end()
|
this.end()
|
||||||
cb(null)
|
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)
|
}, 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() {
|
destroy() {
|
||||||
if (this.handler)
|
if (this.handler)
|
||||||
this.handler.destroy() //关闭事件句柄
|
this.handler.destroy() //关闭事件句柄
|
||||||
|
|||||||
@ -76,6 +76,15 @@ function accordingToCameraHeight() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startDraw(sdk, showData) {
|
function startDraw(sdk, showData) {
|
||||||
|
if (!sdk || !sdk.viewer) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (showData) {
|
||||||
|
let terrainAvailability = sdk.viewer.terrainProvider.availability;
|
||||||
|
if (!terrainAvailability) {
|
||||||
|
return '未加载地形数据!'
|
||||||
|
}
|
||||||
|
}
|
||||||
show = showData
|
show = showData
|
||||||
|
|
||||||
Object.keys(paramData).forEach(item => {
|
Object.keys(paramData).forEach(item => {
|
||||||
@ -120,8 +129,28 @@ function reset() {
|
|||||||
supplementaryContourShow = false
|
supplementaryContourShow = false
|
||||||
supplementaryContourWidth = 1.0
|
supplementaryContourWidth = 1.0
|
||||||
supplementaryContourColor = '#d084d1'
|
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) {
|
async function dialog(sdk) {
|
||||||
_sdk = 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) {
|
if (options.repeat) {
|
||||||
repeat = Number(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 viewer = sdk.viewer
|
||||||
let tools = new Tools(sdk)
|
let tools = new Tools(sdk)
|
||||||
let active = 0
|
let active = 0
|
||||||
@ -72,6 +80,23 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
nameElm.value = name
|
nameElm.value = name
|
||||||
nameElm.addEventListener('input', () => {
|
nameElm.addEventListener('input', () => {
|
||||||
name = nameElm.value
|
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');
|
// let addListBtn = document.createElement('button');
|
||||||
@ -90,7 +115,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
func({
|
func({
|
||||||
name: name,
|
name: name,
|
||||||
points: newPoints,
|
points: newPoints,
|
||||||
repeat: repeat + ''
|
repeat: repeat + '',
|
||||||
|
defaultTime: defaultTimeDom.value,
|
||||||
|
totalTime: totalTimeElm.value
|
||||||
})
|
})
|
||||||
// _Dialog.clickSavePath && _Dialog.clickSavePath(
|
// _Dialog.clickSavePath && _Dialog.clickSavePath(
|
||||||
// {
|
// {
|
||||||
@ -117,7 +144,8 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
||||||
addBtn.addEventListener('click', () => {
|
addBtn.addEventListener('click', () => {
|
||||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
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 = {
|
let data = {
|
||||||
duration: time,
|
duration: time,
|
||||||
position: position,
|
position: position,
|
||||||
@ -127,9 +155,24 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
roll: viewer.camera.roll
|
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)
|
points.splice(active, 0, data)
|
||||||
addTrElm(data)
|
addTrElm(data)
|
||||||
i++
|
i++
|
||||||
|
|
||||||
|
func({
|
||||||
|
name: name,
|
||||||
|
points: points,
|
||||||
|
repeat: repeat + '',
|
||||||
|
defaultTime: defaultTimeDom.value,
|
||||||
|
totalTime: totalTimeElm.value
|
||||||
|
})
|
||||||
})
|
})
|
||||||
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
|
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
|
||||||
// modifyBtn.addEventListener('click', () => {
|
// modifyBtn.addEventListener('click', () => {
|
||||||
@ -147,17 +190,21 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
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']")
|
let repeatElm = contentElm.querySelector("input[name='repeat']")
|
||||||
isTotalTimeElm.addEventListener('change', () => {
|
isTotalTimeElm.addEventListener('click', () => {
|
||||||
let trList = tableBody.getElementsByClassName('tr')
|
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))
|
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
|
||||||
for (let i = 0; i < trList.length - 1; i++) {
|
for (let i = 0; i < trList.length - 1; i++) {
|
||||||
points[i].duration = time
|
points[i].duration = time
|
||||||
trList[i].querySelector("input[name='time']").value = time
|
trList[i].querySelector("input[name='time']").value = time
|
||||||
}
|
}
|
||||||
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
||||||
|
|
||||||
|
totalTimeElm.value = 0//点击应用后默认时间清零
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
totalTimeElm.addEventListener('blur', () => {
|
totalTimeElm.addEventListener('blur', () => {
|
||||||
@ -174,6 +221,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
}
|
}
|
||||||
trList[trList.length - 1].querySelector("input[name='time']").value = 0
|
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.checked = (repeat === Infinity ? true : false)
|
||||||
repeatElm.addEventListener('change', () => {
|
repeatElm.addEventListener('change', () => {
|
||||||
@ -184,6 +238,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
repeat = 0
|
repeat = 0
|
||||||
}
|
}
|
||||||
currentRepeat = repeat
|
currentRepeat = repeat
|
||||||
|
func({
|
||||||
|
name: name,
|
||||||
|
points: points,
|
||||||
|
repeat: repeat + '',
|
||||||
|
defaultTime: defaultTimeDom.value,
|
||||||
|
totalTime: totalTimeElm.value
|
||||||
|
})
|
||||||
_Dialog.changeRepeatStateCallBack && _Dialog.changeRepeatStateCallBack(repeatElm.checked)
|
_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}">
|
<input class="input time" type="number" title="" min="0" max="999.99" step="0.01" name="time" value="${data.duration}">
|
||||||
</div>
|
</div>
|
||||||
<div class="td action">
|
<div class="td action">
|
||||||
<button class="play">播放</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 class="delete">删除</span>
|
<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>
|
</div>
|
||||||
`
|
`
|
||||||
tr.addEventListener('click', (v) => {
|
tr.addEventListener('click', (v) => {
|
||||||
@ -245,16 +307,35 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
let e_play = tr.getElementsByClassName('play')[0]
|
let e_play = tr.getElementsByClassName('play')[0]
|
||||||
let e_delete = tr.getElementsByClassName('delete')[0]
|
let e_delete = tr.getElementsByClassName('delete')[0]
|
||||||
let e_time = tr.querySelector("input[name='time']")
|
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', () => {
|
e_play.addEventListener('click', () => {
|
||||||
for (let m = 0; m < trList.length; m++) {
|
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)
|
flyTo(sdk, points, m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
e_delete.addEventListener("click", (v) => {
|
e_delete.addEventListener("click", (v) => {
|
||||||
for (let m = 0; m < trList.length; m++) {
|
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.splice(m, 1)
|
||||||
points[points.length - 1] && (points[points.length - 1].duration = 0)
|
points[points.length - 1] && (points[points.length - 1].duration = 0)
|
||||||
tableBody.removeChild(tr)
|
tableBody.removeChild(tr)
|
||||||
@ -292,15 +373,21 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
// if (trList.length > 0) {
|
// if (trList.length > 0) {
|
||||||
// trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
|
// 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) => {
|
e_time.addEventListener('input', (v) => {
|
||||||
console.log(isTotalTimeElm, 'isTotalTimeElm')
|
|
||||||
isTotalTimeElm.checked = false
|
isTotalTimeElm.checked = false
|
||||||
data.duration = Number(e_time.value)
|
data.duration = Number(e_time.value)
|
||||||
if (data.duration < 0) {
|
if (data.duration < 0) {
|
||||||
data.duration = 0
|
data.duration = 0
|
||||||
}
|
}
|
||||||
console.log(data.duration, 'duration')
|
|
||||||
})
|
})
|
||||||
e_time.addEventListener('blur', () => {
|
e_time.addEventListener('blur', () => {
|
||||||
e_time.value = Number(Number(e_time.value).toFixed(2))
|
e_time.value = Number(Number(e_time.value).toFixed(2))
|
||||||
@ -322,7 +409,7 @@ const close = () => {
|
|||||||
// _DialogObject = null
|
// _DialogObject = null
|
||||||
// }
|
// }
|
||||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||||
if(contentElm) {
|
if (contentElm) {
|
||||||
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
||||||
let trList = tableBody.getElementsByClassName('tr')
|
let trList = tableBody.getElementsByClassName('tr')
|
||||||
for (let i = trList.length - 1; i >= 0; i--) {
|
for (let i = trList.length - 1; i >= 0; i--) {
|
||||||
@ -335,7 +422,6 @@ const close = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
||||||
console.log(noStart, points, 'noStart')
|
|
||||||
if (clickHandler) {
|
if (clickHandler) {
|
||||||
clickHandler.destroy()
|
clickHandler.destroy()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1434,9 +1434,12 @@ class MapPrint {
|
|||||||
document.body.appendChild(downloadElement);
|
document.body.appendChild(downloadElement);
|
||||||
downloadElement.click();
|
downloadElement.click();
|
||||||
document.body.removeChild(downloadElement);
|
document.body.removeChild(downloadElement);
|
||||||
|
setTimeout(() => {
|
||||||
|
exporting = false;
|
||||||
|
exportBtn.innerHTML = '打印';
|
||||||
|
}, 100);
|
||||||
}, 'image/png', 0.95);
|
}, 'image/png', 0.95);
|
||||||
exporting = false;
|
|
||||||
exportBtn.innerHTML = '打印';
|
|
||||||
// canvas2.toBlob(function (blob) {
|
// canvas2.toBlob(function (blob) {
|
||||||
// let imgBlobData = URL.createObjectURL(blob);
|
// let imgBlobData = URL.createObjectURL(blob);
|
||||||
// let downloadElement = document.createElement('a');
|
// let downloadElement = document.createElement('a');
|
||||||
|
|||||||
@ -50,7 +50,7 @@ const MouseCoordinate = (sdk, status) => {
|
|||||||
contentElm = document.createElement('div');
|
contentElm = document.createElement('div');
|
||||||
contentElm.style.position = 'absolute';
|
contentElm.style.position = 'absolute';
|
||||||
contentElm.style['z-index'] = 777;
|
contentElm.style['z-index'] = 777;
|
||||||
contentElm.style.color = '#ff0000';
|
contentElm.style.color = '#ffffff';
|
||||||
contentElm.style.left = '0px';
|
contentElm.style.left = '0px';
|
||||||
contentElm.style.top = '0px';
|
contentElm.style.top = '0px';
|
||||||
contentElm.style.width = '100%';
|
contentElm.style.width = '100%';
|
||||||
@ -172,7 +172,7 @@ const MouseCoordinate = (sdk, status) => {
|
|||||||
let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||||
let coordinateSystem = getCoordinateSystem()
|
let coordinateSystem = getCoordinateSystem()
|
||||||
let positionType = getDMS()
|
let positionType = getDMS()
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||||
position = {
|
position = {
|
||||||
x: degrees.lng,
|
x: degrees.lng,
|
||||||
y: degrees.lat,
|
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>`
|
// 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 || '度') {
|
switch (positionType || '度') {
|
||||||
case '度':
|
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;
|
break;
|
||||||
case '度分':
|
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;
|
break;
|
||||||
case '度分秒':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
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', coordinateSystem)
|
||||||
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees))
|
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees))
|
||||||
position = result.points[0]
|
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 {
|
else {
|
||||||
let coordinateSystem = getCoordinateSystem()
|
let coordinateSystem = getCoordinateSystem()
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||||
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>`
|
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 {
|
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()
|
animateUpdate()
|
||||||
|
|||||||
@ -11,8 +11,8 @@ import { getLeftClickState, getRightClickState, getMoveState } from "../../Globa
|
|||||||
import { openLeftClick, openRightClick, openMove } from "./ClickCallback"
|
import { openLeftClick, openRightClick, openMove } from "./ClickCallback"
|
||||||
|
|
||||||
|
|
||||||
let sdk2D
|
let sdk2D = null
|
||||||
let sdk3D
|
let sdk3D = null
|
||||||
let activeViewer
|
let activeViewer
|
||||||
let controlViewer
|
let controlViewer
|
||||||
let syncObject = {}
|
let syncObject = {}
|
||||||
@ -434,7 +434,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
|||||||
sdk2D.viewer.imageryLayers.lowerToBottom(layer2d)
|
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)
|
sdk2D.viewer.imageryLayers.raiseToTop(layer2d)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -491,18 +491,18 @@ async function syncPrimitives(primitive) {
|
|||||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
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
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!flag) {
|
// if (!flag) {
|
||||||
sdk2D.viewer.scene.primitives.remove(primitives2D[i])
|
// sdk2D.viewer.scene.primitives.remove(primitives2D[i])
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
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
|
flag = true
|
||||||
primitives2D[i].show = primitives3D[m].show
|
primitives2D[i].show = primitives3D[m].show
|
||||||
primitives2D[i].startColor = primitives3D[m].startColor
|
primitives2D[i].startColor = primitives3D[m].startColor
|
||||||
@ -518,9 +518,9 @@ async function syncPrimitives(primitive) {
|
|||||||
primitives2D[i].modelMatrix = primitives3D[m].modelMatrix
|
primitives2D[i].modelMatrix = primitives3D[m].modelMatrix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!flag) {
|
// if (!flag) {
|
||||||
sdk2D.viewer.scene.primitives.add(primitives3D[m])
|
// sdk2D.viewer.scene.primitives.add(primitives3D[m])
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ let state = false
|
|||||||
let scale = '1:100万'
|
let scale = '1:100万'
|
||||||
|
|
||||||
function SheetIndexStatusSwitch(sdk, s = false) {
|
function SheetIndexStatusSwitch(sdk, s = false) {
|
||||||
if(!sdk) {
|
if (!sdk) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!tools) {
|
if (!tools) {
|
||||||
@ -32,7 +32,7 @@ function SheetIndexStatusSwitch(sdk, s = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && sdk !== sdkD) {
|
if (sdkD && sdk !== sdkD) {
|
||||||
SheetIndexStatusSwitch(sdkD, s)
|
SheetIndexStatusSwitch(sdkD, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,6 @@ function open(sdk) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gridPrimitives) {
|
if (!gridPrimitives) {
|
||||||
gridPrimitives = new Cesium.PrimitiveCollection();
|
gridPrimitives = new Cesium.PrimitiveCollection();
|
||||||
gridPrimitives.name = 'SheetIndexGridPrimitives';
|
gridPrimitives.name = 'SheetIndexGridPrimitives';
|
||||||
@ -128,7 +127,6 @@ function open(sdk) {
|
|||||||
labelCollection = new Cesium.LabelCollection();
|
labelCollection = new Cesium.LabelCollection();
|
||||||
labelCollection.name = 'SheetIndexLabelCollection';
|
labelCollection.name = 'SheetIndexLabelCollection';
|
||||||
}
|
}
|
||||||
|
|
||||||
let stationaryFrames = 0;
|
let stationaryFrames = 0;
|
||||||
let maxRectangle = null;
|
let maxRectangle = null;
|
||||||
gridPrimitives.postRenderEvent = () => {
|
gridPrimitives.postRenderEvent = () => {
|
||||||
|
|||||||
@ -1067,7 +1067,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
|||||||
sdkD.viewer.imageryLayers.lowerToBottom(layerD)
|
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)
|
sdkD.viewer.imageryLayers.raiseToTop(layerD)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1112,7 +1112,7 @@ async function syncPrimitives(primitive) {
|
|||||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
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
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1123,7 +1123,7 @@ async function syncPrimitives(primitive) {
|
|||||||
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
for (let m = primitives3D.length - 1; m >= 1; m--) {
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let i = primitives2D.length - 1; i >= 1; i--) {
|
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
|
flag = true
|
||||||
primitives2D[i].show = primitives3D[m].show
|
primitives2D[i].show = primitives3D[m].show
|
||||||
primitives2D[i].startColor = primitives3D[m].startColor
|
primitives2D[i].startColor = primitives3D[m].startColor
|
||||||
|
|||||||
@ -156,19 +156,20 @@ function CesiumContainer(sdk, options) {
|
|||||||
infoElm.style.color = '#fff';
|
infoElm.style.color = '#fff';
|
||||||
infoElm.style.padding = '4px 10px';
|
infoElm.style.padding = '4px 10px';
|
||||||
infoElm.style['border-radius'] = '18px';
|
infoElm.style['border-radius'] = '18px';
|
||||||
|
infoElm.style.display = 'flex';
|
||||||
|
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>-</span>
|
<div><span>经度:</span><span>-</span></div>
|
||||||
<span>纬度:</span><span>-</span>
|
<div><span>纬度:</span><span>-</span></div>
|
||||||
<span>海拔高度:</span><span>-</span>
|
<div><span>高程:</span><span>-</span></div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>x:</span><span>-</span>
|
<div><span>x:</span><span>-</span></div>
|
||||||
<span>y:</span><span>-</span>
|
<div><span>y:</span><span>-</span></div>
|
||||||
<span>z:</span><span>-</span>
|
<div><span>z:</span><span>-</span></div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
sdk.viewer._element.appendChild(infoElm)
|
sdk.viewer._element.appendChild(infoElm)
|
||||||
@ -197,7 +198,7 @@ function CesiumContainer(sdk, options) {
|
|||||||
// let pos = sdk.viewer.scene.clampToHeight(_cartesian)
|
// let pos = sdk.viewer.scene.clampToHeight(_cartesian)
|
||||||
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
||||||
// position.alt = height
|
// position.alt = height
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||||
// infoElm.innerHTML = `
|
// infoElm.innerHTML = `
|
||||||
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||||
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||||
@ -206,23 +207,23 @@ function CesiumContainer(sdk, options) {
|
|||||||
switch (positionType || '度') {
|
switch (positionType || '度') {
|
||||||
case '度':
|
case '度':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
<div><span>经度:</span><span>${Number(position.lng.toFixed(8))}° </span></div>
|
||||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
<div><span>纬度:</span><span>${Number(position.lat.toFixed(8))}° </span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分':
|
case '度分':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分秒':
|
case '度分秒':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>高程:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -232,11 +233,12 @@ function CesiumContainer(sdk, options) {
|
|||||||
else {
|
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', coordinateSystem)
|
||||||
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||||
|
|
||||||
if (result.points.length) {
|
if (result.points.length) {
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
<div><span>x:</span><span>${Number(result.points[0].x.toFixed(2))}</span></div>
|
||||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
<div><span>y:</span><span>${Number(result.points[0].y.toFixed(2))}</span></div>
|
||||||
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
<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)
|
item.entity && (item.entity.splitDirection = value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -773,7 +774,7 @@ function setCoordinateSystem(sdk, epsg) {
|
|||||||
let tools = new Tools()
|
let tools = new Tools()
|
||||||
let proj = sdk.proj
|
let proj = sdk.proj
|
||||||
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') {
|
||||||
// infoElm.innerHTML = `
|
// infoElm.innerHTML = `
|
||||||
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||||
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
||||||
@ -782,23 +783,23 @@ function setCoordinateSystem(sdk, epsg) {
|
|||||||
switch (positionType || '度') {
|
switch (positionType || '度') {
|
||||||
case '度':
|
case '度':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
<div><span>经度:</span><span>${Number(position.lng.toFixed(8))}° </span></div>
|
||||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
<div><span>纬度:</span><span>${Number(position.lat.toFixed(8))}° </span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分':
|
case '度分':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分秒':
|
case '度分秒':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
default:
|
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', coordinateSystem)
|
||||||
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
<div><span>x:</span><span>${Number(result.points[0].x.toFixed(2))}</span></div>
|
||||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
<div><span>y:</span><span>${Number(result.points[0].y.toFixed(2))}</span></div>
|
||||||
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
<div><span>z:</span><span>${Number(result.points[0].z.toFixed(2))}</span></div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -871,7 +872,7 @@ function getDMS() {
|
|||||||
return positionType
|
return positionType
|
||||||
}
|
}
|
||||||
function setDMS(sdk, type) {
|
function setDMS(sdk, type) {
|
||||||
if (coordinateSystem !== 'EPSG:4326') {
|
if (coordinateSystem !== 'EPSG:4326' && coordinateSystem !== 'EPSG:4490') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
positionType = type
|
positionType = type
|
||||||
@ -888,23 +889,23 @@ function setDMS(sdk, type) {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case '度':
|
case '度':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
<div><span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span></div>
|
||||||
<span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
|
<div><span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分':
|
case '度分':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, true)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, true)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
case '度分秒':
|
case '度分秒':
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span>
|
<div><span>经度:</span><span>${proj.degreesToDMS(position.lng, false)}</span></div>
|
||||||
<span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span>
|
<div><span>纬度:</span><span>${proj.degreesToDMS(position.lat, false)}</span></div>
|
||||||
<span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span>
|
<div><span>海拔高度:</span><span>${Number(position.alt.toFixed(2))}米</span></div>
|
||||||
`
|
`
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -67,12 +67,13 @@ import {
|
|||||||
on as multiViewportModeOn,
|
on as multiViewportModeOn,
|
||||||
off as multiViewportModeOff,
|
off as multiViewportModeOff,
|
||||||
get2DView,
|
get2DView,
|
||||||
getSdk as getSdk2
|
getSdk as getSdk2,
|
||||||
|
syncData
|
||||||
} from '../Global/MultiViewportMode'
|
} from '../Global/MultiViewportMode'
|
||||||
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
||||||
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
||||||
import { dialog as ContourDialog, startDraw as ContourStartDraw, reset as ContourReset } from '../Global/Contour'
|
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 } from '../Global/SplitScreen'
|
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk, syncSplitData } from '../Global/SplitScreen'
|
||||||
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
||||||
|
|
||||||
import { AnalysisClear, SectionClear } from '../Obj/Analysis/clear'
|
import { AnalysisClear, SectionClear } from '../Obj/Analysis/clear'
|
||||||
@ -313,7 +314,8 @@ if (!window.YJ) {
|
|||||||
on: multiViewportModeOn,
|
on: multiViewportModeOn,
|
||||||
off: multiViewportModeOff,
|
off: multiViewportModeOff,
|
||||||
get2DView,
|
get2DView,
|
||||||
getSdk: getSdk2
|
getSdk: getSdk2,
|
||||||
|
syncData: syncData
|
||||||
},
|
},
|
||||||
MouseCoordinate,
|
MouseCoordinate,
|
||||||
MouseRightMenu,
|
MouseRightMenu,
|
||||||
@ -348,11 +350,13 @@ if (!window.YJ) {
|
|||||||
on: SplitScreenOn,
|
on: SplitScreenOn,
|
||||||
off: SplitScreenOff,
|
off: SplitScreenOff,
|
||||||
setActiveId: SplitScreenSetActiveId,
|
setActiveId: SplitScreenSetActiveId,
|
||||||
getSdk
|
getSdk,
|
||||||
|
syncData: syncSplitData
|
||||||
},
|
},
|
||||||
Contour: ContourDialog,
|
Contour: ContourDialog,
|
||||||
ContourStartDraw,
|
ContourStartDraw,
|
||||||
ContourReset
|
ContourReset,
|
||||||
|
ContourSetVal
|
||||||
}, //测量
|
}, //测量
|
||||||
Measure: {
|
Measure: {
|
||||||
GetMeasureStatus: () => {
|
GetMeasureStatus: () => {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import Measure from "../index";
|
|||||||
|
|
||||||
class MeasureAngle extends Measure {
|
class MeasureAngle extends Measure {
|
||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk, { text: "左键开始,右键取消" });
|
super(sdk, { text: "左键单击确定起点位置,右键单击取消夹角测量!" });
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.arcPositions = []
|
this.arcPositions = []
|
||||||
@ -113,6 +113,7 @@ class MeasureAngle extends Measure {
|
|||||||
if (this.ids.length === 0) {
|
if (this.ids.length === 0) {
|
||||||
//需要创建一个线
|
//需要创建一个线
|
||||||
this.line_id = this.createPolyline()
|
this.line_id = this.createPolyline()
|
||||||
|
this.tip.set_text('左键单击确定角点位置,右键单击取消夹角测量!')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ids.push(this.create_point(car))
|
this.ids.push(this.create_point(car))
|
||||||
@ -122,6 +123,7 @@ class MeasureAngle extends Measure {
|
|||||||
this.positions = this.cachePositions.concat(car)
|
this.positions = this.cachePositions.concat(car)
|
||||||
}
|
}
|
||||||
if (this.ids.length === 2) {
|
if (this.ids.length === 2) {
|
||||||
|
this.tip.set_text('左键单击确定终点位置,完成夹角测量!')
|
||||||
this.label_id = Cesium.createGuid()
|
this.label_id = Cesium.createGuid()
|
||||||
this.arc_id = Cesium.createGuid()
|
this.arc_id = Cesium.createGuid()
|
||||||
let p = this.cartesian3Towgs84(car, this.viewer)
|
let p = this.cartesian3Towgs84(car, this.viewer)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class MeasureAzimuth extends Measure {
|
|||||||
* @description 方位角测量
|
* @description 方位角测量
|
||||||
* */
|
* */
|
||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk, { text: "左键开始,右键取消" });
|
super(sdk, { text: "左键单击确定控制点位置,右键单击取消方位角测量!" });
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.arcPositions = []
|
this.arcPositions = []
|
||||||
@ -80,6 +80,7 @@ class MeasureAzimuth extends Measure {
|
|||||||
//需要创建一个线
|
//需要创建一个线
|
||||||
this.line_id = this.createPolyline()
|
this.line_id = this.createPolyline()
|
||||||
}
|
}
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,完成方位角测量!')
|
||||||
this.tip.setPosition(car, movement.position.x, movement.position.y)
|
this.tip.setPosition(car, movement.position.x, movement.position.y)
|
||||||
if (this.cachePositions.length) {
|
if (this.cachePositions.length) {
|
||||||
this.positions = this.cachePositions.concat(car)
|
this.positions = this.cachePositions.concat(car)
|
||||||
|
|||||||
@ -216,6 +216,7 @@ class MeasureDistance extends Measure {
|
|||||||
super.start()
|
super.start()
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地距离测量!')
|
||||||
|
|
||||||
|
|
||||||
let leftEvent = async (movement, car) => {
|
let leftEvent = async (movement, car) => {
|
||||||
@ -234,6 +235,7 @@ class MeasureDistance extends Measure {
|
|||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地距离测量!')
|
||||||
await this.computeDisByTowPoint(pre_p, cur_point)
|
await this.computeDisByTowPoint(pre_p, cur_point)
|
||||||
} else {
|
} else {
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class MeasureHeight extends Measure {
|
|||||||
* @description 高度测量
|
* @description 高度测量
|
||||||
* */
|
* */
|
||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk, {text: "左键开始,右键取消"});
|
super(sdk, {text: "左键单击确定控制点位置,右键单击取消垂直高度测量!"});
|
||||||
}
|
}
|
||||||
|
|
||||||
static create_polygon(that) {
|
static create_polygon(that) {
|
||||||
@ -120,6 +120,7 @@ class MeasureHeight extends Measure {
|
|||||||
this.ids.push(MeasureHeight.create_polygon(this))
|
this.ids.push(MeasureHeight.create_polygon(this))
|
||||||
this.ids.push(MeasureHeight.create_point(this, cartesian))
|
this.ids.push(MeasureHeight.create_point(this, cartesian))
|
||||||
}
|
}
|
||||||
|
this.tip.set_text('左键单击确定终点位置,完成垂直高度测量!')
|
||||||
count++
|
count++
|
||||||
this.tip.setPosition(cartesian, movement.position.x, movement.position.y)
|
this.tip.setPosition(cartesian, movement.position.x, movement.position.y)
|
||||||
if (count === 2) {
|
if (count === 2) {
|
||||||
@ -131,7 +132,7 @@ class MeasureHeight extends Measure {
|
|||||||
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||||
this.text = "相对高度:" + this.height + " 米"
|
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.ids.push(MeasureHeight.create_point(this, cartesian, {label: {text: "半径:" + this.circleRadius + " 米"}}))
|
||||||
this.end()
|
this.end()
|
||||||
@ -148,7 +149,7 @@ class MeasureHeight extends Measure {
|
|||||||
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||||
this.text = "相对高度:" + this.height + " 米"
|
this.text = "相对高度:" + this.height + " 米"
|
||||||
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
// this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class MeasureLocation extends Measure {
|
|||||||
* @description 坐标测量
|
* @description 坐标测量
|
||||||
* */
|
* */
|
||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk, {text: ""});
|
super(sdk, { text: "" });
|
||||||
this.defaultColor = "#f11515"
|
this.defaultColor = "#f11515"
|
||||||
this.locationID = this.randomString()
|
this.locationID = this.randomString()
|
||||||
this.position = new Cesium.Cartesian3()
|
this.position = new Cesium.Cartesian3()
|
||||||
@ -103,16 +103,16 @@ class MeasureLocation extends Measure {
|
|||||||
let leftEvent = (movement, cartesian) => {
|
let leftEvent = (movement, cartesian) => {
|
||||||
this.position = cartesian
|
this.position = cartesian
|
||||||
let entity = this.viewer.entities.getById(this.locationID)
|
let entity = this.viewer.entities.getById(this.locationID)
|
||||||
if(entity) {
|
if (entity) {
|
||||||
entity.show = true
|
entity.show = true
|
||||||
}
|
}
|
||||||
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
let coordinateSystem = getCoordinateSystem()
|
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))}`
|
this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}`
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let result = this.convert([{x: p.lng, y: p.lat, z: p.alt}], 'EPSG:4326', coordinateSystem)
|
let result = this.convert([{ x: p.lng, y: p.lat, z: p.alt }], 'EPSG:4326', coordinateSystem)
|
||||||
this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}`
|
this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}`
|
||||||
}
|
}
|
||||||
this.end()
|
this.end()
|
||||||
@ -125,17 +125,17 @@ class MeasureLocation extends Measure {
|
|||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
this.tip.setPosition(cartesian, movement.endPosition.x, movement.endPosition.y)
|
this.tip.setPosition(cartesian, movement.endPosition.x, movement.endPosition.y)
|
||||||
let entity = this.viewer.entities.getById(this.locationID)
|
let entity = this.viewer.entities.getById(this.locationID)
|
||||||
if(entity) {
|
if (entity) {
|
||||||
entity.show = true
|
entity.show = true
|
||||||
}
|
}
|
||||||
this.position = cartesian
|
this.position = cartesian
|
||||||
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
let p = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
let coordinateSystem = getCoordinateSystem()
|
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))}`
|
this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}`
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let result = this.convert([{x: p.lng, y: p.lat, z: p.alt}], 'EPSG:4326', coordinateSystem)
|
let result = this.convert([{ x: p.lng, y: p.lat, z: p.alt }], 'EPSG:4326', coordinateSystem)
|
||||||
this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}`
|
this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -158,6 +158,7 @@ class MeasureProjectionDistance extends Measure {
|
|||||||
super.start()
|
super.start()
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影距离测量!')
|
||||||
|
|
||||||
let leftEvent = async (movement, car) => {
|
let leftEvent = async (movement, car) => {
|
||||||
if (this.ids.length === 0) {
|
if (this.ids.length === 0) {
|
||||||
@ -178,6 +179,7 @@ class MeasureProjectionDistance extends Measure {
|
|||||||
let text = "投影距离:" + cur_len + " 米"
|
let text = "投影距离:" + cur_len + " 米"
|
||||||
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影距离测量!')
|
||||||
} else {
|
} else {
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
this.ids.push(MeasureProjectionDistance.create_point(car, {show: false}, this))
|
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.event.mouse_move((movement, car) => {
|
||||||
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
|
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
|
||||||
this.positions = this.cachePositions.concat(car)
|
this.positions = this.cachePositions.concat(car)
|
||||||
if (this.cachePositions.length) {
|
// if (this.cachePositions.length) {
|
||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
// let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], 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 cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
let text = "当前投影距离:" + cur_len + " 米"
|
// let text = "当前投影距离:" + cur_len + " 米"
|
||||||
this.tip.set_text(text)
|
// this.tip.set_text(text)
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
this.event.mouse_right(rightEvent)
|
this.event.mouse_right(rightEvent)
|
||||||
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
||||||
|
|||||||
@ -160,6 +160,7 @@ class MeasureSlopeDistance extends Measure {
|
|||||||
super.start()
|
super.start()
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消坡度测量!')
|
||||||
|
|
||||||
let leftEvent = (movement, car) => {
|
let leftEvent = (movement, car) => {
|
||||||
if (this.ids.length === 0) {
|
if (this.ids.length === 0) {
|
||||||
@ -179,6 +180,7 @@ class MeasureSlopeDistance extends Measure {
|
|||||||
//计算坡度
|
//计算坡度
|
||||||
this.computeAngle(pre_p, cur_point)
|
this.computeAngle(pre_p, cur_point)
|
||||||
}
|
}
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击完成坡度测量!')
|
||||||
} else {
|
} else {
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
this.ids.push(MeasureSlopeDistance.create_point(car, {}, this))
|
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.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
|
||||||
this.positions = this.cachePositions.concat(cartesian)
|
this.positions = this.cachePositions.concat(cartesian)
|
||||||
if (this.cachePositions.length) {
|
// if (this.cachePositions.length) {
|
||||||
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
// let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let d1 = this.computeDistance2([pre_p, cur_point])
|
// let d1 = this.computeDistance2([pre_p, cur_point])
|
||||||
let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
// let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
// let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
let cosAlpha = d1 / d3
|
// let cosAlpha = d1 / d3
|
||||||
let acos = Math.acos(cosAlpha)
|
// let acos = Math.acos(cosAlpha)
|
||||||
let angle = this.radiansToDegrees(acos)
|
// let angle = this.radiansToDegrees(acos)
|
||||||
let label = "坡度:" + angle.toFixed(2) + "°"
|
// let label = "坡度:" + angle.toFixed(2) + "°"
|
||||||
this.tip.set_text(label)
|
// this.tip.set_text(label)
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
this.event.mouse_right(rightEvent)
|
this.event.mouse_right(rightEvent)
|
||||||
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
this.event.mouse_right_keyboard_ctrl((movement, car) => {
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class MeasureTdArea extends Measure {
|
|||||||
this.text = ""
|
this.text = ""
|
||||||
this.center = new Cesium.Cartesian3()
|
this.center = new Cesium.Cartesian3()
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地面积测量!')
|
||||||
let height = 0
|
let height = 0
|
||||||
let text
|
let text
|
||||||
|
|
||||||
@ -96,6 +97,10 @@ class MeasureTdArea extends Measure {
|
|||||||
|
|
||||||
this.positions = this.cachePositions.concat({ ...car })
|
this.positions = this.cachePositions.concat({ ...car })
|
||||||
this.tip.setPosition({ ...car }, movement.position.x, movement.position.y)
|
this.tip.setPosition({ ...car }, movement.position.x, movement.position.y)
|
||||||
|
|
||||||
|
if (this.positions.length > 3) {
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地面积测量!')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let rightEvent = (movement, car) => {
|
let rightEvent = (movement, car) => {
|
||||||
this.positions = this.cachePositions
|
this.positions = this.cachePositions
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class MeasureTriangle extends Measure {
|
|||||||
* @description 三角测量
|
* @description 三角测量
|
||||||
* */
|
* */
|
||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk);
|
super(sdk, {text: "左键单击确定控制点位置,右键单击取消三角测量!"});
|
||||||
}
|
}
|
||||||
|
|
||||||
cal_center(positions) {
|
cal_center(positions) {
|
||||||
@ -170,6 +170,7 @@ class MeasureTriangle extends Measure {
|
|||||||
let leftEvent = (movement, car) => {
|
let leftEvent = (movement, car) => {
|
||||||
xiebian_line_positions.push(car)
|
xiebian_line_positions.push(car)
|
||||||
|
|
||||||
|
this.tip.set_text('左键单击确定终点位置,完成三角测量!')
|
||||||
if (this.ids.length === 0) {//创建三角形
|
if (this.ids.length === 0) {//创建三角形
|
||||||
first_point = this.cartesian3Towgs84(car, this.viewer)
|
first_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
this.createPolyline(shuiping_line_id,)
|
this.createPolyline(shuiping_line_id,)
|
||||||
|
|||||||
@ -85,6 +85,7 @@ class MeasureTyArea extends Measure {
|
|||||||
this.ids = []
|
this.ids = []
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.text = ""
|
this.text = ""
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影面积测量!')
|
||||||
this.center = new Cesium.Cartesian3()
|
this.center = new Cesium.Cartesian3()
|
||||||
this.cachePositions = []
|
this.cachePositions = []
|
||||||
let height = 0
|
let height = 0
|
||||||
@ -117,6 +118,9 @@ class MeasureTyArea extends Measure {
|
|||||||
lastcneter = this.center
|
lastcneter = this.center
|
||||||
this.text = "投影面积:" + area + " ㎡"
|
this.text = "投影面积:" + area + " ㎡"
|
||||||
}
|
}
|
||||||
|
if(this.positions.length > 3) {
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影面积测量!')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.event.mouse_left(leftEvent)
|
this.event.mouse_left(leftEvent)
|
||||||
this.event.mouse_move((movement, car) => {
|
this.event.mouse_move((movement, car) => {
|
||||||
|
|||||||
@ -38,19 +38,14 @@ class CircleViewShed extends Tools {
|
|||||||
this.tools = new Tools(sdk)
|
this.tools = new Tools(sdk)
|
||||||
YJ.Analysis.AnalysesResults.push(this)
|
YJ.Analysis.AnalysesResults.push(this)
|
||||||
// CircleViewShed.edit(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)
|
// CircleViewShed.create(this)
|
||||||
}
|
}
|
||||||
draw() {
|
draw() {
|
||||||
|
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||||
|
if (!terrainAvailability) {
|
||||||
|
return '未加载地形数据!'
|
||||||
|
}
|
||||||
CircleViewShed.create(this)
|
CircleViewShed.create(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,13 +110,7 @@ class CircleViewShed extends Tools {
|
|||||||
static create(that) {
|
static create(that) {
|
||||||
let terrainAvailability = that.viewer.terrainProvider.availability;
|
let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||||
if (!terrainAvailability) {
|
if (!terrainAvailability) {
|
||||||
that.tools.message({ type: 'warning', text: '未加载地形数据!' })
|
return '未加载地形数据!'
|
||||||
// window.ELEMENT && window.ELEMENT.Message({
|
|
||||||
// message: '未加载地形数据!',
|
|
||||||
// type: 'warning',
|
|
||||||
// duration: 1500
|
|
||||||
// });
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
let count = 0
|
let count = 0
|
||||||
if (!YJ.Measure.GetMeasureStatus()) {
|
if (!YJ.Measure.GetMeasureStatus()) {
|
||||||
@ -129,10 +118,20 @@ class CircleViewShed extends Tools {
|
|||||||
that._DialogObject.close()
|
that._DialogObject.close()
|
||||||
that._DialogObject = null
|
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) => {
|
Draw.start(async (a, options) => {
|
||||||
// that.center = options.center
|
// that.center = options.center
|
||||||
if (!options) {
|
if (!options) {
|
||||||
|
switch (a) {
|
||||||
|
case 0:
|
||||||
|
Draw.tipText = '左键单击确定中心点位置,右键单击取消区域绘制!CTRL+右键单击撤销'
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Draw.tipText = '左键单击确定圆形视域半径,完成圆形视域分析!'
|
||||||
|
break;
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
that.radius = options.radius
|
that.radius = options.radius
|
||||||
@ -152,47 +151,47 @@ class CircleViewShed extends Tools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async edit(that) {
|
// static async edit(that) {
|
||||||
if (that._DialogObject && that._DialogObject.close) {
|
// if (that._DialogObject && that._DialogObject.close) {
|
||||||
that._DialogObject.close()
|
// that._DialogObject.close()
|
||||||
that._DialogObject = null
|
// that._DialogObject = null
|
||||||
}
|
// }
|
||||||
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||||
title: '圆形视域分析',
|
// title: '圆形视域分析',
|
||||||
left: '180px',
|
// left: '180px',
|
||||||
top: '100px',
|
// top: '100px',
|
||||||
closeCallBack: () => {
|
// closeCallBack: () => {
|
||||||
that.Dialog.closeCallBack && that.Dialog.closeCallBack()
|
// that.Dialog.closeCallBack && that.Dialog.closeCallBack()
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
// YJ.Measure.SetMeasureStatus(false)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
await that._DialogObject.init()
|
// await that._DialogObject.init()
|
||||||
that._DialogObject._element.body.className =
|
// that._DialogObject._element.body.className =
|
||||||
that._DialogObject._element.body.className + ' circle-view-shed'
|
// that._DialogObject._element.body.className + ' circle-view-shed'
|
||||||
let contentElm = document.createElement('div')
|
// let contentElm = document.createElement('div')
|
||||||
contentElm.innerHTML = html()
|
// contentElm.innerHTML = html()
|
||||||
that._DialogObject.contentAppChild(contentElm)
|
// that._DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
let drawElm = document.createElement('button')
|
// let drawElm = document.createElement('button')
|
||||||
drawElm.innerHTML = '绘制'
|
// drawElm.innerHTML = '绘制'
|
||||||
drawElm.addEventListener('click', () => {
|
// drawElm.addEventListener('click', () => {
|
||||||
let terrainAvailability = that.viewer.terrainProvider.availability;
|
// let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||||
if (!terrainAvailability) {
|
// if (!terrainAvailability) {
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
// window.ELEMENT && window.ELEMENT.Message({
|
||||||
message: '未加载地形数据!',
|
// message: '未加载地形数据!',
|
||||||
type: 'warning',
|
// type: 'warning',
|
||||||
duration: 1500
|
// duration: 1500
|
||||||
});
|
// });
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
CircleViewShed.create(that)
|
// CircleViewShed.create(that)
|
||||||
})
|
// })
|
||||||
that._DialogObject.footAppChild(drawElm)
|
// that._DialogObject.footAppChild(drawElm)
|
||||||
|
|
||||||
let all_elm = contentElm.getElementsByTagName('*')
|
// let all_elm = contentElm.getElementsByTagName('*')
|
||||||
that._EventBinding.on(that, all_elm)
|
// that._EventBinding.on(that, all_elm)
|
||||||
that._elms = that._EventBinding.element
|
// that._elms = that._EventBinding.element
|
||||||
}
|
// }
|
||||||
|
|
||||||
analyse() {
|
analyse() {
|
||||||
// this.destroy()
|
// this.destroy()
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class ContourAnalysis {
|
|||||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||||
if (!terrainAvailability) {
|
if (!terrainAvailability) {
|
||||||
this.error = '未加载地形数据!'
|
this.error = '未加载地形数据!'
|
||||||
this.tools.message({ type: 'warning', text: this.error })
|
// this.tools.message({ type: 'warning', text: this.error })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.positions = options.positions
|
this.positions = options.positions
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class CutFillAnalysis {
|
|||||||
}
|
}
|
||||||
this.entities = []
|
this.entities = []
|
||||||
this.tools = new Tools(this.sdk)
|
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)
|
YJ.Analysis.AnalysesResults.push(this)
|
||||||
// CutFillAnalysis.EditBox(this)
|
// CutFillAnalysis.EditBox(this)
|
||||||
}
|
}
|
||||||
@ -37,11 +37,12 @@ class CutFillAnalysis {
|
|||||||
this.clean()
|
this.clean()
|
||||||
this.Draw.start((a, positions) => {
|
this.Draw.start((a, positions) => {
|
||||||
if (!positions || positions.length < 3) {
|
if (!positions || positions.length < 3) {
|
||||||
let _error = '最少需要三个坐标!'
|
if (a >= 3) {
|
||||||
this.tools.message({
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
|
||||||
text: _error,
|
}
|
||||||
type: 'warning',
|
else {
|
||||||
});
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class Profile extends Draw {
|
|||||||
console.warn('上一次测量未结束')
|
console.warn('上一次测量未结束')
|
||||||
} else {
|
} else {
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
that.tip = new MouseTip('左键确定,右键取消', that.sdk)
|
that.tip = new MouseTip('左键点击确定起点位置,右键点击取消绘制!', that.sdk)
|
||||||
that.event = new MouseEvent(that.sdk)
|
that.event = new MouseEvent(that.sdk)
|
||||||
that.positions = []
|
that.positions = []
|
||||||
that.points_ids = [] //存放左键点击时临时添加的point的id
|
that.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
@ -35,6 +35,7 @@ class Profile extends Draw {
|
|||||||
let car = undefined
|
let car = undefined
|
||||||
that.event.mouse_left(async (movement, cartesian) => {
|
that.event.mouse_left(async (movement, cartesian) => {
|
||||||
try {
|
try {
|
||||||
|
that.tip.set_text('左键点击确定终点位置,右键点击取消绘制!')
|
||||||
if (!that.entityHasCreated) {
|
if (!that.entityHasCreated) {
|
||||||
Profile.create_polyline(that)
|
Profile.create_polyline(that)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,20 +10,18 @@ class SlopeAspect extends Tools {
|
|||||||
constructor(sdk) {
|
constructor(sdk) {
|
||||||
super(sdk)
|
super(sdk)
|
||||||
this.viewer = sdk.viewer;
|
this.viewer = sdk.viewer;
|
||||||
|
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||||
|
if (!terrainAvailability) {
|
||||||
|
this.error = '未加载地形数据!'
|
||||||
|
return
|
||||||
|
}
|
||||||
this.event
|
this.event
|
||||||
this.result = []; //存储创建的坡度分析结果,primitive集合
|
this.result = []; //存储创建的坡度分析结果,primitive集合
|
||||||
this.handler = undefined;
|
this.handler = undefined;
|
||||||
this.toolTip = "";
|
this.toolTip = "";
|
||||||
this.tools = new Tools(sdk)
|
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)
|
YJ.Analysis.AnalysesResults.push(this)
|
||||||
this.Draw = new DrawPolygon(this.sdk)
|
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点' })
|
||||||
// this.createNew4Distance()
|
// this.createNew4Distance()
|
||||||
this.createNew4Num(50)
|
this.createNew4Num(50)
|
||||||
}
|
}
|
||||||
@ -36,8 +34,13 @@ class SlopeAspect extends Tools {
|
|||||||
const $this = this;
|
const $this = this;
|
||||||
const viewer = this.viewer;
|
const viewer = this.viewer;
|
||||||
this.Draw.start((e, positions) => {
|
this.Draw.start((e, positions) => {
|
||||||
if (!positions || positions.length <= 2) {
|
if (!positions || positions.length < 3) {
|
||||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
if (e >= 3) {
|
||||||
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let boundary = [];
|
let boundary = [];
|
||||||
@ -66,8 +69,13 @@ class SlopeAspect extends Tools {
|
|||||||
createNew4Num(n) {
|
createNew4Num(n) {
|
||||||
let num = n
|
let num = n
|
||||||
this.Draw.start((e, positions) => {
|
this.Draw.start((e, positions) => {
|
||||||
if (!positions || positions.length <= 2) {
|
if (!positions || positions.length < 3) {
|
||||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
if (e >= 3) {
|
||||||
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let boundary = [];
|
let boundary = [];
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class Submerge extends Tools {
|
|||||||
* @param sdk
|
* @param sdk
|
||||||
* @description 淹没效果
|
* @description 淹没效果
|
||||||
* */
|
* */
|
||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}, callback) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.sdk = sdk
|
this.sdk = sdk
|
||||||
this.options = {}
|
this.options = {}
|
||||||
@ -21,37 +21,30 @@ class Submerge extends Tools {
|
|||||||
this.currentWaterLaver
|
this.currentWaterLaver
|
||||||
this.color = '#00d9ff66'
|
this.color = '#00d9ff66'
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this.Draw = new DrawPolygon(this.sdk)
|
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
|
||||||
this.positions
|
this.positions
|
||||||
this.status = true
|
this.status = true
|
||||||
this.area = 0
|
this.area = 0
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.tools = new Tools(this.sdk)
|
this.tools = new Tools(this.sdk)
|
||||||
|
this.callback = callback
|
||||||
YJ.Analysis.AnalysesResults.push(this)
|
YJ.Analysis.AnalysesResults.push(this)
|
||||||
// Submerge.EditBox(this)
|
// Submerge.EditBox(this)
|
||||||
// Submerge.create(this)
|
// Submerge.create(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(that) {
|
static create(that, func) {
|
||||||
that.Draw.start((a, positions) => {
|
that.Draw.start((a, positions) => {
|
||||||
if (!positions || positions.length < 3) {
|
if (!positions || positions.length < 3) {
|
||||||
let _error = '至少需要三个坐标!'
|
if (a >= 3) {
|
||||||
that.tools.message({
|
that.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
|
||||||
text: _error,
|
}
|
||||||
type: 'warning',
|
else {
|
||||||
});
|
that.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
that.destroy()
|
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 = []
|
let fromDegreesArray = []
|
||||||
that.positions = positions
|
that.positions = positions
|
||||||
that._positions = positions
|
that._positions = positions
|
||||||
@ -99,7 +92,7 @@ class Submerge extends Tools {
|
|||||||
|
|
||||||
that.waterLevel = that.options.maxWaterLevel - that.options.minWaterLevel
|
that.waterLevel = that.options.maxWaterLevel - that.options.minWaterLevel
|
||||||
that.options.waterVolume = Number((that.waterLevel * that.area).toFixed(4))
|
that.options.waterVolume = Number((that.waterLevel * that.area).toFixed(4))
|
||||||
|
func && func(that.options.waterVolume)
|
||||||
that.clickCallBack(that.area, that._positions)
|
that.clickCallBack(that.area, that._positions)
|
||||||
// let contentElm = that._DialogObject._element.body
|
// let contentElm = that._DialogObject._element.body
|
||||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||||
@ -110,8 +103,8 @@ class Submerge extends Tools {
|
|||||||
// Submerge.EditBox(that)
|
// Submerge.EditBox(that)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
draw() {
|
draw(func) {
|
||||||
Submerge.create(this)
|
Submerge.create(this, func)
|
||||||
}
|
}
|
||||||
|
|
||||||
static async EditBox(that) {
|
static async EditBox(that) {
|
||||||
@ -276,6 +269,7 @@ class Submerge extends Tools {
|
|||||||
value = 0
|
value = 0
|
||||||
}
|
}
|
||||||
that.options.waterVolume = Math.floor(value * 10000) / 10000;
|
that.options.waterVolume = Math.floor(value * 10000) / 10000;
|
||||||
|
|
||||||
if (that.area) {
|
if (that.area) {
|
||||||
that.waterLevel = Number((that.options.waterVolume / that.area).toFixed(4))
|
that.waterLevel = Number((that.options.waterVolume / that.area).toFixed(4))
|
||||||
that.options.maxWaterLevel = that.options.minWaterLevel + that.waterLevel
|
that.options.maxWaterLevel = that.options.minWaterLevel + that.waterLevel
|
||||||
@ -338,7 +332,6 @@ class Submerge extends Tools {
|
|||||||
}
|
}
|
||||||
set onEnd(val) {
|
set onEnd(val) {
|
||||||
if (val && typeof val !== 'function') {
|
if (val && typeof val !== 'function') {
|
||||||
console.error('val:', val, '不是一个function')
|
|
||||||
} else {
|
} else {
|
||||||
this.clickCallBack = val
|
this.clickCallBack = val
|
||||||
}
|
}
|
||||||
@ -384,13 +377,21 @@ class Submerge extends Tools {
|
|||||||
|
|
||||||
|
|
||||||
move() {
|
move() {
|
||||||
if (this.TweenAnimate) {
|
// if (this.TweenAnimate) {
|
||||||
TWEEN.remove(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 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
|
|
||||||
}).start()
|
|
||||||
// let contentElm = this._DialogObject._element.body
|
// let contentElm = this._DialogObject._element.body
|
||||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||||
// let startBtn = contentElm.getElementsByClassName('start')[0];
|
// let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||||
@ -401,6 +402,7 @@ class Submerge extends Tools {
|
|||||||
restart() {
|
restart() {
|
||||||
this.currentWaterLaver = this.options.minWaterLevel
|
this.currentWaterLaver = this.options.minWaterLevel
|
||||||
let isPaused = false
|
let isPaused = false
|
||||||
|
let that = this
|
||||||
if (this.TweenAnimate) {
|
if (this.TweenAnimate) {
|
||||||
isPaused = this.TweenAnimate._isPaused
|
isPaused = this.TweenAnimate._isPaused
|
||||||
TWEEN.remove(this.TweenAnimate)
|
TWEEN.remove(this.TweenAnimate)
|
||||||
@ -408,10 +410,13 @@ class Submerge extends Tools {
|
|||||||
let totalTime = ((this.options.maxWaterLevel - this.options.minWaterLevel) / this.options.risingSpeed) * 1000
|
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.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
|
this.currentWaterLaver = r.waterLevel
|
||||||
|
}).onComplete(() => {
|
||||||
|
that.callback()
|
||||||
|
// 在这里执行动画结束后的逻辑
|
||||||
}).start()
|
}).start()
|
||||||
if (isPaused) {
|
// if (isPaused) {
|
||||||
this.pause()
|
this.pause()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
|||||||
@ -182,7 +182,7 @@ class ViewShedStage extends Tools {
|
|||||||
return pitch
|
return pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(that) {
|
static create(that, callBack) {
|
||||||
that.destroy()
|
that.destroy()
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (!YJ.Measure.GetMeasureStatus()) {
|
if (!YJ.Measure.GetMeasureStatus()) {
|
||||||
@ -201,6 +201,7 @@ class ViewShedStage extends Tools {
|
|||||||
that.ids.push(ViewShedStage.create_point(that, cartesian))
|
that.ids.push(ViewShedStage.create_point(that, cartesian))
|
||||||
that.end()
|
that.end()
|
||||||
that.update()
|
that.update()
|
||||||
|
callBack(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
that.event.mouse_move((movement, cartesian) => {
|
that.event.mouse_move((movement, cartesian) => {
|
||||||
@ -212,6 +213,7 @@ class ViewShedStage extends Tools {
|
|||||||
})
|
})
|
||||||
that.ids = []
|
that.ids = []
|
||||||
that.end()
|
that.end()
|
||||||
|
callBack(false)
|
||||||
})
|
})
|
||||||
that.event.gesture_pinck_start((movement, cartesian) => {
|
that.event.gesture_pinck_start((movement, cartesian) => {
|
||||||
let startTime = new Date()
|
let startTime = new Date()
|
||||||
@ -223,6 +225,7 @@ class ViewShedStage extends Tools {
|
|||||||
})
|
})
|
||||||
that.ids = []
|
that.ids = []
|
||||||
that.end()
|
that.end()
|
||||||
|
callBack(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -232,6 +235,7 @@ class ViewShedStage extends Tools {
|
|||||||
text: '上一次测量未结束',
|
text: '上一次测量未结束',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
|
callBack(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,8 +251,8 @@ class ViewShedStage extends Tools {
|
|||||||
this.tip = null
|
this.tip = null
|
||||||
this.event = null
|
this.event = null
|
||||||
}
|
}
|
||||||
draw() {
|
draw(callBack) {
|
||||||
ViewShedStage.create(this)
|
ViewShedStage.create(this, callBack)
|
||||||
}
|
}
|
||||||
|
|
||||||
static create_point(that, cartesian) {
|
static create_point(that, cartesian) {
|
||||||
|
|||||||
@ -1397,7 +1397,7 @@ class AssembleObject extends Base {
|
|||||||
this.previous = null
|
this.previous = null
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -1510,7 +1510,7 @@ class AssembleObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1644,18 +1644,20 @@ class AssembleObject extends Base {
|
|||||||
let polygon = turf.polygon(points)
|
let polygon = turf.polygon(points)
|
||||||
let centroid = turf.pointOnFeature(polygon)
|
let centroid = turf.pointOnFeature(polygon)
|
||||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||||
this
|
setTimeout(() => {
|
||||||
.getClampToHeight({
|
this
|
||||||
lng: centroid.geometry.coordinates[0],
|
.getClampToHeight({
|
||||||
lat: centroid.geometry.coordinates[1]
|
lng: centroid.geometry.coordinates[0],
|
||||||
}, objectsToExclude)
|
lat: centroid.geometry.coordinates[1]
|
||||||
.then(height => {
|
}, objectsToExclude)
|
||||||
this.label.position = [
|
.then(height => {
|
||||||
centroid.geometry.coordinates[0],
|
this.label.position = [
|
||||||
centroid.geometry.coordinates[1],
|
centroid.geometry.coordinates[0],
|
||||||
height
|
centroid.geometry.coordinates[1],
|
||||||
]
|
height
|
||||||
})
|
]
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -1416,7 +1416,7 @@ class AttackArrowObject extends Base {
|
|||||||
}
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -1530,7 +1530,7 @@ class AttackArrowObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1757,18 +1757,20 @@ class AttackArrowObject extends Base {
|
|||||||
let polygon = turf.polygon(points)
|
let polygon = turf.polygon(points)
|
||||||
let centroid = turf.pointOnFeature(polygon)
|
let centroid = turf.pointOnFeature(polygon)
|
||||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||||
this
|
setTimeout(() => {
|
||||||
.getClampToHeight({
|
this
|
||||||
lng: centroid.geometry.coordinates[0],
|
.getClampToHeight({
|
||||||
lat: centroid.geometry.coordinates[1]
|
lng: centroid.geometry.coordinates[0],
|
||||||
}, objectsToExclude)
|
lat: centroid.geometry.coordinates[1]
|
||||||
.then(height => {
|
}, objectsToExclude)
|
||||||
this.label.position = [
|
.then(height => {
|
||||||
centroid.geometry.coordinates[0],
|
this.label.position = [
|
||||||
centroid.geometry.coordinates[1],
|
centroid.geometry.coordinates[0],
|
||||||
height
|
centroid.geometry.coordinates[1],
|
||||||
]
|
height
|
||||||
})
|
]
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.event.mouse_left(leftEvent)
|
this.event.mouse_left(leftEvent)
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class ArcgisLayer extends BaseLayer {
|
|||||||
class ArcgisWXImagery extends ArcgisLayer {
|
class ArcgisWXImagery extends ArcgisLayer {
|
||||||
constructor(sdk, options) {
|
constructor(sdk, options) {
|
||||||
super(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 {
|
class ArcgisLWImagery extends ArcgisLayer {
|
||||||
constructor(sdk, options) {
|
constructor(sdk, options) {
|
||||||
super(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)
|
super(sdk, options)
|
||||||
this.object = {}
|
this.object = {}
|
||||||
this.options.host = this.options.host || getHost()
|
this.options.host = this.options.host || getHost()
|
||||||
this.on()
|
this.loadLayer(this.options)
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
return "layer"
|
return "layer"
|
||||||
}
|
}
|
||||||
|
|
||||||
on() {
|
|
||||||
return this.loadLayer(this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadLayer(data) {
|
async loadLayer(data) {
|
||||||
this.object = { ...data }
|
this.object = { ...data }
|
||||||
let url = ""
|
let url = ""
|
||||||
|
|||||||
@ -466,7 +466,6 @@ class Model extends BaseModel {
|
|||||||
return this.options.name
|
return this.options.name
|
||||||
}
|
}
|
||||||
set name(v) {
|
set name(v) {
|
||||||
console.log(v, 'vvvvvvvvv')
|
|
||||||
this.options.name = v
|
this.options.name = v
|
||||||
this.options.label.text = v
|
this.options.label.text = v
|
||||||
this.label && (this.label.text = v)
|
this.label && (this.label.text = v)
|
||||||
@ -506,14 +505,14 @@ class Model extends BaseModel {
|
|||||||
|
|
||||||
set lng(v) {
|
set lng(v) {
|
||||||
this.options.position = {
|
this.options.position = {
|
||||||
lng: v,
|
lng: Number(Number(v).toFixed(8)),
|
||||||
lat: this.options.position.lat,
|
lat: this.options.position.lat,
|
||||||
alt: this.options.position.alt
|
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.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.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
|
||||||
this._elms.lng && this._elms.lng.forEach((item) => {
|
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) {
|
set lat(v) {
|
||||||
this.options.position = {
|
this.options.position = {
|
||||||
lng: this.options.position.lng,
|
lng: this.options.position.lng,
|
||||||
lat: v,
|
lat: Number(Number(v).toFixed(8)),
|
||||||
alt: this.options.position.alt
|
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.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.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
|
||||||
this._elms.lat && this._elms.lat.forEach((item) => {
|
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 = {
|
this.options.position = {
|
||||||
lng: this.options.position.lng,
|
lng: this.options.position.lng,
|
||||||
lat: this.options.position.lat,
|
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.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.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) => {
|
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) {
|
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.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) => {
|
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) {
|
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.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) => {
|
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) {
|
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.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) => {
|
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能够让初始加载变得模糊
|
progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
|
||||||
dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
|
dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
|
||||||
dynamicScreenSpaceErrorFactor: 1,
|
dynamicScreenSpaceErrorFactor: 1,
|
||||||
dynamicScreenSpaceError: true // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
|
dynamicScreenSpaceError: true, // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
|
||||||
|
backFaceCulling: false, // 开启后,会剔除掉模型的背面,提升性能体验
|
||||||
}
|
}
|
||||||
let tileset
|
let tileset
|
||||||
if (Number(Cesium.VERSION.split('.')[1]) >= 107) {
|
if (Number(Cesium.VERSION.split('.')[1]) >= 107) {
|
||||||
@ -488,14 +489,6 @@ class BaseTileset extends BaseSource {
|
|||||||
* */
|
* */
|
||||||
set rotationEditing(status) {
|
set rotationEditing(status) {
|
||||||
if (!this.tileset.root.transform) {
|
if (!this.tileset.root.transform) {
|
||||||
if (window.ELEMENT) {
|
|
||||||
window.ELEMENT.Message.closeAll();
|
|
||||||
window.ELEMENT.Message({
|
|
||||||
message: '该模型不支持移动和旋转!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.warn('该模型不支持移动和旋转!')
|
console.warn('该模型不支持移动和旋转!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -534,14 +527,6 @@ class BaseTileset extends BaseSource {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.tileset.root.transform) {
|
if (!this.tileset.root.transform) {
|
||||||
if (window.ELEMENT) {
|
|
||||||
window.ELEMENT.Message.closeAll();
|
|
||||||
window.ELEMENT.Message({
|
|
||||||
message: '该模型不支持移动和旋转!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.warn('该模型不支持移动和旋转!')
|
console.warn('该模型不支持移动和旋转!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class BatchModel extends Base {
|
|||||||
let tools = new Tools(sdk)
|
let tools = new Tools(sdk)
|
||||||
// BatchModel.computeDis(this)
|
// BatchModel.computeDis(this)
|
||||||
// if (this.options.positions.length > 0 || this.options.positions.lng) {
|
// 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: '请输入正确的间距!' })
|
tools.message({ type: 'warning', text: '请输入正确的间距!' })
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,6 +72,9 @@ class BatchModel extends Base {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Draw && Draw.start((a, positions) => {
|
Draw && Draw.start((a, positions) => {
|
||||||
|
if(!positions) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.options.positions = positions;
|
this.options.positions = positions;
|
||||||
//判断范围是否过大
|
//判断范围是否过大
|
||||||
if (options.type == '面') {
|
if (options.type == '面') {
|
||||||
@ -156,8 +159,8 @@ class BatchModel extends Base {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else if (that.options.type == '点') {
|
} else if (that.options.type == '点') {
|
||||||
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
// 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 }]
|
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: that.options.positions.alt }]
|
||||||
// posiArr = [that.options.positions]
|
// posiArr = [that.options.positions]
|
||||||
that.pointArr = posiArr
|
that.pointArr = posiArr
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,6 +166,8 @@ class BillboardObject extends Base {
|
|||||||
this.options.attribute.link.content || []
|
this.options.attribute.link.content || []
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
this.options.attribute.vr = this.options.attribute.vr || {}
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
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 = this.options.attribute.camera || {}
|
||||||
this.options.attribute.camera.content =
|
this.options.attribute.camera.content =
|
||||||
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 font = getFontFamily(that.labelFontFamily) || 'Helvetica'
|
||||||
let url = that.replaceHost(that.options.billboard.image, that.options.host)
|
let url = that.replaceHost(that.options.billboard.image, that.options.host)
|
||||||
that._frameImages = []
|
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')) {
|
if (url && url.endsWith('gif')) {
|
||||||
isGlf = true
|
isGlf = true
|
||||||
switch (that.options.heightMode) {
|
switch (that.options.heightMode) {
|
||||||
@ -480,6 +488,11 @@ class BillboardObject extends Base {
|
|||||||
// value: '传感器',
|
// value: '传感器',
|
||||||
// key: 'sensor'
|
// key: 'sensor'
|
||||||
// },
|
// },
|
||||||
|
{
|
||||||
|
name: 'rtmp',
|
||||||
|
value: 'rtmp',
|
||||||
|
key: 'rtmp'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '全景图',
|
name: '全景图',
|
||||||
value: '全景图',
|
value: '全景图',
|
||||||
@ -591,7 +604,12 @@ class BillboardObject extends Base {
|
|||||||
return this.options.position.lng
|
return this.options.position.lng
|
||||||
}
|
}
|
||||||
set lng(v) {
|
set lng(v) {
|
||||||
this.options.position.lng = Number(Number(v).toFixed(8))
|
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.scan && (this.scan.lng = v)
|
||||||
// this.diffuse && (this.diffuse.lng = v)
|
// this.diffuse && (this.diffuse.lng = v)
|
||||||
this.renewPoint()
|
this.renewPoint()
|
||||||
@ -607,7 +625,12 @@ class BillboardObject extends Base {
|
|||||||
return this.options.position.lat
|
return this.options.position.lat
|
||||||
}
|
}
|
||||||
set lat(v) {
|
set lat(v) {
|
||||||
this.options.position.lat = Number(Number(v).toFixed(8))
|
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.scan && (this.scan.lat = v)
|
||||||
// this.diffuse && (this.diffuse.lat = v)
|
// this.diffuse && (this.diffuse.lat = v)
|
||||||
this.renewPoint()
|
this.renewPoint()
|
||||||
@ -623,7 +646,12 @@ class BillboardObject extends Base {
|
|||||||
return this.options.position.alt
|
return this.options.position.alt
|
||||||
}
|
}
|
||||||
set alt(v) {
|
set alt(v) {
|
||||||
this.options.position.alt = Number(Number(v).toFixed(2))
|
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.scan && (this.scan.alt = v)
|
||||||
// this.diffuse && (this.diffuse.alt = v)
|
// this.diffuse && (this.diffuse.alt = v)
|
||||||
this.renewPoint()
|
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() {
|
get attributeGoods() {
|
||||||
return this.options.attribute.goods.content
|
return this.options.attribute.goods.content
|
||||||
}
|
}
|
||||||
@ -2135,11 +2327,12 @@ class BillboardObject extends Base {
|
|||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.lng = this.originalOptions.position.lng
|
this.lng = this.originalOptions.position.lng || 0
|
||||||
this.lat = this.originalOptions.position.lat
|
this.lat = this.originalOptions.position.lat || 0
|
||||||
this.alt = this.originalOptions.position.alt
|
this.alt = this.originalOptions.position.alt || 0
|
||||||
this.attributeLink = this.options.attribute.link.content
|
this.attributeLink = this.options.attribute.link.content
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
this.attributeVr = this.options.attribute.vr.content
|
||||||
|
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||||
this.attributeCamera = this.options.attribute.camera.content
|
this.attributeCamera = this.options.attribute.camera.content
|
||||||
this.attributeGoods = this.options.attribute.goods.content
|
this.attributeGoods = this.options.attribute.goods.content
|
||||||
this.attributeISC = this.options.attribute.isc.content
|
this.attributeISC = this.options.attribute.isc.content
|
||||||
@ -2198,7 +2391,7 @@ class BillboardObject extends Base {
|
|||||||
10000000000000
|
10000000000000
|
||||||
)
|
)
|
||||||
|
|
||||||
let objectsToExclude = []
|
let objectsToExclude = [this.entity]
|
||||||
for (let [key, value] of this.sdk.entityMap) {
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
objectsToExclude.push(value.entity)
|
objectsToExclude.push(value.entity)
|
||||||
|
|||||||
@ -299,8 +299,9 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
|
this.options.lng = positions.lng
|
||||||
|
this.options.lat = positions.lat
|
||||||
this.lng = positions.lng
|
this.lng = positions.lng
|
||||||
this.lat = positions.lat
|
|
||||||
this.tip.setPosition(
|
this.tip.setPosition(
|
||||||
cartesian,
|
cartesian,
|
||||||
movement.endPosition.x,
|
movement.endPosition.x,
|
||||||
@ -309,8 +310,9 @@ class CircleDiffuse extends Base {
|
|||||||
})
|
})
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
|
this.options.lng = positions.lng
|
||||||
|
this.options.lat = positions.lat
|
||||||
this.lng = positions.lng
|
this.lng = positions.lng
|
||||||
this.lat = positions.lat
|
|
||||||
this.event.mouse_move(() => { })
|
this.event.mouse_move(() => { })
|
||||||
this.event.mouse_left(() => { })
|
this.event.mouse_left(() => { })
|
||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
@ -337,8 +339,9 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
|
this.options.lng = positions.lng
|
||||||
|
this.options.lat = positions.lat
|
||||||
this.lng = positions.lng
|
this.lng = positions.lng
|
||||||
this.lat = positions.lat
|
|
||||||
this.event.mouse_move(() => { })
|
this.event.mouse_move(() => { })
|
||||||
this.event.mouse_left(() => { })
|
this.event.mouse_left(() => { })
|
||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
@ -364,8 +367,9 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
if (this.lastOptions) {
|
if (this.lastOptions) {
|
||||||
|
this.options.lng = this.lastOptions.lng
|
||||||
|
this.options.lat = this.lastOptions.lat
|
||||||
this.lng = this.lastOptions.lng
|
this.lng = this.lastOptions.lng
|
||||||
this.lat = this.lastOptions.lat
|
|
||||||
}
|
}
|
||||||
this.lastOptions = undefined
|
this.lastOptions = undefined
|
||||||
}
|
}
|
||||||
@ -385,7 +389,13 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
set lng(v) {
|
set lng(v) {
|
||||||
this.options.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) => {
|
this._elms.lng && this._elms.lng.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
@ -395,7 +405,13 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
set lat(v) {
|
set lat(v) {
|
||||||
this.options.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) => {
|
this._elms.lat && this._elms.lat.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1509,7 +1509,7 @@ class CircleObject extends Base {
|
|||||||
height
|
height
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}, 50);
|
}, 200);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class CurvelineObject extends Base {
|
|||||||
this.options.noseToTail = options.noseToTail || false
|
this.options.noseToTail = options.noseToTail || false
|
||||||
this.options.extend = options.extend || false
|
this.options.extend = options.extend || false
|
||||||
this.options.rotate = (options.rotate || options.rotate === false) ? options.rotate : true
|
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.speed = options.speed || 10
|
||||||
// this.options.dashSize = options.dashSize || 0.03
|
// this.options.dashSize = options.dashSize || 0.03
|
||||||
this.options.wordsName = options.wordsName || 0
|
this.options.wordsName = options.wordsName || 0
|
||||||
@ -239,7 +239,9 @@ class CurvelineObject extends Base {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.options.rotate = v
|
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() {
|
get space() {
|
||||||
@ -480,6 +482,9 @@ class CurvelineObject extends Base {
|
|||||||
return this.options.heightMode ? this.options.heightMode : 0
|
return this.options.heightMode ? this.options.heightMode : 0
|
||||||
}
|
}
|
||||||
set heightMode(v) {
|
set heightMode(v) {
|
||||||
|
if (!this._isNodeEdit) {
|
||||||
|
this._lastHeightMode = null
|
||||||
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
this.options.heightMode = (v || v == 0) ? v : 2
|
this.options.heightMode = (v || v == 0) ? v : 2
|
||||||
let heightModeName = ''
|
let heightModeName = ''
|
||||||
@ -554,7 +559,7 @@ class CurvelineObject extends Base {
|
|||||||
alt: fromDegreesArray[2]
|
alt: fromDegreesArray[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
get extend() {
|
get extend() {
|
||||||
@ -2049,7 +2054,11 @@ class CurvelineObject extends Base {
|
|||||||
}
|
}
|
||||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||||
let ground
|
let ground
|
||||||
switch (this.heightMode) {
|
let heightMode = this.heightMode
|
||||||
|
if (this._isNodeEdit) {
|
||||||
|
heightMode = 0
|
||||||
|
}
|
||||||
|
switch (heightMode) {
|
||||||
case 0:
|
case 0:
|
||||||
case '0':
|
case '0':
|
||||||
ground = false
|
ground = false
|
||||||
@ -2590,10 +2599,20 @@ class CurvelineObject extends Base {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
nodeEdit(cd) {
|
nodeEdit(cd) {
|
||||||
|
if(this._isNodeEdit) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.closeNodeEdit()
|
||||||
|
let lastHeightMode = this.heightMode
|
||||||
|
this._isNodeEdit = true
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
this.heightMode = 0
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
} else {
|
} else {
|
||||||
this.closeNodeEdit()
|
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||||
|
this._lastHeightMode = lastHeightMode
|
||||||
|
}
|
||||||
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.ControllerObject = new Controller(this.sdk)
|
this.ControllerObject = new Controller(this.sdk)
|
||||||
@ -2643,6 +2662,11 @@ class CurvelineObject extends Base {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
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++) {
|
for (let i = 0; i < this.nodePoints.length; i++) {
|
||||||
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
||||||
}
|
}
|
||||||
@ -2668,7 +2692,7 @@ class CurvelineObject extends Base {
|
|||||||
|
|
||||||
this.entity.polyline.positions = new Cesium.CallbackProperty( () => {
|
this.entity.polyline.positions = new Cesium.CallbackProperty( () => {
|
||||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
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)
|
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
@ -2691,10 +2715,18 @@ class CurvelineObject extends Base {
|
|||||||
})
|
})
|
||||||
this.nodePoints.push(entity)
|
this.nodePoints.push(entity)
|
||||||
}
|
}
|
||||||
|
this._isNodeEdit = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeNodeEdit() {
|
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.ControllerObject && this.ControllerObject.destroy()
|
||||||
this.event && this.event.destroy()
|
this.event && this.event.destroy()
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
@ -2919,7 +2951,11 @@ class CurvelineObject extends Base {
|
|||||||
)
|
)
|
||||||
this.renewPolygon(fromDegreesArray)
|
this.renewPolygon(fromDegreesArray)
|
||||||
|
|
||||||
switch (this.heightMode) {
|
let heightMode = this.heightMode
|
||||||
|
if (this._isNodeEdit) {
|
||||||
|
heightMode = 0
|
||||||
|
}
|
||||||
|
switch (heightMode) {
|
||||||
case 0:
|
case 0:
|
||||||
case '0':
|
case '0':
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@ -545,7 +545,7 @@ class EllipseObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1344,7 +1344,7 @@ class EllipseObject extends Base {
|
|||||||
center: this.deepCopyObj(this.options.center)
|
center: this.deepCopyObj(this.options.center)
|
||||||
}
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -1571,20 +1571,22 @@ class EllipseObject extends Base {
|
|||||||
|
|
||||||
that.heightMode = that.heightMode
|
that.heightMode = that.heightMode
|
||||||
|
|
||||||
cb('', {...this.options.center})
|
cb('', { ...this.options.center })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
that.getClampToHeight({
|
setTimeout(() => {
|
||||||
lng: that.center.lng,
|
that.getClampToHeight({
|
||||||
lat: that.center.lat
|
lng: that.center.lng,
|
||||||
}, objectsToExclude).then(height => {
|
lat: that.center.lat
|
||||||
that.label && (that.label.position = [
|
}, objectsToExclude).then(height => {
|
||||||
that.center.lng,
|
that.label && (that.label.position = [
|
||||||
that.center.lat,
|
that.center.lng,
|
||||||
height
|
that.center.lat,
|
||||||
])
|
height
|
||||||
})
|
])
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
createNodePoints(positions[0], 'semiMajorAxis')
|
createNodePoints(positions[0], 'semiMajorAxis')
|
||||||
createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis')
|
createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis')
|
||||||
createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis')
|
createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis')
|
||||||
@ -1611,7 +1613,7 @@ class EllipseObject extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeNodeEdit() {
|
closeNodeEdit() {
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
this.event && this.event.destroy()
|
this.event && this.event.destroy()
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
|
|||||||
@ -96,17 +96,13 @@ class GeoJson extends Base {
|
|||||||
})
|
})
|
||||||
let json = await rsp.json()
|
let json = await rsp.json()
|
||||||
this.geojson = json
|
this.geojson = json
|
||||||
// this.sdk.addIncetance(this.options.id, this)
|
|
||||||
return GeoJson.addDataToGlobe(this, json.features)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*geojosn暂时只用线的形式*/
|
/*geojosn暂时只用线的形式*/
|
||||||
static addDataToGlobe(that) {
|
|
||||||
const geoJsonDataSource = new Cesium.GeoJsonDataSource();
|
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++) {
|
for (let i = 0; i < geojson.features.length; i++) {
|
||||||
if (!geojson.features[i].id) {
|
if (!geojson.features[i].id) {
|
||||||
geojson.features[i].id = that.options.id + '_' + i
|
geojson.features[i].id = this.options.id + '_' + i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log(geojson)
|
// console.log(geojson)
|
||||||
@ -114,13 +110,13 @@ class GeoJson extends Base {
|
|||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
});
|
});
|
||||||
return promise.then(datasource => {
|
return promise.then(datasource => {
|
||||||
that.entity = datasource
|
this.entity = datasource
|
||||||
datasource.entities.values.forEach(enetity => {
|
datasource.entities.values.forEach(enetity => {
|
||||||
// console.log(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)
|
let colorPolygon = color.withAlpha(0.2)
|
||||||
enetity.show = that.options.show
|
enetity.show = this.options.show
|
||||||
that.sdk.viewer.entities.add(enetity)
|
this.sdk.viewer.entities.add(enetity)
|
||||||
if (enetity.billboard) {
|
if (enetity.billboard) {
|
||||||
enetity.billboard.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND
|
enetity.billboard.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND
|
||||||
enetity.point = new Cesium.PointGraphics({
|
enetity.point = new Cesium.PointGraphics({
|
||||||
@ -134,26 +130,26 @@ class GeoJson extends Base {
|
|||||||
|
|
||||||
if (enetity.polyline) {
|
if (enetity.polyline) {
|
||||||
enetity.polyline.material = color
|
enetity.polyline.material = color
|
||||||
enetity.polyline.zIndex = that.sdk._entityZIndex
|
enetity.polyline.zIndex = this.sdk._entityZIndex
|
||||||
that.sdk._entityZIndex++
|
this.sdk._entityZIndex++
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enetity.polygon) {
|
if (enetity.polygon) {
|
||||||
enetity.polygon.perPositionHeight = false
|
enetity.polygon.perPositionHeight = false
|
||||||
enetity.polygon.material = colorPolygon
|
enetity.polygon.material = colorPolygon
|
||||||
enetity.polygon.zIndex = that.sdk._entityZIndex
|
enetity.polygon.zIndex = this.sdk._entityZIndex
|
||||||
|
|
||||||
enetity.polyline = new Cesium.PolylineGraphics({
|
enetity.polyline = new Cesium.PolylineGraphics({
|
||||||
positions: enetity.polygon.hierarchy._value.positions,
|
positions: enetity.polygon.hierarchy._value.positions,
|
||||||
width: 1,
|
width: 1,
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
material: color,
|
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() {
|
start() {
|
||||||
let _this = this
|
let _this = this
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
|
this._error = '上一次测量未结束'
|
||||||
} else {
|
} else {
|
||||||
|
this._error = null
|
||||||
let viewer = this.sdk.viewer
|
let viewer = this.sdk.viewer
|
||||||
CameraController(this.sdk, false)
|
CameraController(this.sdk, false)
|
||||||
super.start()
|
super.start()
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
this.tip = new MouseTip('长按左键,拖动鼠标进行涂鸦,右键结束涂鸦', this.sdk)
|
this.tip = new MouseTip('左键按下开始,松开完成,右键单击完成绘制', this.sdk)
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.positions = []
|
this.positions = []
|
||||||
this.points_ids = [] //存放左键点击时临时添加的point的id
|
this.points_ids = [] //存放左键点击时临时添加的point的id
|
||||||
|
|||||||
@ -1240,7 +1240,7 @@ class GroundSvg extends Base {
|
|||||||
* 拖动
|
* 拖动
|
||||||
* @param {boolean} status=false 状态
|
* @param {boolean} status=false 状态
|
||||||
*/
|
*/
|
||||||
drag(status, cd) {
|
drag(status, dragCallback, endCallback) {
|
||||||
if (!this._loaded || !this.sdk || !this.sdk.viewer) {
|
if (!this._loaded || !this.sdk || !this.sdk.viewer) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1322,7 +1322,7 @@ class GroundSvg extends Base {
|
|||||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||||
angleW = bearing2 - bearingW
|
angleW = bearing2 - bearingW
|
||||||
angleH = bearing2 - bearingH
|
angleH = bearing2 - bearingH
|
||||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
if ((angleW > -270 && angleW < -90) || (angleW < 270 && angleW > 90)) {
|
||||||
angleW = angleW + 180
|
angleW = angleW + 180
|
||||||
flag = true
|
flag = true
|
||||||
}
|
}
|
||||||
@ -1370,8 +1370,7 @@ class GroundSvg extends Base {
|
|||||||
case 'svg-control-points_8':
|
case 'svg-control-points_8':
|
||||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||||
angleH = bearing2 - bearingH
|
angleH = bearing2 - bearingH
|
||||||
|
if ((angleH > -270 && angleH < -90) || (angleH < 270 && angleH > 90)) {
|
||||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
|
||||||
angleH = angleH + 180
|
angleH = angleH + 180
|
||||||
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||||
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||||
@ -1534,7 +1533,7 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.scale = { ...scale }
|
this.scale = { ...scale }
|
||||||
|
dragCallback && dragCallback(this.options)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let pickedObjectArray = this.sdk.viewer.scene.drillPick(movement.endPosition);
|
let pickedObjectArray = this.sdk.viewer.scene.drillPick(movement.endPosition);
|
||||||
@ -1601,7 +1600,7 @@ class GroundSvg extends Base {
|
|||||||
this.ScreenSpaceEventHandler.setInputAction((movement) => {
|
this.ScreenSpaceEventHandler.setInputAction((movement) => {
|
||||||
this.drag(false)
|
this.drag(false)
|
||||||
// if (!this._DialogObject) {
|
// if (!this._DialogObject) {
|
||||||
cd && cd(this.options)
|
endCallback && endCallback(this.options)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -178,8 +178,10 @@ class LabelObject extends Base {
|
|||||||
lng: v[0],
|
lng: v[0],
|
||||||
lat: v[1]
|
lat: v[1]
|
||||||
}, objectsToExclude).then(height => {
|
}, objectsToExclude).then(height => {
|
||||||
v[2] = height
|
if(this.ground) {
|
||||||
this.options.position = [...v]
|
v[2] = height
|
||||||
|
this.options.position = [...v]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// let point1 = Cesium.Cartesian3.fromDegrees(this.options.position[0], this.options.position[1], 0);
|
// 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);
|
// 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],
|
lng: this.options.position[0],
|
||||||
lat: this.options.position[1]
|
lat: this.options.position[1]
|
||||||
}, objectsToExclude).then(height => {
|
}, objectsToExclude).then(height => {
|
||||||
this.options.position[2] = height
|
if(this.ground) {
|
||||||
|
this.options.position[2] = height
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,6 +498,7 @@ class LabelObject extends Base {
|
|||||||
const ctx = this._canvas.getContext('2d')
|
const ctx = this._canvas.getContext('2d')
|
||||||
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||||
ctx.font = this.options.fontSize + 'px ' + this.font
|
ctx.font = this.options.fontSize + 'px ' + this.font
|
||||||
|
this.options.outlineWidth = 0
|
||||||
let texts = this.options.text.split('\n')
|
let texts = this.options.text.split('\n')
|
||||||
let canvasWidth = 0
|
let canvasWidth = 0
|
||||||
let canvasHeight = 0
|
let canvasHeight = 0
|
||||||
@ -503,7 +508,7 @@ class LabelObject extends Base {
|
|||||||
if (width > canvasWidth) {
|
if (width > canvasWidth) {
|
||||||
canvasWidth = width
|
canvasWidth = width
|
||||||
}
|
}
|
||||||
canvasHeight += this.options.fontSize
|
canvasHeight += (this.options.fontSize + (this.options.outlineWidth * 2))
|
||||||
}
|
}
|
||||||
canvasHeight = canvasHeight + 20 + (texts.length - 1) * 5
|
canvasHeight = canvasHeight + 20 + (texts.length - 1) * 5
|
||||||
canvasWidth = canvasWidth + 30
|
canvasWidth = canvasWidth + 30
|
||||||
@ -526,7 +531,7 @@ class LabelObject extends Base {
|
|||||||
ctx.font = this.options.fontSize + 'px ' + this.font
|
ctx.font = this.options.fontSize + 'px ' + this.font
|
||||||
let maxWidth = 0
|
let maxWidth = 0
|
||||||
for (let i = 0; i < texts.length; i++) {
|
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) {
|
if (maxWidth < width) {
|
||||||
maxWidth = width
|
maxWidth = width
|
||||||
}
|
}
|
||||||
@ -535,15 +540,25 @@ class LabelObject extends Base {
|
|||||||
let centerDistance = (canvasWidth - maxWidth) / 2
|
let centerDistance = (canvasWidth - maxWidth) / 2
|
||||||
for (let i = 0; i < texts.length; i++) {
|
for (let i = 0; i < texts.length; i++) {
|
||||||
const text = texts[i]
|
const text = texts[i]
|
||||||
|
ctx.strokeStyle = this.options.outlineColor; // 边框颜色
|
||||||
|
ctx.lineWidth = this.options.outlineWidth * 2; // 边框粗细
|
||||||
if (this.options.fontSize < 10) {
|
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 {
|
} 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(
|
ctx.fillText(
|
||||||
text,
|
text,
|
||||||
15 + centerDistance,
|
15 + centerDistance + this.options.outlineWidth,
|
||||||
this.options.fontSize * (i + 1) +
|
(this.options.fontSize * (i + 1)) +
|
||||||
(10 * 10) / this.options.fontSize +
|
((10 * 10) / this.options.fontSize) +
|
||||||
i * 5
|
(i * 5) + (this.options.outlineWidth / 2)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -585,7 +585,7 @@ class Flame extends Base {
|
|||||||
this.lng = this.originalOptions.lng
|
this.lng = this.originalOptions.lng
|
||||||
this.lat = this.originalOptions.lat
|
this.lat = this.originalOptions.lat
|
||||||
this.alt = this.originalOptions.alt
|
this.alt = this.originalOptions.alt
|
||||||
syncPrimitives(this.entity)
|
// syncPrimitives(this.entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
|
|||||||
@ -1432,7 +1432,7 @@ class PincerArrowObject extends Base {
|
|||||||
}
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -1546,7 +1546,7 @@ class PincerArrowObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,18 +1686,20 @@ class PincerArrowObject extends Base {
|
|||||||
let polygon = turf.polygon(points)
|
let polygon = turf.polygon(points)
|
||||||
let centroid = turf.pointOnFeature(polygon)
|
let centroid = turf.pointOnFeature(polygon)
|
||||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||||
this
|
setTimeout(() => {
|
||||||
.getClampToHeight({
|
this
|
||||||
lng: centroid.geometry.coordinates[0],
|
.getClampToHeight({
|
||||||
lat: centroid.geometry.coordinates[1]
|
lng: centroid.geometry.coordinates[0],
|
||||||
}, objectsToExclude)
|
lat: centroid.geometry.coordinates[1]
|
||||||
.then(height => {
|
}, objectsToExclude)
|
||||||
this.label.position = [
|
.then(height => {
|
||||||
centroid.geometry.coordinates[0],
|
this.label.position = [
|
||||||
centroid.geometry.coordinates[1],
|
centroid.geometry.coordinates[0],
|
||||||
height
|
centroid.geometry.coordinates[1],
|
||||||
]
|
height
|
||||||
})
|
]
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
createNodePoints()
|
createNodePoints()
|
||||||
}, 200);
|
}, 200);
|
||||||
async function createNodePoints() {
|
async function createNodePoints() {
|
||||||
|
|||||||
@ -1500,7 +1500,7 @@ class PolygonObject extends Base {
|
|||||||
fromDegreesArray = []
|
fromDegreesArray = []
|
||||||
this.heightMode = this.heightMode
|
this.heightMode = this.heightMode
|
||||||
|
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -1683,6 +1683,7 @@ class PolygonObject extends Base {
|
|||||||
_this.previous.positions[0],
|
_this.previous.positions[0],
|
||||||
_this.previous.positions[1]
|
_this.previous.positions[1]
|
||||||
]
|
]
|
||||||
|
this.previous = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1699,19 +1700,20 @@ class PolygonObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeEdit(cb = () => { }) {
|
nodeEdit(cb = () => { }) {
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
let previous = [...this.options.positions]
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
cb('上一次测量未结束')
|
cb('上一次测量未结束')
|
||||||
} else {
|
} else {
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
this.picking = false
|
this.picking = false
|
||||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
this.tip = new MouseTip('左键单击选择控制点,右键单击取消编辑', this.sdk)
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
let _this = this
|
let _this = this
|
||||||
@ -1729,6 +1731,7 @@ class PolygonObject extends Base {
|
|||||||
|
|
||||||
let added = false
|
let added = false
|
||||||
let leftEvent = async (movement, cartesian) => {
|
let leftEvent = async (movement, cartesian) => {
|
||||||
|
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
||||||
if (selectPoint) {
|
if (selectPoint) {
|
||||||
this.options.positions[selectPoint.index] = this.cartesian3Towgs84(
|
this.options.positions[selectPoint.index] = this.cartesian3Towgs84(
|
||||||
cartesian,
|
cartesian,
|
||||||
@ -1737,7 +1740,7 @@ class PolygonObject extends Base {
|
|||||||
originalPosition = this.options.positions[selectPoint.index]
|
originalPosition = this.options.positions[selectPoint.index]
|
||||||
added = true
|
added = true
|
||||||
let potHeight = await this.getClampToHeight(
|
let potHeight = await this.getClampToHeight(
|
||||||
this.options.positions[selectPoint.index]
|
this.options.positions[selectPoint.index], objectsToExclude
|
||||||
)
|
)
|
||||||
let entity = this.sdk.viewer.entities.add({
|
let entity = this.sdk.viewer.entities.add({
|
||||||
name: 'node-secondary-edit-point',
|
name: 'node-secondary-edit-point',
|
||||||
@ -1771,7 +1774,6 @@ class PolygonObject extends Base {
|
|||||||
)
|
)
|
||||||
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||||
|
|
||||||
let objectsToExclude = [...this.sdk.viewer.entities.values]
|
|
||||||
if (this.options.positions.length < 3) {
|
if (this.options.positions.length < 3) {
|
||||||
this
|
this
|
||||||
.getClampToHeight({
|
.getClampToHeight({
|
||||||
@ -1847,7 +1849,7 @@ class PolygonObject extends Base {
|
|||||||
selectPoint = pick.id
|
selectPoint = pick.id
|
||||||
this.nodePoints.splice(pick.id.index, 1)
|
this.nodePoints.splice(pick.id.index, 1)
|
||||||
this.sdk.viewer.entities.remove(pick.id)
|
this.sdk.viewer.entities.remove(pick.id)
|
||||||
this.tip.set_text('左键开始,右键结束,CTRL+右键撤销')
|
this.tip.set_text('左键单击确定控制点位置,右键单击结束编辑! CTRL+右键单击撤销上一个控制点')
|
||||||
originalPosition = this.cartesian3Towgs84(
|
originalPosition = this.cartesian3Towgs84(
|
||||||
selectPoint.position.getValue(),
|
selectPoint.position.getValue(),
|
||||||
this.sdk.viewer
|
this.sdk.viewer
|
||||||
@ -1862,6 +1864,51 @@ class PolygonObject extends Base {
|
|||||||
if (added) {
|
if (added) {
|
||||||
this.options.positions.splice(selectPoint.index, 1)
|
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)
|
cb(null, this.options.positions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1919,7 +1966,8 @@ class PolygonObject extends Base {
|
|||||||
])
|
])
|
||||||
let polygon = turf.polygon(positions)
|
let polygon = turf.polygon(positions)
|
||||||
let centroid = turf.centroid(polygon)
|
let centroid = turf.centroid(polygon)
|
||||||
this
|
setTimeout(() => {
|
||||||
|
this
|
||||||
.getClampToHeight({
|
.getClampToHeight({
|
||||||
lng: centroid.geometry.coordinates[0],
|
lng: centroid.geometry.coordinates[0],
|
||||||
lat: centroid.geometry.coordinates[1]
|
lat: centroid.geometry.coordinates[1]
|
||||||
@ -1931,6 +1979,7 @@ class PolygonObject extends Base {
|
|||||||
height
|
height
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -2017,6 +2066,9 @@ class PolygonObject extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.nodePoints.pop()
|
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.smooth = options.smooth || false
|
||||||
this.options.extend = options.extend || false
|
this.options.extend = options.extend || false
|
||||||
this.options.rotate = (options.rotate || options.rotate === false) ? options.rotate : true
|
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.speed = options.speed || 10
|
||||||
// this.options.dashSize = options.dashSize || 0.03
|
// this.options.dashSize = options.dashSize || 0.03
|
||||||
this.options.wordsName = options.wordsName || 0
|
this.options.wordsName = options.wordsName || 0
|
||||||
@ -141,11 +141,11 @@ class PolylineObject extends Base {
|
|||||||
// this.options.attribute.goods.content =
|
// this.options.attribute.goods.content =
|
||||||
// this.options.attribute.goods.content || []
|
// this.options.attribute.goods.content || []
|
||||||
|
|
||||||
delete this.options.attribute.camera
|
delete this.options.attribute.camera
|
||||||
delete this.options.attribute.vr
|
delete this.options.attribute.vr
|
||||||
delete this.options.attribute.goods
|
delete this.options.attribute.goods
|
||||||
|
|
||||||
this.options.richTextContent = options.richTextContent || ''
|
this.options.richTextContent = options.richTextContent || ''
|
||||||
|
|
||||||
|
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
@ -514,6 +514,9 @@ class PolylineObject extends Base {
|
|||||||
return this.options.heightMode ? this.options.heightMode : 0
|
return this.options.heightMode ? this.options.heightMode : 0
|
||||||
}
|
}
|
||||||
set heightMode(v) {
|
set heightMode(v) {
|
||||||
|
if (!this._isNodeEdit) {
|
||||||
|
this._lastHeightMode = null
|
||||||
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
this.options.heightMode = (v || v == 0) ? v : 2
|
this.options.heightMode = (v || v == 0) ? v : 2
|
||||||
let heightModeName = ''
|
let heightModeName = ''
|
||||||
@ -548,6 +551,7 @@ class PolylineObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (ground) {
|
if (ground) {
|
||||||
this.label.ground = ground
|
this.label.ground = ground
|
||||||
@ -570,7 +574,7 @@ class PolylineObject extends Base {
|
|||||||
alt: fromDegreesArray[2]
|
alt: fromDegreesArray[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
get extend() {
|
get extend() {
|
||||||
@ -2077,7 +2081,11 @@ class PolylineObject extends Base {
|
|||||||
}
|
}
|
||||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||||
let ground
|
let ground
|
||||||
switch (this.heightMode) {
|
let heightMode = this.heightMode
|
||||||
|
if (this._isNodeEdit) {
|
||||||
|
heightMode = 0
|
||||||
|
}
|
||||||
|
switch (heightMode) {
|
||||||
case 0:
|
case 0:
|
||||||
case '0':
|
case '0':
|
||||||
ground = false
|
ground = false
|
||||||
@ -2587,13 +2595,21 @@ class PolylineObject extends Base {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
nodeEdit(cb) {
|
nodeEdit(cb) {
|
||||||
|
if(this._isNodeEdit) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.closeNodeEdit()
|
||||||
|
let lastHeightMode = this.heightMode
|
||||||
|
this._isNodeEdit = true
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
this.noseToTail = false
|
this.noseToTail = false
|
||||||
// this.smooth = false
|
// this.smooth = false
|
||||||
this.heightMode = 0
|
this.heightMode = 0
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
} else {
|
} else {
|
||||||
this.closeNodeEdit()
|
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||||
|
this._lastHeightMode = lastHeightMode
|
||||||
|
}
|
||||||
YJ.Measure.SetMeasureStatus(true)
|
YJ.Measure.SetMeasureStatus(true)
|
||||||
this._nodeEditCallback = cb
|
this._nodeEditCallback = cb
|
||||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||||
@ -2644,6 +2660,11 @@ class PolylineObject extends Base {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
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++) {
|
for (let i = 0; i < this.nodePoints.length; i++) {
|
||||||
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
this.sdk.viewer.entities.remove(this.nodePoints[i])
|
||||||
}
|
}
|
||||||
@ -2669,7 +2690,7 @@ class PolylineObject extends Base {
|
|||||||
|
|
||||||
this.entity.polyline.positions = new Cesium.CallbackProperty(() => {
|
this.entity.polyline.positions = new Cesium.CallbackProperty(() => {
|
||||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
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)
|
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
@ -2692,10 +2713,17 @@ class PolylineObject extends Base {
|
|||||||
})
|
})
|
||||||
this.nodePoints.push(entity)
|
this.nodePoints.push(entity)
|
||||||
}
|
}
|
||||||
|
this._isNodeEdit = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeNodeEdit() {
|
closeNodeEdit() {
|
||||||
|
this._isNodeEdit = false
|
||||||
|
let _lastHeightMode = this._lastHeightMode
|
||||||
|
this._lastHeightMode = null
|
||||||
|
if (_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||||
|
this.heightMode = _lastHeightMode
|
||||||
|
}
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
this.ControllerObject && this.ControllerObject.destroy()
|
this.ControllerObject && this.ControllerObject.destroy()
|
||||||
this.event && this.event.destroy()
|
this.event && this.event.destroy()
|
||||||
@ -2846,8 +2874,8 @@ class PolylineObject extends Base {
|
|||||||
this.previous.positions = positionsLngLat
|
this.previous.positions = positionsLngLat
|
||||||
|
|
||||||
// this.entity.polyline.positionsLngLat = positionsLngLat
|
// this.entity.polyline.positionsLngLat = positionsLngLat
|
||||||
let fromDegreesArray = this.renewPositions(this.options.positions, ()=>{
|
let fromDegreesArray = this.renewPositions(this.options.positions, () => {
|
||||||
if(this._positionEditingCallback) {
|
if (this._positionEditingCallback) {
|
||||||
this._positionEditingCallback()
|
this._positionEditingCallback()
|
||||||
this._positionEditingCallback = null
|
this._positionEditingCallback = null
|
||||||
}
|
}
|
||||||
@ -2913,7 +2941,11 @@ class PolylineObject extends Base {
|
|||||||
)
|
)
|
||||||
this.renewPolygon(fromDegreesArray)
|
this.renewPolygon(fromDegreesArray)
|
||||||
|
|
||||||
switch (this.heightMode) {
|
let heightMode = this.heightMode
|
||||||
|
if (this._isNodeEdit) {
|
||||||
|
heightMode = 0
|
||||||
|
}
|
||||||
|
switch (heightMode) {
|
||||||
case 0:
|
case 0:
|
||||||
case '0':
|
case '0':
|
||||||
case 1:
|
case 1:
|
||||||
@ -2958,7 +2990,7 @@ class PolylineObject extends Base {
|
|||||||
return this._lengthChangeCallBack
|
return this._lengthChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set lengthChangeCallBack (cd) {
|
set lengthChangeCallBack(cd) {
|
||||||
this._lengthChangeCallBack = cd
|
this._lengthChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
* @param options.colorOut=rgba(255,255,0,0.3){string} 范围颜色
|
* @param options.colorOut=rgba(255,255,0,0.3){string} 范围颜色
|
||||||
* @param options.colorIn=rgba(255,0,0,0.3){string} 扫描颜色
|
* @param options.colorIn=rgba(255,0,0,0.3){string} 扫描颜色
|
||||||
* @param options.radius=10 {number} 半径
|
* @param options.radius=10 {number} 半径
|
||||||
* @param options.duration=2000 {number} 持续时间
|
* @param options.speed=1 {number} 扫描速度(倍)
|
||||||
* @param options.label {object} 标签对象
|
* @param options.label {object} 标签对象
|
||||||
* @param options.label.show {string} 标签显隐
|
* @param options.label.show {string} 标签显隐
|
||||||
* @param options.label.position {string} 标签位置
|
* @param options.label.position {string} 标签位置
|
||||||
@ -75,7 +75,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
if(this.options.radius > 999999) {
|
if(this.options.radius > 999999) {
|
||||||
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)
|
this.event = new MouseEvent(this.sdk)
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
@ -117,7 +117,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
let height = options.alt;
|
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 arr = calculatePane(that.options, that.options.radius, heading);
|
||||||
let _time = new Date().getTime();
|
let _time = new Date().getTime();
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
// _time = tempTime
|
// _time = tempTime
|
||||||
// heading += speed;
|
// 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);
|
arr = calculatePane(that.options, that.options.radius, heading);
|
||||||
});
|
});
|
||||||
that.entity = viewer.entities.add({
|
that.entity = viewer.entities.add({
|
||||||
@ -384,11 +384,14 @@ class RadarScanStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get duration() {
|
get duration() {
|
||||||
return this.options.duration
|
return 1000
|
||||||
}
|
}
|
||||||
set duration(v) {
|
get speed() {
|
||||||
this.options.duration = v
|
return this.options.speed
|
||||||
this._elms.duration && this._elms.duration.forEach((item) => {
|
}
|
||||||
|
set speed(v) {
|
||||||
|
this.options.speed = v
|
||||||
|
this._elms.speed && this._elms.speed.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
RadarScanStereoscopic.changeParam(this)
|
RadarScanStereoscopic.changeParam(this)
|
||||||
@ -1028,7 +1031,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.colorOut = this.originalOptions.colorOut
|
this.colorOut = this.originalOptions.colorOut
|
||||||
this.colorIn = this.originalOptions.colorIn
|
this.colorIn = this.originalOptions.colorIn
|
||||||
this.radius = this.originalOptions.radius
|
this.radius = this.originalOptions.radius
|
||||||
this.duration = this.originalOptions.duration
|
this.speed = this.originalOptions.speed
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
|
|||||||
@ -1440,6 +1440,10 @@ class SectorObject extends Base {
|
|||||||
center: this.deepCopyObj(this.options.center)
|
center: this.deepCopyObj(this.options.center)
|
||||||
}
|
}
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
if (this._positionEditingCallback) {
|
||||||
|
this._positionEditingCallback()
|
||||||
|
this._positionEditingCallback = null
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
@ -1516,11 +1520,12 @@ class SectorObject extends Base {
|
|||||||
return this._areaChangeCallBack
|
return this._areaChangeCallBack
|
||||||
}
|
}
|
||||||
|
|
||||||
set areaChangeCallBack (cd) {
|
set areaChangeCallBack(cd) {
|
||||||
this._areaChangeCallBack = cd
|
this._areaChangeCallBack = cd
|
||||||
}
|
}
|
||||||
|
|
||||||
static nodeEdit(that, cb = () => { }) {
|
nodeEdit(cb = () => { }) {
|
||||||
|
let that = this
|
||||||
that.positionEditing = false
|
that.positionEditing = false
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
} else {
|
} else {
|
||||||
@ -1592,18 +1597,20 @@ class SectorObject extends Base {
|
|||||||
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
|
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
|
||||||
]
|
]
|
||||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
||||||
that
|
setTimeout(() => {
|
||||||
.getClampToHeight({
|
that
|
||||||
lng: that.options.center.lng,
|
.getClampToHeight({
|
||||||
lat: that.options.center.lat
|
lng: that.options.center.lng,
|
||||||
}, objectsToExclude)
|
lat: that.options.center.lat
|
||||||
.then(height => {
|
}, objectsToExclude)
|
||||||
that.label.position = [
|
.then(height => {
|
||||||
that.options.center.lng,
|
that.label.position = [
|
||||||
that.options.center.lat,
|
that.options.center.lng,
|
||||||
height
|
that.options.center.lat,
|
||||||
]
|
height
|
||||||
})
|
]
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
createNodePoints(positions[1], 'sector-start')
|
createNodePoints(positions[1], 'sector-start')
|
||||||
createNodePoints(positions[positions.length - 4], 'sector-end')
|
createNodePoints(positions[positions.length - 4], 'sector-end')
|
||||||
@ -1675,6 +1682,8 @@ class SectorObject extends Base {
|
|||||||
that.tip = null
|
that.tip = null
|
||||||
|
|
||||||
that.heightMode = that.heightMode
|
that.heightMode = that.heightMode
|
||||||
|
|
||||||
|
cb('', { ...that.options.center })
|
||||||
})
|
})
|
||||||
}, 200);
|
}, 200);
|
||||||
async function createNodePoints(pos, type) {
|
async function createNodePoints(pos, type) {
|
||||||
|
|||||||
@ -1618,7 +1618,7 @@ class StraightArrowObject extends Base {
|
|||||||
_addRr() {
|
_addRr() {
|
||||||
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
|
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
|
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
|
||||||
})
|
})
|
||||||
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
|
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
|
||||||
@ -1631,7 +1631,7 @@ class StraightArrowObject extends Base {
|
|||||||
|
|
||||||
addAttributeRr(vr) {
|
addAttributeRr(vr) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: vr
|
url: vr
|
||||||
})
|
})
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
this.attributeVr = this.options.attribute.vr.content
|
||||||
@ -2191,18 +2191,20 @@ class StraightArrowObject extends Base {
|
|||||||
let polygon = turf.polygon(points)
|
let polygon = turf.polygon(points)
|
||||||
let centroid = turf.pointOnFeature(polygon)
|
let centroid = turf.pointOnFeature(polygon)
|
||||||
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
let objectsToExclude = [...that.sdk.viewer.entities.values]
|
||||||
that
|
setTimeout(() => {
|
||||||
.getClampToHeight({
|
that
|
||||||
lng: centroid.geometry.coordinates[0],
|
.getClampToHeight({
|
||||||
lat: centroid.geometry.coordinates[1]
|
lng: centroid.geometry.coordinates[0],
|
||||||
}, objectsToExclude)
|
lat: centroid.geometry.coordinates[1]
|
||||||
.then(height => {
|
}, objectsToExclude)
|
||||||
that.label.position = [
|
.then(height => {
|
||||||
centroid.geometry.coordinates[0],
|
that.label.position = [
|
||||||
centroid.geometry.coordinates[1],
|
centroid.geometry.coordinates[0],
|
||||||
height
|
centroid.geometry.coordinates[1],
|
||||||
]
|
height
|
||||||
})
|
]
|
||||||
|
})
|
||||||
|
}, 200);
|
||||||
createNodePoints()
|
createNodePoints()
|
||||||
}, 200);
|
}, 200);
|
||||||
async function createNodePoints() {
|
async function createNodePoints() {
|
||||||
|
|||||||
@ -595,7 +595,7 @@ class StandText extends Base {
|
|||||||
selectPoint = pick.id
|
selectPoint = pick.id
|
||||||
this.nodePoints.splice(pick.id.index, 1)
|
this.nodePoints.splice(pick.id.index, 1)
|
||||||
this.sdk.viewer.entities.remove(pick.id)
|
this.sdk.viewer.entities.remove(pick.id)
|
||||||
this.tip.set_text('左键开始,右键结束,CTRL+右键撤销')
|
this.tip.set_text('左键单击确认顶点位置,右键单击结束,CTRL+右键撤销')
|
||||||
originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
this.entity.wall.positions = new Cesium.CallbackProperty(function () {
|
this.entity.wall.positions = new Cesium.CallbackProperty(function () {
|
||||||
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
|
||||||
@ -615,6 +615,15 @@ class StandText extends Base {
|
|||||||
if(isAdd) {
|
if(isAdd) {
|
||||||
this.options.positions.splice(selectPoint.index, 1)
|
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)
|
cb(null, this.options.positions)
|
||||||
}
|
}
|
||||||
let positions = 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.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
|
||||||
this.positions_smooth = []
|
this.positions_smooth = []
|
||||||
this.options.ground = options.ground || false
|
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.state = (options.state || options.state === false) ? options.state : true
|
||||||
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
|
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
|
||||||
this.keyPoints = []
|
this.keyPoints = []
|
||||||
@ -618,20 +619,30 @@ class TrajectoryMotion extends Base {
|
|||||||
set delay(v) {
|
set delay(v) {
|
||||||
this.options.delay = v
|
this.options.delay = v
|
||||||
if (this.TweenAnimate && this.TweenAnimate._isPlaying) {
|
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) => {
|
this._elms.delay && this._elms.delay.forEach((item) => {
|
||||||
item.value = v
|
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() {
|
get state() {
|
||||||
return this.options.state
|
return this.options.state
|
||||||
}
|
}
|
||||||
set state(v) {
|
set state(v) {
|
||||||
this.options.state = v
|
this.options.state = v
|
||||||
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||||
if (this.editObj) {
|
if (this.options.state && this.editObj) {
|
||||||
this.editObj.destroy()
|
this.editObj.destroy()
|
||||||
this.editObj = null
|
this.editObj = null
|
||||||
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
|
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
|
||||||
@ -646,10 +657,10 @@ class TrajectoryMotion extends Base {
|
|||||||
if (this.TweenAnimate.isPlaying()) {
|
if (this.TweenAnimate.isPlaying()) {
|
||||||
this.TweenAnimate.timeout = setTimeout(() => {
|
this.TweenAnimate.timeout = setTimeout(() => {
|
||||||
this.TweenAnimate.resume()
|
this.TweenAnimate.resume()
|
||||||
}, this.options.delay);
|
}, this.options.delay*1000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.TweenAnimate.delay(this.delay).start()
|
this.TweenAnimate.delay(this.delay*1000).start()
|
||||||
}
|
}
|
||||||
this.speed = this.speed
|
this.speed = this.speed
|
||||||
}
|
}
|
||||||
@ -1513,7 +1524,7 @@ class TrajectoryMotion extends Base {
|
|||||||
let HeadingPitchRoll2
|
let HeadingPitchRoll2
|
||||||
let previous = {}
|
let previous = {}
|
||||||
let m = 0
|
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) {
|
if (time || startDistance) {
|
||||||
this.modelMove(positions)
|
this.modelMove(positions)
|
||||||
}
|
}
|
||||||
@ -1562,11 +1573,15 @@ class TrajectoryMotion extends Base {
|
|||||||
animateUpdate
|
animateUpdate
|
||||||
)
|
)
|
||||||
if (_this.options.firstPersonView) {
|
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 }
|
let positionCamera = { ..._this.sdk.viewer.camera._position }
|
||||||
_this.sdk.viewer.camera.setView({
|
_this.sdk.viewer.camera.setView({
|
||||||
destination: positionCamera,
|
destination: positionCamera,
|
||||||
orientation: {
|
orientation: {
|
||||||
heading: Cesium.Math.toRadians(_this.model.heading + 90 + _this.firstPersonHeadingPitch.heading),
|
heading: Cesium.Math.toRadians(targetHeading),
|
||||||
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
||||||
roll: 0
|
roll: 0
|
||||||
}
|
}
|
||||||
@ -1794,10 +1809,14 @@ class TrajectoryMotion extends Base {
|
|||||||
if (_this.viewFollow) {
|
if (_this.viewFollow) {
|
||||||
// console.log(Cesium.Math.toDegrees(_this.sdk.viewer.camera.pitch))
|
// console.log(Cesium.Math.toDegrees(_this.sdk.viewer.camera.pitch))
|
||||||
if (_this.options.firstPersonView) {
|
if (_this.options.firstPersonView) {
|
||||||
|
let targetHeading = heading + 90 + _this.firstPersonHeadingPitch.heading
|
||||||
|
if(!_this.routeDirection) {
|
||||||
|
targetHeading = 180 - targetHeading
|
||||||
|
}
|
||||||
_this.sdk.viewer.camera.setView({
|
_this.sdk.viewer.camera.setView({
|
||||||
destination: positionCamera,
|
destination: positionCamera,
|
||||||
orientation: {
|
orientation: {
|
||||||
heading: Cesium.Math.toRadians(heading + 90 + _this.firstPersonHeadingPitch.heading),
|
heading: Cesium.Math.toRadians(targetHeading),
|
||||||
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
|
||||||
roll: 0
|
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].innerHTML = '开始调整'
|
||||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
|
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.viewFollow) {
|
if (this.viewFollow) {
|
||||||
@ -2333,6 +2353,8 @@ class TrajectoryMotion extends Base {
|
|||||||
Cesium.Matrix4.multiply(originalMatrix, rotationY, originalMatrix)
|
Cesium.Matrix4.multiply(originalMatrix, rotationY, originalMatrix)
|
||||||
Cesium.Matrix4.multiply(originalMatrix, rotationZ, this.entity.modelMatrix)
|
Cesium.Matrix4.multiply(originalMatrix, rotationZ, this.entity.modelMatrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2373,7 +2395,7 @@ class TrajectoryMotion extends Base {
|
|||||||
// maximumScale: 100000,
|
// maximumScale: 100000,
|
||||||
}
|
}
|
||||||
const getAnimationsList = () => {
|
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
|
this.modelAnimate = this.originalOptions.model.animate
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2457,10 +2479,13 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
// 更新坐标
|
// 更新坐标
|
||||||
renewLinePositions(pos) {
|
renewLinePositions(pos) {
|
||||||
let positions = pos
|
let positions = [...pos]
|
||||||
if (this.noseToTail) {
|
if (this.noseToTail) {
|
||||||
positions = [...pos, pos[0]]
|
positions = [...pos, pos[0]]
|
||||||
}
|
}
|
||||||
|
if(this.reverse) {
|
||||||
|
positions.reverse()
|
||||||
|
}
|
||||||
let fromDegreesArrayHeights = []
|
let fromDegreesArrayHeights = []
|
||||||
let time = []
|
let time = []
|
||||||
let positions_smooth = []
|
let positions_smooth = []
|
||||||
|
|||||||
@ -45,11 +45,11 @@ class Vector extends Base {
|
|||||||
this.options.headTables = options.headTables || []
|
this.options.headTables = options.headTables || []
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
|
|
||||||
if (!this.options.path.endsWith('.kml')) {
|
// if (!this.options.path.endsWith('.kml')) {
|
||||||
; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
// ; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
||||||
(this.options.opacity =
|
// (this.options.opacity =
|
||||||
options.opacity || options.opacity === 0 ? options.opacity : 1)
|
// options.opacity || options.opacity === 0 ? options.opacity : 1)
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.options.show =
|
this.options.show =
|
||||||
options.show || options.show === false ? options.show : true
|
options.show || options.show === false ? options.show : true
|
||||||
@ -620,16 +620,26 @@ class Vector extends Base {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!that.options.field) {
|
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);
|
const field = properties.find(prop => that.geojson.features[0].properties[prop] !== undefined);
|
||||||
if (field) {
|
if (field) {
|
||||||
that.options.field = field;
|
that.options.field = field;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (let key in that.geojson.features[0].properties) {
|
const isChinese = (str) => /[\u4e00-\u9fa5]/.test(str);
|
||||||
that.options.field = key;
|
const sortedKeys = Object.keys(that.geojson.features[0].properties || {}).sort((a, b) => {
|
||||||
break;
|
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++) {
|
// for (let i = 0; i < that.#textEntity.length; i++) {
|
||||||
|
|||||||
@ -1342,7 +1342,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
material = new Cesium.CustomMaterialSource({
|
material = new Cesium.CustomMaterialSource({
|
||||||
image: this.getSourceRootPath() + `/img/material/${img}.png`,
|
image: this.getSourceRootPath() + `/img/material/${img}.jpg`,
|
||||||
color: this.options.color,
|
color: this.options.color,
|
||||||
is2D: false,
|
is2D: false,
|
||||||
repeats: new Cesium.CallbackProperty(() => {
|
repeats: new Cesium.CallbackProperty(() => {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ let fontData = [
|
|||||||
{
|
{
|
||||||
name: '思源黑体',
|
name: '思源黑体',
|
||||||
value: '思源黑体',
|
value: '思源黑体',
|
||||||
font: 'SourceHanSansTi',
|
font: 'SourceHanSansTiM',
|
||||||
key: '1'
|
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() {
|
function setSvg() {
|
||||||
let svgElm = document.createElement('svg');
|
let svgElm = document.createElement('svg');
|
||||||
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
||||||
@ -14,7 +14,7 @@ function setSvg() {
|
|||||||
.then(r => r.text())
|
.then(r => r.text())
|
||||||
.then(b => {
|
.then(b => {
|
||||||
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
|
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
|
||||||
if(xmlDoc) {
|
if (xmlDoc) {
|
||||||
xmlDoc.id = 'yj-' + name
|
xmlDoc.id = 'yj-' + name
|
||||||
svgElm.appendChild(xmlDoc)
|
svgElm.appendChild(xmlDoc)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
import md5 from 'js-md5'
|
import md5 from 'js-md5'
|
||||||
import { Proj } from './proj'
|
import { Proj } from './proj'
|
||||||
import { open as projConvertOpen, close as projConvertClose } from './projConvert'
|
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 { setActiveViewer, closeRotateAround, closeViewFollow } from '../Global/global'
|
||||||
import FlowPictureMaterialProperty from '../Obj/Materail/FlowPictureMaterialProperty'
|
import FlowPictureMaterialProperty from '../Obj/Materail/FlowPictureMaterialProperty'
|
||||||
import { syncData, get3DView } from '../Global/MultiViewportMode'
|
import { syncData, get3DView } from '../Global/MultiViewportMode'
|
||||||
@ -709,7 +709,8 @@ class Tools {
|
|||||||
color: color,
|
color: color,
|
||||||
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
||||||
space: newParam.space,
|
space: newParam.space,
|
||||||
speed: newParam.speed
|
speed: newParam.speed,
|
||||||
|
rotate: newParam.rotate
|
||||||
}
|
}
|
||||||
|
|
||||||
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
||||||
@ -733,11 +734,11 @@ class Tools {
|
|||||||
myImg.src = options.image
|
myImg.src = options.image
|
||||||
myImg.onload = function () {
|
myImg.onload = function () {
|
||||||
options.space = Math.max(0.1, options.space);
|
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.width = myImg.width * (options.space + 1)
|
||||||
canvasEle.height = myImg.height
|
canvasEle.height = myImg.height
|
||||||
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
|
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);
|
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
|
||||||
canvasEle.width = myImg.width * (options.space + 1)
|
canvasEle.width = myImg.width * (options.space + 1)
|
||||||
canvasEle.height = myImg.height
|
canvasEle.height = myImg.height
|
||||||
@ -1220,7 +1221,7 @@ class Tools {
|
|||||||
let pos3 = new Cesium.Cartesian3.fromDegrees(position.lng, position.lat);
|
let pos3 = new Cesium.Cartesian3.fromDegrees(position.lng, position.lat);
|
||||||
let position1
|
let position1
|
||||||
try {
|
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) {
|
} catch (error) {
|
||||||
position1 = pos3
|
position1 = pos3
|
||||||
}
|
}
|
||||||
@ -1297,6 +1298,9 @@ class Tools {
|
|||||||
projectionConvertClose()
|
projectionConvertClose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateCoordinates(date1, date2) {
|
||||||
|
updateCoordinates(date1, date2)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desc 导出excel
|
* @desc 导出excel
|
||||||
@ -1541,10 +1545,111 @@ class Tools {
|
|||||||
/**两点之间的距离 */
|
/**两点之间的距离 */
|
||||||
pointDistance(p1, p2) {
|
pointDistance(p1, p2) {
|
||||||
let centerDegress = Cesium.Cartesian3.fromDegrees(p1.lng, p1.lat)
|
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)
|
let distance = Cesium.Cartesian3.distance(point, centerDegress)
|
||||||
return distance
|
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
|
export default Tools
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Proj } from './proj'
|
|||||||
import { legp } from '../Obj/Element/datalist';
|
import { legp } from '../Obj/Element/datalist';
|
||||||
import Tools from "../Tools";
|
import Tools from "../Tools";
|
||||||
let _DialogObject
|
let _DialogObject
|
||||||
|
let Draw
|
||||||
const open = async (sdk, closeCallBack) => {
|
const open = async (sdk, closeCallBack) => {
|
||||||
let proj = new Proj()
|
let proj = new Proj()
|
||||||
let tools = new Tools(sdk)
|
let tools = new Tools(sdk)
|
||||||
@ -139,6 +140,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
let type = items[i].getAttribute('data-type')
|
let type = items[i].getAttribute('data-type')
|
||||||
let convertElm = items[i].getElementsByClassName('convert')[0]
|
let convertElm = items[i].getElementsByClassName('convert')[0]
|
||||||
|
let pickUpElm = items[i].getElementsByClassName('pickUp')[0]
|
||||||
let copyElm = items[i].getElementsByClassName('icon-copy-box')[0]
|
let copyElm = items[i].getElementsByClassName('icon-copy-box')[0]
|
||||||
let clipboard = new ClipboardJS(copyElm, {
|
let clipboard = new ClipboardJS(copyElm, {
|
||||||
text: (trigger) => {
|
text: (trigger) => {
|
||||||
@ -191,6 +193,54 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
clipboard.on('error', function (e) {
|
clipboard.on('error', function (e) {
|
||||||
tools.message({ type: 'warning', text: '复制失败' })
|
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', () => {
|
convertElm.addEventListener('click', () => {
|
||||||
// let a = proj.degreesToDMS(100.345546743)
|
// let a = proj.degreesToDMS(100.345546743)
|
||||||
let lng,
|
let lng,
|
||||||
@ -319,10 +369,12 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
items[i].style.order = 0
|
items[i].style.order = 0
|
||||||
items[i].style.display = 'block'
|
items[i].style.display = 'block'
|
||||||
convertElm.style.display = 'inline-block'
|
convertElm.style.display = 'inline-block'
|
||||||
|
pickUpElm.style.display = 'inline-block'
|
||||||
} else {
|
} else {
|
||||||
items[i].style.order = 1
|
items[i].style.order = 1
|
||||||
items[i].style.display = 'none'
|
items[i].style.display = 'none'
|
||||||
convertElm.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) {
|
if (selectData[i].value === selectDataLegpElm.value) {
|
||||||
for (let m = 0; m < items.length; m++) {
|
for (let m = 0; m < items.length; m++) {
|
||||||
let convertElm = items[m].getElementsByClassName('convert')[0]
|
let convertElm = items[m].getElementsByClassName('convert')[0]
|
||||||
|
let pickUpElm = items[m].getElementsByClassName('pickUp')[0]
|
||||||
if (m == selectData[i].key) {
|
if (m == selectData[i].key) {
|
||||||
items[m].style.order = 0
|
items[m].style.order = 0
|
||||||
items[m].style.display = 'block'
|
items[m].style.display = 'block'
|
||||||
convertElm.style.display = 'inline-block'
|
convertElm.style.display = 'inline-block'
|
||||||
|
pickUpElm.style.display = 'inline-block'
|
||||||
} else {
|
} else {
|
||||||
if (m === 0) {
|
if (m === 0) {
|
||||||
items[m].style.order = 2
|
items[m].style.order = 2
|
||||||
@ -383,6 +437,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
}
|
}
|
||||||
items[m].style.display = 'none'
|
items[m].style.display = 'none'
|
||||||
convertElm.style.display = 'none'
|
convertElm.style.display = 'none'
|
||||||
|
pickUpElm.style.display = 'none'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -397,6 +452,7 @@ const close = () => {
|
|||||||
_DialogObject.close()
|
_DialogObject.close()
|
||||||
_DialogObject = null
|
_DialogObject = null
|
||||||
}
|
}
|
||||||
|
Draw && Draw.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
export { open, close }
|
export { open, close }
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import Tools from '../Tools'
|
|||||||
let _DialogObject
|
let _DialogObject
|
||||||
let tip
|
let tip
|
||||||
let event
|
let event
|
||||||
|
let datalistLeftInput, datalistRightInput
|
||||||
const open = async (sdk, closeCallBack) => {
|
const open = async (sdk, closeCallBack) => {
|
||||||
let topls = new Tools()
|
let topls = new Tools()
|
||||||
let proj = new Proj()
|
let proj = new Proj()
|
||||||
@ -89,23 +90,23 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
let legpObjectLeft = legp(contentElm.getElementsByClassName('left')[0], ".datalist_left")
|
// let legpObjectLeft = legp(contentElm.getElementsByClassName('left')[0], ".datalist_left")
|
||||||
legpObjectLeft.legp_search(tagData, true)
|
// legpObjectLeft.legp_search(tagData, true)
|
||||||
let legpObjectRight = legp(contentElm.getElementsByClassName('right')[0], ".datalist_right")
|
// let legpObjectRight = legp(contentElm.getElementsByClassName('right')[0], ".datalist_right")
|
||||||
legpObjectRight.legp_search(tagData, true)
|
// legpObjectRight.legp_search(tagData, true)
|
||||||
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
||||||
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
||||||
let sourceCopyElm = contentElm.getElementsByClassName('sourceCopy')[0]
|
let sourceCopyElm = contentElm.getElementsByClassName('sourceCopy')[0]
|
||||||
let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
// let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
||||||
datalistLeftInput.value = tagData[0].value
|
// datalistLeftInput.value = tagData[0].value
|
||||||
legpObjectLeft.legp_searchActive(tagData[0].value)
|
// legpObjectLeft.legp_searchActive(tagData[0].value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let datalistRightInput = contentElm.getElementsByClassName('datalist_right')[0].getElementsByTagName('input')[0]
|
// let datalistRightInput = contentElm.getElementsByClassName('datalist_right')[0].getElementsByTagName('input')[0]
|
||||||
datalistRightInput.value = tagData[0].value
|
// datalistRightInput.value = tagData[0].value
|
||||||
legpObjectRight.legp_searchActive(tagData[0].value)
|
// legpObjectRight.legp_searchActive(tagData[0].value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -119,35 +120,35 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
let beforeleftVal = 'EPSG:4326'
|
let beforeleftVal = 'EPSG:4326'
|
||||||
let beforerightVal = 'EPSG:4326'
|
let beforerightVal = 'EPSG:4326'
|
||||||
// 监听输入事件(实时触发)
|
// 监听输入事件(实时触发)
|
||||||
datalistLeftInput.addEventListener('input', (e) => {
|
// datalistLeftInput.addEventListener('input', (e) => {
|
||||||
const newValue = e.target.value;
|
// const newValue = e.target.value;
|
||||||
if (leftXElm.value && leftYElm.value) {
|
// if (leftXElm.value && leftYElm.value) {
|
||||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], beforeleftVal, newValue)
|
// let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], beforeleftVal, newValue)
|
||||||
if (result.code === 0) {
|
// if (result.code === 0) {
|
||||||
leftXElm.value = result.points[0].x
|
// leftXElm.value = result.points[0].x
|
||||||
leftYElm.value = result.points[0].y
|
// leftYElm.value = result.points[0].y
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
beforeleftVal = newValue
|
// beforeleftVal = newValue
|
||||||
|
|
||||||
// 可以在这里调用legp_searchActive方法
|
// // 可以在这里调用legp_searchActive方法
|
||||||
legpObjectLeft.legp_searchActive(newValue);
|
// // legpObjectLeft.legp_searchActive(newValue);
|
||||||
});
|
// });
|
||||||
|
|
||||||
datalistRightInput.addEventListener('input', (e) => {
|
// datalistRightInput.addEventListener('input', (e) => {
|
||||||
const newValue = e.target.value;
|
// const newValue = e.target.value;
|
||||||
if (rightXElm.value && rightYElm.value) {
|
// if (rightXElm.value && rightYElm.value) {
|
||||||
let result = proj.convert([{ x: Number(rightXElm.value), y: Number(rightYElm.value) }], beforerightVal, newValue)
|
// let result = proj.convert([{ x: Number(rightXElm.value), y: Number(rightYElm.value) }], beforerightVal, newValue)
|
||||||
if (result.code === 0) {
|
// if (result.code === 0) {
|
||||||
rightXElm.value = result.points[0].x
|
// rightXElm.value = result.points[0].x
|
||||||
rightYElm.value = result.points[0].y
|
// rightYElm.value = result.points[0].y
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
beforerightVal = datalistRightInput.value
|
// beforerightVal = datalistRightInput.value
|
||||||
// 可以在这里调用legp_searchActive方法
|
// // 可以在这里调用legp_searchActive方法
|
||||||
legpObjectRight.legp_searchActive(newValue);
|
// // legpObjectRight.legp_searchActive(newValue);
|
||||||
});
|
// });
|
||||||
|
|
||||||
pickElm.addEventListener('click', () => {
|
pickElm.addEventListener('click', () => {
|
||||||
tip && tip.destroy()
|
tip && tip.destroy()
|
||||||
@ -165,7 +166,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
let pos84 = topls.cartesian3Towgs84(cartesian, sdk.viewer)
|
let pos84 = topls.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||||
tip && tip.destroy()
|
tip && tip.destroy()
|
||||||
event && event.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) {
|
if (result.code === 0) {
|
||||||
leftXElm.value = result.points[0].x
|
leftXElm.value = result.points[0].x
|
||||||
leftYElm.value = result.points[0].y
|
leftYElm.value = result.points[0].y
|
||||||
@ -183,7 +184,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
topls.message({ type: 'warning', text: '请输入源坐标' })
|
topls.message({ type: 'warning', text: '请输入源坐标' })
|
||||||
return
|
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) {
|
if (result.code === 0) {
|
||||||
rightXElm.value = result.points[0].x
|
rightXElm.value = result.points[0].x
|
||||||
rightYElm.value = result.points[0].y
|
rightYElm.value = result.points[0].y
|
||||||
@ -240,4 +241,9 @@ const close = () => {
|
|||||||
event && event.destroy()
|
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 = [
|
let fontData = [
|
||||||
{
|
{
|
||||||
name: '思源黑体',
|
name: '思源黑体',
|
||||||
value: 'SourceHanSansTi',
|
value: 'SourceHanSansTiM',
|
||||||
url: tools.getSourceRootPath() + '/custom/fonts/SourceHanSansCN-Medium.otf',
|
url: tools.getSourceRootPath() + '/custom/fonts/SourceHanSansCN-Medium.otf',
|
||||||
format: 'opentype'
|
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 |
Reference in New Issue
Block a user