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,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑正多边形方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { getRegularPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditRegularPolygon = function EditRegularPolygon(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
|
+
var updatePositions = getRegularPoints(updatePos.center, updatePos.end, updatePos.num);
|
|
15
|
+
entity.show = false;
|
|
16
|
+
var dynamicHierarchy = new Cesium.CallbackProperty(function () {
|
|
17
|
+
return new Cesium.PolygonHierarchy(updatePositions);
|
|
18
|
+
}, false);
|
|
19
|
+
if (editItem) {
|
|
20
|
+
editEntity = editItem.target;
|
|
21
|
+
editEntity.show = true;
|
|
22
|
+
editEntity.polygon.hierarchy = dynamicHierarchy;
|
|
23
|
+
editItem.processEntities = initVertexEntities();
|
|
24
|
+
} else {
|
|
25
|
+
var newPolygon = Cesium.clone(entity.polygon);
|
|
26
|
+
newPolygon.material = Cesium.Color.RED.withAlpha(0.4);
|
|
27
|
+
newPolygon.hierarchy = dynamicHierarchy;
|
|
28
|
+
editEntity = viewer.entities.add({
|
|
29
|
+
GeoType: 'EditRegularPolygon',
|
|
30
|
+
Editable: true,
|
|
31
|
+
id: 'edit_' + entity.id,
|
|
32
|
+
polygon: newPolygon
|
|
33
|
+
});
|
|
34
|
+
var vertexs = initVertexEntities();
|
|
35
|
+
collection.push({
|
|
36
|
+
id: entity.id,
|
|
37
|
+
source: entity,
|
|
38
|
+
target: editEntity,
|
|
39
|
+
geoType: 'remix_regularpolygon',
|
|
40
|
+
processEntities: vertexs
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
44
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
45
|
+
var currentPickPolygon = undefined; //当前选择的要移动的多边形
|
|
46
|
+
// 左键摁下事件
|
|
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 === 'RegularPolygonEditEnd') {
|
|
56
|
+
lockingMap(viewer, false);
|
|
57
|
+
currentPickVertex = pickEntity;
|
|
58
|
+
} else if (pickEntity.GeoType === 'EditRegularPolygon' || pickEntity.GeoType === 'RegularPolygonEditCenter') {
|
|
59
|
+
lockingMap(viewer, false);
|
|
60
|
+
currentPickPolygon = pickEntity;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
64
|
+
// 鼠标移动事件
|
|
65
|
+
handler.setInputAction(function (event) {
|
|
66
|
+
//console.log("鼠标移动事件监测:------正多边形编辑中------");
|
|
67
|
+
if (boolDown && currentPickVertex) {
|
|
68
|
+
var pos = getCatesian3FromPX(viewer, event.endPosition);
|
|
69
|
+
updatePos.end = pos;
|
|
70
|
+
updatePositions = getRegularPoints(updatePos.center, pos, updatePos.num);
|
|
71
|
+
}
|
|
72
|
+
if (boolDown && currentPickPolygon) {
|
|
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.center = new Cesium.Cartesian3(updatePos.center.x + changed_x, updatePos.center.y + changed_y, updatePos.center.z + changed_z);
|
|
79
|
+
updatePos.end = new Cesium.Cartesian3(updatePos.end.x + changed_x, updatePos.end.y + changed_y, updatePos.end.z + changed_z);
|
|
80
|
+
updatePositions.forEach(function (element) {
|
|
81
|
+
element.x = element.x + changed_x;
|
|
82
|
+
element.y = element.y + changed_y;
|
|
83
|
+
element.z = element.z + changed_z;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
87
|
+
// 左键抬起事件
|
|
88
|
+
handler.setInputAction(function () {
|
|
89
|
+
entity.polygon.hierarchy = editEntity.polygon.hierarchy;
|
|
90
|
+
boolDown = false;
|
|
91
|
+
currentPickVertex = undefined;
|
|
92
|
+
currentPickPolygon = undefined;
|
|
93
|
+
lockingMap(viewer, true);
|
|
94
|
+
entity.EditingPoint = updatePos;
|
|
95
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
96
|
+
// 左键点击事件
|
|
97
|
+
handler.setInputAction(function (event) {
|
|
98
|
+
var pick = viewer.scene.pick(event.position);
|
|
99
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
100
|
+
if (pick.id.GeoType === 'RegularPolygonEditCenter') {
|
|
101
|
+
var index = pick.id.description.getValue() + 1;
|
|
102
|
+
var pos = pick.id.position.getValue();
|
|
103
|
+
updateProcessObj(true, index, pos);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
107
|
+
//右键点击事件
|
|
108
|
+
handler.setInputAction(function (event) {
|
|
109
|
+
var pick = viewer.scene.pick(event.position);
|
|
110
|
+
if (Cesium.defined(pick) && pick.id) {
|
|
111
|
+
if (pick.id.GeoType === 'RegularPolygonEditCenter') {
|
|
112
|
+
if (updatePositions.length < 4) {
|
|
113
|
+
alert('多边形节点数不能少于3个');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
var index = pick.id.description.getValue();
|
|
117
|
+
updateProcessObj(false, index);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
121
|
+
function updateProcessObj(add, index, pos) {
|
|
122
|
+
var item = collection.find(function (ele) {
|
|
123
|
+
return ele.id === entity.id;
|
|
124
|
+
});
|
|
125
|
+
if (item && item.processEntities) {
|
|
126
|
+
item.processEntities.forEach(function (entity) {
|
|
127
|
+
viewer.entities.remove(entity);
|
|
128
|
+
});
|
|
129
|
+
add ? updatePositions.splice(index, 0, pos) : updatePositions.splice(index, 1);
|
|
130
|
+
item.processEntities = initVertexEntities();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function initVertexEntities() {
|
|
134
|
+
var centerEntity = viewer.entities.add({
|
|
135
|
+
id: 'edit_' + newSessionid(),
|
|
136
|
+
position: new Cesium.CallbackProperty(function () {
|
|
137
|
+
return updatePos.center;
|
|
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
|
+
});
|
|
148
|
+
centerEntity.GeoType = 'RegularPolygonEditCenter';
|
|
149
|
+
centerEntity.Editable = true;
|
|
150
|
+
var endEntity = viewer.entities.add({
|
|
151
|
+
id: 'edit_' + newSessionid(),
|
|
152
|
+
position: new Cesium.CallbackProperty(function () {
|
|
153
|
+
return updatePos.end;
|
|
154
|
+
}, false),
|
|
155
|
+
point: {
|
|
156
|
+
pixelSize: 20,
|
|
157
|
+
color: Cesium.Color.GREEN.withAlpha(1),
|
|
158
|
+
outlineWidth: 2,
|
|
159
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
160
|
+
outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
|
|
161
|
+
},
|
|
162
|
+
show: true
|
|
163
|
+
});
|
|
164
|
+
endEntity.GeoType = 'RegularPolygonEditEnd';
|
|
165
|
+
endEntity.Editable = true;
|
|
166
|
+
var processEntities = [centerEntity, endEntity];
|
|
167
|
+
return processEntities;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
export default EditRegularPolygon;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑直角箭头方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getRightAngleArrowPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
6
|
+
var EditRightAngleArrow = function EditRightAngleArrow(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
|
+
entity.show = false;
|
|
14
|
+
var dynamicHierarchy = new Cesium.CallbackProperty(function () {
|
|
15
|
+
var updatePositions = getRightAngleArrowPoints(updatePos);
|
|
16
|
+
return new Cesium.PolygonHierarchy(updatePositions);
|
|
17
|
+
}, false);
|
|
18
|
+
if (editItem) {
|
|
19
|
+
editEntity = editItem.target;
|
|
20
|
+
editEntity.show = true;
|
|
21
|
+
editEntity.polygon.hierarchy = dynamicHierarchy;
|
|
22
|
+
editItem.processEntities = initVertexEntities();
|
|
23
|
+
} else {
|
|
24
|
+
var newPolygon = Cesium.clone(entity.polygon);
|
|
25
|
+
newPolygon.material = Cesium.Color.RED.withAlpha(0.4);
|
|
26
|
+
newPolygon.hierarchy = dynamicHierarchy;
|
|
27
|
+
editEntity = viewer.entities.add({
|
|
28
|
+
GeoType: 'EditRightAngleArrow',
|
|
29
|
+
Editable: true,
|
|
30
|
+
id: 'edit_' + entity.id,
|
|
31
|
+
polygon: newPolygon
|
|
32
|
+
});
|
|
33
|
+
var vertexs = initVertexEntities();
|
|
34
|
+
collection.push({
|
|
35
|
+
id: entity.id,
|
|
36
|
+
source: entity,
|
|
37
|
+
target: editEntity,
|
|
38
|
+
geoType: 'remix_rightanglearrow',
|
|
39
|
+
processEntities: vertexs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
43
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
44
|
+
var currentPickPolygon = 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 === 'RightAngleArrowEditPoints') {
|
|
55
|
+
lockingMap(viewer, false);
|
|
56
|
+
currentPickVertex = pickEntity;
|
|
57
|
+
} else if (pickEntity.GeoType === 'EditRightAngleArrow' || pickEntity.GeoType === 'RightAngleArrowEditCenterPoints') {
|
|
58
|
+
lockingMap(viewer, false);
|
|
59
|
+
currentPickPolygon = pickEntity;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
63
|
+
// 鼠标移动事件
|
|
64
|
+
handler.setInputAction(function (event) {
|
|
65
|
+
//console.log('鼠标移动事件监测:------攻击箭头编辑中------');
|
|
66
|
+
if (boolDown && currentPickVertex) {
|
|
67
|
+
var pos = viewer.scene.pickPosition(event.endPosition);
|
|
68
|
+
updatePos[currentPickVertex.description.getValue()] = pos;
|
|
69
|
+
}
|
|
70
|
+
if (boolDown && currentPickPolygon) {
|
|
71
|
+
var startPosition = viewer.scene.pickPosition(event.startPosition);
|
|
72
|
+
var endPosition = viewer.scene.pickPosition(event.endPosition);
|
|
73
|
+
var changed_x = endPosition.x - startPosition.x;
|
|
74
|
+
var changed_y = endPosition.y - startPosition.y;
|
|
75
|
+
var changed_z = endPosition.z - startPosition.z;
|
|
76
|
+
updatePos.forEach(function (element) {
|
|
77
|
+
element.x = element.x + changed_x;
|
|
78
|
+
element.y = element.y + changed_y;
|
|
79
|
+
element.z = element.z + changed_z;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
83
|
+
// 左键抬起事件
|
|
84
|
+
handler.setInputAction(function () {
|
|
85
|
+
entity.polygon.hierarchy = editEntity.polygon.hierarchy;
|
|
86
|
+
boolDown = false;
|
|
87
|
+
currentPickVertex = undefined;
|
|
88
|
+
currentPickPolygon = undefined;
|
|
89
|
+
lockingMap(viewer, true);
|
|
90
|
+
entity.EditingPoint = updatePos;
|
|
91
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
92
|
+
function initVertexEntities() {
|
|
93
|
+
var vertexPointsEntity = []; //中途创建的Point对象
|
|
94
|
+
var centerPointsEntity = []; //中途创建的中心点对象
|
|
95
|
+
var _loop = function _loop(index) {
|
|
96
|
+
var point = viewer.entities.add({
|
|
97
|
+
id: 'edit_' + newSessionid(),
|
|
98
|
+
position: new Cesium.CallbackProperty(function () {
|
|
99
|
+
return updatePos[index];
|
|
100
|
+
}, false),
|
|
101
|
+
point: {
|
|
102
|
+
pixelSize: 20,
|
|
103
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
104
|
+
outlineWidth: 2,
|
|
105
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
106
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
107
|
+
},
|
|
108
|
+
show: true,
|
|
109
|
+
description: index //记录节点索引
|
|
110
|
+
});
|
|
111
|
+
point.GeoType = 'RightAngleArrowEditPoints';
|
|
112
|
+
point.Editable = true;
|
|
113
|
+
vertexPointsEntity.push(point);
|
|
114
|
+
if (index > 0) {
|
|
115
|
+
var centerPoint = viewer.entities.add({
|
|
116
|
+
id: 'edit_' + newSessionid(),
|
|
117
|
+
position: new Cesium.CallbackProperty(function () {
|
|
118
|
+
var startPos = updatePos[index - 1];
|
|
119
|
+
return Cesium.Cartesian3.midpoint(startPos, updatePos[index], new Cesium.Cartesian3());
|
|
120
|
+
}, false),
|
|
121
|
+
point: {
|
|
122
|
+
pixelSize: 15,
|
|
123
|
+
color: Cesium.Color.GREEN.withAlpha(1),
|
|
124
|
+
outlineWidth: 2,
|
|
125
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
126
|
+
outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
|
|
127
|
+
},
|
|
128
|
+
show: true,
|
|
129
|
+
description: index //记录节点索引
|
|
130
|
+
});
|
|
131
|
+
centerPoint.GeoType = 'RightAngleArrowEditCenterPoints';
|
|
132
|
+
centerPoint.Editable = true;
|
|
133
|
+
centerPointsEntity.push(centerPoint);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
for (var index = 0; index < updatePos.length; index++) {
|
|
137
|
+
_loop(index);
|
|
138
|
+
}
|
|
139
|
+
var processEntities = vertexPointsEntity.concat(centerPointsEntity);
|
|
140
|
+
return processEntities;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
export default EditRightAngleArrow;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑圆角矩形方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { computeRoundedRectanglePoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditRoundRectangle = function EditRoundRectangle(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 new Cesium.PolygonHierarchy(computeRoundedRectanglePoints(updatePos));
|
|
17
|
+
}, false);
|
|
18
|
+
if (editItem) {
|
|
19
|
+
editEntity = editItem.target;
|
|
20
|
+
editEntity.show = true;
|
|
21
|
+
editEntity.polygon.hierarchy = dynamicPositions;
|
|
22
|
+
editItem.processEntities = initVertexEntities();
|
|
23
|
+
} else {
|
|
24
|
+
var newRoundRectangle = Cesium.clone(entity.polygon);
|
|
25
|
+
newRoundRectangle.material = Cesium.Color.RED.withAlpha(0.4);
|
|
26
|
+
newRoundRectangle.hierarchy = dynamicPositions;
|
|
27
|
+
editEntity = viewer.entities.add({
|
|
28
|
+
GeoType: 'EditRoundRectangle',
|
|
29
|
+
Editable: true,
|
|
30
|
+
id: 'edit_' + entity.id,
|
|
31
|
+
polygon: newRoundRectangle
|
|
32
|
+
});
|
|
33
|
+
var vertexs = initVertexEntities();
|
|
34
|
+
collection.push({
|
|
35
|
+
id: entity.id,
|
|
36
|
+
source: entity,
|
|
37
|
+
target: editEntity,
|
|
38
|
+
geoType: 'remix_roundrectangle',
|
|
39
|
+
processEntities: vertexs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
43
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
44
|
+
var currentPickPolygon = 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 === 'RoundRectangleEditPoint') {
|
|
55
|
+
lockingMap(viewer, false);
|
|
56
|
+
currentPickVertex = pickEntity;
|
|
57
|
+
} else if (pickEntity.GeoType === 'EditRoundRectangle') {
|
|
58
|
+
lockingMap(viewer, false);
|
|
59
|
+
currentPickPolygon = 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 && currentPickPolygon) {
|
|
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.polygon.hierarchy = editEntity.polygon.hierarchy;
|
|
85
|
+
boolDown = false;
|
|
86
|
+
currentPickVertex = undefined;
|
|
87
|
+
currentPickPolygon = 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 = 'RoundRectangleEditPoint';
|
|
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 EditRoundRectangle;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑扇形方法
|
|
3
|
+
*/
|
|
4
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
+
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
+
import { calculateSectorPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
|
|
7
|
+
var EditSector = function EditSector(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 new Cesium.PolygonHierarchy(calculateSectorPoints(updatePos));
|
|
17
|
+
}, false);
|
|
18
|
+
if (editItem) {
|
|
19
|
+
editEntity = editItem.target;
|
|
20
|
+
editEntity.show = true;
|
|
21
|
+
editEntity.polygon.hierarchy = dynamicPositions;
|
|
22
|
+
editItem.processEntities = initVertexEntities();
|
|
23
|
+
} else {
|
|
24
|
+
var newSector = Cesium.clone(entity.polygon);
|
|
25
|
+
newSector.material = Cesium.Color.RED.withAlpha(0.4);
|
|
26
|
+
newSector.hierarchy = dynamicPositions;
|
|
27
|
+
editEntity = viewer.entities.add({
|
|
28
|
+
GeoType: 'EditSector',
|
|
29
|
+
Editable: true,
|
|
30
|
+
id: 'edit_' + entity.id,
|
|
31
|
+
polygon: newSector
|
|
32
|
+
});
|
|
33
|
+
var vertexs = initVertexEntities();
|
|
34
|
+
collection.push({
|
|
35
|
+
id: entity.id,
|
|
36
|
+
source: entity,
|
|
37
|
+
target: editEntity,
|
|
38
|
+
geoType: 'remix_sector',
|
|
39
|
+
processEntities: vertexs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var boolDown = false; //鼠标左键是否处于摁下状态
|
|
43
|
+
var currentPickVertex = undefined; //当前选择的要编辑的节点
|
|
44
|
+
var currentPickPolygon = 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 === 'SectorEditPoint') {
|
|
55
|
+
lockingMap(viewer, false);
|
|
56
|
+
currentPickVertex = pickEntity;
|
|
57
|
+
} else if (pickEntity.GeoType === 'EditSector') {
|
|
58
|
+
lockingMap(viewer, false);
|
|
59
|
+
currentPickPolygon = 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 && currentPickPolygon) {
|
|
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
|
+
for (var index = 0; index < updatePos.length; index++) {
|
|
79
|
+
updatePos[index] = new Cesium.Cartesian3(updatePos[index].x + changed_x, updatePos[index].y + changed_y, updatePos[index].z + changed_z);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
83
|
+
// 左键抬起事件
|
|
84
|
+
handler.setInputAction(function () {
|
|
85
|
+
entity.polygon.hierarchy = editEntity.polygon.hierarchy;
|
|
86
|
+
boolDown = false;
|
|
87
|
+
currentPickVertex = undefined;
|
|
88
|
+
currentPickPolygon = undefined;
|
|
89
|
+
lockingMap(viewer, true);
|
|
90
|
+
entity.EditingPoint = updatePos;
|
|
91
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
92
|
+
function initVertexEntities() {
|
|
93
|
+
var processEntities = [];
|
|
94
|
+
var _loop = function _loop(index) {
|
|
95
|
+
var verEntity = viewer.entities.add({
|
|
96
|
+
id: 'edit_' + newSessionid(),
|
|
97
|
+
position: new Cesium.CallbackProperty(function () {
|
|
98
|
+
return updatePos[index];
|
|
99
|
+
}, false),
|
|
100
|
+
point: {
|
|
101
|
+
pixelSize: 20,
|
|
102
|
+
color: Cesium.Color.YELLOW.withAlpha(0.6),
|
|
103
|
+
outlineWidth: 2,
|
|
104
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
105
|
+
outlineColor: Cesium.Color.DARKRED.withAlpha(1)
|
|
106
|
+
},
|
|
107
|
+
show: true,
|
|
108
|
+
description: index //记录节点索引
|
|
109
|
+
});
|
|
110
|
+
verEntity.GeoType = 'SectorEditPoint';
|
|
111
|
+
verEntity.Editable = true;
|
|
112
|
+
processEntities.push(verEntity);
|
|
113
|
+
};
|
|
114
|
+
for (var index = 0; index < updatePos.length; index++) {
|
|
115
|
+
_loop(index);
|
|
116
|
+
}
|
|
117
|
+
return processEntities;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
export default EditSector;
|