修改tip提示语

This commit is contained in:
zh
2025-12-10 14:59:18 +08:00
parent 5b200529b5
commit 44d9ace1c7
30 changed files with 448 additions and 172 deletions

View File

@ -17,6 +17,7 @@ class Draw extends Tools {
this.viewer = sdk.viewer
this.entityHasCreated = false
this.event = null
this._tipText = options.tipText
this.tip = null
this.points_ids = []
this.color = options.color || 'rgba(185,14,14,0.58)'
@ -24,6 +25,17 @@ class Draw extends Tools {
this._sdk2D = get2DView()
}
get tipText() {
return this._tipText || ''
}
set tipText(text) {
this._tipText = text
if(this.tip) {
this.tip.set_text(text)
}
}
create_point(cartesian, viewer = this.viewer) {
let id = this.randomString()
viewer.entities.add(

View File

@ -72,7 +72,7 @@ class DrawAssemble extends Draw {
// eslint-disable-next-line no-undef
YJ.Measure.SetMeasureStatus(true)
let into
this.tip = new MouseTip('左键确定,右键取消;', that.sdk)
this.tip = new MouseTip(this.tipText || '左键确定,右键取消;', that.sdk)
this.event = new MouseEvent(that.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -100,6 +100,9 @@ class DrawAssemble extends Draw {
cb(null, array)
this.end()
}
else {
cb(cache_positions.length)
}
})
this.event.mouse_move((movement, cartesian) => {
if (into === '2D') {
@ -147,6 +150,22 @@ class DrawAssemble extends Draw {
this.end()
})
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '2D') {
return
}
if (this.points_ids.length >= 1) {
if(this.points_ids.length === 1) {
this.viewer.entities.remove(this.assemblePolygon)
this.assemblePolygon = undefined
}
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
this.anchorpoints.pop()
cb(cache_positions.length)
}
})
this.event.gesture_pinck_start((movement, cartesian) => {
if (into === '2D') {
return
@ -176,6 +195,7 @@ class DrawAssemble extends Draw {
cache_positions.push(this.cartesian3Towgs84(cartesian))
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian))
cb(cache_positions.length)
}
}
})
@ -204,6 +224,9 @@ class DrawAssemble extends Draw {
cb(null, array)
this.end()
}
else {
cb(cache_positions.length)
}
})
this.event2D.mouse_move((movement, cartesian) => {
if (into === '3D') {
@ -250,6 +273,21 @@ class DrawAssemble extends Draw {
cb(null)
this.end()
})
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '3D') {
return
}
if (this.points_ids.length >= 1) {
if(this.points_ids.length === 1) {
this.viewer.entities.remove(this.assemblePolygon)
this.assemblePolygon = undefined
}
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
this.anchorpoints.pop()
cb(cache_positions.length)
}
})
this.event2D.gesture_pinck_start((movement, cartesian) => {
if (into === '3D') {
@ -280,6 +318,7 @@ class DrawAssemble extends Draw {
cache_positions.push(this.cartesian3Towgs84(cartesian))
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
cb(cache_positions.length)
}
}
})

View File

