deeptwins-engine-3d 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Build/DeepTwins/Image/f_point.png +0 -0
- package/dist/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
- package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
- package/dist/esm/constant.d.ts +29 -0
- package/dist/esm/constant.js +47 -0
- package/dist/esm/drawer/index.d.ts +56 -59
- package/dist/esm/drawer/index.js +380 -292
- package/dist/esm/drawer/shape/BaseShape.d.ts +33 -0
- package/dist/esm/drawer/shape/BaseShape.js +228 -0
- package/dist/esm/drawer/shape/Point.d.ts +44 -11
- package/dist/esm/drawer/shape/Point.js +299 -35
- package/dist/esm/drawer/shape/Polygon.d.ts +43 -9
- package/dist/esm/drawer/shape/Polygon.js +408 -56
- package/dist/esm/drawer/shape/Polyline.d.ts +41 -10
- package/dist/esm/drawer/shape/Polyline.js +373 -31
- package/dist/esm/drawer/utils.d.ts +1 -0
- package/dist/esm/drawer/utils.js +63 -0
- package/dist/esm/graphicLayer/BaseLayer.d.ts +1 -0
- package/dist/esm/graphicLayer/BaseLayer.js +8 -3
- package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/graphicLayer/BaseSource.js +13 -3
- package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +2 -0
- package/dist/esm/graphicLayer/GraphicLayerCollection.js +46 -4
- package/dist/esm/graphicLayer/HtmlEntity.js +1 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/map/Map.d.ts +1 -0
- package/dist/esm/map/Map.js +10 -0
- package/dist/esm/measure/Area.d.ts +29 -0
- package/dist/esm/measure/{AreaMeasure.js → Area.js} +156 -65
- package/dist/esm/measure/BaseDraw.d.ts +13 -0
- package/dist/esm/measure/BaseDraw.js +70 -0
- package/dist/esm/measure/Distance.d.ts +23 -0
- package/dist/esm/measure/Distance.js +239 -0
- package/dist/esm/measure/index.d.ts +44 -5
- package/dist/esm/measure/index.js +278 -5
- package/dist/esm/measure/utils.d.ts +108 -14
- package/dist/esm/measure/utils.js +262 -20
- package/dist/esm/plot/create/CreateAssemble.d.ts +2 -0
- package/dist/esm/plot/create/CreateAssemble.js +63 -0
- package/dist/esm/plot/create/CreateAttackArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateAttackArrow.js +75 -0
- package/dist/esm/plot/create/CreateBillboard.d.ts +2 -0
- package/dist/esm/plot/create/CreateBillboard.js +47 -0
- package/dist/esm/plot/create/CreateBow.d.ts +2 -0
- package/dist/esm/plot/create/CreateBow.js +63 -0
- package/dist/esm/plot/create/CreateCircle.d.ts +2 -0
- package/dist/esm/plot/create/CreateCircle.js +68 -0
- package/dist/esm/plot/create/CreateCurve.d.ts +2 -0
- package/dist/esm/plot/create/CreateCurve.js +76 -0
- package/dist/esm/plot/create/CreateElliptic.d.ts +2 -0
- package/dist/esm/plot/create/CreateElliptic.js +69 -0
- package/dist/esm/plot/create/CreateFlag.d.ts +2 -0
- package/dist/esm/plot/create/CreateFlag.js +80 -0
- package/dist/esm/plot/create/CreateFormation.d.ts +2 -0
- package/dist/esm/plot/create/CreateFormation.js +65 -0
- package/dist/esm/plot/create/CreateFreeLine.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreeLine.js +69 -0
- package/dist/esm/plot/create/CreateFreePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreePolygon.js +65 -0
- package/dist/esm/plot/create/CreateLabel.d.ts +2 -0
- package/dist/esm/plot/create/CreateLabel.js +55 -0
- package/dist/esm/plot/create/CreateLineArrow.d.ts +2 -0
- package/dist/esm/plot/create/CreateLineArrow.js +79 -0
- package/dist/esm/plot/create/CreatePincerArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreatePincerArrow.js +73 -0
- package/dist/esm/plot/create/CreatePoint.d.ts +2 -0
- package/dist/esm/plot/create/CreatePoint.js +47 -0
- package/dist/esm/plot/create/CreatePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolygon.js +80 -0
- package/dist/esm/plot/create/CreatePolyline.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolyline.js +70 -0
- package/dist/esm/plot/create/CreateRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRectangle.js +60 -0
- package/dist/esm/plot/create/CreateRegularPolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateRegularPolygon.js +75 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.js +73 -0
- package/dist/esm/plot/create/CreateRoundRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRoundRectangle.js +63 -0
- package/dist/esm/plot/create/CreateSector.d.ts +2 -0
- package/dist/esm/plot/create/CreateSector.js +65 -0
- package/dist/esm/plot/create/CreateStraightArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateStraightArrow.js +65 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.js +67 -0
- package/dist/esm/plot/create/index.d.ts +25 -0
- package/dist/esm/plot/create/index.js +25 -0
- package/dist/esm/plot/edit/EditAssemble.d.ts +8 -0
- package/dist/esm/plot/edit/EditAssemble.js +120 -0
- package/dist/esm/plot/edit/EditAttackArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditAttackArrow.js +182 -0
- package/dist/esm/plot/edit/EditBillboard.d.ts +7 -0
- package/dist/esm/plot/edit/EditBillboard.js +70 -0
- package/dist/esm/plot/edit/EditBow.d.ts +8 -0
- package/dist/esm/plot/edit/EditBow.js +119 -0
- package/dist/esm/plot/edit/EditCircle.d.ts +8 -0
- package/dist/esm/plot/edit/EditCircle.js +133 -0
- package/dist/esm/plot/edit/EditCurve.d.ts +8 -0
- package/dist/esm/plot/edit/EditCurve.js +180 -0
- package/dist/esm/plot/edit/EditElliptic.d.ts +8 -0
- package/dist/esm/plot/edit/EditElliptic.js +144 -0
- package/dist/esm/plot/edit/EditFlag.d.ts +8 -0
- package/dist/esm/plot/edit/EditFlag.js +121 -0
- package/dist/esm/plot/edit/EditFormation.d.ts +8 -0
- package/dist/esm/plot/edit/EditFormation.js +120 -0
- package/dist/esm/plot/edit/EditLabel.d.ts +7 -0
- package/dist/esm/plot/edit/EditLabel.js +100 -0
- package/dist/esm/plot/edit/EditLineArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditLineArrow.js +180 -0
- package/dist/esm/plot/edit/EditPincerArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditPincerArrow.js +121 -0
- package/dist/esm/plot/edit/EditPoint.d.ts +7 -0
- package/dist/esm/plot/edit/EditPoint.js +70 -0
- package/dist/esm/plot/edit/EditPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolygon.js +181 -0
- package/dist/esm/plot/edit/EditPolyline.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolyline.js +179 -0
- package/dist/esm/plot/edit/EditRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRectangle.js +119 -0
- package/dist/esm/plot/edit/EditRegularPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditRegularPolygon.js +170 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.js +143 -0
- package/dist/esm/plot/edit/EditRoundRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRoundRectangle.js +119 -0
- package/dist/esm/plot/edit/EditSector.d.ts +8 -0
- package/dist/esm/plot/edit/EditSector.js +120 -0
- package/dist/esm/plot/edit/EditStraightArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditStraightArrow.js +120 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.js +121 -0
- package/dist/esm/plot/edit/index.d.ts +23 -0
- package/dist/esm/plot/edit/index.js +23 -0
- package/dist/esm/plot/utils/Algorithm.d.ts +2 -0
- package/dist/esm/plot/utils/Algorithm.js +316 -0
- package/dist/esm/plot/utils/Coordinate.d.ts +98 -0
- package/dist/esm/plot/utils/Coordinate.js +184 -0
- package/dist/esm/plot/utils/DomUtil.d.ts +34 -0
- package/dist/esm/plot/utils/DomUtil.js +100 -0
- package/dist/esm/plot/utils/PlotCommon.d.ts +101 -0
- package/dist/esm/plot/utils/PlotCommon.js +1412 -0
- package/dist/esm/plot/utils/ReminderTip.d.ts +10 -0
- package/dist/esm/plot/utils/ReminderTip.js +67 -0
- package/dist/esm/plot/utils/Tooltip.d.ts +3 -0
- package/dist/esm/plot/utils/Tooltip.js +97 -0
- package/dist/esm/plot/utils/plotUtil.d.ts +5 -0
- package/dist/esm/plot/utils/plotUtil.js +268 -0
- package/dist/esm/tool/utils.d.ts +8 -7
- package/dist/esm/tool/utils.js +20 -16
- package/dist/esm/toolTip/index.d.ts +2 -1
- package/dist/esm/toolTip/index.js +12 -6
- package/dist/esm/typings.d.ts +1 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
- package/dist/esm/drawer/base.d.ts +0 -51
- package/dist/esm/drawer/base.js +0 -179
- package/dist/esm/drawer/painter.d.ts +0 -41
- package/dist/esm/drawer/painter.js +0 -115
- package/dist/esm/drawer/shape/Ellipse.d.ts +0 -10
- package/dist/esm/drawer/shape/Ellipse.js +0 -62
- package/dist/esm/drawer/shape/Rectangle.d.ts +0 -10
- package/dist/esm/drawer/shape/Rectangle.js +0 -85
- package/dist/esm/drawer/typings.d.ts +0 -106
- package/dist/esm/drawer/typings.js +0 -1
- package/dist/esm/measure/AreaMeasure.d.ts +0 -19
- package/dist/esm/measure/AreaSurfaceMeasure.d.ts +0 -30
- package/dist/esm/measure/AreaSurfaceMeasure.js +0 -151
- package/dist/esm/measure/DistanceMeasure.d.ts +0 -19
- package/dist/esm/measure/DistanceMeasure.js +0 -91
- package/dist/esm/measure/DistanceSurfaceMeasure.d.ts +0 -37
- package/dist/esm/measure/DistanceSurfaceMeasure.js +0 -122
- package/dist/esm/measure/Measure.d.ts +0 -111
- package/dist/esm/measure/Measure.js +0 -177
- package/dist/esm/tool/cesiumExtends/Subscriber/index.d.ts +0 -66
- package/dist/esm/tool/cesiumExtends/Subscriber/index.js +0 -246
- package/dist/esm/tool/kriging.d.ts +0 -10
- package/dist/esm/tool/kriging.js +0 -436
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑弓形方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { calculateBowPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditBow = function EditBow(viewer, entity, handler, collection) {
|
|
8
|
+
var editItem = collection.find(function (ele) {
|
|
9
|
+
return ele.id === entity.id;
|
|
10
|
+
});
|
|
11
|
+
var editEntity;
|
|
12
|
+
var sourcePos = entity.EditingPoint;
|
|
13
|
+
var updatePos = Cesium.clone(sourcePos, true);
|
|
14
|
+
entity.show = false;
|
|
15
|
+
var dynamicPositions = new Cesium.CallbackProperty(function () {
|
|
16
|
+
return calculateBowPoints(updatePos);
|
|
17
|
+
}, false);
|
|
18
|
+
if (editItem) {
|
|
19
|
+
editEntity = editItem.target;
|
|
20
|
+
editEntity.show = true;
|
|
21
|
+
editEntity.polyline.positions = dynamicPositions;
|
|
22
|
+
editItem.processEntities = initVertexEntities();
|
|
23
|
+
} else {
|
|
24
|
+
var newBow = Cesium.clone(entity.polyline);
|
|
25
|
+
newBow.material = Cesium.Color.RED.withAlpha(0.4);
|
|
26
|
+
newBow.positions = dynamicPositions;
|
|
27
|
+
editEntity = viewer.entities.add({
|
|
28
|
+
GeoType: 'EditBow',
|
|
29
|
+
Editable: true,
|
|
30
|
+
id: 'edit_' + entity.id,
|
|
31
|
+
polyline: newBow
|
|
32
|
+
});
|
|
33
|
+
var vertexs = initVertexEntities();
|
|
34
|
+
collection.push({
|
|
35
|
+
id: entity.id,
|
|
36
|
+
source: entity,
|
|
37
|
+
target: editEntity,
|
|
38
|
+
geoType: 'remix_bow',
|
|
39
|
+
processEntities: vertexs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
43
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
44
|
+
var currentPickFormation = undefined; //当前选择的要移动的弓形对象
|
|
45
|
+
// 左键摁下事件
|
|
46
|
+
handler.setInputAction(function (event) {
|
|
47
|
+
boolDown = true;
|
|
48
|
+
var pick = viewer.scene.pick(event.position);
|
|
49
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
50
|
+
var pickEntity = pick.id;
|
|
51
|
+
if (!pickEntity.GeoType || !pickEntity.Editable) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (pickEntity.GeoType === 'BowEditPoint') {
|
|
55
|
+
lockingMap(viewer, false);
|
|
56
|
+
currentPickVertex = pickEntity;
|
|
57
|
+
} else if (pickEntity.GeoType === 'EditBow') {
|
|
58
|
+
lockingMap(viewer, false);
|
|
59
|
+
currentPickFormation = pickEntity;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
63
|
+
// 鼠标移动事件
|
|
64
|
+
handler.setInputAction(function (event) {
|
|
65
|
+
//console.log('鼠标移动事件监测:------弓形编辑中------');
|
|
66
|
+
if (boolDown && currentPickVertex) {
|
|
67
|
+
var pos = getCatesian3FromPX(viewer, event.endPosition);
|
|
68
|
+
if (pos) {
|
|
69
|
+
updatePos[currentPickVertex.description] = pos;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (boolDown && currentPickFormation) {
|
|
73
|
+
var startPosition = viewer.scene.pickPosition(event.startPosition);
|
|
74
|
+
var endPosition = viewer.scene.pickPosition(event.endPosition);
|
|
75
|
+
var changed_x = endPosition.x - startPosition.x;
|
|
76
|
+
var changed_y = endPosition.y - startPosition.y;
|
|
77
|
+
var changed_z = endPosition.z - startPosition.z;
|
|
78
|
+
updatePos[0] = new Cesium.Cartesian3(updatePos[0].x + changed_x, updatePos[0].y + changed_y, updatePos[0].z + changed_z);
|
|
79
|
+
updatePos[1] = new Cesium.Cartesian3(updatePos[1].x + changed_x, updatePos[1].y + changed_y, updatePos[1].z + changed_z);
|
|
80
|
+
}
|
|
81
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
82
|
+
// 左键抬起事件
|
|
83
|
+
handler.setInputAction(function () {
|
|
84
|
+
entity.polyline.positions = editEntity.polyline.positions;
|
|
85
|
+
boolDown = false;
|
|
86
|
+
currentPickVertex = undefined;
|
|
87
|
+
currentPickFormation = undefined;
|
|
88
|
+
lockingMap(viewer, true);
|
|
89
|
+
entity.EditingPoint = updatePos;
|
|
90
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
91
|
+
function initVertexEntities() {
|
|
92
|
+
var processEntities = [];
|
|
93
|
+
var _loop = function _loop(index) {
|
|
94
|
+
var verEntity = viewer.entities.add({
|
|
95
|
+
id: 'edit_' + newSessionid(),
|
|
96
|
+
position: new Cesium.CallbackProperty(function () {
|
|
97
|
+
return updatePos[index];
|
|
98
|
+
}, false),
|
|
99
|
+
point: {
|
|
100
|
+
pixelSize: 20,
|
|
101
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
102
|
+
outlineWidth: 2,
|
|
103
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
104
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
105
|
+
},
|
|
106
|
+
show: true,
|
|
107
|
+
description: index //记录节点索引
|
|
108
|
+
});
|
|
109
|
+
verEntity.GeoType = 'BowEditPoint';
|
|
110
|
+
verEntity.Editable = true;
|
|
111
|
+
processEntities.push(verEntity);
|
|
112
|
+
};
|
|
113
|
+
for (var index = 0; index < updatePos.length; index++) {
|
|
114
|
+
_loop(index);
|
|
115
|
+
}
|
|
116
|
+
return processEntities;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export default EditBow;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑圆方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { getSemiAxis, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditCircle = function EditCircle(viewer, entity, handler, collection) {
|
|
8
|
+
var editItem = collection.find(function (ele) {
|
|
9
|
+
return ele.id === entity.id;
|
|
10
|
+
});
|
|
11
|
+
var editEntity;
|
|
12
|
+
var sourcePos = entity.EditingPoint;
|
|
13
|
+
var updatePos = Cesium.clone(sourcePos, true);
|
|
14
|
+
entity.show = false;
|
|
15
|
+
var dynamicPos = new Cesium.CallbackProperty(function () {
|
|
16
|
+
return updatePos[0];
|
|
17
|
+
}, false);
|
|
18
|
+
var radius = new Cesium.CallbackProperty(function () {
|
|
19
|
+
return getSemiAxis(updatePos);
|
|
20
|
+
}, false);
|
|
21
|
+
if (editItem) {
|
|
22
|
+
editEntity = editItem.target;
|
|
23
|
+
editEntity.show = true;
|
|
24
|
+
editEntity.position = dynamicPos;
|
|
25
|
+
editEntity.ellipse.semiMinorAxis = editEntity.ellipse.semiMajorAxis = radius;
|
|
26
|
+
editItem.processEntities = initVertexEntities();
|
|
27
|
+
} else {
|
|
28
|
+
var newCircle = Cesium.clone(entity.ellipse);
|
|
29
|
+
newCircle.material = Cesium.Color.RED.withAlpha(0.4);
|
|
30
|
+
newCircle.semiMinorAxis = newCircle.semiMajorAxis = radius;
|
|
31
|
+
editEntity = viewer.entities.add({
|
|
32
|
+
position: dynamicPos,
|
|
33
|
+
GeoType: 'EditCircle',
|
|
34
|
+
Editable: true,
|
|
35
|
+
id: 'edit_' + entity.id,
|
|
36
|
+
ellipse: newCircle
|
|
37
|
+
});
|
|
38
|
+
var vertexs = initVertexEntities();
|
|
39
|
+
collection.push({
|
|
40
|
+
id: entity.id,
|
|
41
|
+
source: entity,
|
|
42
|
+
target: editEntity,
|
|
43
|
+
geoType: 'remix_circle',
|
|
44
|
+
processEntities: vertexs
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
48
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
49
|
+
var currentPickPolygon = undefined; //当前选择的要移动的圆
|
|
50
|
+
// 左键摁下事件
|
|
51
|
+
handler.setInputAction(function (event) {
|
|
52
|
+
boolDown = true;
|
|
53
|
+
var pick = viewer.scene.pick(event.position);
|
|
54
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
55
|
+
var pickEntity = pick.id;
|
|
56
|
+
if (!pickEntity.GeoType || !pickEntity.Editable) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (pickEntity.GeoType === 'CircleEditEnd') {
|
|
60
|
+
lockingMap(viewer, false);
|
|
61
|
+
currentPickVertex = pickEntity;
|
|
62
|
+
} else if (pickEntity.GeoType === 'EditCircle' || pickEntity.GeoType === 'CircleEditCenter') {
|
|
63
|
+
lockingMap(viewer, false);
|
|
64
|
+
currentPickPolygon = pickEntity;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
68
|
+
// 鼠标移动事件
|
|
69
|
+
handler.setInputAction(function (event) {
|
|
70
|
+
//console.log('鼠标移动事件监测:------正多边形编辑中------');
|
|
71
|
+
if (boolDown && currentPickVertex) {
|
|
72
|
+
var pos = getCatesian3FromPX(viewer, event.endPosition);
|
|
73
|
+
updatePos[1] = pos;
|
|
74
|
+
}
|
|
75
|
+
if (boolDown && currentPickPolygon) {
|
|
76
|
+
var startPosition = viewer.scene.pickPosition(event.startPosition);
|
|
77
|
+
var endPosition = viewer.scene.pickPosition(event.endPosition);
|
|
78
|
+
var changed_x = endPosition.x - startPosition.x;
|
|
79
|
+
var changed_y = endPosition.y - startPosition.y;
|
|
80
|
+
var changed_z = endPosition.z - startPosition.z;
|
|
81
|
+
updatePos[0] = new Cesium.Cartesian3(updatePos[0].x + changed_x, updatePos[0].y + changed_y, updatePos[0].z + changed_z);
|
|
82
|
+
updatePos[1] = new Cesium.Cartesian3(updatePos[1].x + changed_x, updatePos[1].y + changed_y, updatePos[1].z + changed_z);
|
|
83
|
+
}
|
|
84
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
85
|
+
// 左键抬起事件
|
|
86
|
+
handler.setInputAction(function () {
|
|
87
|
+
entity.position = editEntity.position;
|
|
88
|
+
entity.ellipse.semiMinorAxis = editEntity.ellipse.semiMinorAxis;
|
|
89
|
+
entity.ellipse.semiMajorAxis = editEntity.ellipse.semiMajorAxis;
|
|
90
|
+
boolDown = false;
|
|
91
|
+
currentPickVertex = undefined;
|
|
92
|
+
currentPickPolygon = undefined;
|
|
93
|
+
lockingMap(viewer, true);
|
|
94
|
+
entity.EditingPoint = updatePos;
|
|
95
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
96
|
+
function initVertexEntities() {
|
|
97
|
+
var centerEntity = viewer.entities.add({
|
|
98
|
+
id: 'edit_' + newSessionid(),
|
|
99
|
+
position: new Cesium.CallbackProperty(function () {
|
|
100
|
+
return updatePos[0];
|
|
101
|
+
}, false),
|
|
102
|
+
point: {
|
|
103
|
+
pixelSize: 20,
|
|
104
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
105
|
+
outlineWidth: 2,
|
|
106
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
107
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
108
|
+
},
|
|
109
|
+
show: true
|
|
110
|
+
});
|
|
111
|
+
centerEntity.GeoType = 'CircleEditCenter';
|
|
112
|
+
centerEntity.Editable = true;
|
|
113
|
+
var endEntity = viewer.entities.add({
|
|
114
|
+
id: 'edit_' + newSessionid(),
|
|
115
|
+
position: new Cesium.CallbackProperty(function () {
|
|
116
|
+
return updatePos[1];
|
|
117
|
+
}, false),
|
|
118
|
+
point: {
|
|
119
|
+
pixelSize: 20,
|
|
120
|
+
color: Cesium.Color.GREEN.withAlpha(1),
|
|
121
|
+
outlineWidth: 2,
|
|
122
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
123
|
+
outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
|
|
124
|
+
},
|
|
125
|
+
show: true
|
|
126
|
+
});
|
|
127
|
+
endEntity.GeoType = 'CircleEditEnd';
|
|
128
|
+
endEntity.Editable = true;
|
|
129
|
+
var processEntities = [centerEntity, endEntity];
|
|
130
|
+
return processEntities;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export default EditCircle;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑曲线方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { createBezierPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
6
|
+
var EditCurve = function EditCurve(viewer, entity, handler, collection) {
|
|
7
|
+
var editItem = collection.find(function (ele) {
|
|
8
|
+
return ele.id === entity.id;
|
|
9
|
+
});
|
|
10
|
+
var editEntity;
|
|
11
|
+
var sourcePos = entity.EditingPoint;
|
|
12
|
+
var updatePos = Cesium.clone(sourcePos, true);
|
|
13
|
+
var linePoints = createBezierPoints(updatePos);
|
|
14
|
+
entity.polyline.positions = linePoints;
|
|
15
|
+
entity.show = false;
|
|
16
|
+
var dynamicPos = new Cesium.CallbackProperty(function () {
|
|
17
|
+
return createBezierPoints(updatePos);
|
|
18
|
+
}, false);
|
|
19
|
+
if (editItem) {
|
|
20
|
+
editEntity = editItem.target;
|
|
21
|
+
editEntity.show = true;
|
|
22
|
+
editEntity.polyline.position = dynamicPos;
|
|
23
|
+
editItem.processEntities = initVertexEntities();
|
|
24
|
+
} else {
|
|
25
|
+
var newPolyline = Cesium.clone(entity.polyline);
|
|
26
|
+
newPolyline.material = Cesium.Color.RED.withAlpha(0.4);
|
|
27
|
+
newPolyline.width = 10;
|
|
28
|
+
newPolyline.positions = dynamicPos;
|
|
29
|
+
editEntity = viewer.entities.add({
|
|
30
|
+
GeoType: 'EditCurve',
|
|
31
|
+
Editable: true,
|
|
32
|
+
id: 'edit_' + entity.id,
|
|
33
|
+
polyline: newPolyline
|
|
34
|
+
});
|
|
35
|
+
var vertexs = initVertexEntities();
|
|
36
|
+
collection.push({
|
|
37
|
+
id: entity.id,
|
|
38
|
+
source: entity,
|
|
39
|
+
target: editEntity,
|
|
40
|
+
geoType: 'remix_curve',
|
|
41
|
+
processEntities: vertexs
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
45
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
46
|
+
var currentPickPolyline = undefined; //当前选择的要移动的折线
|
|
47
|
+
handler.setInputAction(function (event) {
|
|
48
|
+
boolDown = true;
|
|
49
|
+
var pick = viewer.scene.pick(event.position);
|
|
50
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
51
|
+
var pickEntity = pick.id;
|
|
52
|
+
if (!pickEntity.GeoType || !pickEntity.Editable) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (pickEntity.GeoType === 'CurveEditPoints') {
|
|
56
|
+
lockingMap(viewer, false);
|
|
57
|
+
currentPickVertex = pickEntity;
|
|
58
|
+
} else if (pickEntity.GeoType === 'EditCurve') {
|
|
59
|
+
lockingMap(viewer, false);
|
|
60
|
+
currentPickPolyline = pickEntity;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
64
|
+
// 鼠标移动事件
|
|
65
|
+
handler.setInputAction(function (event) {
|
|
66
|
+
//console.log("鼠标移动事件监测:------曲线编辑中------");
|
|
67
|
+
if (boolDown && currentPickVertex) {
|
|
68
|
+
var pos = viewer.scene.pickPosition(event.endPosition);
|
|
69
|
+
updatePos[currentPickVertex.description.getValue()] = pos;
|
|
70
|
+
}
|
|
71
|
+
if (boolDown && currentPickPolyline) {
|
|
72
|
+
var startPosition = viewer.scene.pickPosition(event.startPosition);
|
|
73
|
+
var endPosition = viewer.scene.pickPosition(event.endPosition);
|
|
74
|
+
var changed_x = endPosition.x - startPosition.x;
|
|
75
|
+
var changed_y = endPosition.y - startPosition.y;
|
|
76
|
+
var changed_z = endPosition.z - startPosition.z;
|
|
77
|
+
updatePos.forEach(function (element) {
|
|
78
|
+
element.x = element.x + changed_x;
|
|
79
|
+
element.y = element.y + changed_y;
|
|
80
|
+
element.z = element.z + changed_z;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
84
|
+
// 左键抬起事件
|
|
85
|
+
handler.setInputAction(function () {
|
|
86
|
+
entity.polyline.positions = editEntity.polyline.positions.getValue();
|
|
87
|
+
boolDown = false;
|
|
88
|
+
currentPickVertex = undefined;
|
|
89
|
+
currentPickPolyline = undefined;
|
|
90
|
+
lockingMap(viewer, true);
|
|
91
|
+
entity.EditingPoint = Cesium.clone(updatePos, true);
|
|
92
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
93
|
+
// 左键点击事件
|
|
94
|
+
handler.setInputAction(function (event) {
|
|
95
|
+
var pick = viewer.scene.pick(event.position);
|
|
96
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
97
|
+
if (pick.id.GeoType === 'CurveEditCenterPoints') {
|
|
98
|
+
var index = pick.id.description.getValue() + 1;
|
|
99
|
+
var pos = pick.id.position.getValue();
|
|
100
|
+
updateProcessObj(true, index, pos);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
104
|
+
//右键点击事件
|
|
105
|
+
handler.setInputAction(function (event) {
|
|
106
|
+
var pick = viewer.scene.pick(event.position);
|
|
107
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
108
|
+
if (pick.id.GeoType === 'CurveEditPoints') {
|
|
109
|
+
if (updatePos.length < 3) {
|
|
110
|
+
alert('折线节点数不能少于2个');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
var index = pick.id.description.getValue();
|
|
114
|
+
updateProcessObj(false, index);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
118
|
+
function updateProcessObj(add, index, pos) {
|
|
119
|
+
var item = collection.find(function (ele) {
|
|
120
|
+
return ele.id === entity.id;
|
|
121
|
+
});
|
|
122
|
+
if (item && item.processEntities) {
|
|
123
|
+
item.processEntities.forEach(function (entity) {
|
|
124
|
+
viewer.entities.remove(entity);
|
|
125
|
+
});
|
|
126
|
+
add ? updatePos.splice(index, 0, pos) : updatePos.splice(index, 1);
|
|
127
|
+
item.processEntities = initVertexEntities();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function initVertexEntities() {
|
|
131
|
+
var vertexPointsEntity = []; //中途创建的Point对象
|
|
132
|
+
var centerPointsEntity = []; //中途创建的虚拟Point对象
|
|
133
|
+
var _loop = function _loop(index) {
|
|
134
|
+
var point = viewer.entities.add({
|
|
135
|
+
id: 'edit_' + newSessionid(),
|
|
136
|
+
position: new Cesium.CallbackProperty(function () {
|
|
137
|
+
return updatePos[index];
|
|
138
|
+
}, false),
|
|
139
|
+
point: {
|
|
140
|
+
pixelSize: 20,
|
|
141
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
142
|
+
outlineWidth: 2,
|
|
143
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
144
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
145
|
+
},
|
|
146
|
+
show: true,
|
|
147
|
+
description: index //记录节点索引
|
|
148
|
+
});
|
|
149
|
+
point.GeoType = 'CurveEditPoints';
|
|
150
|
+
point.Editable = true;
|
|
151
|
+
vertexPointsEntity.push(point);
|
|
152
|
+
if (updatePos[index + 1]) {
|
|
153
|
+
var centerPoint = viewer.entities.add({
|
|
154
|
+
id: 'edit_' + newSessionid(),
|
|
155
|
+
position: new Cesium.CallbackProperty(function () {
|
|
156
|
+
return Cesium.Cartesian3.midpoint(updatePos[index], updatePos[index + 1], new Cesium.Cartesian3());
|
|
157
|
+
}, false),
|
|
158
|
+
point: {
|
|
159
|
+
pixelSize: 15,
|
|
160
|
+
color: Cesium.Color.GREEN.withAlpha(1),
|
|
161
|
+
outlineWidth: 2,
|
|
162
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
163
|
+
outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
|
|
164
|
+
},
|
|
165
|
+
show: true,
|
|
166
|
+
description: index //记录节点索引
|
|
167
|
+
});
|
|
168
|
+
centerPoint.GeoType = 'CurveEditCenterPoints';
|
|
169
|
+
centerPoint.Editable = true;
|
|
170
|
+
centerPointsEntity.push(centerPoint);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
for (var index = 0; index < updatePos.length; index++) {
|
|
174
|
+
_loop(index);
|
|
175
|
+
}
|
|
176
|
+
var processEntities = vertexPointsEntity.concat(centerPointsEntity);
|
|
177
|
+
return processEntities;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
export default EditCurve;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑椭圆方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { getEllipticAngle, getSemiAxis, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditElliptic = function EditElliptic(viewer, entity, handler, collection) {
|
|
8
|
+
var editItem = collection.find(function (ele) {
|
|
9
|
+
return ele.id === entity.id;
|
|
10
|
+
});
|
|
11
|
+
var editEntity;
|
|
12
|
+
var sourcePos = entity.EditingPoint;
|
|
13
|
+
var updatePos = Cesium.clone(sourcePos, true);
|
|
14
|
+
entity.show = false;
|
|
15
|
+
var dynamicPos = new Cesium.CallbackProperty(function () {
|
|
16
|
+
return updatePos[0];
|
|
17
|
+
}, false);
|
|
18
|
+
var semiMinorAxis = new Cesium.CallbackProperty(function () {
|
|
19
|
+
return getSemiAxis(updatePos) / 2;
|
|
20
|
+
}, false);
|
|
21
|
+
var semiMajorAxis = new Cesium.CallbackProperty(function () {
|
|
22
|
+
return getSemiAxis(updatePos);
|
|
23
|
+
}, false);
|
|
24
|
+
var rotation = new Cesium.CallbackProperty(function () {
|
|
25
|
+
return getEllipticAngle(updatePos);
|
|
26
|
+
}, false);
|
|
27
|
+
if (editItem) {
|
|
28
|
+
editEntity = editItem.target;
|
|
29
|
+
editEntity.show = true;
|
|
30
|
+
editEntity.position = dynamicPos;
|
|
31
|
+
editEntity.ellipse.semiMinorAxis = semiMinorAxis;
|
|
32
|
+
editEntity.ellipse.semiMajorAxis = semiMajorAxis;
|
|
33
|
+
editEntity.ellipse.rotation = rotation;
|
|
34
|
+
editItem.processEntities = initVertexEntities();
|
|
35
|
+
} else {
|
|
36
|
+
var newElliptic = Cesium.clone(entity.ellipse);
|
|
37
|
+
newElliptic.material = Cesium.Color.RED.withAlpha(0.4);
|
|
38
|
+
newElliptic.semiMinorAxis = semiMinorAxis;
|
|
39
|
+
newElliptic.semiMajorAxis = semiMajorAxis;
|
|
40
|
+
newElliptic.rotation = rotation;
|
|
41
|
+
editEntity = viewer.entities.add({
|
|
42
|
+
position: dynamicPos,
|
|
43
|
+
GeoType: 'EditElliptic',
|
|
44
|
+
Editable: true,
|
|
45
|
+
id: 'edit_' + entity.id,
|
|
46
|
+
ellipse: newElliptic
|
|
47
|
+
});
|
|
48
|
+
var vertexs = initVertexEntities();
|
|
49
|
+
collection.push({
|
|
50
|
+
id: entity.id,
|
|
51
|
+
source: entity,
|
|
52
|
+
target: editEntity,
|
|
53
|
+
geoType: 'remix_elliptic',
|
|
54
|
+
processEntities: vertexs
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
58
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
59
|
+
var currentPickPolygon = undefined; //当前选择的要移动的椭圆
|
|
60
|
+
// 左键摁下事件
|
|
61
|
+
handler.setInputAction(function (event) {
|
|
62
|
+
boolDown = true;
|
|
63
|
+
var pick = viewer.scene.pick(event.position);
|
|
64
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
65
|
+
var pickEntity = pick.id;
|
|
66
|
+
if (!pickEntity.GeoType || !pickEntity.Editable) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (pickEntity.GeoType === 'EllipticEditEnd') {
|
|
70
|
+
lockingMap(viewer, false);
|
|
71
|
+
currentPickVertex = pickEntity;
|
|
72
|
+
} else if (pickEntity.GeoType === 'EditElliptic' || pickEntity.GeoType === 'EllipticEditCenter') {
|
|
73
|
+
lockingMap(viewer, false);
|
|
74
|
+
currentPickPolygon = pickEntity;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
78
|
+
// 鼠标移动事件
|
|
79
|
+
handler.setInputAction(function (event) {
|
|
80
|
+
//console.log('鼠标移动事件监测:------正多边形编辑中------');
|
|
81
|
+
if (boolDown && currentPickVertex) {
|
|
82
|
+
var pos = getCatesian3FromPX(viewer, event.endPosition);
|
|
83
|
+
updatePos[1] = pos;
|
|
84
|
+
}
|
|
85
|
+
if (boolDown && currentPickPolygon) {
|
|
86
|
+
var startPosition = viewer.scene.pickPosition(event.startPosition);
|
|
87
|
+
var endPosition = viewer.scene.pickPosition(event.endPosition);
|
|
88
|
+
var changed_x = endPosition.x - startPosition.x;
|
|
89
|
+
var changed_y = endPosition.y - startPosition.y;
|
|
90
|
+
var changed_z = endPosition.z - startPosition.z;
|
|
91
|
+
updatePos[0] = new Cesium.Cartesian3(updatePos[0].x + changed_x, updatePos[0].y + changed_y, updatePos[0].z + changed_z);
|
|
92
|
+
updatePos[1] = new Cesium.Cartesian3(updatePos[1].x + changed_x, updatePos[1].y + changed_y, updatePos[1].z + changed_z);
|
|
93
|
+
}
|
|
94
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
95
|
+
// 左键抬起事件
|
|
96
|
+
handler.setInputAction(function () {
|
|
97
|
+
entity.position = editEntity.position;
|
|
98
|
+
entity.ellipse.semiMinorAxis = editEntity.ellipse.semiMinorAxis;
|
|
99
|
+
entity.ellipse.semiMajorAxis = editEntity.ellipse.semiMajorAxis;
|
|
100
|
+
entity.ellipse.rotation = editEntity.ellipse.rotation;
|
|
101
|
+
boolDown = false;
|
|
102
|
+
currentPickVertex = undefined;
|
|
103
|
+
currentPickPolygon = undefined;
|
|
104
|
+
lockingMap(viewer, true);
|
|
105
|
+
entity.EditingPoint = updatePos;
|
|
106
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
107
|
+
function initVertexEntities() {
|
|
108
|
+
var centerEntity = viewer.entities.add({
|
|
109
|
+
id: 'edit_' + newSessionid(),
|
|
110
|
+
position: new Cesium.CallbackProperty(function () {
|
|
111
|
+
return updatePos[0];
|
|
112
|
+
}, false),
|
|
113
|
+
point: {
|
|
114
|
+
pixelSize: 20,
|
|
115
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
116
|
+
outlineWidth: 2,
|
|
117
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
118
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
119
|
+
},
|
|
120
|
+
show: true
|
|
121
|
+
});
|
|
122
|
+
centerEntity.GeoType = 'EllipticEditCenter';
|
|
123
|
+
centerEntity.Editable = true;
|
|
124
|
+
var endEntity = viewer.entities.add({
|
|
125
|
+
id: 'edit_' + newSessionid(),
|
|
126
|
+
position: new Cesium.CallbackProperty(function () {
|
|
127
|
+
return updatePos[1];
|
|
128
|
+
}, false),
|
|
129
|
+
point: {
|
|
130
|
+
pixelSize: 20,
|
|
131
|
+
color: Cesium.Color.GREEN.withAlpha(1),
|
|
132
|
+
outlineWidth: 2,
|
|
133
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
134
|
+
outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
|
|
135
|
+
},
|
|
136
|
+
show: true
|
|
137
|
+
});
|
|
138
|
+
endEntity.GeoType = 'EllipticEditEnd';
|
|
139
|
+
endEntity.Editable = true;
|
|
140
|
+
var processEntities = [centerEntity, endEntity];
|
|
141
|
+
return processEntities;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
export default EditElliptic;
|