deeptwins-engine-3d 0.1.64 → 0.1.65

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.
Files changed (169) hide show
  1. package/dist/esm/{plot/utils/Algorithm.js → drawer/algorithm.js} +1 -3
  2. package/dist/esm/drawer/common.d.ts +61 -0
  3. package/dist/esm/{plot/utils/PlotCommon.js → drawer/common.js} +104 -551
  4. package/dist/esm/drawer/index.d.ts +11 -18
  5. package/dist/esm/drawer/index.js +329 -80
  6. package/dist/esm/{plot/utils → drawer}/plotUtil.js +1 -3
  7. package/dist/esm/drawer/shape/Assemble.d.ts +34 -0
  8. package/dist/esm/drawer/shape/Assemble.js +415 -0
  9. package/dist/esm/drawer/shape/AttackArrow.d.ts +32 -0
  10. package/dist/esm/drawer/shape/AttackArrow.js +442 -0
  11. package/dist/esm/drawer/shape/BaseShape.d.ts +14 -4
  12. package/dist/esm/drawer/shape/BaseShape.js +175 -20
  13. package/dist/esm/drawer/shape/Bow.d.ts +31 -0
  14. package/dist/esm/drawer/shape/Bow.js +375 -0
  15. package/dist/esm/drawer/shape/Circle.d.ts +37 -0
  16. package/dist/esm/drawer/shape/Circle.js +461 -0
  17. package/dist/esm/drawer/shape/Curve.d.ts +29 -0
  18. package/dist/esm/drawer/shape/Curve.js +386 -0
  19. package/dist/esm/drawer/shape/DragPoint.d.ts +32 -0
  20. package/dist/esm/drawer/shape/DragPoint.js +211 -0
  21. package/dist/esm/drawer/shape/Elliptic.d.ts +38 -0
  22. package/dist/esm/drawer/shape/Elliptic.js +491 -0
  23. package/dist/esm/drawer/shape/Formation.d.ts +33 -0
  24. package/dist/esm/drawer/shape/Formation.js +395 -0
  25. package/dist/esm/drawer/shape/PincerArrow.d.ts +32 -0
  26. package/dist/esm/drawer/shape/PincerArrow.js +445 -0
  27. package/dist/esm/drawer/shape/Point.d.ts +2 -31
  28. package/dist/esm/drawer/shape/Point.js +7 -201
  29. package/dist/esm/drawer/shape/Polygon.d.ts +1 -1
  30. package/dist/esm/drawer/shape/Polygon.js +10 -81
  31. package/dist/esm/drawer/shape/Polyline.d.ts +1 -1
  32. package/dist/esm/drawer/shape/Polyline.js +10 -81
  33. package/dist/esm/drawer/shape/RegularPolygon.d.ts +37 -0
  34. package/dist/esm/drawer/shape/RegularPolygon.js +468 -0
  35. package/dist/esm/drawer/shape/RightAngleArrow.d.ts +34 -0
  36. package/dist/esm/drawer/shape/RightAngleArrow.js +423 -0
  37. package/dist/esm/drawer/shape/Sector.d.ts +37 -0
  38. package/dist/esm/drawer/shape/Sector.js +568 -0
  39. package/dist/esm/drawer/shape/StraightArrow.d.ts +34 -0
  40. package/dist/esm/drawer/shape/StraightArrow.js +422 -0
  41. package/dist/esm/drawer/shape/SwallowtailArrow.d.ts +36 -0
  42. package/dist/esm/drawer/shape/SwallowtailArrow.js +438 -0
  43. package/dist/esm/drawer/types.d.ts +23 -0
  44. package/dist/esm/drawer/types.js +11 -0
  45. package/dist/esm/drawer/utils.d.ts +14 -0
  46. package/dist/esm/drawer/utils.js +320 -2
  47. package/dist/esm/index.js +2 -2
  48. package/dist/esm/measure/Area.d.ts +17 -17
  49. package/dist/esm/measure/Area.js +95 -63
  50. package/dist/esm/measure/BaseDraw.d.ts +9 -4
  51. package/dist/esm/measure/BaseDraw.js +37 -2
  52. package/dist/esm/measure/Distance.d.ts +9 -9
  53. package/dist/esm/measure/Distance.js +52 -68
  54. package/dist/esm/measure/index.d.ts +16 -26
  55. package/dist/esm/measure/index.js +72 -84
  56. package/dist/esm/measure/types.d.ts +94 -0
  57. package/dist/esm/measure/types.js +17 -0
  58. package/dist/esm/measure/utils.d.ts +7 -7
  59. package/dist/esm/measure/utils.js +43 -24
  60. package/dist/esm/tool/utils.js +1 -1
  61. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/esm/plot/create/CreateAssemble.d.ts +0 -2
  64. package/dist/esm/plot/create/CreateAssemble.js +0 -63
  65. package/dist/esm/plot/create/CreateAttackArrow.d.ts +0 -5
  66. package/dist/esm/plot/create/CreateAttackArrow.js +0 -75
  67. package/dist/esm/plot/create/CreateBillboard.d.ts +0 -2
  68. package/dist/esm/plot/create/CreateBillboard.js +0 -47
  69. package/dist/esm/plot/create/CreateBow.d.ts +0 -2
  70. package/dist/esm/plot/create/CreateBow.js +0 -63
  71. package/dist/esm/plot/create/CreateCircle.d.ts +0 -2
  72. package/dist/esm/plot/create/CreateCircle.js +0 -68
  73. package/dist/esm/plot/create/CreateCurve.d.ts +0 -2
  74. package/dist/esm/plot/create/CreateCurve.js +0 -76
  75. package/dist/esm/plot/create/CreateElliptic.d.ts +0 -2
  76. package/dist/esm/plot/create/CreateElliptic.js +0 -69
  77. package/dist/esm/plot/create/CreateFlag.d.ts +0 -2
  78. package/dist/esm/plot/create/CreateFlag.js +0 -80
  79. package/dist/esm/plot/create/CreateFormation.d.ts +0 -2
  80. package/dist/esm/plot/create/CreateFormation.js +0 -65
  81. package/dist/esm/plot/create/CreateFreeLine.d.ts +0 -2
  82. package/dist/esm/plot/create/CreateFreeLine.js +0 -69
  83. package/dist/esm/plot/create/CreateFreePolygon.d.ts +0 -2
  84. package/dist/esm/plot/create/CreateFreePolygon.js +0 -65
  85. package/dist/esm/plot/create/CreateLabel.d.ts +0 -2
  86. package/dist/esm/plot/create/CreateLabel.js +0 -55
  87. package/dist/esm/plot/create/CreateLineArrow.d.ts +0 -2
  88. package/dist/esm/plot/create/CreateLineArrow.js +0 -79
  89. package/dist/esm/plot/create/CreatePincerArrow.d.ts +0 -5
  90. package/dist/esm/plot/create/CreatePincerArrow.js +0 -73
  91. package/dist/esm/plot/create/CreatePoint.d.ts +0 -2
  92. package/dist/esm/plot/create/CreatePoint.js +0 -47
  93. package/dist/esm/plot/create/CreatePolygon.d.ts +0 -2
  94. package/dist/esm/plot/create/CreatePolygon.js +0 -80
  95. package/dist/esm/plot/create/CreatePolyline.d.ts +0 -2
  96. package/dist/esm/plot/create/CreatePolyline.js +0 -70
  97. package/dist/esm/plot/create/CreateRectangle.d.ts +0 -2
  98. package/dist/esm/plot/create/CreateRectangle.js +0 -60
  99. package/dist/esm/plot/create/CreateRegularPolygon.d.ts +0 -2
  100. package/dist/esm/plot/create/CreateRegularPolygon.js +0 -75
  101. package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +0 -5
  102. package/dist/esm/plot/create/CreateRightAngleArrow.js +0 -73
  103. package/dist/esm/plot/create/CreateRoundRectangle.d.ts +0 -2
  104. package/dist/esm/plot/create/CreateRoundRectangle.js +0 -63
  105. package/dist/esm/plot/create/CreateSector.d.ts +0 -2
  106. package/dist/esm/plot/create/CreateSector.js +0 -65
  107. package/dist/esm/plot/create/CreateStraightArrow.d.ts +0 -5
  108. package/dist/esm/plot/create/CreateStraightArrow.js +0 -65
  109. package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +0 -5
  110. package/dist/esm/plot/create/CreateSwallowtailArrow.js +0 -67
  111. package/dist/esm/plot/create/index.d.ts +0 -25
  112. package/dist/esm/plot/create/index.js +0 -25
  113. package/dist/esm/plot/edit/EditAssemble.d.ts +0 -8
  114. package/dist/esm/plot/edit/EditAssemble.js +0 -120
  115. package/dist/esm/plot/edit/EditAttackArrow.d.ts +0 -8
  116. package/dist/esm/plot/edit/EditAttackArrow.js +0 -182
  117. package/dist/esm/plot/edit/EditBillboard.d.ts +0 -7
  118. package/dist/esm/plot/edit/EditBillboard.js +0 -70
  119. package/dist/esm/plot/edit/EditBow.d.ts +0 -8
  120. package/dist/esm/plot/edit/EditBow.js +0 -119
  121. package/dist/esm/plot/edit/EditCircle.d.ts +0 -8
  122. package/dist/esm/plot/edit/EditCircle.js +0 -133
  123. package/dist/esm/plot/edit/EditCurve.d.ts +0 -8
  124. package/dist/esm/plot/edit/EditCurve.js +0 -180
  125. package/dist/esm/plot/edit/EditElliptic.d.ts +0 -8
  126. package/dist/esm/plot/edit/EditElliptic.js +0 -144
  127. package/dist/esm/plot/edit/EditFlag.d.ts +0 -8
  128. package/dist/esm/plot/edit/EditFlag.js +0 -121
  129. package/dist/esm/plot/edit/EditFormation.d.ts +0 -8
  130. package/dist/esm/plot/edit/EditFormation.js +0 -120
  131. package/dist/esm/plot/edit/EditLabel.d.ts +0 -7
  132. package/dist/esm/plot/edit/EditLabel.js +0 -100
  133. package/dist/esm/plot/edit/EditLineArrow.d.ts +0 -8
  134. package/dist/esm/plot/edit/EditLineArrow.js +0 -180
  135. package/dist/esm/plot/edit/EditPincerArrow.d.ts +0 -8
  136. package/dist/esm/plot/edit/EditPincerArrow.js +0 -121
  137. package/dist/esm/plot/edit/EditPoint.d.ts +0 -7
  138. package/dist/esm/plot/edit/EditPoint.js +0 -70
  139. package/dist/esm/plot/edit/EditPolygon.d.ts +0 -8
  140. package/dist/esm/plot/edit/EditPolygon.js +0 -181
  141. package/dist/esm/plot/edit/EditPolyline.d.ts +0 -8
  142. package/dist/esm/plot/edit/EditPolyline.js +0 -179
  143. package/dist/esm/plot/edit/EditRectangle.d.ts +0 -8
  144. package/dist/esm/plot/edit/EditRectangle.js +0 -119
  145. package/dist/esm/plot/edit/EditRegularPolygon.d.ts +0 -8
  146. package/dist/esm/plot/edit/EditRegularPolygon.js +0 -170
  147. package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +0 -8
  148. package/dist/esm/plot/edit/EditRightAngleArrow.js +0 -143
  149. package/dist/esm/plot/edit/EditRoundRectangle.d.ts +0 -8
  150. package/dist/esm/plot/edit/EditRoundRectangle.js +0 -119
  151. package/dist/esm/plot/edit/EditSector.d.ts +0 -8
  152. package/dist/esm/plot/edit/EditSector.js +0 -120
  153. package/dist/esm/plot/edit/EditStraightArrow.d.ts +0 -8
  154. package/dist/esm/plot/edit/EditStraightArrow.js +0 -120
  155. package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +0 -8
  156. package/dist/esm/plot/edit/EditSwallowtailArrow.js +0 -121
  157. package/dist/esm/plot/edit/index.d.ts +0 -23
  158. package/dist/esm/plot/edit/index.js +0 -23
  159. package/dist/esm/plot/utils/DomUtil.d.ts +0 -34
  160. package/dist/esm/plot/utils/DomUtil.js +0 -100
  161. package/dist/esm/plot/utils/PlotCommon.d.ts +0 -101
  162. package/dist/esm/plot/utils/ReminderTip.d.ts +0 -10
  163. package/dist/esm/plot/utils/ReminderTip.js +0 -67
  164. package/dist/esm/plot/utils/Tooltip.d.ts +0 -3
  165. package/dist/esm/plot/utils/Tooltip.js +0 -97
  166. /package/dist/esm/{plot/utils/Algorithm.d.ts → drawer/algorithm.d.ts} +0 -0
  167. /package/dist/esm/{plot/utils/Coordinate.d.ts → drawer/coordinate.d.ts} +0 -0
  168. /package/dist/esm/{plot/utils/Coordinate.js → drawer/coordinate.js} +0 -0
  169. /package/dist/esm/{plot/utils → drawer}/plotUtil.d.ts +0 -0
