修改tip提示语
This commit is contained in:
@ -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
|
||||||
@ -137,6 +137,9 @@ class DrawPolyline extends Draw {
|
|||||||
cb(null, positions, smoothPos)
|
cb(null, positions, smoothPos)
|
||||||
this.end()
|
this.end()
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
cb(cache_positions.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
if(into === '2D') {
|
if(into === '2D') {
|
||||||
@ -175,6 +178,7 @@ class DrawPolyline 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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -186,6 +190,7 @@ class DrawPolyline extends Draw {
|
|||||||
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -287,6 +293,7 @@ class DrawPolyline 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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -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() //关闭事件句柄
|
||||||
|
|||||||
@ -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) => {
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -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.setText('左键点击确定终点位置,右键点击取消绘制!')
|
||||||
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 = [];
|
||||||
|
|||||||
@ -21,7 +21,7 @@ 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
|
||||||
@ -36,23 +36,15 @@ class Submerge extends Tools {
|
|||||||
static create(that) {
|
static create(that) {
|
||||||
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
|
||||||
|
|||||||
@ -488,14 +488,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 +526,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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
}
|
}
|
||||||
@ -1700,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
|
||||||
@ -1848,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
|
||||||
@ -1863,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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2018,6 +2064,9 @@ class PolygonObject extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.nodePoints.pop()
|
this.nodePoints.pop()
|
||||||
|
if(this.options.positions.length < 3) {
|
||||||
|
this.tip.set_text('左键单击确定控制点位置,右键单击取消编辑! CTRL+右键单击撤销上一个控制点')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -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 (!that.options.positions || that.options.positions.length < 2) {
|
||||||
|
console.warn('最少需要两个坐标!')
|
||||||
|
window.ELEMENT && window.ELEMENT.Message({
|
||||||
|
message: '最少需要两个坐标!',
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
that.options.positions = [...previous]
|
||||||
|
}
|
||||||
cb(null, this.options.positions)
|
cb(null, this.options.positions)
|
||||||
}
|
}
|
||||||
let positions = this.options.positions
|
let positions = this.options.positions
|
||||||
|
|||||||
Reference in New Issue
Block a user