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.
- package/dist/esm/{plot/utils/Algorithm.js → drawer/algorithm.js} +1 -3
- package/dist/esm/drawer/common.d.ts +61 -0
- package/dist/esm/{plot/utils/PlotCommon.js → drawer/common.js} +104 -551
- package/dist/esm/drawer/index.d.ts +11 -18
- package/dist/esm/drawer/index.js +329 -80
- package/dist/esm/{plot/utils → drawer}/plotUtil.js +1 -3
- package/dist/esm/drawer/shape/Assemble.d.ts +34 -0
- package/dist/esm/drawer/shape/Assemble.js +415 -0
- package/dist/esm/drawer/shape/AttackArrow.d.ts +32 -0
- package/dist/esm/drawer/shape/AttackArrow.js +442 -0
- package/dist/esm/drawer/shape/BaseShape.d.ts +14 -4
- package/dist/esm/drawer/shape/BaseShape.js +175 -20
- package/dist/esm/drawer/shape/Bow.d.ts +31 -0
- package/dist/esm/drawer/shape/Bow.js +375 -0
- package/dist/esm/drawer/shape/Circle.d.ts +37 -0
- package/dist/esm/drawer/shape/Circle.js +461 -0
- package/dist/esm/drawer/shape/Curve.d.ts +29 -0
- package/dist/esm/drawer/shape/Curve.js +386 -0
- package/dist/esm/drawer/shape/DragPoint.d.ts +32 -0
- package/dist/esm/drawer/shape/DragPoint.js +211 -0
- package/dist/esm/drawer/shape/Elliptic.d.ts +38 -0
- package/dist/esm/drawer/shape/Elliptic.js +491 -0
- package/dist/esm/drawer/shape/Formation.d.ts +33 -0
- package/dist/esm/drawer/shape/Formation.js +395 -0
- package/dist/esm/drawer/shape/PincerArrow.d.ts +32 -0
- package/dist/esm/drawer/shape/PincerArrow.js +445 -0
- package/dist/esm/drawer/shape/Point.d.ts +2 -31
- package/dist/esm/drawer/shape/Point.js +7 -201
- package/dist/esm/drawer/shape/Polygon.d.ts +1 -1
- package/dist/esm/drawer/shape/Polygon.js +10 -81
- package/dist/esm/drawer/shape/Polyline.d.ts +1 -1
- package/dist/esm/drawer/shape/Polyline.js +10 -81
- package/dist/esm/drawer/shape/RegularPolygon.d.ts +37 -0
- package/dist/esm/drawer/shape/RegularPolygon.js +468 -0
- package/dist/esm/drawer/shape/RightAngleArrow.d.ts +34 -0
- package/dist/esm/drawer/shape/RightAngleArrow.js +423 -0
- package/dist/esm/drawer/shape/Sector.d.ts +37 -0
- package/dist/esm/drawer/shape/Sector.js +568 -0
- package/dist/esm/drawer/shape/StraightArrow.d.ts +34 -0
- package/dist/esm/drawer/shape/StraightArrow.js +422 -0
- package/dist/esm/drawer/shape/SwallowtailArrow.d.ts +36 -0
- package/dist/esm/drawer/shape/SwallowtailArrow.js +438 -0
- package/dist/esm/drawer/types.d.ts +23 -0
- package/dist/esm/drawer/types.js +11 -0
- package/dist/esm/drawer/utils.d.ts +14 -0
- package/dist/esm/drawer/utils.js +320 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/measure/Area.d.ts +17 -17
- package/dist/esm/measure/Area.js +95 -63
- package/dist/esm/measure/BaseDraw.d.ts +9 -4
- package/dist/esm/measure/BaseDraw.js +37 -2
- package/dist/esm/measure/Distance.d.ts +9 -9
- package/dist/esm/measure/Distance.js +52 -68
- package/dist/esm/measure/index.d.ts +16 -26
- package/dist/esm/measure/index.js +72 -84
- package/dist/esm/measure/types.d.ts +94 -0
- package/dist/esm/measure/types.js +17 -0
- package/dist/esm/measure/utils.d.ts +7 -7
- package/dist/esm/measure/utils.js +43 -24
- package/dist/esm/tool/utils.js +1 -1
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
- package/dist/esm/plot/create/CreateAssemble.d.ts +0 -2
- package/dist/esm/plot/create/CreateAssemble.js +0 -63
- package/dist/esm/plot/create/CreateAttackArrow.d.ts +0 -5
- package/dist/esm/plot/create/CreateAttackArrow.js +0 -75
- package/dist/esm/plot/create/CreateBillboard.d.ts +0 -2
- package/dist/esm/plot/create/CreateBillboard.js +0 -47
- package/dist/esm/plot/create/CreateBow.d.ts +0 -2
- package/dist/esm/plot/create/CreateBow.js +0 -63
- package/dist/esm/plot/create/CreateCircle.d.ts +0 -2
- package/dist/esm/plot/create/CreateCircle.js +0 -68
- package/dist/esm/plot/create/CreateCurve.d.ts +0 -2
- package/dist/esm/plot/create/CreateCurve.js +0 -76
- package/dist/esm/plot/create/CreateElliptic.d.ts +0 -2
- package/dist/esm/plot/create/CreateElliptic.js +0 -69
- package/dist/esm/plot/create/CreateFlag.d.ts +0 -2
- package/dist/esm/plot/create/CreateFlag.js +0 -80
- package/dist/esm/plot/create/CreateFormation.d.ts +0 -2
- package/dist/esm/plot/create/CreateFormation.js +0 -65
- package/dist/esm/plot/create/CreateFreeLine.d.ts +0 -2
- package/dist/esm/plot/create/CreateFreeLine.js +0 -69
- package/dist/esm/plot/create/CreateFreePolygon.d.ts +0 -2
- package/dist/esm/plot/create/CreateFreePolygon.js +0 -65
- package/dist/esm/plot/create/CreateLabel.d.ts +0 -2
- package/dist/esm/plot/create/CreateLabel.js +0 -55
- package/dist/esm/plot/create/CreateLineArrow.d.ts +0 -2
- package/dist/esm/plot/create/CreateLineArrow.js +0 -79
- package/dist/esm/plot/create/CreatePincerArrow.d.ts +0 -5
- package/dist/esm/plot/create/CreatePincerArrow.js +0 -73
- package/dist/esm/plot/create/CreatePoint.d.ts +0 -2
- package/dist/esm/plot/create/CreatePoint.js +0 -47
- package/dist/esm/plot/create/CreatePolygon.d.ts +0 -2
- package/dist/esm/plot/create/CreatePolygon.js +0 -80
- package/dist/esm/plot/create/CreatePolyline.d.ts +0 -2
- package/dist/esm/plot/create/CreatePolyline.js +0 -70
- package/dist/esm/plot/create/CreateRectangle.d.ts +0 -2
- package/dist/esm/plot/create/CreateRectangle.js +0 -60
- package/dist/esm/plot/create/CreateRegularPolygon.d.ts +0 -2
- package/dist/esm/plot/create/CreateRegularPolygon.js +0 -75
- package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +0 -5
- package/dist/esm/plot/create/CreateRightAngleArrow.js +0 -73
- package/dist/esm/plot/create/CreateRoundRectangle.d.ts +0 -2
- package/dist/esm/plot/create/CreateRoundRectangle.js +0 -63
- package/dist/esm/plot/create/CreateSector.d.ts +0 -2
- package/dist/esm/plot/create/CreateSector.js +0 -65
- package/dist/esm/plot/create/CreateStraightArrow.d.ts +0 -5
- package/dist/esm/plot/create/CreateStraightArrow.js +0 -65
- package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +0 -5
- package/dist/esm/plot/create/CreateSwallowtailArrow.js +0 -67
- package/dist/esm/plot/create/index.d.ts +0 -25
- package/dist/esm/plot/create/index.js +0 -25
- package/dist/esm/plot/edit/EditAssemble.d.ts +0 -8
- package/dist/esm/plot/edit/EditAssemble.js +0 -120
- package/dist/esm/plot/edit/EditAttackArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditAttackArrow.js +0 -182
- package/dist/esm/plot/edit/EditBillboard.d.ts +0 -7
- package/dist/esm/plot/edit/EditBillboard.js +0 -70
- package/dist/esm/plot/edit/EditBow.d.ts +0 -8
- package/dist/esm/plot/edit/EditBow.js +0 -119
- package/dist/esm/plot/edit/EditCircle.d.ts +0 -8
- package/dist/esm/plot/edit/EditCircle.js +0 -133
- package/dist/esm/plot/edit/EditCurve.d.ts +0 -8
- package/dist/esm/plot/edit/EditCurve.js +0 -180
- package/dist/esm/plot/edit/EditElliptic.d.ts +0 -8
- package/dist/esm/plot/edit/EditElliptic.js +0 -144
- package/dist/esm/plot/edit/EditFlag.d.ts +0 -8
- package/dist/esm/plot/edit/EditFlag.js +0 -121
- package/dist/esm/plot/edit/EditFormation.d.ts +0 -8
- package/dist/esm/plot/edit/EditFormation.js +0 -120
- package/dist/esm/plot/edit/EditLabel.d.ts +0 -7
- package/dist/esm/plot/edit/EditLabel.js +0 -100
- package/dist/esm/plot/edit/EditLineArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditLineArrow.js +0 -180
- package/dist/esm/plot/edit/EditPincerArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditPincerArrow.js +0 -121
- package/dist/esm/plot/edit/EditPoint.d.ts +0 -7
- package/dist/esm/plot/edit/EditPoint.js +0 -70
- package/dist/esm/plot/edit/EditPolygon.d.ts +0 -8
- package/dist/esm/plot/edit/EditPolygon.js +0 -181
- package/dist/esm/plot/edit/EditPolyline.d.ts +0 -8
- package/dist/esm/plot/edit/EditPolyline.js +0 -179
- package/dist/esm/plot/edit/EditRectangle.d.ts +0 -8
- package/dist/esm/plot/edit/EditRectangle.js +0 -119
- package/dist/esm/plot/edit/EditRegularPolygon.d.ts +0 -8
- package/dist/esm/plot/edit/EditRegularPolygon.js +0 -170
- package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditRightAngleArrow.js +0 -143
- package/dist/esm/plot/edit/EditRoundRectangle.d.ts +0 -8
- package/dist/esm/plot/edit/EditRoundRectangle.js +0 -119
- package/dist/esm/plot/edit/EditSector.d.ts +0 -8
- package/dist/esm/plot/edit/EditSector.js +0 -120
- package/dist/esm/plot/edit/EditStraightArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditStraightArrow.js +0 -120
- package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +0 -8
- package/dist/esm/plot/edit/EditSwallowtailArrow.js +0 -121
- package/dist/esm/plot/edit/index.d.ts +0 -23
- package/dist/esm/plot/edit/index.js +0 -23
- package/dist/esm/plot/utils/DomUtil.d.ts +0 -34
- package/dist/esm/plot/utils/DomUtil.js +0 -100
- package/dist/esm/plot/utils/PlotCommon.d.ts +0 -101
- package/dist/esm/plot/utils/ReminderTip.d.ts +0 -10
- package/dist/esm/plot/utils/ReminderTip.js +0 -67
- package/dist/esm/plot/utils/Tooltip.d.ts +0 -3
- package/dist/esm/plot/utils/Tooltip.js +0 -97
- /package/dist/esm/{plot/utils/Algorithm.d.ts → drawer/algorithm.d.ts} +0 -0
- /package/dist/esm/{plot/utils/Coordinate.d.ts → drawer/coordinate.d.ts} +0 -0
- /package/dist/esm/{plot/utils/Coordinate.js → drawer/coordinate.js} +0 -0
- /package/dist/esm/{plot/utils → drawer}/plotUtil.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 集结地标绘功能
|
|
3
|
-
*/
|
|
4
|
-
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
-
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
6
|
-
import { computeAssemblePoints, newSessionid } from "../utils/PlotCommon";
|
|
7
|
-
import CreateRemindertip from "../utils/ReminderTip";
|
|
8
|
-
var CreateAssemble = function CreateAssemble(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 assemblePolygon = undefined;
|
|
16
|
-
// 左键点击事件
|
|
17
|
-
handler.setInputAction(function (event) {
|
|
18
|
-
window.toolTip = '左键双击键结束绘制';
|
|
19
|
-
var pos = getCatesian3FromPX(viewer, event.position);
|
|
20
|
-
if (!pos || Cesium.defined(assemblePolygon)) return;
|
|
21
|
-
anchorpoints.push(pos);
|
|
22
|
-
var dynamicPositions = new Cesium.CallbackProperty(function () {
|
|
23
|
-
var points = computeAssemblePoints(anchorpoints);
|
|
24
|
-
return new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(points));
|
|
25
|
-
}, false);
|
|
26
|
-
assemblePolygon = viewer.entities.add({
|
|
27
|
-
name: 'AssemblePolygon',
|
|
28
|
-
id: id,
|
|
29
|
-
polygon: {
|
|
30
|
-
hierarchy: dynamicPositions,
|
|
31
|
-
material: color,
|
|
32
|
-
outline: true,
|
|
33
|
-
outlineColor: Cesium.Color.GREEN,
|
|
34
|
-
heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
assemblePolygon.GeoType = 'AssemblePolygon'; //记录对象的类型,用户后续编辑等操作
|
|
38
|
-
assemblePolygon.Editable = true; //代表当前对象可编辑,false状态下不可编辑
|
|
39
|
-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
40
|
-
// 鼠标移动事件
|
|
41
|
-
handler.setInputAction(function (movement) {
|
|
42
|
-
//console.log('鼠标移动事件监测:------创建集结地------');
|
|
43
|
-
var endPos = movement.endPosition;
|
|
44
|
-
CreateRemindertip(window.toolTip, endPos, true);
|
|
45
|
-
var endCartesian = getCatesian3FromPX(viewer, endPos);
|
|
46
|
-
if (!endCartesian || !Cesium.defined(assemblePolygon)) return;
|
|
47
|
-
if (anchorpoints.length === 2) {
|
|
48
|
-
anchorpoints.pop();
|
|
49
|
-
}
|
|
50
|
-
anchorpoints.push(endCartesian);
|
|
51
|
-
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
52
|
-
// 左键双击事件
|
|
53
|
-
handler.setInputAction(function () {
|
|
54
|
-
assemblePolygon.polygon.hierarchy = new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(computeAssemblePoints(anchorpoints)));
|
|
55
|
-
assemblePolygon.PottingPoint = Cesium.clone(anchorpoints, true);
|
|
56
|
-
assemblePolygon.EditingPoint = Cesium.clone(anchorpoints, true);
|
|
57
|
-
resultList.push(assemblePolygon);
|
|
58
|
-
handler.destroy();
|
|
59
|
-
CreateRemindertip(window.toolTip, null, false);
|
|
60
|
-
if (typeof callback == 'function') callback(assemblePolygon);
|
|
61
|
-
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
62
|
-
};
|
|
63
|
-
export default CreateAssemble;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 创建攻击箭头
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as Cesium from 'deeptwins-cesium';
|
|
6
|
-
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
7
|
-
import { getAttackArrowPoints, newSessionid } from "../utils/PlotCommon";
|
|
8
|
-
import CreateRemindertip from "../utils/ReminderTip";
|
|
9
|
-
var CreateAttackArrow = function CreateAttackArrow(viewer, handler, resultList, options, callback) {
|
|
10
|
-
var id = options.id || newSessionid();
|
|
11
|
-
if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
|
|
12
|
-
var color = options.color ? Cesium.Color.fromCssColorString(options.color) : Cesium.Color.RED;
|
|
13
|
-
var onground = options.onground || true;
|
|
14
|
-
var anchorpoints = [];
|
|
15
|
-
var attackArrow = undefined;
|
|
16
|
-
window.toolTip = '左键点击开始绘制';
|
|
17
|
-
//左键点击事件
|
|
18
|
-
handler.setInputAction(function (event) {
|
|
19
|
-
window.toolTip = '左键添加点,右键撤销,左键双击结束绘制';
|
|
20
|
-
var cartesian = getCatesian3FromPX(viewer, event.position);
|
|
21
|
-
if (!cartesian) return;
|
|
22
|
-
anchorpoints.push(cartesian);
|
|
23
|
-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
24
|
-
//鼠标移动事件
|
|
25
|
-
handler.setInputAction(function (move) {
|
|
26
|
-
//console.log('鼠标移动事件监测:------创建攻击箭头------');
|
|
27
|
-
var endPos = move.endPosition;
|
|
28
|
-
CreateRemindertip(window.toolTip, endPos, true);
|
|
29
|
-
var cartesian = getCatesian3FromPX(viewer, endPos);
|
|
30
|
-
if (!cartesian) return;
|
|
31
|
-
if (anchorpoints.length >= 2) {
|
|
32
|
-
var dynamicPositions = new Cesium.CallbackProperty(function () {
|
|
33
|
-
var pointlist = getAttackArrowPoints(anchorpoints);
|
|
34
|
-
return new Cesium.PolygonHierarchy(pointlist);
|
|
35
|
-
}, false);
|
|
36
|
-
if (!Cesium.defined(attackArrow)) {
|
|
37
|
-
anchorpoints.push(cartesian);
|
|
38
|
-
attackArrow = viewer.entities.add({
|
|
39
|
-
id: id,
|
|
40
|
-
name: 'AttackArrow',
|
|
41
|
-
polygon: new Cesium.PolygonGraphics({
|
|
42
|
-
hierarchy: dynamicPositions,
|
|
43
|
-
show: true,
|
|
44
|
-
fill: true,
|
|
45
|
-
material: color,
|
|
46
|
-
heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
attackArrow.GeoType = 'AttackArrow'; //记录对象的类型,用户后续编辑等操作
|
|
50
|
-
attackArrow.Editable = true; //代表当前对象可编辑,false状态下不可编辑
|
|
51
|
-
} else {
|
|
52
|
-
anchorpoints.pop();
|
|
53
|
-
anchorpoints.push(cartesian);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
57
|
-
//左键双击事件
|
|
58
|
-
handler.setInputAction(function (event) {
|
|
59
|
-
anchorpoints.pop();
|
|
60
|
-
anchorpoints.pop(); //因为是双击结束,所以要pop两次,一次是move的结果,一次是单击结果
|
|
61
|
-
attackArrow.PottingPoint = Cesium.clone(anchorpoints, true); //记录对象的节点数据,用户后续编辑等操作
|
|
62
|
-
attackArrow.EditingPoint = Cesium.clone(anchorpoints, true); //记录复杂对象的编辑的节点数据,用户后续编辑等操作
|
|
63
|
-
var pointlist = getAttackArrowPoints(anchorpoints);
|
|
64
|
-
attackArrow.polygon.hierarchy = new Cesium.PolygonHierarchy(pointlist);
|
|
65
|
-
resultList.push(attackArrow);
|
|
66
|
-
handler.destroy();
|
|
67
|
-
CreateRemindertip(window.toolTip, event.position, false);
|
|
68
|
-
if (typeof callback == 'function') callback(attackArrow);
|
|
69
|
-
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
70
|
-
// 右键摁下事件
|
|
71
|
-
handler.setInputAction(function () {
|
|
72
|
-
anchorpoints.pop();
|
|
73
|
-
}, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
|
|
74
|
-
};
|
|
75
|
-
export default CreateAttackArrow;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 广告牌标绘功能
|
|
3
|
-
*/
|
|
4
|
-
import * as Cesium from 'deeptwins-cesium';
|
|
5
|
-
import * as utils from "../../tool/utils";
|
|
6
|
-
import { getCatesian3FromPX } from "../utils/Coordinate";
|
|
7
|
-
import { newSessionid } from "../utils/PlotCommon";
|
|
8
|
-
import CreateRemindertip from "../utils/ReminderTip";
|
|
9
|
-
var CreateBillboard = function CreateBillboard(viewer, handler, resultList, options, callback) {
|
|
10
|
-
var id = options.id || newSessionid();
|
|
11
|
-
var onground = options.onground || true;
|
|
12
|
-
var image = options.image || utils.getDeepTwinsFile('Image/f_point.png');
|
|
13
|
-
if (viewer.entities.getById(id)) throw new Error('the id parameter is an unique value');
|
|
14
|
-
window.toolTip = '左键点击选择点位';
|
|
15
|
-
handler.setInputAction(function (event) {
|
|
16
|
-
var pixPos = event.position;
|
|
17
|
-
var cartesian = getCatesian3FromPX(viewer, pixPos);
|
|
18
|
-
var billboard = viewer.entities.add({
|
|
19
|
-
id: id,
|
|
20
|
-
name: 'Billboard',
|
|
21
|
-
position: cartesian,
|
|
22
|
-
billboard: {
|
|
23
|
-
image: image,
|
|
24
|
-
scale: 1,
|
|
25
|
-
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
26
|
-
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
27
|
-
scaleByDistance: new Cesium.NearFarScalar(1.5e1, 1.5, 1.5e5, 0.4),
|
|
28
|
-
heightReference: onground ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE,
|
|
29
|
-
disableDepthTestDistance: 15000 //解决遮挡显示一半的问题
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
billboard.GeoType = 'Billboard'; //记录对象的类型,用户后续编辑等操作
|
|
33
|
-
billboard.PottingPoint = cartesian; //记录对象的节点数据,用户后续编辑等操作
|
|
34
|
-
billboard.EditingPoint = cartesian; //记录对象的节点数据,用户后续编辑等操作
|
|
35
|
-
billboard.Editable = true; //代表当前对象可编辑,false状态下不可编辑
|
|
36
|
-
resultList.push(billboard);
|
|
37
|
-
handler.destroy();
|
|
38
|
-
CreateRemindertip(window.toolTip, event.position, false);
|
|
39
|
-
if (callback && typeof callback == 'function') callback(billboard);
|
|
40
|
-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
41
|
-
handler.setInputAction(function (movement) {
|
|
42
|
-
//console.log('鼠标移动事件监测:------创建点------');
|
|
43
|
-
var endPos = movement.endPosition;
|
|
44
|
-
CreateRemindertip(window.toolTip, endPos, true);
|
|
45
|
-
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
46
|
-
};
|
|
47
|
-
export default CreateBillboard;
|
|
@@ -1,63 +0,0 @@
|
|
|
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;
|
|
@@ -1,68 +0,0 @@
|
|
|
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;
|
|
@@ -1,76 +0,0 @@
|
|
|
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
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;
|
|
@@ -1,80 +0,0 @@
|
|
|
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;
|
|
@@ -1,65 +0,0 @@
|
|
|
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;
|