@ -48,7 +48,7 @@ export default class DrawAttackArrow extends Draw {
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确定右键结束CTRL+右键撤销', this.sdk)
this.tip = new MouseTip(this.tipText || '左键确定右键结束CTRL+右键撤销', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -71,6 +71,7 @@ export default class DrawAttackArrow extends Draw {
this.points_ids.push(this.create_point(cartesian))
cache_positions.push(pos84)
isMove = false
cb(cache_positions.length)
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
@ -110,6 +111,7 @@ export default class DrawAttackArrow extends Draw {
if (this.points_ids.length > 1) {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cb(cache_positions.length)
}
})

View File

@ -21,7 +21,7 @@ export default class DrawCircle extends Draw {
super.start()
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键开始,右键取消', this.sdk)
this.tip = new MouseTip(this.tipText || '左键开始,右键取消', this.sdk)
this.event = new MouseEvent(this.sdk)
let clickNum = 0
this.circle_id = this.randomString() //圆id
@ -37,7 +37,7 @@ export default class DrawCircle extends Draw {
return
}
into = '3D'
this.tip.set_text('再次左键,完成绘制;右键取消')
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
clickNum++
if (clickNum === 1) {
this.point_id = this.create_point(cartesian)
@ -45,6 +45,7 @@ export default class DrawCircle extends Draw {
positions = this.createCircle(center, 0.01)
cache_points.push(cartesian)
createCirclePolygon()
cb(clickNum)
}
if (clickNum === 2) {
radius_points = cache_points.concat(cartesian)
@ -77,7 +78,24 @@ export default class DrawCircle extends Draw {
radius = this.computeDistance2([center, endpoint])
positions = this.createCircle(center, radius)
}
})
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '2D') {
return
}
if (this.point_id) {
this.remove_entity(this.circle_id)
this.remove_entity(this.point_id)
this.point_id = null
cache_points = []
radius_points = []
positions = []
center = {}
endpoint = null
clickNum = 0
cb(clickNum)
}
})
this.event.gesture_pinck_start((movement, cartesian) => {
@ -92,7 +110,7 @@ export default class DrawCircle extends Draw {
cb(false)
}
else {
this.tip.set_text('再次左键,完成绘制;右键取消')
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
clickNum++
if (clickNum === 1) {
this.point_id = this.create_point(cartesian)
@ -104,6 +122,7 @@ export default class DrawCircle extends Draw {
(movement.position1.x + movement.position2.x) / 2,
(movement.position1.y + movement.position2.y) / 2
)
cb(clickNum)
}
if (clickNum === 2) {
radius_points = cache_points.concat(cartesian)
@ -124,7 +143,7 @@ export default class DrawCircle extends Draw {
return
}
into = '2D'
this.tip.set_text('再次左键,完成绘制;右键取消')
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
clickNum++
if (clickNum === 1) {
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
@ -132,6 +151,7 @@ export default class DrawCircle extends Draw {
positions = this.createCircle(center, 0.01)
cache_points.push(cartesian)
createCirclePolygon(this._sdk2D.viewer)
cb(clickNum)
}
if (clickNum === 2) {
radius_points = cache_points.concat(cartesian)
@ -179,7 +199,7 @@ export default class DrawCircle extends Draw {
cb(false)
}
else {
this.tip.set_text('再次左键,完成绘制;右键取消')
this.tip.set_text(this.tipText || '再次左键,完成绘制;右键取消')
clickNum++
if (clickNum === 1) {
this.point_id = this.create_point(cartesian, this._sdk2D.viewer)
@ -191,6 +211,7 @@ export default class DrawCircle extends Draw {
((movement.position1.x + movement.position2.x) / 2) + this.viewer.canvas.width,
(movement.position1.y + movement.position2.y) / 2
)
cb(clickNum)
}
if (clickNum === 2) {
radius_points = cache_points.concat(cartesian)
@ -203,6 +224,24 @@ export default class DrawCircle extends Draw {
}
})
})
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '3D') {
return
}
if (this.point_id) {
this.remove_entity(this.circle_id)
this.remove_entity(this.point_id)
this.point_id = null
cache_points = []
radius_points = []
positions = []
center = {}
endpoint = null
clickNum = 0
cb(clickNum)
}
})
}
let that = this

View File

