Selaa lähdekoodia

refine @dc-modules/plot and fix the issue #26

tags/2.1.4
Caven Chen 4 vuotta sitten
vanhempi
commit
02ba6a5c0e

+ 14
- 1
modules/plot/draw/Draw.js Näytä tiedosto

@@ -13,16 +13,29 @@ class Draw {
this._floatingAnchor = undefined
this._clampToGround = true
this._tooltip = undefined
this._tooltipMess = '单击选择点位'
this._layer = undefined
this._plotEvent = undefined
this._options = {}
this._positions = []
}

_mountEntity() {}

_onClick(e) {}

_onMouseMove(e) {}
_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, this._tooltipMess)
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}

_onRightClick(e) {}


+ 3
- 11
modules/plot/draw/DrawAttackArrow.js Näytä tiedosto

@@ -17,7 +17,6 @@ const DEF_STYLE = {
class DrawAttackArrow extends Draw {
constructor(style) {
super()
this._positions = []
this._floatingAnchor = undefined
this._style = {
...DEF_STYLE,
@@ -46,6 +45,9 @@ class DrawAttackArrow extends Draw {
_onClick(e) {
let len = this._positions.length
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
if (len === 0) {
this._positions.push(position)
this.createAnchor(position)
@@ -64,16 +66,6 @@ class DrawAttackArrow extends Draw {
this._plotEvent.raiseEvent(attackArrow)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawAttackArrow

+ 3
- 11
modules/plot/draw/DrawCircle.js Näytä tiedosto

@@ -16,7 +16,6 @@ const DEF_STYLE = {
class DrawCircle extends Draw {
constructor(style) {
super()
this._positions = []
this._radius = 0
this._style = {
...DEF_STYLE,
@@ -63,6 +62,9 @@ class DrawCircle extends Draw {
_onClick(e) {
let len = this._positions.length
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
if (len === 0) {
this._positions.push(position)
this.createAnchor(position, true)
@@ -83,16 +85,6 @@ class DrawCircle extends Draw {
this._plotEvent.raiseEvent(circle)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawCircle

+ 0
- 11
modules/plot/draw/DrawDoubleArrow.js Näytä tiedosto

@@ -17,7 +17,6 @@ const DEF_STYLE = {
class DrawDoubleArrow extends Draw {
constructor(style) {
super()
this._positions = []
this._floatingAnchor = undefined
this._style = {
...DEF_STYLE,
@@ -64,16 +63,6 @@ class DrawDoubleArrow extends Draw {
this._plotEvent.raiseEvent(doubleArrow)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawDoubleArrow

+ 3
- 11
modules/plot/draw/DrawFineArrow.js Näytä tiedosto

@@ -17,7 +17,6 @@ const DEF_STYLE = {
class DrawFineArrow extends Draw {
constructor(style) {
super()
this._positions = []
this._floatingAnchor = undefined
this._style = {
...DEF_STYLE,
@@ -45,6 +44,9 @@ class DrawFineArrow extends Draw {

_onClick(e) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let len = this._positions.length
if (len === 0) {
this._positions.push(position)
@@ -64,16 +66,6 @@ class DrawFineArrow extends Draw {
this._plotEvent.raiseEvent(fineArrow)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawFineArrow

+ 0
- 11
modules/plot/draw/DrawGatheringPlace.js Näytä tiedosto

@@ -17,7 +17,6 @@ const DEF_STYLE = {
class DrawGatheringPlace extends Draw {
constructor(style) {
super()
this._positions = []
this._floatingAnchor = undefined
this._style = {
...DEF_STYLE,
@@ -64,16 +63,6 @@ class DrawGatheringPlace extends Draw {
this._plotEvent.raiseEvent(gatheringPlace)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawGatheringPlace

+ 1
- 1
modules/plot/draw/DrawPoint.js Näytä tiedosto

@@ -45,7 +45,7 @@ class DrawPoint extends Draw {
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
this._tooltip.showAt(e.windowPosition, this._tooltipMess)
this._position = this._clampToGround ? e.surfacePosition : e.position
}
}

+ 4
- 11
modules/plot/draw/DrawPolygon.js Näytä tiedosto

@@ -16,11 +16,11 @@ const DEF_STYLE = {
class DrawPolygon extends Draw {
constructor(style) {
super()
this._positions = []
this._style = {
...DEF_STYLE,
...style
}
this._tooltipMess = '左击选择点位,右击结束'
}

_mountEntity() {
@@ -41,6 +41,9 @@ class DrawPolygon extends Draw {

_onClick(e) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let len = this._positions.length
if (len === 0) {
this._positions.push(position)
@@ -51,16 +54,6 @@ class DrawPolygon extends Draw {
this.createAnchor(position)
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '左击选择点位,右击结束')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}

_onRightClick(e) {
this.unbindEvent()
let polygon = new Polygon(

+ 4
- 11
modules/plot/draw/DrawPolyline.js Näytä tiedosto

@@ -16,11 +16,11 @@ const DEF_STYLE = {
class DrawPolyline extends Draw {
constructor(style) {
super()
this._positions = []
this._style = {
...DEF_STYLE,
...style
}
this._tooltipMess = '左击选择点位,右击结束'
}

_mountEntity() {
@@ -37,6 +37,9 @@ class DrawPolyline extends Draw {

_onClick(e) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let len = this._positions.length
if (len === 0) {
this._positions.push(position)
@@ -47,16 +50,6 @@ class DrawPolyline extends Draw {
this.createAnchor(position)
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位,右击结束')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}

_onRightClick(e) {
this.unbindEvent()
let polyline = new Polyline(

+ 3
- 11
modules/plot/draw/DrawRectangle.js Näytä tiedosto

@@ -15,7 +15,6 @@ const DEF_STYLE = {
class DrawRectangle extends Draw {
constructor(style) {
super()
this._positions = []
this._style = {
...DEF_STYLE,
...style
@@ -40,6 +39,9 @@ class DrawRectangle extends Draw {

_onClick(e) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let len = this._positions.length
if (len === 0) {
this._positions.push(position)
@@ -58,16 +60,6 @@ class DrawRectangle extends Draw {
this._plotEvent.raiseEvent(rectangle)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '左击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawRectangle

+ 3
- 11
modules/plot/draw/DrawTailedAttackArrow.js Näytä tiedosto

@@ -17,7 +17,6 @@ const DEF_STYLE = {
class DrawTailedAttackArrow extends Draw {
constructor(style) {
super()
this._positions = []
this._floatingAnchor = undefined
this._style = {
...DEF_STYLE,
@@ -45,6 +44,9 @@ class DrawTailedAttackArrow extends Draw {

_onClick(e) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let len = this._positions.length
if (len === 0) {
this._positions.push(position)
@@ -64,16 +66,6 @@ class DrawTailedAttackArrow extends Draw {
this._plotEvent.raiseEvent(tailedAttackArrow)
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '单击选择点位')
if (this._floatingAnchor) {
let position = this._clampToGround ? e.surfacePosition : e.position
this._floatingAnchor.position.setValue(position)
this._positions.pop()
this._positions.push(position)
}
}
}

export default DrawTailedAttackArrow

+ 19
- 1
modules/plot/edit/Edit.js Näytä tiedosto

@@ -16,11 +16,13 @@ class Edit {
this._isMoving = false
this._clampToGround = true
this._tooltip = undefined
this._tooltipMess = '点击锚点移动,右击结束编辑'
this._layer = undefined
this._anchorLayer = undefined
this._layer = undefined
this._plotEvent = undefined
this._options = {}
this._positions = []
}

_mountEntity() {}
@@ -29,7 +31,23 @@ class Edit {

_onClick(e) {}

_onMouseMove(e) {}
_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, this._tooltipMess)
if (!this._isMoving) {
return false
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {}


+ 3
- 16
modules/plot/edit/EditAttackArrow.js Näytä tiedosto

@@ -12,7 +12,6 @@ class EditAttackArrow extends Edit {
constructor(overlay) {
super()
this._overlay = overlay
this._positions = []
this._graphics = new AttackArrowGraphics()
}

@@ -45,6 +44,9 @@ class EditAttackArrow extends Edit {
this._isMoving = false
if (this._pickedAnchor && this._pickedAnchor.position) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
@@ -60,21 +62,6 @@ class EditAttackArrow extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.positions = Transform.transformCartesianArrayToWGS84Array(

+ 2
- 1
modules/plot/edit/EditBillboard.js Näytä tiedosto

@@ -12,6 +12,7 @@ class EditBillboard extends Edit {
super()
this._overlay = overlay
this._position = undefined
this._tooltipMess = '右击结束编辑'
}

_mountEntity() {
@@ -26,7 +27,7 @@ class EditBillboard extends Edit {
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '右击结束编辑')
this._tooltip.showAt(e.windowPosition, this._tooltipMess)
this._position = this._clampToGround ? e.surfacePosition : e.position
}


+ 3
- 16
modules/plot/edit/EditCircle.js Näytä tiedosto

@@ -13,7 +13,6 @@ class EditCircle extends Edit {
this._overlay = overlay
this._center = undefined
this._radius = 0
this._positions = []
}

_mountEntity() {
@@ -79,6 +78,9 @@ class EditCircle extends Edit {
this._isMoving = false
if (this._pickedAnchor && this._pickedAnchor.position) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
let properties = this._pickedAnchor.properties.getValue(now)
this._positions[properties.index] = position
@@ -92,21 +94,6 @@ class EditCircle extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.center = Transform.transformCartesianToWGS84(

+ 0
- 16
modules/plot/edit/EditDoubleArrow.js Näytä tiedosto

@@ -12,7 +12,6 @@ class EditDoubleArrow extends Edit {
constructor(overlay) {
super()
this._overlay = overlay
this._positions = []
this._graphics = new DoubleArrowGraphics()
}

@@ -60,21 +59,6 @@ class EditDoubleArrow extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.positions = Transform.transformCartesianArrayToWGS84Array(

+ 0
- 16
modules/plot/edit/EditFineArrow.js Näytä tiedosto

@@ -12,7 +12,6 @@ class EditFineArrow extends Edit {
constructor(overlay) {
super()
this._overlay = overlay
this._positions = []
this._graphics = new FineArrowGraphics()
}

@@ -60,21 +59,6 @@ class EditFineArrow extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.positions = Transform.transformCartesianArrayToWGS84Array(

+ 3
- 16
modules/plot/edit/EditGatheringPlace.js Näytä tiedosto

@@ -12,7 +12,6 @@ class EditGatheringPlace extends Edit {
constructor(overlay) {
super()
this._overlay = overlay
this._positions = []
this._graphics = new GatheringPlaceGraphics()
}

@@ -48,6 +47,9 @@ class EditGatheringPlace extends Edit {
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
@@ -60,21 +62,6 @@ class EditGatheringPlace extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.positions = Transform.transformCartesianArrayToWGS84Array(

+ 2
- 1
modules/plot/edit/EditPoint.js Näytä tiedosto

@@ -12,6 +12,7 @@ class EditPoint extends Edit {
super()
this._overlay = overlay
this._position = undefined
this._tooltipMess = '右击结束编辑'
}

_mountEntity() {
@@ -26,7 +27,7 @@ class EditPoint extends Edit {
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '右击结束编辑')
this._tooltip.showAt(e.windowPosition, this._tooltipMess)
this._position = this._clampToGround ? e.surfacePosition : e.position
}


+ 7
- 1
modules/plot/edit/EditPolygon.js Näytä tiedosto

@@ -49,6 +49,9 @@ class EditPolygon extends Edit {
this._isMoving = false
if (this._pickedAnchor && this._pickedAnchor.position) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
@@ -103,13 +106,16 @@ class EditPolygon extends Edit {
_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
return false
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let currentIndex = properties.index
this._pickedAnchor.position.setValue(position)
this._positions[currentIndex] = position

+ 4
- 2
modules/plot/edit/EditPolyline.js Näytä tiedosto

@@ -89,14 +89,16 @@ class EditPolyline extends Edit {
_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
return false
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position

if (!position) {
return false
}
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
if (!properties.isMid) {

+ 3
- 15
modules/plot/edit/EditTailedAttackArrow.js Näytä tiedosto

@@ -45,6 +45,9 @@ class EditTailedAttackArrow extends Edit {
this._isMoving = false
if (this._pickedAnchor && this._pickedAnchor.position) {
let position = this._clampToGround ? e.surfacePosition : e.position
if (!position) {
return false
}
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
@@ -60,21 +63,6 @@ class EditTailedAttackArrow extends Edit {
}
}

_onMouseMove(e) {
this._tooltip.showAt(e.windowPosition, '点击锚点移动,右击结束编辑')
if (!this._isMoving) {
return
}
if (this._pickedAnchor && this._pickedAnchor.position) {
let properties = this._pickedAnchor.properties.getValue(
Cesium.JulianDate.now()
)
let position = this._clampToGround ? e.surfacePosition : e.position
this._pickedAnchor.position.setValue(position)
this._positions[properties.index] = position
}
}

_onRightClick(e) {
this.unbindEvent()
this._overlay.positions = Transform.transformCartesianArrayToWGS84Array(

Loading…
Peruuta
Tallenna