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