bruce-cesium 0.4.0 → 0.4.2

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 (34) hide show
  1. package/dist/bruce-cesium.es5.js +46 -58
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +45 -57
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +30 -30
  6. package/dist/lib/rendering/entity-render-engine.js +848 -848
  7. package/dist/lib/rendering/menu-item-manager.js +252 -252
  8. package/dist/lib/rendering/render-addons/measure-addon.js +186 -186
  9. package/dist/lib/rendering/render-addons/render-addon.js +2 -2
  10. package/dist/lib/rendering/render-helper.js +296 -296
  11. package/dist/lib/rendering/render-managers/common/shared-getters.js +31 -31
  12. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +146 -146
  13. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +143 -143
  14. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +234 -234
  15. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +139 -139
  16. package/dist/lib/rendering/render-managers/render-manager.js +50 -50
  17. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +236 -236
  18. package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js +320 -320
  19. package/dist/lib/rendering/tile-render-engine.js +815 -831
  20. package/dist/lib/rendering/tile-render-engine.js.map +1 -1
  21. package/dist/lib/rendering/tileset-render-engine.js +499 -499
  22. package/dist/lib/rendering/view-render-engine.js +305 -309
  23. package/dist/lib/rendering/view-render-engine.js.map +1 -1
  24. package/dist/lib/rendering/visuals-register.js +402 -394
  25. package/dist/lib/rendering/visuals-register.js.map +1 -1
  26. package/dist/lib/utils/drawing-utils.js +42 -42
  27. package/dist/lib/utils/entity-utils.js +99 -99
  28. package/dist/lib/utils/measure-utils.js +34 -34
  29. package/dist/lib/utils/view-utils.js +72 -72
  30. package/dist/lib/viewer/cesium-view-monitor.js +231 -231
  31. package/dist/lib/viewer/viewer-utils.js +85 -85
  32. package/dist/types/rendering/tile-render-engine.d.ts +2 -4
  33. package/dist/types/rendering/visuals-register.d.ts +2 -0
  34. package/package.json +76 -76
