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.
Files changed (178) hide show
  1. package/dist/assets/Build/DeepTwins/Image/f_point.png +0 -0
  2. package/dist/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
  3. package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
  4. package/dist/esm/constant.d.ts +29 -0
  5. package/dist/esm/constant.js +47 -0
  6. package/dist/esm/drawer/index.d.ts +56 -59
  7. package/dist/esm/drawer/index.js +380 -292
  8. package/dist/esm/drawer/shape/BaseShape.d.ts +33 -0
  9. package/dist/esm/drawer/shape/BaseShape.js +228 -0
  10. package/dist/esm/drawer/shape/Point.d.ts +44 -11
  11. package/dist/esm/drawer/shape/Point.js +299 -35
  12. package/dist/esm/drawer/shape/Polygon.d.ts +43 -9
  13. package/dist/esm/drawer/shape/Polygon.js +408 -56
  14. package/dist/esm/drawer/shape/Polyline.d.ts +41 -10
  15. package/dist/esm/drawer/shape/Polyline.js +373 -31
  16. package/dist/esm/drawer/utils.d.ts +1 -0
  17. package/dist/esm/drawer/utils.js +63 -0
  18. package/dist/esm/graphicLayer/BaseLayer.d.ts +1 -0
  19. package/dist/esm/graphicLayer/BaseLayer.js +8 -3
  20. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  21. package/dist/esm/graphicLayer/BaseSource.js +13 -3
  22. package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +2 -0
  23. package/dist/esm/graphicLayer/GraphicLayerCollection.js +46 -4
  24. package/dist/esm/graphicLayer/HtmlEntity.js +1 -2
  25. package/dist/esm/index.d.ts +1 -1
  26. package/dist/esm/index.js +7 -4
  27. package/dist/esm/map/Map.d.ts +1 -0
  28. package/dist/esm/map/Map.js +10 -0
  29. package/dist/esm/measure/Area.d.ts +29 -0
  30. package/dist/esm/measure/{AreaMeasure.js → Area.js} +156 -65
  31. package/dist/esm/measure/BaseDraw.d.ts +13 -0
  32. package/dist/esm/measure/BaseDraw.js +70 -0
  33. package/dist/esm/measure/Distance.d.ts +23 -0
  34. package/dist/esm/measure/Distance.js +239 -0
  35. package/dist/esm/measure/index.d.ts +44 -5
  36. package/dist/esm/measure/index.js +278 -5
  37. package/dist/esm/measure/utils.d.ts +108 -14
  38. package/dist/esm/measure/utils.js +262 -20
  39. package/dist/esm/plot/create/CreateAssemble.d.ts +2 -0
  40. package/dist/esm/plot/create/CreateAssemble.js +63 -0
  41. package/dist/esm/plot/create/CreateAttackArrow.d.ts +5 -0
  42. package/dist/esm/plot/create/CreateAttackArrow.js +75 -0
  43. package/dist/esm/plot/create/CreateBillboard.d.ts +2 -0
  44. package/dist/esm/plot/create/CreateBillboard.js +47 -0
  45. package/dist/esm/plot/create/CreateBow.d.ts +2 -0
  46. package/dist/esm/plot/create/CreateBow.js +63 -0
  47. package/dist/esm/plot/create/CreateCircle.d.ts +2 -0
  48. package/dist/esm/plot/create/CreateCircle.js +68 -0
  49. package/dist/esm/plot/create/CreateCurve.d.ts +2 -0
  50. package/dist/esm/plot/create/CreateCurve.js +76 -0
  51. package/dist/esm/plot/create/CreateElliptic.d.ts +2 -0
  52. package/dist/esm/plot/create/CreateElliptic.js +69 -0
  53. package/dist/esm/plot/create/CreateFlag.d.ts +2 -0
  54. package/dist/esm/plot/create/CreateFlag.js +80 -0
  55. package/dist/esm/plot/create/CreateFormation.d.ts +2 -0
  56. package/dist/esm/plot/create/CreateFormation.js +65 -0
  57. package/dist/esm/plot/create/CreateFreeLine.d.ts +2 -0
  58. package/dist/esm/plot/create/CreateFreeLine.js +69 -0
  59. package/dist/esm/plot/create/CreateFreePolygon.d.ts +2 -0
  60. package/dist/esm/plot/create/CreateFreePolygon.js +65 -0
  61. package/dist/esm/plot/create/CreateLabel.d.ts +2 -0
  62. package/dist/esm/plot/create/CreateLabel.js +55 -0
  63. package/dist/esm/plot/create/CreateLineArrow.d.ts +2 -0
  64. package/dist/esm/plot/create/CreateLineArrow.js +79 -0
  65. package/dist/esm/plot/create/CreatePincerArrow.d.ts +5 -0
  66. package/dist/esm/plot/create/CreatePincerArrow.js +73 -0
  67. package/dist/esm/plot/create/CreatePoint.d.ts +2 -0
  68. package/dist/esm/plot/create/CreatePoint.js +47 -0
  69. package/dist/esm/plot/create/CreatePolygon.d.ts +2 -0
  70. package/dist/esm/plot/create/CreatePolygon.js +80 -0
  71. package/dist/esm/plot/create/CreatePolyline.d.ts +2 -0
  72. package/dist/esm/plot/create/CreatePolyline.js +70 -0
  73. package/dist/esm/plot/create/CreateRectangle.d.ts +2 -0
  74. package/dist/esm/plot/create/CreateRectangle.js +60 -0
  75. package/dist/esm/plot/create/CreateRegularPolygon.d.ts +2 -0
  76. package/dist/esm/plot/create/CreateRegularPolygon.js +75 -0
  77. package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +5 -0
  78. package/dist/esm/plot/create/CreateRightAngleArrow.js +73 -0
  79. package/dist/esm/plot/create/CreateRoundRectangle.d.ts +2 -0
  80. package/dist/esm/plot/create/CreateRoundRectangle.js +63 -0
  81. package/dist/esm/plot/create/CreateSector.d.ts +2 -0
  82. package/dist/esm/plot/create/CreateSector.js +65 -0
  83. package/dist/esm/plot/create/CreateStraightArrow.d.ts +5 -0
  84. package/dist/esm/plot/create/CreateStraightArrow.js +65 -0
  85. package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +5 -0
  86. package/dist/esm/plot/create/CreateSwallowtailArrow.js +67 -0
  87. package/dist/esm/plot/create/index.d.ts +25 -0
  88. package/dist/esm/plot/create/index.js +25 -0
  89. package/dist/esm/plot/edit/EditAssemble.d.ts +8 -0
  90. package/dist/esm/plot/edit/EditAssemble.js +120 -0
  91. package/dist/esm/plot/edit/EditAttackArrow.d.ts +8 -0
  92. package/dist/esm/plot/edit/EditAttackArrow.js +182 -0
  93. package/dist/esm/plot/edit/EditBillboard.d.ts +7 -0
  94. package/dist/esm/plot/edit/EditBillboard.js +70 -0
  95. package/dist/esm/plot/edit/EditBow.d.ts +8 -0
  96. package/dist/esm/plot/edit/EditBow.js +119 -0
  97. package/dist/esm/plot/edit/EditCircle.d.ts +8 -0
  98. package/dist/esm/plot/edit/EditCircle.js +133 -0
  99. package/dist/esm/plot/edit/EditCurve.d.ts +8 -0
  100. package/dist/esm/plot/edit/EditCurve.js +180 -0
  101. package/dist/esm/plot/edit/EditElliptic.d.ts +8 -0
  102. package/dist/esm/plot/edit/EditElliptic.js +144 -0
  103. package/dist/esm/plot/edit/EditFlag.d.ts +8 -0
  104. package/dist/esm/plot/edit/EditFlag.js +121 -0
  105. package/dist/esm/plot/edit/EditFormation.d.ts +8 -0
  106. package/dist/esm/plot/edit/EditFormation.js +120 -0
  107. package/dist/esm/plot/edit/EditLabel.d.ts +7 -0
  108. package/dist/esm/plot/edit/EditLabel.js +100 -0
  109. package/dist/esm/plot/edit/EditLineArrow.d.ts +8 -0
  110. package/dist/esm/plot/edit/EditLineArrow.js +180 -0
  111. package/dist/esm/plot/edit/EditPincerArrow.d.ts +8 -0
  112. package/dist/esm/plot/edit/EditPincerArrow.js +121 -0
  113. package/dist/esm/plot/edit/EditPoint.d.ts +7 -0
  114. package/dist/esm/plot/edit/EditPoint.js +70 -0
  115. package/dist/esm/plot/edit/EditPolygon.d.ts +8 -0
  116. package/dist/esm/plot/edit/EditPolygon.js +181 -0
  117. package/dist/esm/plot/edit/EditPolyline.d.ts +8 -0
  118. package/dist/esm/plot/edit/EditPolyline.js +179 -0
  119. package/dist/esm/plot/edit/EditRectangle.d.ts +8 -0
  120. package/dist/esm/plot/edit/EditRectangle.js +119 -0
  121. package/dist/esm/plot/edit/EditRegularPolygon.d.ts +8 -0
  122. package/dist/esm/plot/edit/EditRegularPolygon.js +170 -0
  123. package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +8 -0
  124. package/dist/esm/plot/edit/EditRightAngleArrow.js +143 -0
  125. package/dist/esm/plot/edit/EditRoundRectangle.d.ts +8 -0
  126. package/dist/esm/plot/edit/EditRoundRectangle.js +119 -0
  127. package/dist/esm/plot/edit/EditSector.d.ts +8 -0
  128. package/dist/esm/plot/edit/EditSector.js +120 -0
  129. package/dist/esm/plot/edit/EditStraightArrow.d.ts +8 -0
  130. package/dist/esm/plot/edit/EditStraightArrow.js +120 -0
  131. package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +8 -0
  132. package/dist/esm/plot/edit/EditSwallowtailArrow.js +121 -0
  133. package/dist/esm/plot/edit/index.d.ts +23 -0
  134. package/dist/esm/plot/edit/index.js +23 -0
  135. package/dist/esm/plot/utils/Algorithm.d.ts +2 -0
  136. package/dist/esm/plot/utils/Algorithm.js +316 -0
  137. package/dist/esm/plot/utils/Coordinate.d.ts +98 -0
  138. package/dist/esm/plot/utils/Coordinate.js +184 -0
  139. package/dist/esm/plot/utils/DomUtil.d.ts +34 -0
  140. package/dist/esm/plot/utils/DomUtil.js +100 -0
  141. package/dist/esm/plot/utils/PlotCommon.d.ts +101 -0
  142. package/dist/esm/plot/utils/PlotCommon.js +1412 -0
  143. package/dist/esm/plot/utils/ReminderTip.d.ts +10 -0
  144. package/dist/esm/plot/utils/ReminderTip.js +67 -0
  145. package/dist/esm/plot/utils/Tooltip.d.ts +3 -0
  146. package/dist/esm/plot/utils/Tooltip.js +97 -0
  147. package/dist/esm/plot/utils/plotUtil.d.ts +5 -0
  148. package/dist/esm/plot/utils/plotUtil.js +268 -0
  149. package/dist/esm/tool/utils.d.ts +8 -7
  150. package/dist/esm/tool/utils.js +20 -16
  151. package/dist/esm/toolTip/index.d.ts +2 -1
  152. package/dist/esm/toolTip/index.js +12 -6
  153. package/dist/esm/typings.d.ts +1 -0
  154. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  155. package/package.json +1 -1
  156. package/dist/esm/drawer/base.d.ts +0 -51
  157. package/dist/esm/drawer/base.js +0 -179
  158. package/dist/esm/drawer/painter.d.ts +0 -41
  159. package/dist/esm/drawer/painter.js +0 -115
  160. package/dist/esm/drawer/shape/Ellipse.d.ts +0 -10
  161. package/dist/esm/drawer/shape/Ellipse.js +0 -62
  162. package/dist/esm/drawer/shape/Rectangle.d.ts +0 -10
  163. package/dist/esm/drawer/shape/Rectangle.js +0 -85
  164. package/dist/esm/drawer/typings.d.ts +0 -106
  165. package/dist/esm/drawer/typings.js +0 -1
  166. package/dist/esm/measure/AreaMeasure.d.ts +0 -19
  167. package/dist/esm/measure/AreaSurfaceMeasure.d.ts +0 -30
  168. package/dist/esm/measure/AreaSurfaceMeasure.js +0 -151
  169. package/dist/esm/measure/DistanceMeasure.d.ts +0 -19
  170. package/dist/esm/measure/DistanceMeasure.js +0 -91
  171. package/dist/esm/measure/DistanceSurfaceMeasure.d.ts +0 -37
  172. package/dist/esm/measure/DistanceSurfaceMeasure.js +0 -122
  173. package/dist/esm/measure/Measure.d.ts +0 -111
  174. package/dist/esm/measure/Measure.js +0 -177
  175. package/dist/esm/tool/cesiumExtends/Subscriber/index.d.ts +0 -66
  176. package/dist/esm/tool/cesiumExtends/Subscriber/index.js +0 -246
  177. package/dist/esm/tool/kriging.d.ts +0 -10
  178. package/dist/esm/tool/kriging.js +0 -436
