deeptwins-engine-3d 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Build/DeepTwins/Image/f_point.png +0 -0
- package/dist/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
- package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
- package/dist/esm/constant.d.ts +29 -0
- package/dist/esm/constant.js +47 -0
- package/dist/esm/drawer/index.d.ts +56 -59
- package/dist/esm/drawer/index.js +380 -292
- package/dist/esm/drawer/shape/BaseShape.d.ts +33 -0
- package/dist/esm/drawer/shape/BaseShape.js +228 -0
- package/dist/esm/drawer/shape/Point.d.ts +44 -11
- package/dist/esm/drawer/shape/Point.js +299 -35
- package/dist/esm/drawer/shape/Polygon.d.ts +43 -9
- package/dist/esm/drawer/shape/Polygon.js +408 -56
- package/dist/esm/drawer/shape/Polyline.d.ts +41 -10
- package/dist/esm/drawer/shape/Polyline.js +373 -31
- package/dist/esm/drawer/utils.d.ts +1 -0
- package/dist/esm/drawer/utils.js +63 -0
- package/dist/esm/graphicLayer/BaseLayer.d.ts +1 -0
- package/dist/esm/graphicLayer/BaseLayer.js +8 -3
- package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/graphicLayer/BaseSource.js +13 -3
- package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +2 -0
- package/dist/esm/graphicLayer/GraphicLayerCollection.js +46 -4
- package/dist/esm/graphicLayer/HtmlEntity.js +1 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/map/Map.d.ts +1 -0
- package/dist/esm/map/Map.js +10 -0
- package/dist/esm/measure/Area.d.ts +29 -0
- package/dist/esm/measure/{AreaMeasure.js → Area.js} +156 -65
- package/dist/esm/measure/BaseDraw.d.ts +13 -0
- package/dist/esm/measure/BaseDraw.js +70 -0
- package/dist/esm/measure/Distance.d.ts +23 -0
- package/dist/esm/measure/Distance.js +239 -0
- package/dist/esm/measure/index.d.ts +44 -5
- package/dist/esm/measure/index.js +278 -5
- package/dist/esm/measure/utils.d.ts +108 -14
- package/dist/esm/measure/utils.js +262 -20
- package/dist/esm/plot/create/CreateAssemble.d.ts +2 -0
- package/dist/esm/plot/create/CreateAssemble.js +63 -0
- package/dist/esm/plot/create/CreateAttackArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateAttackArrow.js +75 -0
- package/dist/esm/plot/create/CreateBillboard.d.ts +2 -0
- package/dist/esm/plot/create/CreateBillboard.js +47 -0
- package/dist/esm/plot/create/CreateBow.d.ts +2 -0
- package/dist/esm/plot/create/CreateBow.js +63 -0
- package/dist/esm/plot/create/CreateCircle.d.ts +2 -0
- package/dist/esm/plot/create/CreateCircle.js +68 -0
- package/dist/esm/plot/create/CreateCurve.d.ts +2 -0
- package/dist/esm/plot/create/CreateCurve.js +76 -0
- package/dist/esm/plot/create/CreateElliptic.d.ts +2 -0
- package/dist/esm/plot/create/CreateElliptic.js +69 -0
- package/dist/esm/plot/create/CreateFlag.d.ts +2 -0
- package/dist/esm/plot/create/CreateFlag.js +80 -0
- package/dist/esm/plot/create/CreateFormation.d.ts +2 -0
- package/dist/esm/plot/create/CreateFormation.js +65 -0
- package/dist/esm/plot/create/CreateFreeLine.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreeLine.js +69 -0
- package/dist/esm/plot/create/CreateFreePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreePolygon.js +65 -0
- package/dist/esm/plot/create/CreateLabel.d.ts +2 -0
- package/dist/esm/plot/create/CreateLabel.js +55 -0
- package/dist/esm/plot/create/CreateLineArrow.d.ts +2 -0
- package/dist/esm/plot/create/CreateLineArrow.js +79 -0
- package/dist/esm/plot/create/CreatePincerArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreatePincerArrow.js +73 -0
- package/dist/esm/plot/create/CreatePoint.d.ts +2 -0
- package/dist/esm/plot/create/CreatePoint.js +47 -0
- package/dist/esm/plot/create/CreatePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolygon.js +80 -0
- package/dist/esm/plot/create/CreatePolyline.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolyline.js +70 -0
- package/dist/esm/plot/create/CreateRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRectangle.js +60 -0
- package/dist/esm/plot/create/CreateRegularPolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateRegularPolygon.js +75 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.js +73 -0
- package/dist/esm/plot/create/CreateRoundRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRoundRectangle.js +63 -0
- package/dist/esm/plot/create/CreateSector.d.ts +2 -0
- package/dist/esm/plot/create/CreateSector.js +65 -0
- package/dist/esm/plot/create/CreateStraightArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateStraightArrow.js +65 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.js +67 -0
- package/dist/esm/plot/create/index.d.ts +25 -0
- package/dist/esm/plot/create/index.js +25 -0
- package/dist/esm/plot/edit/EditAssemble.d.ts +8 -0
- package/dist/esm/plot/edit/EditAssemble.js +120 -0
- package/dist/esm/plot/edit/EditAttackArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditAttackArrow.js +182 -0
- package/dist/esm/plot/edit/EditBillboard.d.ts +7 -0
- package/dist/esm/plot/edit/EditBillboard.js +70 -0
- package/dist/esm/plot/edit/EditBow.d.ts +8 -0
- package/dist/esm/plot/edit/EditBow.js +119 -0
- package/dist/esm/plot/edit/EditCircle.d.ts +8 -0
- package/dist/esm/plot/edit/EditCircle.js +133 -0
- package/dist/esm/plot/edit/EditCurve.d.ts +8 -0
- package/dist/esm/plot/edit/EditCurve.js +180 -0
- package/dist/esm/plot/edit/EditElliptic.d.ts +8 -0
- package/dist/esm/plot/edit/EditElliptic.js +144 -0
- package/dist/esm/plot/edit/EditFlag.d.ts +8 -0
- package/dist/esm/plot/edit/EditFlag.js +121 -0
- package/dist/esm/plot/edit/EditFormation.d.ts +8 -0
- package/dist/esm/plot/edit/EditFormation.js +120 -0
- package/dist/esm/plot/edit/EditLabel.d.ts +7 -0
- package/dist/esm/plot/edit/EditLabel.js +100 -0
- package/dist/esm/plot/edit/EditLineArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditLineArrow.js +180 -0
- package/dist/esm/plot/edit/EditPincerArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditPincerArrow.js +121 -0
- package/dist/esm/plot/edit/EditPoint.d.ts +7 -0
- package/dist/esm/plot/edit/EditPoint.js +70 -0
- package/dist/esm/plot/edit/EditPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolygon.js +181 -0
- package/dist/esm/plot/edit/EditPolyline.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolyline.js +179 -0
- package/dist/esm/plot/edit/EditRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRectangle.js +119 -0
- package/dist/esm/plot/edit/EditRegularPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditRegularPolygon.js +170 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.js +143 -0
- package/dist/esm/plot/edit/EditRoundRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRoundRectangle.js +119 -0
- package/dist/esm/plot/edit/EditSector.d.ts +8 -0
- package/dist/esm/plot/edit/EditSector.js +120 -0
- package/dist/esm/plot/edit/EditStraightArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditStraightArrow.js +120 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.js +121 -0
- package/dist/esm/plot/edit/index.d.ts +23 -0
- package/dist/esm/plot/edit/index.js +23 -0
- package/dist/esm/plot/utils/Algorithm.d.ts +2 -0
- package/dist/esm/plot/utils/Algorithm.js +316 -0
- package/dist/esm/plot/utils/Coordinate.d.ts +98 -0
- package/dist/esm/plot/utils/Coordinate.js +184 -0
- package/dist/esm/plot/utils/DomUtil.d.ts +34 -0
- package/dist/esm/plot/utils/DomUtil.js +100 -0
- package/dist/esm/plot/utils/PlotCommon.d.ts +101 -0
- package/dist/esm/plot/utils/PlotCommon.js +1412 -0
- package/dist/esm/plot/utils/ReminderTip.d.ts +10 -0
- package/dist/esm/plot/utils/ReminderTip.js +67 -0
- package/dist/esm/plot/utils/Tooltip.d.ts +3 -0
- package/dist/esm/plot/utils/Tooltip.js +97 -0
- package/dist/esm/plot/utils/plotUtil.d.ts +5 -0
- package/dist/esm/plot/utils/plotUtil.js +268 -0
- package/dist/esm/tool/utils.d.ts +8 -7
- package/dist/esm/tool/utils.js +20 -16
- package/dist/esm/toolTip/index.d.ts +2 -1
- package/dist/esm/toolTip/index.js +12 -6
- package/dist/esm/typings.d.ts +1 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
- package/dist/esm/drawer/base.d.ts +0 -51
- package/dist/esm/drawer/base.js +0 -179
- package/dist/esm/drawer/painter.d.ts +0 -41
- package/dist/esm/drawer/painter.js +0 -115
- package/dist/esm/drawer/shape/Ellipse.d.ts +0 -10
- package/dist/esm/drawer/shape/Ellipse.js +0 -62
- package/dist/esm/drawer/shape/Rectangle.d.ts +0 -10
- package/dist/esm/drawer/shape/Rectangle.js +0 -85
- package/dist/esm/drawer/typings.d.ts +0 -106
- package/dist/esm/drawer/typings.js +0 -1
- package/dist/esm/measure/AreaMeasure.d.ts +0 -19
- package/dist/esm/measure/AreaSurfaceMeasure.d.ts +0 -30
- package/dist/esm/measure/AreaSurfaceMeasure.js +0 -151
- package/dist/esm/measure/DistanceMeasure.d.ts +0 -19
- package/dist/esm/measure/DistanceMeasure.js +0 -91
- package/dist/esm/measure/DistanceSurfaceMeasure.d.ts +0 -37
- package/dist/esm/measure/DistanceSurfaceMeasure.js +0 -122
- package/dist/esm/measure/Measure.d.ts +0 -111
- package/dist/esm/measure/Measure.js +0 -177
- package/dist/esm/tool/cesiumExtends/Subscriber/index.d.ts +0 -66
- package/dist/esm/tool/cesiumExtends/Subscriber/index.js +0 -246
- package/dist/esm/tool/kriging.d.ts +0 -10
- package/dist/esm/tool/kriging.js +0 -436
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Cartesian2, Color, HeightReference, LabelCollection, LabelStyle, NearFarScalar } from 'deeptwins-cesium';
|
|
2
|
-
import Drawer from '../drawer';
|
|
3
|
-
import ToolTip from '../toolTip/index';
|
|
4
|
-
import type { Units } from '@turf/helpers';
|
|
5
|
-
import type { Cartesian3, Entity, Viewer } from 'deeptwins-cesium';
|
|
6
|
-
import type { DrawOption } from '../drawer';
|
|
7
|
-
export type MeasureUnits = Units;
|
|
8
|
-
export type MeasureLocaleOptions = {
|
|
9
|
-
start: string;
|
|
10
|
-
total: string;
|
|
11
|
-
area: string;
|
|
12
|
-
/**
|
|
13
|
-
* 格式化显示长度
|
|
14
|
-
* @param length 单位米
|
|
15
|
-
* @param unit 目标单位
|
|
16
|
-
*/
|
|
17
|
-
formatLength(length: number, unitedLength: number, unit: MeasureUnits): string;
|
|
18
|
-
/**
|
|
19
|
-
* 格式化显示面积
|
|
20
|
-
* @param area 单位米
|
|
21
|
-
* @param unit 目标单位
|
|
22
|
-
*/
|
|
23
|
-
formatArea(area: number, unitedArea: number, unit: MeasureUnits): string;
|
|
24
|
-
};
|
|
25
|
-
export type MeasureOptions = {
|
|
26
|
-
labelStyle?: {
|
|
27
|
-
font?: string;
|
|
28
|
-
fillColor?: Color;
|
|
29
|
-
backgroundColor?: Color;
|
|
30
|
-
backgroundPadding?: Cartesian2;
|
|
31
|
-
outlineWidth?: number;
|
|
32
|
-
style?: LabelStyle;
|
|
33
|
-
pixelOffset?: Cartesian2;
|
|
34
|
-
scale?: number;
|
|
35
|
-
scaleByDistance?: NearFarScalar;
|
|
36
|
-
heightReference?: HeightReference;
|
|
37
|
-
};
|
|
38
|
-
/** defaults to kilometers */
|
|
39
|
-
units?: MeasureUnits;
|
|
40
|
-
complete?: (entity: Entity) => void;
|
|
41
|
-
drawerOptions?: Partial<DrawOption>;
|
|
42
|
-
/**
|
|
43
|
-
* @example
|
|
44
|
-
* {
|
|
45
|
-
start: '起点',
|
|
46
|
-
area: '面积',
|
|
47
|
-
total: '总计',
|
|
48
|
-
formatLength: (length, unitedLength) => {
|
|
49
|
-
if (length < 1000) {
|
|
50
|
-
return length + '米';
|
|
51
|
-
}
|
|
52
|
-
return unitedLength + '千米';
|
|
53
|
-
},
|
|
54
|
-
formatArea: (area, unitedArea) => {
|
|
55
|
-
if (area < 1000000) {
|
|
56
|
-
return area + '平方米';
|
|
57
|
-
}
|
|
58
|
-
return unitedArea + '平方千米';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
*/
|
|
62
|
-
locale?: Partial<MeasureLocaleOptions>;
|
|
63
|
-
};
|
|
64
|
-
export type Status = 'INIT' | 'WORKING' | 'DESTROY';
|
|
65
|
-
export default class Measure {
|
|
66
|
-
protected _viewer: Viewer;
|
|
67
|
-
protected _status: Status;
|
|
68
|
-
protected _labels: LabelCollection;
|
|
69
|
-
protected _labelStyle: MeasureOptions['labelStyle'];
|
|
70
|
-
protected _units: MeasureUnits;
|
|
71
|
-
protected _locale: MeasureLocaleOptions;
|
|
72
|
-
mouseTooltip: ToolTip;
|
|
73
|
-
drawer: Drawer;
|
|
74
|
-
private _complete;
|
|
75
|
-
/**
|
|
76
|
-
* 量算工具
|
|
77
|
-
* @param viewer
|
|
78
|
-
* @param {MeasureOptions['locale']} [options.locale] 绘制时的提示信息
|
|
79
|
-
*/
|
|
80
|
-
constructor(viewer: Viewer, options?: MeasureOptions);
|
|
81
|
-
/**
|
|
82
|
-
* @return {boolean} 返回量算工具是否已销毁
|
|
83
|
-
*/
|
|
84
|
-
get destroyed(): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* 根据传入的坐标信息更新标签
|
|
87
|
-
* @param {Cartesian3[]} positions
|
|
88
|
-
*/
|
|
89
|
-
protected _updateLabelFunc(positions: Cartesian3[]): void;
|
|
90
|
-
protected _cartesian2Lonlat(positions: Cartesian3[]): number[][];
|
|
91
|
-
start(): void;
|
|
92
|
-
/**
|
|
93
|
-
* 开始绘制
|
|
94
|
-
* @param {string} type 绘制图形类型
|
|
95
|
-
* @param {boolean} clampToGround 是否贴地
|
|
96
|
-
*/
|
|
97
|
-
protected _start(type: 'polygon' | 'polyline' | 'point' | 'ellipse' | 'rectangle', options?: {
|
|
98
|
-
style?: object;
|
|
99
|
-
clampToGround?: boolean;
|
|
100
|
-
}): void;
|
|
101
|
-
getDistances(): {
|
|
102
|
-
total: any;
|
|
103
|
-
prev: any;
|
|
104
|
-
}[];
|
|
105
|
-
getAreas(): any;
|
|
106
|
-
/**
|
|
107
|
-
* 清除测量结果,重置绘制
|
|
108
|
-
*/
|
|
109
|
-
end(): void;
|
|
110
|
-
destroy(): void;
|
|
111
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
import { Cartesian2, Math as CMath, Color, HeightReference, LabelCollection, LabelStyle, NearFarScalar } from 'deeptwins-cesium';
|
|
11
|
-
import Drawer from "../drawer";
|
|
12
|
-
import ToolTip from "../toolTip/index";
|
|
13
|
-
import { formatArea, formatLength } from "./utils";
|
|
14
|
-
var DefaultOptions = {
|
|
15
|
-
labelStyle: {
|
|
16
|
-
font: "bold 20px Arial",
|
|
17
|
-
fillColor: Color.WHITE,
|
|
18
|
-
backgroundColor: new Color(0.165, 0.165, 0.165, 0.8),
|
|
19
|
-
backgroundPadding: new Cartesian2(4, 4),
|
|
20
|
-
outlineWidth: 4,
|
|
21
|
-
style: LabelStyle.FILL_AND_OUTLINE,
|
|
22
|
-
pixelOffset: new Cartesian2(4, 0),
|
|
23
|
-
scale: 1,
|
|
24
|
-
scaleByDistance: new NearFarScalar(1, 0.85, 8.0e6, 0.75),
|
|
25
|
-
heightReference: HeightReference.CLAMP_TO_GROUND
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var Measure = /*#__PURE__*/function () {
|
|
29
|
-
/**
|
|
30
|
-
* 量算工具
|
|
31
|
-
* @param viewer
|
|
32
|
-
* @param {MeasureOptions['locale']} [options.locale] 绘制时的提示信息
|
|
33
|
-
*/
|
|
34
|
-
function Measure(viewer) {
|
|
35
|
-
var _options$units;
|
|
36
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
37
|
-
_classCallCheck(this, Measure);
|
|
38
|
-
_defineProperty(this, "_viewer", void 0);
|
|
39
|
-
_defineProperty(this, "_status", void 0);
|
|
40
|
-
_defineProperty(this, "_labels", void 0);
|
|
41
|
-
_defineProperty(this, "_labelStyle", void 0);
|
|
42
|
-
_defineProperty(this, "_units", void 0);
|
|
43
|
-
_defineProperty(this, "_locale", void 0);
|
|
44
|
-
_defineProperty(this, "mouseTooltip", void 0);
|
|
45
|
-
_defineProperty(this, "drawer", void 0);
|
|
46
|
-
_defineProperty(this, "_complete", void 0);
|
|
47
|
-
if (!viewer) throw new Error('undefined viewer');
|
|
48
|
-
this._viewer = viewer;
|
|
49
|
-
this._labelStyle = _objectSpread(_objectSpread({}, DefaultOptions.labelStyle), options.labelStyle);
|
|
50
|
-
this._units = (_options$units = options.units) !== null && _options$units !== void 0 ? _options$units : 'kilometers';
|
|
51
|
-
this._complete = options.complete;
|
|
52
|
-
this._locale = _objectSpread({
|
|
53
|
-
area: '面积',
|
|
54
|
-
start: '起点',
|
|
55
|
-
total: '总计',
|
|
56
|
-
formatLength: formatLength,
|
|
57
|
-
formatArea: formatArea
|
|
58
|
-
}, options.locale);
|
|
59
|
-
this.mouseTooltip = new ToolTip(viewer);
|
|
60
|
-
this.mouseTooltip.show(false);
|
|
61
|
-
this.drawer = new Drawer(viewer, _objectSpread({
|
|
62
|
-
sameStyle: true,
|
|
63
|
-
terrain: true
|
|
64
|
-
}, options.drawerOptions));
|
|
65
|
-
this._labels = new LabelCollection({
|
|
66
|
-
scene: this._viewer.scene
|
|
67
|
-
});
|
|
68
|
-
this._viewer.scene.primitives.add(this._labels);
|
|
69
|
-
this._status = 'INIT';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @return {boolean} 返回量算工具是否已销毁
|
|
74
|
-
*/
|
|
75
|
-
_createClass(Measure, [{
|
|
76
|
-
key: "destroyed",
|
|
77
|
-
get: function get() {
|
|
78
|
-
return this._status === 'DESTROY';
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 根据传入的坐标信息更新标签
|
|
83
|
-
* @param {Cartesian3[]} positions
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
|
-
}, {
|
|
88
|
-
key: "_updateLabelFunc",
|
|
89
|
-
value: function _updateLabelFunc(positions) {}
|
|
90
|
-
}, {
|
|
91
|
-
key: "_cartesian2Lonlat",
|
|
92
|
-
value: function _cartesian2Lonlat(positions) {
|
|
93
|
-
var _this = this;
|
|
94
|
-
return positions.map(function (pos) {
|
|
95
|
-
var cartographic = _this._viewer.scene.globe.ellipsoid.cartesianToCartographic(pos);
|
|
96
|
-
var lon = +CMath.toDegrees(cartographic.longitude);
|
|
97
|
-
var lat = +CMath.toDegrees(cartographic.latitude);
|
|
98
|
-
return [lon, lat];
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "start",
|
|
103
|
-
value: function start() {}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* 开始绘制
|
|
107
|
-
* @param {string} type 绘制图形类型
|
|
108
|
-
* @param {boolean} clampToGround 是否贴地
|
|
109
|
-
*/
|
|
110
|
-
}, {
|
|
111
|
-
key: "_start",
|
|
112
|
-
value: function _start(type, options) {
|
|
113
|
-
var _ref = options !== null && options !== void 0 ? options : {},
|
|
114
|
-
style = _ref.style,
|
|
115
|
-
clampToGround = _ref.clampToGround;
|
|
116
|
-
if (this._status !== 'INIT') return;
|
|
117
|
-
var self = this;
|
|
118
|
-
this.drawer.start({
|
|
119
|
-
type: type,
|
|
120
|
-
onPointsChange: self._updateLabelFunc.bind(self),
|
|
121
|
-
dynamicOptions: _objectSpread(_objectSpread({}, style), {}, {
|
|
122
|
-
clampToGround: clampToGround
|
|
123
|
-
}),
|
|
124
|
-
finalOptions: _objectSpread(_objectSpread({}, style), {}, {
|
|
125
|
-
clampToGround: clampToGround
|
|
126
|
-
}),
|
|
127
|
-
complete: this._complete
|
|
128
|
-
});
|
|
129
|
-
this._status = 'WORKING';
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
key: "getDistances",
|
|
133
|
-
value: function getDistances() {
|
|
134
|
-
var distances = [];
|
|
135
|
-
for (var i = 1; i < this._labels.length; i += 1) {
|
|
136
|
-
var label = this._labels.get(i);
|
|
137
|
-
distances.push({
|
|
138
|
-
// @ts-ignore
|
|
139
|
-
total: label === null || label === void 0 ? void 0 : label.total,
|
|
140
|
-
// @ts-ignore
|
|
141
|
-
prev: label === null || label === void 0 ? void 0 : label.prev
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return distances;
|
|
145
|
-
}
|
|
146
|
-
}, {
|
|
147
|
-
key: "getAreas",
|
|
148
|
-
value: function getAreas() {
|
|
149
|
-
var label = this._labels.get(0);
|
|
150
|
-
// @ts-ignore
|
|
151
|
-
return label.total;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* 清除测量结果,重置绘制
|
|
156
|
-
*/
|
|
157
|
-
}, {
|
|
158
|
-
key: "end",
|
|
159
|
-
value: function end() {
|
|
160
|
-
this.drawer.reset();
|
|
161
|
-
this._labels.removeAll();
|
|
162
|
-
this._status = 'INIT';
|
|
163
|
-
}
|
|
164
|
-
}, {
|
|
165
|
-
key: "destroy",
|
|
166
|
-
value: function destroy() {
|
|
167
|
-
this.end();
|
|
168
|
-
this.mouseTooltip.destroy();
|
|
169
|
-
if (this._viewer && !this._viewer.isDestroyed()) {
|
|
170
|
-
this._viewer.scene.primitives.remove(this._labels);
|
|
171
|
-
}
|
|
172
|
-
this._status = 'DESTROY';
|
|
173
|
-
}
|
|
174
|
-
}]);
|
|
175
|
-
return Measure;
|
|
176
|
-
}();
|
|
177
|
-
export { Measure as default };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Cartesian2, Entity, Viewer } from 'deeptwins-cesium';
|
|
2
|
-
interface EventArgs {
|
|
3
|
-
position?: Cartesian2;
|
|
4
|
-
endPosition?: Cartesian2;
|
|
5
|
-
startPosition?: Cartesian2;
|
|
6
|
-
[name: string]: any;
|
|
7
|
-
}
|
|
8
|
-
type ListenCallback<T> = (movement: EventArgs, substance: T) => void;
|
|
9
|
-
type ExternalListenCallback = (movement: EventArgs, result: any) => void;
|
|
10
|
-
type EventType = 'LEFT_DOWN' | 'LEFT_UP' | 'LEFT_CLICK' | 'LEFT_DOUBLE_CLICK' | 'RIGHT_DOWN' | 'RIGHT_UP' | 'RIGHT_CLICK' | 'MIDDLE_DOWN' | 'MIDDLE_UP' | 'MIDDLE_CLICK' | 'MOUSE_MOVE' | 'WHEEL' | 'PINCH_START' | 'PINCH_MOVE' | 'PINCH_END';
|
|
11
|
-
declare class Subscriber {
|
|
12
|
-
private _viewer;
|
|
13
|
-
private _handler;
|
|
14
|
-
private _eventCollection;
|
|
15
|
-
private _externalEventCollection;
|
|
16
|
-
private _eventTypeList;
|
|
17
|
-
private _moveDebounce?;
|
|
18
|
-
private _lastTime;
|
|
19
|
-
private _enablePickResult;
|
|
20
|
-
private _lastResult;
|
|
21
|
-
private _enable;
|
|
22
|
-
private _isDestroy;
|
|
23
|
-
/**
|
|
24
|
-
* 是否被销毁
|
|
25
|
-
*/
|
|
26
|
-
get isDestroy(): boolean;
|
|
27
|
-
/** 是否执行监听回调 */
|
|
28
|
-
get enable(): boolean;
|
|
29
|
-
set enable(val: boolean);
|
|
30
|
-
constructor(viewer: Viewer, options?: {
|
|
31
|
-
element?: HTMLCanvasElement;
|
|
32
|
-
pickResult?: {
|
|
33
|
-
enable: boolean;
|
|
34
|
-
moveDebounce?: number;
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
private _initListener;
|
|
38
|
-
private _shouldUpdate;
|
|
39
|
-
private _eventRegister;
|
|
40
|
-
/**
|
|
41
|
-
* @description 为Entity添加监听事件
|
|
42
|
-
* @param substances 需要添加事件的Entity或Entity数组
|
|
43
|
-
* @param callback 需要响应的事件
|
|
44
|
-
* @param eventType 事件类型
|
|
45
|
-
*/
|
|
46
|
-
add(substances: Entity | Entity[], callback: ListenCallback<Entity>, eventType: EventType): void;
|
|
47
|
-
/**
|
|
48
|
-
* @description 添加特定事件,与add不同在于该事件不会过滤Entity
|
|
49
|
-
* @param callback 事件处理函数
|
|
50
|
-
* @param eventType 事件类型
|
|
51
|
-
* @return {string} Event Id 事件移除时需要提供事件ID
|
|
52
|
-
*/
|
|
53
|
-
addExternal(callback: ExternalListenCallback, eventType: EventType): string;
|
|
54
|
-
/**
|
|
55
|
-
* @description 移除指定Substance的相应事件
|
|
56
|
-
* @param substances 需要移除事件的Substance
|
|
57
|
-
* @param eventType 需要移除的时间类型
|
|
58
|
-
*/
|
|
59
|
-
remove(substances: Entity | Entity[], eventType: EventType): void;
|
|
60
|
-
removeExternal(ids: string | string[], eventType?: EventType): void;
|
|
61
|
-
private _searchExternal;
|
|
62
|
-
removeNative(viewer: Viewer, eventType: EventType): void;
|
|
63
|
-
convertCesiumEventType(subscriberEventType: EventType): number;
|
|
64
|
-
destroy(): void;
|
|
65
|
-
}
|
|
66
|
-
export { Subscriber as default, Subscriber, type EventArgs, type EventType, type ExternalListenCallback, type ListenCallback, };
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
-
import { ScreenSpaceEventHandler, ScreenSpaceEventType } from 'deeptwins-cesium';
|
|
12
|
-
function uniqueId() {
|
|
13
|
-
var _val = '';
|
|
14
|
-
do {
|
|
15
|
-
_val = Math.random().toString(36).slice(-8);
|
|
16
|
-
} while (_val.length < 8);
|
|
17
|
-
return _val;
|
|
18
|
-
}
|
|
19
|
-
var Subscriber = /*#__PURE__*/function () {
|
|
20
|
-
function Subscriber(viewer, options) {
|
|
21
|
-
var _options$pickResult, _options$pickResult$e, _options$pickResult2;
|
|
22
|
-
_classCallCheck(this, Subscriber);
|
|
23
|
-
_defineProperty(this, "_viewer", void 0);
|
|
24
|
-
_defineProperty(this, "_handler", void 0);
|
|
25
|
-
_defineProperty(this, "_eventCollection", void 0);
|
|
26
|
-
_defineProperty(this, "_externalEventCollection", void 0);
|
|
27
|
-
_defineProperty(this, "_eventTypeList", void 0);
|
|
28
|
-
_defineProperty(this, "_moveDebounce", void 0);
|
|
29
|
-
_defineProperty(this, "_lastTime", void 0);
|
|
30
|
-
_defineProperty(this, "_enablePickResult", void 0);
|
|
31
|
-
_defineProperty(this, "_lastResult", void 0);
|
|
32
|
-
_defineProperty(this, "_enable", void 0);
|
|
33
|
-
_defineProperty(this, "_isDestroy", void 0);
|
|
34
|
-
this._viewer = viewer;
|
|
35
|
-
this._handler = new ScreenSpaceEventHandler((options === null || options === void 0 ? void 0 : options.element) || this._viewer.canvas);
|
|
36
|
-
this._moveDebounce = options === null || options === void 0 || (_options$pickResult = options.pickResult) === null || _options$pickResult === void 0 ? void 0 : _options$pickResult.moveDebounce;
|
|
37
|
-
this._enablePickResult = (_options$pickResult$e = options === null || options === void 0 || (_options$pickResult2 = options.pickResult) === null || _options$pickResult2 === void 0 ? void 0 : _options$pickResult2.enable) !== null && _options$pickResult$e !== void 0 ? _options$pickResult$e : false;
|
|
38
|
-
this._lastTime = new Date().getTime();
|
|
39
|
-
this._isDestroy = false;
|
|
40
|
-
this._enable = true;
|
|
41
|
-
|
|
42
|
-
// 初始化事件类型列表
|
|
43
|
-
this._eventTypeList = ['LEFT_DOWN', 'LEFT_UP', 'LEFT_CLICK', 'LEFT_DOUBLE_CLICK', 'RIGHT_DOWN', 'RIGHT_UP', 'RIGHT_CLICK', 'MIDDLE_DOWN', 'MIDDLE_UP', 'MIDDLE_CLICK', 'MOUSE_MOVE', 'WHEEL', 'PINCH_START', 'PINCH_MOVE', 'PINCH_END'];
|
|
44
|
-
|
|
45
|
-
// 初始化事件集合
|
|
46
|
-
this._eventCollection = Object.create(null);
|
|
47
|
-
this._externalEventCollection = Object.create(null);
|
|
48
|
-
this._initListener();
|
|
49
|
-
}
|
|
50
|
-
_createClass(Subscriber, [{
|
|
51
|
-
key: "isDestroy",
|
|
52
|
-
get:
|
|
53
|
-
/**
|
|
54
|
-
* 是否被销毁
|
|
55
|
-
*/
|
|
56
|
-
function get() {
|
|
57
|
-
return this._isDestroy;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** 是否执行监听回调 */
|
|
61
|
-
}, {
|
|
62
|
-
key: "enable",
|
|
63
|
-
get: function get() {
|
|
64
|
-
return this._enable;
|
|
65
|
-
},
|
|
66
|
-
set: function set(val) {
|
|
67
|
-
this._enable = val;
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "_initListener",
|
|
71
|
-
value: function _initListener() {
|
|
72
|
-
var _this = this;
|
|
73
|
-
this._eventTypeList.forEach(function (type) {
|
|
74
|
-
_this._eventCollection[type] = new Map();
|
|
75
|
-
_this._externalEventCollection[type] = new Map();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "_shouldUpdate",
|
|
80
|
-
value: function _shouldUpdate() {
|
|
81
|
-
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
82
|
-
if (!this._moveDebounce) return true;
|
|
83
|
-
var timeNow = new Date().getTime();
|
|
84
|
-
if (timeNow - this._lastTime < this._moveDebounce) {
|
|
85
|
-
return false;
|
|
86
|
-
} else {
|
|
87
|
-
if (update) this._lastTime = timeNow;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "_eventRegister",
|
|
93
|
-
value: function _eventRegister(eventType) {
|
|
94
|
-
var _this2 = this;
|
|
95
|
-
if (this._isDestroy) return;
|
|
96
|
-
var eventCollection = this._eventCollection[eventType];
|
|
97
|
-
var externalEventCollection = this._externalEventCollection[eventType];
|
|
98
|
-
this._handler.setInputAction(function (movement) {
|
|
99
|
-
if (_this2._isDestroy || !_this2._enable || eventType === 'MOUSE_MOVE' && !_this2._shouldUpdate()) return;
|
|
100
|
-
if (_this2._enablePickResult) {
|
|
101
|
-
if (eventType === 'MOUSE_MOVE' && movement.endPosition) {
|
|
102
|
-
_this2._lastResult = _this2._viewer.scene.pick(movement.endPosition);
|
|
103
|
-
} else if (movement.position) {
|
|
104
|
-
_this2._lastResult = _this2._viewer.scene.pick(movement.position);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (externalEventCollection.size > 0) {
|
|
108
|
-
var iterator = externalEventCollection.values();
|
|
109
|
-
var val = iterator.next();
|
|
110
|
-
while (!val.done) {
|
|
111
|
-
val.value(movement, _this2._lastResult);
|
|
112
|
-
val = iterator.next();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (movement.position || movement.endPosition) {
|
|
116
|
-
var _this2$_lastResult;
|
|
117
|
-
var entity = (_this2$_lastResult = _this2._lastResult) === null || _this2$_lastResult === void 0 ? void 0 : _this2$_lastResult.id;
|
|
118
|
-
if (entity && eventCollection.has(entity.id) && typeof eventCollection.get(entity.id) === 'function') {
|
|
119
|
-
var func = eventCollection.get(entity.id);
|
|
120
|
-
if (func) func(movement, entity);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}, ScreenSpaceEventType[eventType]);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @description 为Entity添加监听事件
|
|
128
|
-
* @param substances 需要添加事件的Entity或Entity数组
|
|
129
|
-
* @param callback 需要响应的事件
|
|
130
|
-
* @param eventType 事件类型
|
|
131
|
-
*/
|
|
132
|
-
}, {
|
|
133
|
-
key: "add",
|
|
134
|
-
value: function add(substances, callback, eventType) {
|
|
135
|
-
if (this._isDestroy) return;
|
|
136
|
-
if (this._eventCollection[eventType].size === 0 && this._externalEventCollection[eventType].size === 0) this._eventRegister(eventType);
|
|
137
|
-
var substancesArray = Array.isArray(substances) ? substances : [substances];
|
|
138
|
-
var _iterator = _createForOfIteratorHelper(substancesArray),
|
|
139
|
-
_step;
|
|
140
|
-
try {
|
|
141
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
142
|
-
var _substance = _step.value;
|
|
143
|
-
this._eventCollection[eventType].set(_substance.id, callback);
|
|
144
|
-
}
|
|
145
|
-
} catch (err) {
|
|
146
|
-
_iterator.e(err);
|
|
147
|
-
} finally {
|
|
148
|
-
_iterator.f();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @description 添加特定事件,与add不同在于该事件不会过滤Entity
|
|
154
|
-
* @param callback 事件处理函数
|
|
155
|
-
* @param eventType 事件类型
|
|
156
|
-
* @return {string} Event Id 事件移除时需要提供事件ID
|
|
157
|
-
*/
|
|
158
|
-
}, {
|
|
159
|
-
key: "addExternal",
|
|
160
|
-
value: function addExternal(callback, eventType) {
|
|
161
|
-
if (this._isDestroy) return '';
|
|
162
|
-
if (this._eventCollection[eventType].size === 0 && this._externalEventCollection[eventType].size === 0) this._eventRegister(eventType);
|
|
163
|
-
var eId = uniqueId();
|
|
164
|
-
this._externalEventCollection[eventType].set(eId, callback);
|
|
165
|
-
return eId;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @description 移除指定Substance的相应事件
|
|
170
|
-
* @param substances 需要移除事件的Substance
|
|
171
|
-
* @param eventType 需要移除的时间类型
|
|
172
|
-
*/
|
|
173
|
-
}, {
|
|
174
|
-
key: "remove",
|
|
175
|
-
value: function remove(substances, eventType) {
|
|
176
|
-
if (this._isDestroy) return;
|
|
177
|
-
var substancesArray = Array.isArray(substances) ? substances : [substances];
|
|
178
|
-
var _iterator2 = _createForOfIteratorHelper(substancesArray),
|
|
179
|
-
_step2;
|
|
180
|
-
try {
|
|
181
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
182
|
-
var _substance2 = _step2.value;
|
|
183
|
-
if (this._eventCollection[eventType].has(_substance2.id)) {
|
|
184
|
-
this._eventCollection[eventType].delete(_substance2.id);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
} catch (err) {
|
|
188
|
-
_iterator2.e(err);
|
|
189
|
-
} finally {
|
|
190
|
-
_iterator2.f();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
key: "removeExternal",
|
|
195
|
-
value: function removeExternal(ids, eventType) {
|
|
196
|
-
if (this._isDestroy) return;
|
|
197
|
-
var idsArray = Array.isArray(ids) ? ids : [ids];
|
|
198
|
-
var _iterator3 = _createForOfIteratorHelper(idsArray),
|
|
199
|
-
_step3;
|
|
200
|
-
try {
|
|
201
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
202
|
-
var _this$_externalEventC;
|
|
203
|
-
var id = _step3.value;
|
|
204
|
-
var type = eventType || this._searchExternal(id);
|
|
205
|
-
if (type && (_this$_externalEventC = this._externalEventCollection[type]) !== null && _this$_externalEventC !== void 0 && _this$_externalEventC.has(id)) {
|
|
206
|
-
this._externalEventCollection[type].delete(id);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
} catch (err) {
|
|
210
|
-
_iterator3.e(err);
|
|
211
|
-
} finally {
|
|
212
|
-
_iterator3.f();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}, {
|
|
216
|
-
key: "_searchExternal",
|
|
217
|
-
value: function _searchExternal(id) {
|
|
218
|
-
if (this._isDestroy) return;
|
|
219
|
-
var types = Object.keys(this._externalEventCollection);
|
|
220
|
-
for (var _i = 0, _types = types; _i < _types.length; _i++) {
|
|
221
|
-
var type = _types[_i];
|
|
222
|
-
var events = this._externalEventCollection[type];
|
|
223
|
-
if (events.has(id)) return type;
|
|
224
|
-
}
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
}, {
|
|
228
|
-
key: "removeNative",
|
|
229
|
-
value: function removeNative(viewer, eventType) {
|
|
230
|
-
viewer.screenSpaceEventHandler.removeInputAction(this.convertCesiumEventType(eventType));
|
|
231
|
-
}
|
|
232
|
-
}, {
|
|
233
|
-
key: "convertCesiumEventType",
|
|
234
|
-
value: function convertCesiumEventType(subscriberEventType) {
|
|
235
|
-
return ScreenSpaceEventType[subscriberEventType];
|
|
236
|
-
}
|
|
237
|
-
}, {
|
|
238
|
-
key: "destroy",
|
|
239
|
-
value: function destroy() {
|
|
240
|
-
this._isDestroy = true;
|
|
241
|
-
this._handler.destroy();
|
|
242
|
-
}
|
|
243
|
-
}]);
|
|
244
|
-
return Subscriber;
|
|
245
|
-
}();
|
|
246
|
-
export { Subscriber as default, Subscriber };
|