@@ -1,232 +1,232 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CesiumViewMonitor = void 0;
4
- var bruce_models_1 = require("bruce-models");
5
- var Cesium = require("cesium");
6
- var TIME_LAG = 300;
7
- var POSITION_CHECK_TIMER = 950;
8
- var DEFAULT_GROUNDED_HEIGHT = 300;
9
- var MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
10
- var NET_STEP_PERCENT = 5;
11
- var BORDER_STEPS = 3;
12
- var ESearchStatus;
13
- (function (ESearchStatus) {
14
- ESearchStatus[ESearchStatus["LocationFound"] = 1] = "LocationFound";
15
- ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
16
- ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
17
- })(ESearchStatus || (ESearchStatus = {}));
18
- function netScanViewForBoundaries(viewer) {
19
- var maxLong = -2 * Math.PI;
20
- var minLong = 2 * Math.PI;
21
- var maxLat = -2 * Math.PI;
22
- var minLat = 2 * Math.PI;
23
- var found = 0;
24
- var updateMinMaxForPoint = function (stepX, stepY) {
25
- var x = Math.round(0 + (viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
26
- var y = Math.round(0 + (viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
27
- var winPos = new Cesium.Cartesian2(x, y);
28
- try {
29
- var intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
30
- if (intersection) {
31
- var point = Cesium.Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
32
- maxLong = Math.max(maxLong, point.longitude);
33
- maxLat = Math.max(maxLat, point.latitude);
34
- minLong = Math.min(minLong, point.longitude);
35
- minLat = Math.min(minLat, point.latitude);
36
- found++;
37
- }
38
- }
39
- catch (_a) {
40
- }
41
- };
42
- // Outer circle.
43
- updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
44
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
45
- updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
46
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
47
- // Inner circle.
48
- updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
49
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
50
- updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
51
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
52
- if (found > 0) {
53
- var viewRect = {
54
- east: maxLong,
55
- west: minLong,
56
- north: maxLat,
57
- south: minLat
58
- };
59
- return viewRect;
60
- }
61
- return null;
62
- }
63
- function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
64
- var ray = viewer.camera.getPickRay(screenPos);
65
- var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
66
- if (intersection) {
67
- return intersection;
68
- }
69
- return null;
70
- }
71
- function areBoundsEqual(a, b) {
72
- return a.north == b.north && a.south == b.south && a.east == b.east && a.west == b.west;
73
- }
74
- function arePosEqual(a, b) {
75
- return a.latitude == b.latitude && a.longitude == b.longitude;
76
- }
77
- /**
78
- * Monitors and emits events when the Cesium view changes.
79
- */
80
- var CesiumViewMonitor = /** @class */ (function () {
81
- function CesiumViewMonitor(viewer) {
82
- var _this = this;
83
- this.target = null;
84
- this.bounds = null;
85
- this.disposed = false;
86
- this.updatedEvent = null;
87
- this.viewer = viewer;
88
- this.tryEmitUpdate();
89
- this.checkInterval = setInterval(function () {
90
- _this.updateQueue();
91
- }, POSITION_CHECK_TIMER);
92
- }
93
- Object.defineProperty(CesiumViewMonitor.prototype, "Disposed", {
94
- get: function () {
95
- return this.disposed;
96
- },
97
- enumerable: false,
98
- configurable: true
99
- });
100
- CesiumViewMonitor.prototype.Updated = function () {
101
- if (!this.updatedEvent) {
102
- this.updatedEvent = new bruce_models_1.BruceEvent();
103
- }
104
- return this.updatedEvent;
105
- };
106
- CesiumViewMonitor.prototype.GetBounds = function () {
107
- return this.bounds;
108
- };
109
- CesiumViewMonitor.prototype.GetTarget = function () {
110
- return this.target;
111
- };
112
- CesiumViewMonitor.prototype.DoUpdate = function () {
113
- this.tryEmitUpdate();
114
- };
115
- CesiumViewMonitor.prototype.Dispose = function () {
116
- if (this.disposed) {
117
- return;
118
- }
119
- this.disposed = true;
120
- clearInterval(this.checkInterval);
121
- };
122
- CesiumViewMonitor.prototype.tryDoUpdate = function () {
123
- var _a;
124
- if (!this.viewer || this.viewer.isDestroyed()) {
125
- this.Dispose();
126
- return ESearchStatus.LocationMissing;
127
- }
128
- var viewRect = null;
129
- var center = null;
130
- var camera = this.viewer.camera;
131
- var terrainHeight = this.viewer.scene.globe.getHeight(camera.positionCartographic);
132
- var cameraPosition = this.viewer.camera.positionCartographic;
133
- // We are almost at the ground, screw horizon, just load around.
134
- if (terrainHeight && ((cameraPosition.height - terrainHeight) < DEFAULT_GROUNDED_HEIGHT)) {
135
- // View area calculation.
136
- viewRect = {};
137
- var viewRectRad = netScanViewForBoundaries(this.viewer);
138
- if (viewRectRad &&
139
- viewRectRad.east &&
140
- viewRectRad.west &&
141
- viewRectRad.north &&
142
- viewRectRad.south) {
143
- viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
144
- viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
145
- viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
146
- viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
147
- }
148
- else {
149
- viewRect.east = cameraPosition.longitude;
150
- viewRect.west = cameraPosition.longitude;
151
- viewRect.south = cameraPosition.latitude;
152
- viewRect.north = cameraPosition.latitude;
153
- }
154
- center = {};
155
- center.latitude = Cesium.Math.toDegrees(camera.positionCartographic.latitude);
156
- center.longitude = Cesium.Math.toDegrees(camera.positionCartographic.longitude);
157
- }
158
- else {
159
- // View area calculation.
160
- var windowPosition = new Cesium.Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
161
- var intersection = getAdjustedGroundIntersectionOfCameraRay(this.viewer, windowPosition);
162
- var point = null;
163
- if (intersection) {
164
- point = Cesium.Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
165
- }
166
- if (point) {
167
- center = {};
168
- center.latitude = Cesium.Math.toDegrees(point.latitude);
169
- center.longitude = Cesium.Math.toDegrees(point.longitude);
170
- var viewRectRad = netScanViewForBoundaries(this.viewer);
171
- if (viewRectRad) {
172
- viewRect = {};
173
- viewRect.east = Cesium.Math.toDegrees(viewRectRad.east);
174
- viewRect.west = Cesium.Math.toDegrees(viewRectRad.west);
175
- viewRect.south = Cesium.Math.toDegrees(viewRectRad.south);
176
- viewRect.north = Cesium.Math.toDegrees(viewRectRad.north);
177
- }
178
- }
179
- }
180
- // Minimal field of view.
181
- if (viewRect) {
182
- var centerLong = (viewRect.east + viewRect.west) / 2;
183
- var centerLat = (viewRect.north + viewRect.south) / 2;
184
- viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
185
- viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
186
- viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
187
- viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
188
- viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
189
- }
190
- if (center && viewRect) {
191
- if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
192
- (!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
193
- this.target = center;
194
- this.bounds = viewRect;
195
- return ESearchStatus.LocationChanged;
196
- }
197
- return ESearchStatus.LocationFound;
198
- }
199
- return ESearchStatus.LocationMissing;
200
- };
201
- CesiumViewMonitor.prototype.tryEmitUpdate = function () {
202
- var _a;
203
- var searchResult = this.tryDoUpdate();
204
- if (searchResult == ESearchStatus.LocationChanged) {
205
- var interest = {
206
- bounds: this.bounds,
207
- target: this.target
208
- };
209
- (_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
210
- }
211
- else if (searchResult == ESearchStatus.LocationMissing) {
212
- this.updateQueue();
213
- }
214
- };
215
- CesiumViewMonitor.prototype.queuePosition = function (lag) {
216
- var _this = this;
217
- if (this.pendingTimeout) {
218
- clearTimeout(this.pendingTimeout);
219
- }
220
- this.pendingTimeout = setTimeout(function () {
221
- if (!_this.disposed) {
222
- _this.tryEmitUpdate();
223
- }
224
- }, lag);
225
- };
226
- CesiumViewMonitor.prototype.updateQueue = function () {
227
- this.queuePosition(TIME_LAG);
228
- };
229
- return CesiumViewMonitor;
230
- }());
231
- exports.CesiumViewMonitor = CesiumViewMonitor;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CesiumViewMonitor = void 0;
4
+ var bruce_models_1 = require("bruce-models");
5
+ var Cesium = require("cesium");
6
+ var TIME_LAG = 300;
7
+ var POSITION_CHECK_TIMER = 950;
8
+ var DEFAULT_GROUNDED_HEIGHT = 300;
9
+ var MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
10
+ var NET_STEP_PERCENT = 5;
11
+ var BORDER_STEPS = 3;
12
+ var ESearchStatus;
13
+ (function (ESearchStatus) {
14
+ ESearchStatus[ESearchStatus["LocationFound"] = 1] = "LocationFound";
15
+ ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
16
+ ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
17
+ })(ESearchStatus || (ESearchStatus = {}));
18
+ function netScanViewForBoundaries(viewer) {
19
+ var maxLong = -2 * Math.PI;
20
+ var minLong = 2 * Math.PI;
21
+ var maxLat = -2 * Math.PI;
22
+ var minLat = 2 * Math.PI;
23
+ var found = 0;
24
+ var updateMinMaxForPoint = function (stepX, stepY) {
25
+ var x = Math.round(0 + (viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
26
+ var y = Math.round(0 + (viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
27
+ var winPos = new Cesium.Cartesian2(x, y);
28
+ try {
29
+ var intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
30
+ if (intersection) {
31
+ var point = Cesium.Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
32
+ maxLong = Math.max(maxLong, point.longitude);
33
+ maxLat = Math.max(maxLat, point.latitude);
34
+ minLong = Math.min(minLong, point.longitude);
35
+ minLat = Math.min(minLat, point.latitude);
36
+ found++;
37
+ }
38
+ }
39
+ catch (_a) {
40
+ }
41
+ };
42
+ // Outer circle.
43
+ updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
44
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
45
+ updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
46
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
47
+ // Inner circle.
48
+ updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
49
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
50
+ updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
51
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
52
+ if (found > 0) {
53
+ var viewRect = {
54
+ east: maxLong,
55
+ west: minLong,
56
+ north: maxLat,
57
+ south: minLat
58
+ };
59
+ return viewRect;
60
+ }
61
+ return null;
62
+ }
63
+ function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
64
+ var ray = viewer.camera.getPickRay(screenPos);
65
+ var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
66
+ if (intersection) {
67
+ return intersection;
68
+ }
69
+ return null;
70
+ }
71
+ function areBoundsEqual(a, b) {
72
+ return a.north == b.north && a.south == b.south && a.east == b.east && a.west == b.west;
73
+ }
74
+ function arePosEqual(a, b) {
75
+ return a.latitude == b.latitude && a.longitude == b.longitude;
76
+ }
77
+ /**
78
+ * Monitors and emits events when the Cesium view changes.
79
+ */
80
+ var CesiumViewMonitor = /** @class */ (function () {
81
+ function CesiumViewMonitor(viewer) {
82
+ var _this = this;
83
+ this.target = null;
84
+ this.bounds = null;
85
+ this.disposed = false;
86
+ this.updatedEvent = null;
87
+ this.viewer = viewer;
88
+ this.tryEmitUpdate();
89
+ this.checkInterval = setInterval(function () {
90
+ _this.updateQueue();
91
+ }, POSITION_CHECK_TIMER);
92
+ }
93
+ Object.defineProperty(CesiumViewMonitor.prototype, "Disposed", {
94
+ get: function () {
95
+ return this.disposed;
96
+ },
97
+ enumerable: false,
98
+ configurable: true
99
+ });
100
+ CesiumViewMonitor.prototype.Updated = function () {
101
+ if (!this.updatedEvent) {
102
+ this.updatedEvent = new bruce_models_1.BruceEvent();
103
+ }
104
+ return this.updatedEvent;
105
+ };
106
+ CesiumViewMonitor.prototype.GetBounds = function () {
107
+ return this.bounds;
108
+ };
109
+ CesiumViewMonitor.prototype.GetTarget = function () {
110
+ return this.target;
111
+ };
112
+ CesiumViewMonitor.prototype.DoUpdate = function () {
113
+ this.tryEmitUpdate();
114
+ };
115
+ CesiumViewMonitor.prototype.Dispose = function () {
116
+ if (this.disposed) {
117
+ return;
118
+ }
119
+ this.disposed = true;
120
+ clearInterval(this.checkInterval);
121
+ };
122
+ CesiumViewMonitor.prototype.tryDoUpdate = function () {
123
+ var _a;
124
+ if (!this.viewer || this.viewer.isDestroyed()) {
125
+ this.Dispose();
126
+ return ESearchStatus.LocationMissing;
127
+ }
128
+ var viewRect = null;
129
+ var center = null;
130
+ var camera = this.viewer.camera;
131
+ var terrainHeight = this.viewer.scene.globe.getHeight(camera.positionCartographic);
132
+ var cameraPosition = this.viewer.camera.positionCartographic;
133
+ // We are almost at the ground, screw horizon, just load around.
134
+ if (terrainHeight && ((cameraPosition.height - terrainHeight) < DEFAULT_GROUNDED_HEIGHT)) {
135
+ // View area calculation.
136
+ viewRect = {};
137
+ var viewRectRad = netScanViewForBoundaries(this.viewer);
138
+ if (viewRectRad &&
139
+ viewRectRad.east &&
140
+ viewRectRad.west &&
141
+ viewRectRad.north &&
142
+ viewRectRad.south) {
143
+ viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
144
+ viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
145
+ viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
146
+ viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
147
+ }
148
+ else {
149
+ viewRect.east = cameraPosition.longitude;
150
+ viewRect.west = cameraPosition.longitude;
151
+ viewRect.south = cameraPosition.latitude;
152
+ viewRect.north = cameraPosition.latitude;
153
+ }
154
+ center = {};
155
+ center.latitude = Cesium.Math.toDegrees(camera.positionCartographic.latitude);
156
+ center.longitude = Cesium.Math.toDegrees(camera.positionCartographic.longitude);
157
+ }
158
+ else {
159
+ // View area calculation.
160
+ var windowPosition = new Cesium.Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
161
+ var intersection = getAdjustedGroundIntersectionOfCameraRay(this.viewer, windowPosition);
162
+ var point = null;
163
+ if (intersection) {
164
+ point = Cesium.Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
165
+ }
166
+ if (point) {
167
+ center = {};
168
+ center.latitude = Cesium.Math.toDegrees(point.latitude);
169
+ center.longitude = Cesium.Math.toDegrees(point.longitude);
170
+ var viewRectRad = netScanViewForBoundaries(this.viewer);
171
+ if (viewRectRad) {
172
+ viewRect = {};
173
+ viewRect.east = Cesium.Math.toDegrees(viewRectRad.east);
174
+ viewRect.west = Cesium.Math.toDegrees(viewRectRad.west);
175
+ viewRect.south = Cesium.Math.toDegrees(viewRectRad.south);
176
+ viewRect.north = Cesium.Math.toDegrees(viewRectRad.north);
177
+ }
178
+ }
179
+ }
180
+ // Minimal field of view.
181
+ if (viewRect) {
182
+ var centerLong = (viewRect.east + viewRect.west) / 2;
183
+ var centerLat = (viewRect.north + viewRect.south) / 2;
184
+ viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
185
+ viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
186
+ viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
187
+ viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
188
+ viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
189
+ }
190
+ if (center && viewRect) {
191
+ if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
192
+ (!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
193
+ this.target = center;
194
+ this.bounds = viewRect;
195
+ return ESearchStatus.LocationChanged;
196
+ }
197
+ return ESearchStatus.LocationFound;
198
+ }
199
+ return ESearchStatus.LocationMissing;
200
+ };
201
+ CesiumViewMonitor.prototype.tryEmitUpdate = function () {
202
+ var _a;
203
+ var searchResult = this.tryDoUpdate();
204
+ if (searchResult == ESearchStatus.LocationChanged) {
205
+ var interest = {
206
+ bounds: this.bounds,
207
+ target: this.target
208
+ };
209
+ (_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
210
+ }
211
+ else if (searchResult == ESearchStatus.LocationMissing) {
212
+ this.updateQueue();
213
+ }
214
+ };
215
+ CesiumViewMonitor.prototype.queuePosition = function (lag) {
216
+ var _this = this;
217
+ if (this.pendingTimeout) {
218
+ clearTimeout(this.pendingTimeout);
219
+ }
220
+ this.pendingTimeout = setTimeout(function () {
221
+ if (!_this.disposed) {
222
+ _this.tryEmitUpdate();
223
+ }
224
+ }, lag);
225
+ };
226
+ CesiumViewMonitor.prototype.updateQueue = function () {
227
+ this.queuePosition(TIME_LAG);
228
+ };
229
+ return CesiumViewMonitor;
230
+ }());
231
+ exports.CesiumViewMonitor = CesiumViewMonitor;
232
232
  //# sourceMappingURL=cesium-view-monitor.js.map
@@ -1,86 +1,86 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViewerUtils = void 0;
4
- var Cesium = require("cesium");
5
- var ViewerUtils;
6
- (function (ViewerUtils) {
7
- /**
8
- * Creates a Cesium viewer in a given HTML container and returns it.
9
- * This will kill all widgets in the process.
10
- * @param container
11
- * @returns
12
- */
13
- function InitViewer(container) {
14
- if (container._cViewer) {
15
- throw new Error("Container already has a viewer.");
16
- }
17
- var cViewer = new Cesium.Viewer(container, {
18
- imageryProvider: new Cesium.ArcGisMapServerImageryProvider({
19
- url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
20
- enablePickFeatures: false
21
- })
22
- });
23
- cViewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
24
- cViewer.camera.percentageChanged = 0.05;
25
- ViewerUtils.DestroyWidget(cViewer.timeline);
26
- ViewerUtils.DestroyWidget(cViewer.vrButton);
27
- ViewerUtils.DestroyWidget(cViewer.sceneModePicker);
28
- ViewerUtils.DestroyWidget(cViewer.homeButton);
29
- ViewerUtils.DestroyWidget(cViewer.fullscreenButton);
30
- ViewerUtils.DestroyWidget(cViewer.baseLayerPicker);
31
- ViewerUtils.StyleContainer(cViewer);
32
- container._cViewer = cViewer;
33
- return cViewer;
34
- }
35
- ViewerUtils.InitViewer = InitViewer;
36
- function GetViewerFromContainer(container) {
37
- return container._cViewer;
38
- }
39
- ViewerUtils.GetViewerFromContainer = GetViewerFromContainer;
40
- function DestroyWidget(widget) {
41
- if (widget && !widget.isDestroyed()) {
42
- widget.destroy();
43
- }
44
- }
45
- ViewerUtils.DestroyWidget = DestroyWidget;
46
- /**
47
- * Hides all unnecessary elements from the Cesium viewer container.
48
- * @param viewer
49
- */
50
- function StyleContainer(viewer) {
51
- var _a;
52
- var container = viewer.container;
53
- var genContainer = (_a = container.getElementsByClassName("cesium-viewer")) === null || _a === void 0 ? void 0 : _a[0];
54
- if (genContainer) {
55
- var children = genContainer.children;
56
- for (var i = 0; i < children.length; i++) {
57
- var child = children[i];
58
- if (!child.classList.contains("cesium-viewer-cesiumWidgetContainer")) {
59
- child.style.display = "none";
60
- }
61
- }
62
- }
63
- var canvas = viewer.canvas;
64
- canvas.style.width = "100%";
65
- canvas.style.height = "100%";
66
- var widget = canvas.parentElement;
67
- widget.style.width = "100%";
68
- widget.style.height = "100%";
69
- widget.style.touchAction = "none";
70
- var widgetContainer = widget.parentElement;
71
- widgetContainer.style.width = "100%";
72
- widgetContainer.style.height = "100%";
73
- var viewerContainer = widgetContainer.parentElement;
74
- viewerContainer.style.fontFamily = "sans-serif";
75
- viewerContainer.style.fontSize = "16px";
76
- viewerContainer.style.overflow = "hidden";
77
- viewerContainer.style.display = "block";
78
- viewerContainer.style.position = "relative";
79
- viewerContainer.style.top = "0";
80
- viewerContainer.style.left = "0";
81
- viewerContainer.style.width = "100%";
82
- viewerContainer.style.height = "100%";
83
- }
84
- ViewerUtils.StyleContainer = StyleContainer;
85
- })(ViewerUtils = exports.ViewerUtils || (exports.ViewerUtils = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewerUtils = void 0;
4
+ var Cesium = require("cesium");
5
+ var ViewerUtils;
6
+ (function (ViewerUtils) {
7
+ /**
8
+ * Creates a Cesium viewer in a given HTML container and returns it.
9
+ * This will kill all widgets in the process.
10
+ * @param container
11
+ * @returns
12
+ */
13
+ function InitViewer(container) {
14
+ if (container._cViewer) {
15
+ throw new Error("Container already has a viewer.");
16
+ }
17
+ var cViewer = new Cesium.Viewer(container, {
18
+ imageryProvider: new Cesium.ArcGisMapServerImageryProvider({
19
+ url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
20
+ enablePickFeatures: false
21
+ })
22
+ });
23
+ cViewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
24
+ cViewer.camera.percentageChanged = 0.05;
25
+ ViewerUtils.DestroyWidget(cViewer.timeline);
26
+ ViewerUtils.DestroyWidget(cViewer.vrButton);
27
+ ViewerUtils.DestroyWidget(cViewer.sceneModePicker);
28
+ ViewerUtils.DestroyWidget(cViewer.homeButton);
29
+ ViewerUtils.DestroyWidget(cViewer.fullscreenButton);
30
+ ViewerUtils.DestroyWidget(cViewer.baseLayerPicker);
31
+ ViewerUtils.StyleContainer(cViewer);
32
+ container._cViewer = cViewer;
33
+ return cViewer;
34
+ }
35
+ ViewerUtils.InitViewer = InitViewer;
36
+ function GetViewerFromContainer(container) {
37
+ return container._cViewer;
38
+ }
39
+ ViewerUtils.GetViewerFromContainer = GetViewerFromContainer;
40
+ function DestroyWidget(widget) {
41
+ if (widget && !widget.isDestroyed()) {
42
+ widget.destroy();
43
+ }
44
+ }
45
+ ViewerUtils.DestroyWidget = DestroyWidget;
46
+ /**
47
+ * Hides all unnecessary elements from the Cesium viewer container.
48
+ * @param viewer
49
+ */
50
+ function StyleContainer(viewer) {
51
+ var _a;
52
+ var container = viewer.container;
53
+ var genContainer = (_a = container.getElementsByClassName("cesium-viewer")) === null || _a === void 0 ? void 0 : _a[0];
54
+ if (genContainer) {
55
+ var children = genContainer.children;
56
+ for (var i = 0; i < children.length; i++) {
57
+ var child = children[i];
58
+ if (!child.classList.contains("cesium-viewer-cesiumWidgetContainer")) {
59
+ child.style.display = "none";
60
+ }
61
+ }
62
+ }
63
+ var canvas = viewer.canvas;
64
+ canvas.style.width = "100%";
65
+ canvas.style.height = "100%";
66
+ var widget = canvas.parentElement;
67
+ widget.style.width = "100%";
68
+ widget.style.height = "100%";
69
+ widget.style.touchAction = "none";
70
+ var widgetContainer = widget.parentElement;
71
+ widgetContainer.style.width = "100%";
72
+ widgetContainer.style.height = "100%";
73
+ var viewerContainer = widgetContainer.parentElement;
74
+ viewerContainer.style.fontFamily = "sans-serif";
75
+ viewerContainer.style.fontSize = "16px";
76
+ viewerContainer.style.overflow = "hidden";
77
+ viewerContainer.style.display = "block";
78
+ viewerContainer.style.position = "relative";
79
+ viewerContainer.style.top = "0";
80
+ viewerContainer.style.left = "0";
81
+ viewerContainer.style.width = "100%";
82
+ viewerContainer.style.height = "100%";
83
+ }
84
+ ViewerUtils.StyleContainer = StyleContainer;
85
+ })(ViewerUtils = exports.ViewerUtils || (exports.ViewerUtils = {}));
86
86
  //# sourceMappingURL=viewer-utils.js.map
@@ -36,8 +36,7 @@ export declare namespace TileRenderEngine {
36
36
  interface IParams {
37
37
  apiGetter: BruceApi.IGetter;
38
38
  viewer: Cesium.Viewer;
39
- sources: ProjectViewTile.IViewImagery[];
40
- enabled: ProjectViewTile.IBookmarkImagery[];
39
+ tiles: ProjectViewTile.IBookmarkImagery[];
41
40
  }
42
41
  function GetOrCreateLayer(viewer: Cesium.Viewer, apiGetter: BruceApi.IGetter, meta: ProjectViewTile.ITileMeta): Promise<Cesium.ImageryLayer>;
43
42
  function Render(params: IParams): Promise<void>;
@@ -69,8 +68,7 @@ export declare namespace TileRenderEngine {
69
68
  interface IParams {
70
69
  apiGetter: BruceApi.IGetter;
71
70
  viewer: Cesium.Viewer;
72
- source: ProjectViewTile.IViewTerrain;
73
- enabled: ProjectViewTile.IBookmarkTerrain;
71
+ tile: ProjectViewTile.IBookmarkTerrain;
74
72
  }
75
73
  function Render(params: IParams): Promise<void>;
76
74
  }