@@ -0,0 +1,63 @@
1
+ /**
2
+ * 弓形标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { calculateBowPoints, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateBow = function CreateBow(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var width = options.width || 5;
12
+ var onground = options.onground || true;
13
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
14
+ window.toolTip = '左键点击开始绘制';
15
+ var anchorpoints = []; //记录阵型的两个端点
16
+ var bowPolyline = undefined;
17
+ // 左键点击事件
18
+ handler.setInputAction(function (event) {
19
+ window.toolTip = '左键双击键结束绘制';
20
+ var pos = getCatesian3FromPX(viewer, event.position);
21
+ if (!pos || Cesium.defined(bowPolyline)) return;
22
+ anchorpoints.push(pos);
23
+ var dynamicPositions = new Cesium.CallbackProperty(function () {
24
+ return calculateBowPoints(anchorpoints);
25
+ }, false);
26
+ bowPolyline = viewer.entities.add({
27
+ name: 'Bow',
28
+ id: id,
29
+ polyline: {
30
+ positions: dynamicPositions,
31
+ width: width,
32
+ material: color,
33
+ clampToGround: onground
34
+ }
35
+ });
36
+ bowPolyline.GeoType = 'Bow'; //记录对象的类型,用户后续编辑等操作
37
+ bowPolyline.Editable = true; //代表当前对象可编辑,false状态下不可编辑
38
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
39
+ // 鼠标移动事件
40
+ handler.setInputAction(function (movement) {
41
+ //console.log('鼠标移动事件监测:------创建弓形------');
42
+ var endPos = movement.endPosition;
43
+ CreateRemindertip(window.toolTip, endPos, true);
44
+ if (!Cesium.defined(bowPolyline)) return;
45
+ var endCartesian = getCatesian3FromPX(viewer, endPos);
46
+ if (!endCartesian) return;
47
+ if (anchorpoints.length > 1) {
48
+ anchorpoints.pop();
49
+ }
50
+ anchorpoints.push(endCartesian);
51
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
52
+ // 左键双击事件
53
+ handler.setInputAction(function () {
54
+ bowPolyline.polyline.positions = calculateBowPoints(anchorpoints);
55
+ bowPolyline.PottingPoint = Cesium.clone(anchorpoints, true);
56
+ bowPolyline.EditingPoint = Cesium.clone(anchorpoints, true);
57
+ resultList.push(bowPolyline);
58
+ handler.destroy();
59
+ CreateRemindertip(window.toolTip, null, false);
60
+ if (typeof callback == 'function') callback(bowPolyline);
61
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
62
+ };
63
+ export default CreateBow;
@@ -0,0 +1,2 @@
1
+ declare const CreateCircle: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((circle: any) => void) | undefined) => void;
2
+ export default CreateCircle;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * 圆形标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateCircle = function CreateCircle(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var onground = options.onground || true;
12
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
13
+ window.toolTip = '左键点击开始绘制';
14
+ var anchorpoints = []; //两个点,一个中心点,一个端点
15
+ var circle = undefined;
16
+ var radius = new Cesium.CallbackProperty(function () {
17
+ return getSemiAxis(anchorpoints);
18
+ }, false);
19
+ // 左键点击事件
20
+ handler.setInputAction(function (event) {
21
+ window.toolTip = '左键双击键结束绘制';
22
+ var pos = getCatesian3FromPX(viewer, event.position);
23
+ if (!pos) return;
24
+ if (anchorpoints.length === 0) {
25
+ anchorpoints.push(pos);
26
+ }
27
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
28
+ // 鼠标移动事件
29
+ handler.setInputAction(function (movement) {
30
+ var endPos = movement.endPosition;
31
+ CreateRemindertip(window.toolTip, endPos, true);
32
+ if (anchorpoints.length === 0) return;
33
+ //console.log('鼠标移动事件监测:------创建圆形------');
34
+ var endCartesian = getCatesian3FromPX(viewer, endPos);
35
+ if (Cesium.defined(circle)) {
36
+ anchorpoints.pop();
37
+ anchorpoints.push(endCartesian);
38
+ } else {
39
+ anchorpoints.push(endCartesian);
40
+ circle = viewer.entities.add({
41
+ id: id,
42
+ position: anchorpoints[0],
43
+ name: 'Circle',
44
+ ellipse: {
45
+ semiMinorAxis: radius,
46
+ semiMajorAxis: radius,
47
+ material: color,
48
+ heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
49
+ }
50
+ });
51
+ circle.GeoType = 'Circle'; //记录对象的类型,用户后续编辑等操作
52
+ circle.Editable = true; //代表当前对象可编辑,false状态下不可编辑
53
+ }
54
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
55
+ // 左键双击事件
56
+ handler.setInputAction(function () {
57
+ circle.PottingPoint = Cesium.clone(anchorpoints, true);
58
+ circle.EditingPoint = Cesium.clone(anchorpoints, true);
59
+ resultList.push(circle);
60
+ handler.destroy();
61
+ CreateRemindertip(window.toolTip, null, false);
62
+ if (typeof callback == 'function') callback(circle);
63
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
64
+ };
65
+ function getSemiAxis(points) {
66
+ return points.length === 2 ? Cesium.Cartesian3.distance(points[0], points[1]) : 0;
67
+ }
68
+ export default CreateCircle;
@@ -0,0 +1,2 @@
1
+ declare const CreateCurve: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((curve: any) => void) | undefined) => void;
2
+ export default CreateCurve;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 曲线标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { createBezierPoints, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateCurve = function CreateCurve(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.9);
11
+ var onground = options.onground || true;
12
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
13
+ window.toolTip = '左键点击开始绘制';
14
+ var anchorpoints = [];
15
+ var polyline = undefined;
16
+ var linePoints;
17
+ // 左键点击事件
18
+ handler.setInputAction(function (event) {
19
+ window.toolTip = '左键添加点,右键撤销,左键双击结束绘制';
20
+ var pixPos = event.position;
21
+ var cartesian = getCatesian3FromPX(viewer, pixPos);
22
+ if (anchorpoints.length == 0) {
23
+ anchorpoints.push(cartesian);
24
+ }
25
+ anchorpoints.push(cartesian);
26
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
27
+ // 鼠标移动事件
28
+ handler.setInputAction(function (movement) {
29
+ //console.log('鼠标移动事件监测:------创建自由曲线------');
30
+ var endPos = movement.endPosition;
31
+ CreateRemindertip(window.toolTip, endPos, true);
32
+ if (anchorpoints.length > 0) {
33
+ if (!Cesium.defined(polyline)) {
34
+ linePoints = createBezierPoints(anchorpoints);
35
+ polyline = viewer.entities.add({
36
+ name: 'Curve',
37
+ id: id,
38
+ polyline: {
39
+ positions: new Cesium.CallbackProperty(function () {
40
+ return linePoints;
41
+ }, false),
42
+ width: 15,
43
+ material: new Cesium.PolylineGlowMaterialProperty({
44
+ glowPower: 0.3,
45
+ color: color
46
+ }),
47
+ clampToGround: onground
48
+ }
49
+ });
50
+ polyline.GeoType = 'Curve'; //记录对象的类型,用户后续编辑等操作
51
+ polyline.Editable = true; //代表当前对象可编辑,false状态下不可编辑
52
+ } else {
53
+ anchorpoints.pop();
54
+ var cartesian = getCatesian3FromPX(viewer, endPos);
55
+ anchorpoints.push(cartesian);
56
+ linePoints = createBezierPoints(anchorpoints);
57
+ }
58
+ }
59
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
60
+ // 左键双击事件
61
+ handler.setInputAction(function (event) {
62
+ anchorpoints.pop();
63
+ anchorpoints.pop(); //因为是双击结束,所以要pop两次,一次是move的结果,一次是单击结果
64
+ polyline.PottingPoint = Cesium.clone(anchorpoints, true); //记录对象的节点数据,用户后续编辑等操作
65
+ polyline.EditingPoint = Cesium.clone(anchorpoints, true); //记录复杂对象的编辑的节点数据,用户后续编辑等操作
66
+ resultList.push(polyline);
67
+ handler.destroy();
68
+ CreateRemindertip(window.toolTip, event.position, false);
69
+ if (typeof callback == 'function') callback(polyline);
70
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
71
+ // 右键摁下事件
72
+ handler.setInputAction(function () {
73
+ anchorpoints.pop();
74
+ }, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
75
+ };
76
+ export default CreateCurve;
@@ -0,0 +1,2 @@
1
+ declare const CreateElliptic: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((elliptic: any) => void) | undefined) => void;
2
+ export default CreateElliptic;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 椭圆标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { getEllipticAngle, getSemiAxis, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateElliptic = function CreateElliptic(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var onground = options.onground || true;
12
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
13
+ window.toolTip = '左键点击开始绘制';
14
+ var anchorpoints = []; //两个点,一个中心点,一个长轴端点
15
+ var elliptic = undefined;
16
+ // 左键点击事件
17
+ handler.setInputAction(function (event) {
18
+ window.toolTip = '左键双击键结束绘制';
19
+ var pos = getCatesian3FromPX(viewer, event.position);
20
+ if (!pos) return;
21
+ if (anchorpoints.length === 0) {
22
+ anchorpoints.push(pos);
23
+ }
24
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
25
+ // 鼠标移动事件
26
+ handler.setInputAction(function (movement) {
27
+ var endPos = movement.endPosition;
28
+ CreateRemindertip(window.toolTip, endPos, true);
29
+ if (anchorpoints.length === 0) return;
30
+ //console.log('鼠标移动事件监测:------创建椭圆形------');
31
+ var endCartesian = getCatesian3FromPX(viewer, endPos);
32
+ if (Cesium.defined(elliptic)) {
33
+ anchorpoints.pop();
34
+ anchorpoints.push(endCartesian);
35
+ } else {
36
+ anchorpoints.push(endCartesian);
37
+ elliptic = viewer.entities.add({
38
+ id: id,
39
+ position: anchorpoints[0],
40
+ name: 'Elliptic',
41
+ ellipse: {
42
+ semiMinorAxis: new Cesium.CallbackProperty(function () {
43
+ return getSemiAxis(anchorpoints) / 2;
44
+ }, false),
45
+ semiMajorAxis: new Cesium.CallbackProperty(function () {
46
+ return getSemiAxis(anchorpoints);
47
+ }, false),
48
+ rotation: new Cesium.CallbackProperty(function () {
49
+ return getEllipticAngle(anchorpoints);
50
+ }, false),
51
+ material: color,
52
+ heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
53
+ }
54
+ });
55
+ elliptic.GeoType = 'Elliptic'; //记录对象的类型,用户后续编辑等操作
56
+ elliptic.Editable = true; //代表当前对象可编辑,false状态下不可编辑
57
+ }
58
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
59
+ // 左键双击事件
60
+ handler.setInputAction(function () {
61
+ elliptic.PottingPoint = Cesium.clone(anchorpoints, true);
62
+ elliptic.EditingPoint = Cesium.clone(anchorpoints, true);
63
+ resultList.push(elliptic);
64
+ handler.destroy();
65
+ CreateRemindertip(window.toolTip, null, false);
66
+ if (typeof callback == 'function') callback(elliptic);
67
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
68
+ };
69
+ export default CreateElliptic;
@@ -0,0 +1,2 @@
1
+ declare const CreateFlag: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((flag: any) => void) | undefined) => void;
2
+ export default CreateFlag;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * 旗标标绘功能,包括 0:曲线,1:矩形.2:正三角,3:倒三角,4:对三角
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { calculateFlagPoints, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateFlag = function CreateFlag(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var onground = options.onground || true;
12
+ var type = options.type || 0; //默认绘制曲线旗标
13
+ var flagType = {
14
+ 0: 'CurveFlag',
15
+ //曲线旗标
16
+ 1: 'RectangleFlag',
17
+ //矩形旗标
18
+ 2: 'RegularTriangleFlag',
19
+ //正三角旗标
20
+ 3: 'InvertedTriangleFlag',
21
+ //倒三角旗标
22
+ 4: 'TriangleFlag' //对三角旗标
23
+ };
24
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
25
+ window.toolTip = '左键点击开始绘制';
26
+ var anchorpoints = [];
27
+ var flagPolygon = undefined;
28
+ // 左键点击事件
29
+ handler.setInputAction(function (event) {
30
+ window.toolTip = '左键双击键结束绘制';
31
+ var cartesian = getCatesian3FromPX(viewer, event.position);
32
+ if (Cesium.defined(flagPolygon) || !cartesian) {
33
+ return;
34
+ }
35
+ anchorpoints.push(cartesian);
36
+ var dynamicPositions = new Cesium.CallbackProperty(function () {
37
+ var points = calculateFlagPoints(anchorpoints, type);
38
+ return new Cesium.PolygonHierarchy(points);
39
+ }, false);
40
+ flagPolygon = viewer.entities.add({
41
+ name: flagType[type],
42
+ id: id,
43
+ polygon: {
44
+ hierarchy: dynamicPositions,
45
+ material: color,
46
+ outline: true,
47
+ outlineColor: Cesium.Color.GREEN,
48
+ heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
49
+ }
50
+ });
51
+ flagPolygon.GeoType = flagType[type]; //记录对象的类型,用户后续编辑等操作
52
+ flagPolygon.Editable = true; //代表当前对象可编辑,false状态下不可编辑
53
+ flagPolygon.GeoNum = type; //代表当前旗标类型标签
54
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
55
+ // 鼠标移动事件
56
+ handler.setInputAction(function (movement) {
57
+ //console.log('鼠标移动事件监测:------创建旗标------');
58
+ var endPos = movement.endPosition;
59
+ CreateRemindertip(window.toolTip, endPos, true);
60
+ if (!Cesium.defined(flagPolygon)) return;
61
+ var endCartesian = getCatesian3FromPX(viewer, endPos);
62
+ if (!endCartesian) return;
63
+ if (anchorpoints.length > 1) {
64
+ anchorpoints.pop();
65
+ }
66
+ anchorpoints.push(endCartesian);
67
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
68
+ // 左键双击事件
69
+ handler.setInputAction(function () {
70
+ var points = calculateFlagPoints(anchorpoints, type);
71
+ flagPolygon.polygon.hierarchy = new Cesium.PolygonHierarchy(points);
72
+ flagPolygon.PottingPoint = Cesium.clone(anchorpoints, true);
73
+ flagPolygon.EditingPoint = Cesium.clone(anchorpoints, true);
74
+ resultList.push(flagPolygon);
75
+ handler.destroy();
76
+ CreateRemindertip(window.toolTip, null, false);
77
+ if (typeof callback == 'function') callback(flagPolygon);
78
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
79
+ };
80
+ export default CreateFlag;
@@ -0,0 +1,2 @@
1
+ declare const CreateFormation: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((formation: any) => void) | undefined) => void;
2
+ export default CreateFormation;
@@ -0,0 +1,65 @@
1
+ /*
2
+ * 防御、进攻阵型标绘功能 0-防御阵型;1-进攻阵型
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { calculateFormationPoints, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateFormation = function CreateFormation(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var width = options.width || 5;
12
+ var onground = options.onground || true;
13
+ var type = options.type || 0; //0-防御阵型;1-进攻阵型
14
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
15
+ window.toolTip = '左键点击开始绘制';
16
+ var anchorpoints = []; //记录阵型的两个端点
17
+ var formationPolyline = undefined;
18
+ // 左键点击事件
19
+ handler.setInputAction(function (event) {
20
+ window.toolTip = '左键双击键结束绘制';
21
+ var pos = getCatesian3FromPX(viewer, event.position);
22
+ if (!pos || Cesium.defined(formationPolyline)) return;
23
+ anchorpoints.push(pos);
24
+ var dynamicPositions = new Cesium.CallbackProperty(function () {
25
+ return calculateFormationPoints(anchorpoints, type);
26
+ }, false);
27
+ formationPolyline = viewer.entities.add({
28
+ name: 'Formation',
29
+ id: id,
30
+ polyline: {
31
+ positions: dynamicPositions,
32
+ width: width,
33
+ material: color,
34
+ clampToGround: onground
35
+ }
36
+ });
37
+ formationPolyline.GeoType = 'Formation'; //记录对象的类型,用户后续编辑等操作
38
+ formationPolyline.Editable = true; //代表当前对象可编辑,false状态下不可编辑
39
+ formationPolyline.GeoNum = type; //代表当前对象类型标记,防御或者进攻
40
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
41
+ // 鼠标移动事件
42
+ handler.setInputAction(function (movement) {
43
+ //console.log('鼠标移动事件监测:------创建阵型------');
44
+ var endPos = movement.endPosition;
45
+ CreateRemindertip(window.toolTip, endPos, true);
46
+ if (!Cesium.defined(formationPolyline)) return;
47
+ var endCartesian = getCatesian3FromPX(viewer, endPos);
48
+ if (!endCartesian) return;
49
+ if (anchorpoints.length > 1) {
50
+ anchorpoints.pop();
51
+ }
52
+ anchorpoints.push(endCartesian);
53
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
54
+ // 左键双击事件
55
+ handler.setInputAction(function () {
56
+ formationPolyline.polyline.positions = calculateFormationPoints(anchorpoints, type);
57
+ formationPolyline.PottingPoint = Cesium.clone(anchorpoints, true);
58
+ formationPolyline.EditingPoint = Cesium.clone(anchorpoints, true);
59
+ resultList.push(formationPolyline);
60
+ handler.destroy();
61
+ CreateRemindertip(window.toolTip, null, false);
62
+ if (typeof callback == 'function') callback(formationPolyline);
63
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
64
+ };
65
+ export default CreateFormation;
@@ -0,0 +1,2 @@
1
+ declare const CreateFreeLine: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((polyline: any) => void) | undefined) => void;
2
+ export default CreateFreeLine;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 自由线标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateFreeLine = function CreateFreeLine(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.9);
11
+ var onground = options.onground || true;
12
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
13
+ window.toolTip = '左键点击开始绘制';
14
+ var anchorpoints = [];
15
+ var polyline = undefined;
16
+ // 左键点击事件
17
+ handler.setInputAction(function (event) {
18
+ window.toolTip = '鼠标移动绘制,左键双击结束绘制';
19
+ var pixPos = event.position;
20
+ var cartesian = getCatesian3FromPX(viewer, pixPos);
21
+ if (!cartesian) {
22
+ return;
23
+ }
24
+ if (anchorpoints.length == 0) {
25
+ anchorpoints.push(cartesian);
26
+ polyline = viewer.entities.add({
27
+ name: 'FreeLine',
28
+ id: id,
29
+ polyline: {
30
+ show: true,
31
+ positions: new Cesium.CallbackProperty(function () {
32
+ return anchorpoints;
33
+ }, false),
34
+ width: 15,
35
+ material: new Cesium.PolylineGlowMaterialProperty({
36
+ glowPower: 0.3,
37
+ color: color
38
+ }),
39
+ clampToGround: onground
40
+ }
41
+ });
42
+ polyline.GeoType = 'FreeLine'; //记录对象的类型,用户后续编辑等操作
43
+ polyline.Editable = false; //代表当前对象可编辑,false状态下不可编辑
44
+ }
45
+ anchorpoints.push(cartesian);
46
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
47
+ // 鼠标移动事件
48
+ handler.setInputAction(function (movement) {
49
+ //console.log('鼠标移动事件监测:------创建自由线------');
50
+ var endPos = movement.endPosition;
51
+ CreateRemindertip(window.toolTip, endPos, true);
52
+ if (anchorpoints.length > 1) {
53
+ var cartesian = getCatesian3FromPX(viewer, endPos);
54
+ if (!cartesian) {
55
+ return;
56
+ }
57
+ anchorpoints.push(cartesian);
58
+ }
59
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
60
+ // 左键双击事件
61
+ handler.setInputAction(function (event) {
62
+ polyline.PottingPoint = anchorpoints;
63
+ resultList.push(polyline);
64
+ handler.destroy();
65
+ CreateRemindertip(window.toolTip, event.position, false);
66
+ if (callback && typeof callback == 'function') callback(polyline);
67
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
68
+ };
69
+ export default CreateFreeLine;
@@ -0,0 +1,2 @@
1
+ declare const CreateFreePolygon: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((polygon: any) => void) | undefined) => void;
2
+ export default CreateFreePolygon;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 自由多边形标绘功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateFreePolygon = function CreateFreePolygon(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.BLUE.withAlpha(0.4);
11
+ var onground = options.onground || true;
12
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
13
+ window.toolTip = '左键点击开始绘制';
14
+ var anchorpoints = [];
15
+ var polygon = undefined;
16
+ // 左键点击事件
17
+ handler.setInputAction(function (event) {
18
+ window.toolTip = '左键双击结束绘制';
19
+ if (Cesium.defined(polygon)) {
20
+ return;
21
+ }
22
+ var pixPos = event.position;
23
+ var cartesian = getCatesian3FromPX(viewer, pixPos);
24
+ if (anchorpoints.length == 0) {
25
+ anchorpoints.push(cartesian);
26
+ var dynamicPositions = new Cesium.CallbackProperty(function () {
27
+ return new Cesium.PolygonHierarchy(anchorpoints);
28
+ }, false);
29
+ polygon = viewer.entities.add({
30
+ name: 'FreePolygon',
31
+ id: id,
32
+ polygon: {
33
+ hierarchy: dynamicPositions,
34
+ material: color,
35
+ outline: true,
36
+ outlineColor: Cesium.Color.GREEN,
37
+ heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
38
+ }
39
+ });
40
+ polygon.GeoType = 'FreePolygon'; //记录对象的类型,用户后续编辑等操作
41
+ polygon.Editable = false; //代表当前对象可编辑,false状态下不可编辑
42
+ }
43
+ anchorpoints.push(cartesian);
44
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
45
+ // 鼠标移动事件
46
+ handler.setInputAction(function (movement) {
47
+ //console.log('鼠标移动事件监测:------创建自由多边形------');
48
+ var endPos = movement.endPosition;
49
+ CreateRemindertip(window.toolTip, endPos, true);
50
+ if (Cesium.defined(polygon)) {
51
+ var cartesian = getCatesian3FromPX(viewer, endPos);
52
+ anchorpoints.push(cartesian);
53
+ }
54
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
55
+ // 左键双击事件
56
+ handler.setInputAction(function (event) {
57
+ var hierarchyPos = new Cesium.PolygonHierarchy(anchorpoints);
58
+ polygon.PottingPoint = Cesium.clone(hierarchyPos, true); //记录对象的节点数据,用户后续编辑等操作
59
+ resultList.push(polygon);
60
+ handler.destroy();
61
+ CreateRemindertip(window.toolTip, event.position, false);
62
+ if (typeof callback == 'function') callback(polygon);
63
+ }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
64
+ };
65
+ export default CreateFreePolygon;
@@ -0,0 +1,2 @@
1
+ declare const CreateLabel: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((label: any) => void) | undefined) => void;
2
+ export default CreateLabel;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * 文本标注功能
3
+ */
4
+ import * as Cesium from 'deeptwins-cesium';
5
+ import { getCatesian3FromPX } from "../utils/Coordinate";
6
+ import { getLabelText, newSessionid } from "../utils/PlotCommon";
7
+ import CreateRemindertip from "../utils/ReminderTip";
8
+ var CreateLabel = function CreateLabel(viewer, handler, resultList, options, callback) {
9
+ var id = options.id || newSessionid();
10
+ var onground = options.onground || true;
11
+ var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.WHITE;
12
+ var text = getLabelText(options.text || 'undefined', 0);
13
+ var size = options.size || '32';
14
+ if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
15
+ window.toolTip = '左键点击选择点位';
16
+ handler.setInputAction(function (event) {
17
+ var pixPos = event.position;
18
+ var cartesian = getCatesian3FromPX(viewer, pixPos);
19
+ var point = viewer.entities.add({
20
+ id: id,
21
+ name: 'Label',
22
+ position: cartesian,
23
+ label: {
24
+ text: text,
25
+ font: size + 'px Helvetica',
26
+ fillColor: color,
27
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
28
+ heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE,
29
+ disableDepthTestDistance: 100000 //解决遮挡显示一半的问题
30
+ }
31
+ });
32
+ point.GeoType = 'Label'; //记录对象的类型,用户后续编辑等操作
33
+ point.PottingPoint = {
34
+ position: cartesian,
35
+ text: text,
36
+ size: size
37
+ }; //记录对象的节点数据,用户后续编辑等操作
38
+ point.EditingPoint = {
39
+ position: cartesian,
40
+ text: text,
41
+ size: size
42
+ }; //记录对象的节点数据,用户后续编辑等操作
43
+ point.Editable = true; //代表当前对象可编辑,false状态下不可编辑
44
+ resultList.push(point);
45
+ handler.destroy();
46
+ CreateRemindertip(window.toolTip, event.position, false);
47
+ if (callback && typeof callback == 'function') callback(point);
48
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
49
+ handler.setInputAction(function (movement) {
50
+ //console.log('鼠标移动事件监测:------创建文本------');
51
+ var endPos = movement.endPosition;
52
+ CreateRemindertip(window.toolTip, endPos, true);
53
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
54
+ };
55
+ export default CreateLabel;
@@ -0,0 +1,2 @@
1
+ declare const CreateLineArrow: (viewer: any, handler: any, resultList: any[], options: any, callback?: ((lineArrow: any) => void) | undefined) => void;
2
+ export default CreateLineArrow;