@ -15,7 +15,7 @@ export default class DrawElliptic extends Draw {
let into
this.entity_ids = []
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键开始,右键取消', this.sdk)
this.tip = new MouseTip(this.tipText || '左键开始,右键取消', this.sdk)
this.event = new MouseEvent(this.sdk)
let clickNum = 0
this.elliptic_id = this.randomString() //圆id
@ -34,7 +34,7 @@ export default class DrawElliptic extends Draw {
let bearing = 0
this.event.mouse_left((movement, cartesian) => {
if(into === '2D') {
if (into === '2D') {
return
}
into = '3D'
@ -62,6 +62,9 @@ export default class DrawElliptic extends Draw {
this.end()
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
}
else {
cb(clickNum)
}
// if (clickNum === 2) {
// radius_points = cache_points.concat(cartesian)
// endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
@ -72,14 +75,14 @@ export default class DrawElliptic extends Draw {
// }
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
if (into === '2D') {
return
}
this.end()
cb(false)
})
this.event.mouse_move((movement, cartesian) => {
if(into === '2D') {
if (into === '2D') {
return
}
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) {
this.event2D = new MouseEvent(this._sdk2D)
this.event2D.mouse_left((movement, cartesian) => {
if(into === '3D') {
if (into === '3D') {
return
}
into = '2D'
@ -126,6 +140,9 @@ export default class DrawElliptic extends Draw {
this.end()
cb(null, { center, bearing, semiMajorAxis, semiMinorAxis })
}
else {
cb(clickNum)
}
// if (clickNum === 2) {
// radius_points = cache_points.concat(cartesian)
// endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
@ -136,14 +153,14 @@ export default class DrawElliptic extends Draw {
// }
})
this.event2D.mouse_right((movement, cartesian) => {
if(into === '3D') {
if (into === '3D') {
return
}
this.end()
cb(false)
})
this.event2D.mouse_move((movement, cartesian) => {
if(into === '3D') {
if (into === '3D') {
return
}
this.tip.setPosition(

View File

@ -47,7 +47,7 @@ export default class DrawPincerArrow extends Draw {
super.start()
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确定右键取消CTRL+右键撤销', this.sdk)
this.tip = new MouseTip(this.tipText || '左键确定右键取消CTRL+右键撤销', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -74,6 +74,9 @@ export default class DrawPincerArrow extends Draw {
this.end()
cb(null, cache_positions, c)
}
else {
cb(cache_positions.length)
}
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
@ -102,6 +105,7 @@ export default class DrawPincerArrow extends Draw {
if (this.points_ids.length > 1) {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cb(cache_positions.length)
}
})
@ -155,6 +159,9 @@ export default class DrawPincerArrow extends Draw {
this.end()
cb(null, cache_positions, c)
}
else {
cb(cache_positions.length)
}
}
})
})
@ -183,6 +190,9 @@ export default class DrawPincerArrow extends Draw {
this.end()
cb(null, cache_positions, c)
}
else {
cb(cache_positions.length)
}
})
this.event2D.mouse_right((movement, cartesian) => {
if(into === '3D') {
@ -211,6 +221,7 @@ export default class DrawPincerArrow extends Draw {
if (this.points_ids.length > 1) {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cb(cache_positions.length)
}
})
@ -264,6 +275,9 @@ export default class DrawPincerArrow extends Draw {
this.end()
cb(null, cache_positions, c)
}
else {
cb(cache_positions.length)
}
}
})
})

View File

@ -28,7 +28,7 @@ class DrawPoint extends Draw {
} else {
let car = undefined
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确定,右键结束;', this.sdk)
this.tip = new MouseTip(this.tipText || '左键确定,右键结束;', this.sdk)
this.event = new MouseEvent(this.sdk)
this.event.mouse_left((movement, cartesian) => {
this.end()

View File

@ -62,7 +62,7 @@ class DrawPolygon extends Draw {
super.start()
YJ.Measure.SetMeasureStatus(true)
let into
this.tip = new MouseTip('左键确定右键结束CTRL+右键撤销', this.sdk)
this.tip = new MouseTip(this.tipText || '左键确定右键结束CTRL+右键撤销', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -88,6 +88,7 @@ class DrawPolygon extends Draw {
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian))
cb(cache_positions.length)
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
@ -122,6 +123,7 @@ class DrawPolygon extends Draw {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cache_84_position.pop()
cb(cache_positions.length)
}
})
@ -134,6 +136,7 @@ class DrawPolygon extends Draw {
cache_positions.pop()
cache_84_position.pop()
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
@ -164,6 +167,7 @@ class DrawPolygon extends Draw {
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian))
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
})
@ -190,6 +194,7 @@ class DrawPolygon extends Draw {
cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
cb(cache_positions.length)
})
this.event2D.mouse_right((movement, cartesian) => {
if(into === '3D') {
@ -224,6 +229,7 @@ class DrawPolygon extends Draw {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cache_84_position.pop()
cb(cache_positions.length)
}
})
@ -236,6 +242,7 @@ class DrawPolygon extends Draw {
cache_positions.pop()
cache_84_position.pop()
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
@ -266,6 +273,7 @@ class DrawPolygon extends Draw {
// console.log(this.cartesian3Towgs84(cartesian))
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
})

View File

@ -96,7 +96,7 @@ class DrawPolyline extends Draw {
super.start()
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确定右键结束CTRL+右键撤销', this.sdk)
this.tip = new MouseTip(this.tipText || '左键确定右键结束CTRL+右键撤销', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -137,6 +137,9 @@ class DrawPolyline extends Draw {
cb(null, positions, smoothPos)
this.end()
}
else {
cb(cache_positions.length)
}
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
@ -175,6 +178,7 @@ class DrawPolyline extends Draw {
if (this.points_ids.length > 1) {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cb(cache_positions.length)
}
})
@ -186,6 +190,7 @@ class DrawPolyline extends Draw {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
@ -225,6 +230,7 @@ class DrawPolyline extends Draw {
cache_positions.push(cartesian)
this.points_ids.push(this.create_point(cartesian, this.viewer))
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
})
@ -287,6 +293,7 @@ class DrawPolyline extends Draw {
if (this.points_ids.length > 1) {
this.remove_entity(this.points_ids.pop()) //移除point
cache_positions.pop()
cb(cache_positions.length)
}
})
@ -337,6 +344,7 @@ class DrawPolyline extends Draw {
cache_positions.push(cartesian)
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
this.positions = cache_positions.concat(cartesian)
cb(cache_positions.length)
}
})
})

View File

@ -58,7 +58,7 @@ class DrawRect extends Draw {
super.start()
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确定,右键取消', that.sdk)
this.tip = new MouseTip(this.tipText || '左键确定,右键取消', that.sdk)
this.event = new MouseEvent(that.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id
@ -86,10 +86,10 @@ class DrawRect extends Draw {
secondtPoint = wgs84
this.end()
cb(null, that.rectObj, [firstPoint, secondtPoint])
}
else {
cb(cnt)
}
})
this.event.mouse_right((movement, cartesian) => {
if(into === '2D') {
@ -113,6 +113,19 @@ class DrawRect extends Draw {
}
})
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '2D') {
return
}
if (this.points_ids.length >= 1) {
this.remove_entity(this.points_ids.pop()) //移除point
this.polygonHasCreated = false
this.rect = []
cnt--
cb(cnt)
}
})
this.event.gesture_pinck_start((movement, cartesian) => {
if(into === '2D') {
return
@ -145,7 +158,9 @@ class DrawRect extends Draw {
secondtPoint = wgs84
this.end()
cb(null, that.rectObj, [firstPoint, secondtPoint])
}
else {
cb(cnt)
}
}
})
@ -172,9 +187,10 @@ class DrawRect extends Draw {
secondtPoint = wgs84
this.end()
cb(null, that.rectObj, [firstPoint, secondtPoint])
}
else {
cb(cnt)
}
})
this.event2D.mouse_right((movement, cartesian) => {
@ -199,6 +215,19 @@ class DrawRect extends Draw {
}
})
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '3D') {
return
}
if (this.points_ids.length >= 1) {
this.remove_entity(this.points_ids.pop()) //移除point
this.polygonHasCreated = false
this.rect = []
cnt--
cb(cnt)
}
})
this.event2D.gesture_pinck_start((movement, cartesian) => {
if(into === '3D') {
return
@ -231,7 +260,9 @@ class DrawRect extends Draw {
secondtPoint = wgs84
this.end()
cb(null, that.rectObj, [firstPoint, secondtPoint])
}
else {
cb(cnt)
}
}
})