@@ -1,182 +0,0 @@
1
- /**
2
- * 编辑攻击箭头方法
3
- */
4
- import * as Cesium from 'deeptwins-cesium';
5
- import { getAttackArrowPoints, lockingMap, newSessionid } from "../utils/PlotCommon";
6
- var EditAttackArrow = function EditAttackArrow(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 = getAttackArrowPoints(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: 'EditAttackArrow',
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_attackarrow',
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 === 'AttackArrowEditPoints') {
55
- lockingMap(viewer, false);
56
- currentPickVertex = pickEntity;
57
- } else if (pickEntity.GeoType === 'EditAttackArrow') {
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
- // 左键点击事件
93
- handler.setInputAction(function (event) {
94
- var pick = viewer.scene.pick(event.position);
95
- if (Cesium.defined(pick) && pick.id) {
96
- if (pick.id.GeoType === 'AttackArrowEditCenterPoints') {
97
- var index = pick.id.description.getValue();
98
- var pos = pick.id.position.getValue();
99
- updateProcessObj(true, index, pos);
100
- }
101
- }
102
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
103
- //右键点击事件
104
- handler.setInputAction(function (event) {
105
- var pick = viewer.scene.pick(event.position);
106
- if (Cesium.defined(pick) && pick.id && pick.id.GeoType === 'AttackArrowEditPoints') {
107
- var index = pick.id.description.getValue();
108
- if (index < 2) {
109
- alert('攻击箭头的箭尾节点不支持删除');
110
- return;
111
- }
112
- if (updatePos.length < 4) {
113
- alert('攻击箭头节点数不能少于3个');
114
- return;
115
- }
116
- updateProcessObj(false, index);
117
- }
118
- }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
119
- function updateProcessObj(add, index, pos) {
120
- var item = collection.find(function (ele) {
121
- return ele.id === entity.id;
122
- });
123
- if (item && item.processEntities) {
124
- item.processEntities.forEach(function (entity) {
125
- viewer.entities.remove(entity);
126
- });
127
- add ? updatePos.splice(index, 0, pos) : updatePos.splice(index, 1);
128
- item.processEntities = initVertexEntities();
129
- }
130
- }
131
- function initVertexEntities() {
132
- var vertexPointsEntity = []; //中途创建的Point对象
133
- var centerPointsEntity = []; //中途创建的虚拟Point对象
134
- var _loop = function _loop(index) {
135
- var point = viewer.entities.add({
136
- id: 'edit_' + newSessionid(),
137
- position: new Cesium.CallbackProperty(function () {
138
- return updatePos[index];
139
- }, false),
140
- point: {
141
- pixelSize: 20,
142
- color: Cesium.Color.YELLOW.withAlpha(0.6),
143
- outlineWidth: 2,
144
- heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
145
- outlineColor: Cesium.Color.DARKRED.withAlpha(1)
146
- },
147
- show: true,
148
- description: index //记录节点索引
149
- });
150
- point.GeoType = 'AttackArrowEditPoints';
151
- point.Editable = true;
152
- vertexPointsEntity.push(point);
153
- if (index > 1) {
154
- var centerPoint = viewer.entities.add({
155
- id: 'edit_' + newSessionid(),
156
- position: new Cesium.CallbackProperty(function () {
157
- var startPos = index === 2 ? Cesium.Cartesian3.midpoint(updatePos[0], updatePos[1], new Cesium.Cartesian3()) : updatePos[index - 1];
158
- return Cesium.Cartesian3.midpoint(startPos, updatePos[index], new Cesium.Cartesian3());
159
- }, false),
160
- point: {
161
- pixelSize: 15,
162
- color: Cesium.Color.GREEN.withAlpha(1),
163
- outlineWidth: 2,
164
- heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
165
- outlineColor: Cesium.Color.YELLOW.withAlpha(0.6)
166
- },
167
- show: true,
168
- description: index //记录节点索引
169
- });
170
- centerPoint.GeoType = 'AttackArrowEditCenterPoints';
171
- centerPoint.Editable = true;
172
- centerPointsEntity.push(centerPoint);
173
- }
174
- };
175
- for (var index = 0; index < updatePos.length; index++) {
176
- _loop(index);
177
- }
178
- var processEntities = vertexPointsEntity.concat(centerPointsEntity);
179
- return processEntities;
180
- }
181
- };
182
- export default EditAttackArrow;
@@ -1,7 +0,0 @@
1
- declare const EditBillboard: (viewer: any, entity: any, handler: any, collection: {
2
- id: string;
3
- source: any;
4
- target: any;
5
- geoType: string;
6
- }[]) => void;
7
- export default EditBillboard;
@@ -1,70 +0,0 @@
1
- /**
2
- * 编辑广告牌方法
3
- */
4
- import * as Cesium from 'deeptwins-cesium';
5
- import { getCatesian3FromPX } from "../utils/Coordinate";
6
- import { lockingMap } from "../utils/PlotCommon";
7
- var EditBillboard = function EditBillboard(viewer, entity, handler, collection) {
8
- entity.show = false;
9
- var editItem = collection.find(function (ele) {
10
- return ele.id === entity.id;
11
- });
12
- var editEntity;
13
- var sourcePos = entity.EditingPoint;
14
- var updatePos = Cesium.clone(sourcePos, true);
15
- if (editItem) {
16
- editEntity = editItem.target;
17
- editEntity.show = true;
18
- editEntity.position = new Cesium.CallbackProperty(function () {
19
- return updatePos;
20
- }, false);
21
- } else {
22
- var newBillboard = Cesium.clone(entity.billboard, false);
23
- newBillboard.scale = 1.2;
24
- newBillboard.color = Cesium.Color.ORANGE.withAlpha(0.8);
25
- editEntity = viewer.entities.add({
26
- GeoType: 'EditBillboard',
27
- Editable: true,
28
- id: 'edit_' + entity.id,
29
- position: new Cesium.CallbackProperty(function () {
30
- return updatePos;
31
- }, false),
32
- billboard: newBillboard
33
- });
34
- collection.push({
35
- id: entity.id,
36
- source: entity,
37
- target: editEntity,
38
- geoType: 'point'
39
- });
40
- }
41
- var boolDown = false;
42
- // 左键摁下事件
43
- handler.setInputAction(function (event) {
44
- var pick = viewer.scene.pick(event.position);
45
- if (Cesium.defined(pick) && pick.id) {
46
- var pickEntity = pick.id;
47
- if (pickEntity.id === editEntity.id) {
48
- boolDown = true;
49
- lockingMap(viewer, false);
50
- }
51
- }
52
- }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
53
- // 鼠标移动事件
54
- handler.setInputAction(function (movement) {
55
- if (!boolDown) return;
56
- //console.log('鼠标移动事件监测:------广告版编辑中------');
57
- var endPos = getCatesian3FromPX(viewer, movement.endPosition);
58
- if (endPos) updatePos = endPos;
59
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
60
- // 左键抬起事件
61
- handler.setInputAction(function () {
62
- entity.position = editEntity.position.getValue();
63
- boolDown = false;
64
- entity.show = true;
65
- editEntity.show = false;
66
- lockingMap(viewer, true);
67
- entity.EditingPoint = updatePos;
68
- }, Cesium.ScreenSpaceEventType.LEFT_UP);
69
- };
70
- export default EditBillboard;
@@ -1,8 +0,0 @@
1
- declare const EditBow: (viewer: any, entity: any, handler: any, collection: {
2
- id: string;
3
- source: any;
4
- target: any;
5
- geoType: string;
6
- processEntities?: any[];
7
- }[]) => void;
8
- export default EditBow;
@@ -1,119 +0,0 @@
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;
@@ -1,8 +0,0 @@
1
- declare const EditCircle: (viewer: any, entity: any, handler: any, collection: {
2
- id: string;
3
- source: any;
4
- target: any;
5
- geoType: string;
6
- processEntities?: any[];
7
- }[]) => void;
8
- export default EditCircle;
@@ -1,133 +0,0 @@
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;
@@ -1,8 +0,0 @@
1
- declare const EditCurve: (viewer: any, entity: any, handler: any, collection: {
2
- id: string;
3
- source: any;
4
- target: any;
5
- geoType: string;
6
- processEntities?: any[];
7
- }[]) => void;
8
- export default EditCurve;