View File

@ -26,7 +26,7 @@ class DrawSector extends Draw {
super.start()
let into
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('左键确认,右键取消', that.sdk)
this.tip = new MouseTip(this.tipText || '左键确认,右键取消', that.sdk)
this.event = new MouseEvent(that.sdk)
this._sector_id = null; //扇形
this._positions = []; //活动点
@ -45,6 +45,7 @@ class DrawSector extends Draw {
if (this._positions.length < 3) {
this.points_ids.push(this.create_point(cartesian));
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
cb(this._positions.length)
}
else {
this.end()
@ -90,6 +91,20 @@ class DrawSector extends Draw {
this.end()
cb(null)
})
this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '2D') {
return
}
if (this._positions.length >= 1) {
this.remove_entity(this.points_ids.pop())
this.remove_entity(this.points_ids.pop())
this.remove_entity(this._sector_id)
this._sector_id = undefined
this._positions.pop()
this._positions.pop()
cb(this._positions.length)
}
})
if (!this._is2D && this._sdk2D) {
this.event2D = new MouseEvent(this._sdk2D)
this.event2D.mouse_left((movement, cartesian) => {
@ -102,6 +117,7 @@ class DrawSector extends Draw {
if (this._positions.length < 3) {
this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer));
this._positions.push(this.cartesian3Towgs84(cartesian, this.viewer));
cb(this._positions.length)
}
else {
this.end()
@ -147,6 +163,20 @@ class DrawSector extends Draw {
this.end()
cb(null)
})
this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
if(into === '3D') {
return
}
if (this._positions.length >= 1) {
this.remove_entity(this.points_ids.pop())
this.remove_entity(this.points_ids.pop())
this.remove_entity(this._sector_id)
this._sector_id = undefined
this._positions.pop()
this._positions.pop()
cb(this._positions.length)
}
})
}
}
}

View File

@ -185,6 +185,18 @@ export default class MouseEvent {
}, Cesium.ScreenSpaceEventType.PINCH_MOVE)
}
keyboard_ctrl_z(cb) {
// // this.sdk.viewer.canvas.tabindex = 0
// // this.sdk.viewer.canvas.focus()
// let mapElm = this.sdk.viewer.canvas
// mapElm.addEventListener('keydown', function(e) {
// if (e.ctrlKey && e.key === 'z') {
// e.preventDefault();
// console.log('编辑器内触发 Ctrl + Z');
// }
// });
}
destroy() {
if (this.handler)
this.handler.destroy() //关闭事件句柄

View File

@ -9,7 +9,7 @@ import Measure from "../index";
class MeasureAngle extends Measure {
constructor(sdk) {
super(sdk, { text: "左键开始,右键取消" });
super(sdk, { text: "左键单击确定起点位置,右键单击取消夹角测量!" });
this.cachePositions = []
this.positions = []
this.arcPositions = []
@ -113,6 +113,7 @@ class MeasureAngle extends Measure {
if (this.ids.length === 0) {
//需要创建一个线
this.line_id = this.createPolyline()
this.tip.set_text('左键单击确定角点位置,右键单击取消夹角测量!')
}
this.ids.push(this.create_point(car))
@ -122,6 +123,7 @@ class MeasureAngle extends Measure {
this.positions = this.cachePositions.concat(car)
}
if (this.ids.length === 2) {
this.tip.set_text('左键单击确定终点位置,完成夹角测量!')
this.label_id = Cesium.createGuid()
this.arc_id = Cesium.createGuid()
let p = this.cartesian3Towgs84(car, this.viewer)

View File

@ -7,7 +7,7 @@ class MeasureAzimuth extends Measure {
* @description 方位角测量
* */
constructor(sdk) {
super(sdk, { text: "左键开始,右键取消" });
super(sdk, { text: "左键单击确定控制点位置,右键单击取消方位角测量!" });
this.cachePositions = []
this.positions = []
this.arcPositions = []
@ -80,6 +80,7 @@ class MeasureAzimuth extends Measure {
//需要创建一个线
this.line_id = this.createPolyline()
}
this.tip.set_text('左键单击确定控制点位置,完成方位角测量!')
this.tip.setPosition(car, movement.position.x, movement.position.y)
if (this.cachePositions.length) {
this.positions = this.cachePositions.concat(car)

View File

@ -216,6 +216,7 @@ class MeasureDistance extends Measure {
super.start()
this.positions = []
this.cachePositions = []
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地距离测量!')
let leftEvent = async (movement, car) => {
@ -234,6 +235,7 @@ class MeasureDistance extends Measure {
let cur_point = this.cartesian3Towgs84(car, this.viewer)
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
this.cachePositions.push(car)
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地距离测量!')
await this.computeDisByTowPoint(pre_p, cur_point)
} else {
this.cachePositions.push(car)

View File

@ -14,7 +14,7 @@ class MeasureHeight extends Measure {
* @description 高度测量
* */
constructor(sdk) {
super(sdk, {text: "左键开始,右键取消"});
super(sdk, {text: "左键单击确定控制点位置,右键单击取消垂直高度测量!"});
}
static create_polygon(that) {
@ -120,6 +120,7 @@ class MeasureHeight extends Measure {
this.ids.push(MeasureHeight.create_polygon(this))
this.ids.push(MeasureHeight.create_point(this, cartesian))
}
this.tip.set_text('左键单击确定终点位置,完成垂直高度测量!')
count++
this.tip.setPosition(cartesian, movement.position.x, movement.position.y)
if (count === 2) {
@ -131,7 +132,7 @@ class MeasureHeight extends Measure {
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
this.text = "相对高度:" + this.height + " 米"
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
// this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
}
this.ids.push(MeasureHeight.create_point(this, cartesian, {label: {text: "半径:" + this.circleRadius + " 米"}}))
this.end()
@ -148,7 +149,7 @@ class MeasureHeight extends Measure {
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
this.text = "相对高度:" + this.height + " 米"
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
// this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
}
})
this.event.mouse_right((movement, cartesian) => {

View File

@ -158,6 +158,7 @@ class MeasureProjectionDistance extends Measure {
super.start()
this.positions = []
this.cachePositions = []
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影距离测量!')
let leftEvent = async (movement, car) => {
if (this.ids.length === 0) {
@ -178,6 +179,7 @@ class MeasureProjectionDistance extends Measure {
let text = "投影距离:" + cur_len + " 米"
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
this.cachePositions.push(car)
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影距离测量!')
} else {
this.cachePositions.push(car)
this.ids.push(MeasureProjectionDistance.create_point(car, {show: false}, this))
@ -212,13 +214,13 @@ class MeasureProjectionDistance extends Measure {
this.event.mouse_move((movement, car) => {
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
this.positions = this.cachePositions.concat(car)
if (this.cachePositions.length) {
let cur_point = this.cartesian3Towgs84(car, this.viewer)
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
let cur_len = this.computeDistance2([cur_point, pre_p])
let text = "当前投影距离:" + cur_len + " 米"
this.tip.set_text(text)
}
// if (this.cachePositions.length) {
// let cur_point = this.cartesian3Towgs84(car, this.viewer)
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
// let cur_len = this.computeDistance2([cur_point, pre_p])
// let text = "当前投影距离:" + cur_len + " 米"
// this.tip.set_text(text)
// }
})
this.event.mouse_right(rightEvent)
this.event.mouse_right_keyboard_ctrl((movement, car) => {

View File

@ -160,6 +160,7 @@ class MeasureSlopeDistance extends Measure {
super.start()
this.positions = []
this.cachePositions = []
this.tip.set_text('左键单击确定控制点位置,右键单击取消坡度测量!')
let leftEvent = (movement, car) => {
if (this.ids.length === 0) {
@ -179,6 +180,7 @@ class MeasureSlopeDistance extends Measure {
//计算坡度
this.computeAngle(pre_p, cur_point)
}
this.tip.set_text('左键单击确定控制点位置,右键单击完成坡度测量!')
} else {
this.cachePositions.push(car)
this.ids.push(MeasureSlopeDistance.create_point(car, {}, this))
@ -232,18 +234,18 @@ class MeasureSlopeDistance extends Measure {
}
this.tip.setPosition(car, movement.endPosition.x, movement.endPosition.y)
this.positions = this.cachePositions.concat(cartesian)
if (this.cachePositions.length) {
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
let d1 = this.computeDistance2([pre_p, cur_point])
let d2 = Math.abs(pre_p.alt - cur_point.alt)
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
let cosAlpha = d1 / d3
let acos = Math.acos(cosAlpha)
let angle = this.radiansToDegrees(acos)
let label = "坡度:" + angle.toFixed(2) + "°"
this.tip.set_text(label)
}
// if (this.cachePositions.length) {
// let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
// let d1 = this.computeDistance2([pre_p, cur_point])
// let d2 = Math.abs(pre_p.alt - cur_point.alt)
// let d3 = Math.sqrt(d1 * d1 + d2 * d2)
// let cosAlpha = d1 / d3
// let acos = Math.acos(cosAlpha)
// let angle = this.radiansToDegrees(acos)
// let label = "坡度:" + angle.toFixed(2) + "°"
// this.tip.set_text(label)
// }
})
this.event.mouse_right(rightEvent)
this.event.mouse_right_keyboard_ctrl((movement, car) => {

View File

@ -80,6 +80,7 @@ class MeasureTdArea extends Measure {
this.text = ""
this.center = new Cesium.Cartesian3()
this.cachePositions = []
this.tip.set_text('左键单击确定控制点位置,右键单击取消贴地面积测量!')
let height = 0
let text
@ -96,6 +97,10 @@ class MeasureTdArea extends Measure {
this.positions = this.cachePositions.concat({ ...car })
this.tip.setPosition({ ...car }, movement.position.x, movement.position.y)
if (this.positions.length > 3) {
this.tip.set_text('左键单击确定控制点位置,右键单击完成贴地面积测量!')
}
}
let rightEvent = (movement, car) => {
this.positions = this.cachePositions

View File

@ -14,7 +14,7 @@ class MeasureTriangle extends Measure {
* @description 三角测量
* */
constructor(sdk) {
super(sdk);
super(sdk, {text: "左键单击确定控制点位置,右键单击取消三角测量!"});
}
cal_center(positions) {
@ -170,6 +170,7 @@ class MeasureTriangle extends Measure {
let leftEvent = (movement, car) => {
xiebian_line_positions.push(car)
this.tip.set_text('左键单击确定终点位置,完成三角测量!')
if (this.ids.length === 0) {//创建三角形
first_point = this.cartesian3Towgs84(car, this.viewer)
this.createPolyline(shuiping_line_id,)

View File

@ -85,6 +85,7 @@ class MeasureTyArea extends Measure {
this.ids = []
this.positions = []
this.text = ""
this.tip.set_text('左键单击确定控制点位置,右键单击取消投影面积测量!')
this.center = new Cesium.Cartesian3()
this.cachePositions = []
let height = 0
@ -117,6 +118,9 @@ class MeasureTyArea extends Measure {
lastcneter = this.center
this.text = "投影面积:" + area + " ㎡"
}
if(this.positions.length > 3) {
this.tip.set_text('左键单击确定控制点位置,右键单击完成投影面积测量!')
}
}
this.event.mouse_left(leftEvent)
this.event.mouse_move((movement, car) => {

View File

@ -38,19 +38,14 @@ class CircleViewShed extends Tools {
this.tools = new Tools(sdk)
YJ.Analysis.AnalysesResults.push(this)
// CircleViewShed.edit(this)
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.tools.message({ type: 'warning', text: '未加载地形数据!' })
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
return
}
// CircleViewShed.create(this)
}
draw() {
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
return '未加载地形数据!'
}
CircleViewShed.create(this)
}
@ -115,13 +110,7 @@ class CircleViewShed extends Tools {
static create(that) {
let terrainAvailability = that.viewer.terrainProvider.availability;
if (!terrainAvailability) {
that.tools.message({ type: 'warning', text: '未加载地形数据!' })
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
return
return '未加载地形数据!'
}
let count = 0
if (!YJ.Measure.GetMeasureStatus()) {
@ -129,10 +118,20 @@ class CircleViewShed extends Tools {
that._DialogObject.close()
that._DialogObject = null
}
let Draw = new YJ.Draw.DrawCircle(that.sdk)
let Draw = new YJ.Draw.DrawCircle(that.sdk, {
tipText: '左键单击确定中心点位置右键单击取消区域绘制CTRL+右键单击撤销'
})
Draw.start(async (a, options) => {
// that.center = options.center
if (!options) {
switch (a) {
case 0:
Draw.tipText = '左键单击确定中心点位置右键单击取消区域绘制CTRL+右键单击撤销'
break;
case 1:
Draw.tipText = '左键单击确定圆形视域半径,完成圆形视域分析!'
break;
}
return
}
that.radius = options.radius
@ -152,47 +151,47 @@ class CircleViewShed extends Tools {
}
}
static async edit(that) {
if (that._DialogObject && that._DialogObject.close) {
that._DialogObject.close()
that._DialogObject = null
}
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
title: '圆形视域分析',
left: '180px',
top: '100px',
closeCallBack: () => {
that.Dialog.closeCallBack && that.Dialog.closeCallBack()
YJ.Measure.SetMeasureStatus(false)
}
})
await that._DialogObject.init()
that._DialogObject._element.body.className =
that._DialogObject._element.body.className + ' circle-view-shed'
let contentElm = document.createElement('div')
contentElm.innerHTML = html()
that._DialogObject.contentAppChild(contentElm)
// static async edit(that) {
// if (that._DialogObject && that._DialogObject.close) {
// that._DialogObject.close()
// that._DialogObject = null
// }
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
// title: '圆形视域分析',
// left: '180px',
// top: '100px',
// closeCallBack: () => {
// that.Dialog.closeCallBack && that.Dialog.closeCallBack()
// YJ.Measure.SetMeasureStatus(false)
// }
// })
// await that._DialogObject.init()
// that._DialogObject._element.body.className =
// that._DialogObject._element.body.className + ' circle-view-shed'
// let contentElm = document.createElement('div')
// contentElm.innerHTML = html()
// that._DialogObject.contentAppChild(contentElm)
let drawElm = document.createElement('button')
drawElm.innerHTML = '绘制'
drawElm.addEventListener('click', () => {
let terrainAvailability = that.viewer.terrainProvider.availability;
if (!terrainAvailability) {
window.ELEMENT && window.ELEMENT.Message({
message: '未加载地形数据!',
type: 'warning',
duration: 1500
});
return
}
CircleViewShed.create(that)
})
that._DialogObject.footAppChild(drawElm)
// let drawElm = document.createElement('button')
// drawElm.innerHTML = '绘制'
// drawElm.addEventListener('click', () => {
// let terrainAvailability = that.viewer.terrainProvider.availability;
// if (!terrainAvailability) {
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
// return
// }
// CircleViewShed.create(that)
// })
// that._DialogObject.footAppChild(drawElm)
let all_elm = contentElm.getElementsByTagName('*')
that._EventBinding.on(that, all_elm)
that._elms = that._EventBinding.element
}
// let all_elm = contentElm.getElementsByTagName('*')
// that._EventBinding.on(that, all_elm)
// that._elms = that._EventBinding.element
// }
analyse() {
// this.destroy()

View File

@ -28,7 +28,7 @@ class CutFillAnalysis {
}
this.entities = []
this.tools = new Tools(this.sdk)
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
YJ.Analysis.AnalysesResults.push(this)
// CutFillAnalysis.EditBox(this)
}
@ -37,11 +37,12 @@ class CutFillAnalysis {
this.clean()
this.Draw.start((a, positions) => {
if (!positions || positions.length < 3) {
let _error = '最少需要三个坐标!'
this.tools.message({
text: _error,
type: 'warning',
});
if (a >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
}
return
}
let fromDegreesArray = []

View File

@ -26,7 +26,7 @@ class Profile extends Draw {
console.warn('上一次测量未结束')
} else {
YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('左键确定,右键取消', that.sdk)
that.tip = new MouseTip('左键点击确定起点位置,右键点击取消绘制!', that.sdk)
that.event = new MouseEvent(that.sdk)
that.positions = []
that.points_ids = [] //存放左键点击时临时添加的point的id
@ -35,6 +35,7 @@ class Profile extends Draw {
let car = undefined
that.event.mouse_left(async (movement, cartesian) => {
try {
that.tip.setText('左键点击确定终点位置,右键点击取消绘制!')
if (!that.entityHasCreated) {
Profile.create_polyline(that)
}

View File

@ -10,20 +10,18 @@ class SlopeAspect extends Tools {
constructor(sdk) {
super(sdk)
this.viewer = sdk.viewer;
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.error = '未加载地形数据!'
return
}
this.event
this.result = []; //存储创建的坡度分析结果primitive集合
this.handler = undefined;
this.toolTip = "";
this.tools = new Tools(sdk)
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.error = '未加载地形数据!'
this.tools.message({ type: 'warning', text: this.error })
return
}
YJ.Analysis.AnalysesResults.push(this)
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点' })
// this.createNew4Distance()
this.createNew4Num(50)
}
@ -36,8 +34,13 @@ class SlopeAspect extends Tools {
const $this = this;
const viewer = this.viewer;
this.Draw.start((e, positions) => {
if (!positions || positions.length <= 2) {
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
if (!positions || positions.length < 3) {
if (e >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
}
return
}
let boundary = [];
@ -66,8 +69,13 @@ class SlopeAspect extends Tools {
createNew4Num(n) {
let num = n
this.Draw.start((e, positions) => {
if (!positions || positions.length <= 2) {
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
if (!positions || positions.length < 3) {
if (e >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
}
return
}
let boundary = [];

View File

@ -21,7 +21,7 @@ class Submerge extends Tools {
this.currentWaterLaver
this.color = '#00d9ff66'
this.Dialog = _Dialog
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
this.positions
this.status = true
this.area = 0
@ -36,23 +36,15 @@ class Submerge extends Tools {
static create(that) {
that.Draw.start((a, positions) => {
if (!positions || positions.length < 3) {
let _error = '至少需要三个坐标!'
that.tools.message({
text: _error,
type: 'warning',
});
if (a >= 3) {
that.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
}
else {
that.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
}
return
}
that.destroy()
if (!positions || positions.length == 0) {
that.positions = []
that._positions = []
that.options.minWaterLevel = 0
that.options.maxWaterLevel = 0
that.options.waterVolume = 0
that.area = 0
return
}
let fromDegreesArray = []
that.positions = positions
that._positions = positions

View File

@ -488,14 +488,6 @@ class BaseTileset extends BaseSource {
* */
set rotationEditing(status) {
if (!this.tileset.root.transform) {
if (window.ELEMENT) {
window.ELEMENT.Message.closeAll();
window.ELEMENT.Message({
message: '该模型不支持移动和旋转!',
type: 'warning',
duration: 1500
});
}
console.warn('该模型不支持移动和旋转!')
return
}
@ -534,14 +526,6 @@ class BaseTileset extends BaseSource {
return
}
if (!this.tileset.root.transform) {
if (window.ELEMENT) {
window.ELEMENT.Message.closeAll();
window.ELEMENT.Message({
message: '该模型不支持移动和旋转!',
type: 'warning',
duration: 1500
});
}
console.warn('该模型不支持移动和旋转!')
return
}

View File

@ -125,13 +125,14 @@ class Graffiti extends Draw {
start() {
let _this = this
if (YJ.Measure.GetMeasureStatus()) {
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
this._error = '上一次测量未结束'
} else {
this._error = null
let viewer = this.sdk.viewer
CameraController(this.sdk, false)
super.start()
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('长按左键,拖动鼠标进行涂鸦,右键结束涂鸦', this.sdk)
this.tip = new MouseTip('左键按下开始,松开完成,右键单击完成绘制', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id

View File

@ -1500,7 +1500,7 @@ class PolygonObject extends Base {
fromDegreesArray = []
this.heightMode = this.heightMode
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1700,19 +1700,20 @@ class PolygonObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
nodeEdit(cb = () => { }) {
this.positionEditing = false
setTimeout(() => {
let previous = [...this.options.positions]
if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束')
} else {
YJ.Measure.SetMeasureStatus(true)
this.picking = false
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
this.tip = new MouseTip('左键单击选择控制点,右键单击取消编辑', this.sdk)
this.event = new MouseEvent(this.sdk)
this.nodePoints = []
let _this = this
@ -1848,7 +1849,7 @@ class PolygonObject extends Base {
selectPoint = pick.id
this.nodePoints.splice(pick.id.index, 1)
this.sdk.viewer.entities.remove(pick.id)
this.tip.set_text('左键开始右键结束CTRL+右键撤销')
this.tip.set_text('左键单击确定控制点位置,右键单击结束编辑! CTRL+右键单击撤销上一个控制点')
originalPosition = this.cartesian3Towgs84(
selectPoint.position.getValue(),
this.sdk.viewer
@ -1863,6 +1864,51 @@ class PolygonObject extends Base {
if (added) {
this.options.positions.splice(selectPoint.index, 1)
}
if (this.options.positions.length < 3) {
this.options.positions = [...previous]
let positions = this.options.positions
let fromDegreesArray = []
for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat)
}
this.positions = Cesium.Cartesian3.fromDegreesArray(
fromDegreesArray
)
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
this.previous = {
positions: [...this.positions]
}
let objectsToExclude = [...this.sdk.viewer.entities.values]
let positions2 = [[]]
for (let i = 0; i < this.options.positions.length; i++) {
positions2[0].push([
this.options.positions[i].lng,
this.options.positions[i].lat
])
}
positions2[0].push([
this.options.positions[0].lng,
this.options.positions[0].lat
])
let polygon = turf.polygon(positions2)
let centroid = turf.centroid(polygon)
this
.getClampToHeight({
lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1]
}, objectsToExclude)
.then(height => {
this.label.position = [
centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1],
height
]
})
this.areaByMeter = this.computeArea(this.options.positions)
this.areaChangeCallBack && this.areaChangeCallBack()
}
cb(null, this.options.positions)
}
@ -2018,6 +2064,9 @@ class PolygonObject extends Base {
}
}
this.nodePoints.pop()
if(this.options.positions.length < 3) {
this.tip.set_text('左键单击确定控制点位置,右键单击取消编辑! CTRL+右键单击撤销上一个控制点')
}
}
})

View File

@ -595,7 +595,7 @@ class StandText extends Base {
selectPoint = pick.id
this.nodePoints.splice(pick.id.index, 1)
this.sdk.viewer.entities.remove(pick.id)
this.tip.set_text('左键开始右键结束CTRL+右键撤销')
this.tip.set_text('左键单击确认顶点位置,右键单击结束CTRL+右键撤销')
originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
this.entity.wall.positions = new Cesium.CallbackProperty(function () {
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
@ -615,6 +615,15 @@ class StandText extends Base {
if(isAdd) {
this.options.positions.splice(selectPoint.index, 1)
}
if (!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)
}
let positions = this.options.positions