bruce-cesium 2.9.8 → 3.0.0
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/bruce-cesium.es5.js +785 -178
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +786 -181
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/getters/batched-data-getter.js +92 -0
- package/dist/lib/rendering/getters/batched-data-getter.js.map +1 -0
- package/dist/lib/rendering/getters/entity-filter-getter.js +394 -0
- package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -0
- package/dist/lib/rendering/getters/entity-globe.js +195 -0
- package/dist/lib/rendering/getters/entity-globe.js.map +1 -0
- package/dist/lib/rendering/menu-item-creator.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +1 -1
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +2 -2
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +2 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +2 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +2 -1
- package/dist/lib/rendering/render-managers/entities/entity-render-manager.js.map +1 -1
- package/dist/lib/rendering/tile-render-engine.js.map +1 -1
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/lib/utils/view-utils.js.map +1 -1
- package/dist/lib/viewer/cesium-view-monitor.js +177 -174
- package/dist/lib/viewer/cesium-view-monitor.js.map +1 -1
- package/dist/lib/widgets/widget-bookmarks.js.map +1 -1
- package/dist/lib/widgets/widget-info-view.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/getters/batched-data-getter.d.ts +26 -0
- package/dist/types/rendering/getters/entity-filter-getter.d.ts +58 -0
- package/dist/types/rendering/getters/entity-globe.d.ts +20 -0
- package/dist/types/rendering/menu-item-creator.d.ts +2 -2
- package/dist/types/rendering/menu-item-manager.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/shared-getters.d.ts +3 -4
- package/dist/types/rendering/render-managers/entities/entities-ids-render-manager.d.ts +1 -1
- package/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +1 -1
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +1 -1
- package/dist/types/rendering/render-managers/entities/entity-render-manager.d.ts +1 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-osm-render-manager.d.ts +1 -1
- package/dist/types/rendering/view-render-engine.d.ts +2 -2
- package/dist/types/utils/view-utils.d.ts +2 -2
- package/dist/types/viewer/cesium-view-monitor.d.ts +32 -26
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -75,191 +75,194 @@
|
|
|
75
75
|
function arePosEqual(a, b) {
|
|
76
76
|
return a.latitude == b.latitude && a.longitude == b.longitude;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Object.defineProperty(CesiumViewMonitor.prototype, "Disposed", {
|
|
96
|
-
get: function () {
|
|
97
|
-
return this.disposed;
|
|
98
|
-
},
|
|
99
|
-
enumerable: false,
|
|
100
|
-
configurable: true
|
|
101
|
-
});
|
|
102
|
-
CesiumViewMonitor.prototype.createEntity = function () {
|
|
103
|
-
var _this = this;
|
|
104
|
-
if (this.entity) {
|
|
105
|
-
return;
|
|
78
|
+
(function (CesiumViewMonitor) {
|
|
79
|
+
/**
|
|
80
|
+
* Monitors and emits events when the Cesium view changes.
|
|
81
|
+
*/
|
|
82
|
+
var Monitor = /** @class */ (function () {
|
|
83
|
+
function Monitor(viewer) {
|
|
84
|
+
var _this = this;
|
|
85
|
+
this.target = null;
|
|
86
|
+
this.bounds = null;
|
|
87
|
+
this.disposed = false;
|
|
88
|
+
this.updatedEvent = null;
|
|
89
|
+
this.entity = null;
|
|
90
|
+
this.viewer = viewer;
|
|
91
|
+
this.tryEmitUpdate();
|
|
92
|
+
this.checkInterval = setInterval(function () {
|
|
93
|
+
_this.updateQueue();
|
|
94
|
+
}, POSITION_CHECK_TIMER);
|
|
106
95
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return
|
|
110
|
-
}, false),
|
|
111
|
-
point: {
|
|
112
|
-
pixelSize: 8,
|
|
113
|
-
color: Cesium.Color.ORANGE
|
|
96
|
+
Object.defineProperty(Monitor.prototype, "Disposed", {
|
|
97
|
+
get: function () {
|
|
98
|
+
return this.disposed;
|
|
114
99
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return _this.bounds ? Cesium.Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
118
|
-
}, false),
|
|
119
|
-
material: Cesium.Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
120
|
-
zIndex: 1
|
|
121
|
-
}
|
|
100
|
+
enumerable: false,
|
|
101
|
+
configurable: true
|
|
122
102
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
this.entity = null;
|
|
129
|
-
};
|
|
130
|
-
CesiumViewMonitor.prototype.Updated = function () {
|
|
131
|
-
if (!this.updatedEvent) {
|
|
132
|
-
this.updatedEvent = new bruceModels.BruceEvent();
|
|
133
|
-
}
|
|
134
|
-
return this.updatedEvent;
|
|
135
|
-
};
|
|
136
|
-
CesiumViewMonitor.prototype.GetBounds = function () {
|
|
137
|
-
return this.bounds;
|
|
138
|
-
};
|
|
139
|
-
CesiumViewMonitor.prototype.GetTarget = function () {
|
|
140
|
-
return this.target;
|
|
141
|
-
};
|
|
142
|
-
CesiumViewMonitor.prototype.DoUpdate = function () {
|
|
143
|
-
this.tryEmitUpdate();
|
|
144
|
-
};
|
|
145
|
-
CesiumViewMonitor.prototype.Dispose = function () {
|
|
146
|
-
if (this.disposed) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this.disposed = true;
|
|
150
|
-
clearInterval(this.checkInterval);
|
|
151
|
-
this.destroyEntity();
|
|
152
|
-
};
|
|
153
|
-
CesiumViewMonitor.prototype.tryDoUpdate = function () {
|
|
154
|
-
var _a;
|
|
155
|
-
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
156
|
-
this.Dispose();
|
|
157
|
-
return ESearchStatus.LocationMissing;
|
|
158
|
-
}
|
|
159
|
-
var viewRect = null;
|
|
160
|
-
var center = null;
|
|
161
|
-
var camera = this.viewer.camera;
|
|
162
|
-
var terrainHeight = this.viewer.scene.globe.getHeight(camera.positionCartographic);
|
|
163
|
-
var cameraPosition = this.viewer.camera.positionCartographic;
|
|
164
|
-
// We are almost at the ground, screw horizon, just load around.
|
|
165
|
-
if (terrainHeight && ((cameraPosition.height - terrainHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
166
|
-
// View area calculation.
|
|
167
|
-
viewRect = {};
|
|
168
|
-
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
169
|
-
if (viewRectRad &&
|
|
170
|
-
viewRectRad.east &&
|
|
171
|
-
viewRectRad.west &&
|
|
172
|
-
viewRectRad.north &&
|
|
173
|
-
viewRectRad.south) {
|
|
174
|
-
viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
175
|
-
viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
176
|
-
viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
177
|
-
viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
103
|
+
Monitor.prototype.createEntity = function () {
|
|
104
|
+
var _this = this;
|
|
105
|
+
if (this.entity) {
|
|
106
|
+
return;
|
|
178
107
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
108
|
+
this.entity = this.viewer.entities.add({
|
|
109
|
+
position: new Cesium.CallbackProperty(function () {
|
|
110
|
+
return _this.target ? Cesium.Cartesian3.fromDegrees(_this.target.longitude, _this.target.latitude) : null;
|
|
111
|
+
}, false),
|
|
112
|
+
point: {
|
|
113
|
+
pixelSize: 8,
|
|
114
|
+
color: Cesium.Color.ORANGE
|
|
115
|
+
},
|
|
116
|
+
rectangle: {
|
|
117
|
+
coordinates: new Cesium.CallbackProperty(function () {
|
|
118
|
+
return _this.bounds ? Cesium.Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
119
|
+
}, false),
|
|
120
|
+
material: Cesium.Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
121
|
+
zIndex: 1
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
Monitor.prototype.destroyEntity = function () {
|
|
126
|
+
if (this.entity && this.viewer.entities.contains(this.entity)) {
|
|
127
|
+
this.viewer.entities.remove(this.entity);
|
|
184
128
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// View area calculation.
|
|
191
|
-
var windowPosition = new Cesium.Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
192
|
-
var intersection = getAdjustedGroundIntersectionOfCameraRay(this.viewer, windowPosition);
|
|
193
|
-
var point = null;
|
|
194
|
-
if (intersection) {
|
|
195
|
-
point = Cesium.Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
129
|
+
this.entity = null;
|
|
130
|
+
};
|
|
131
|
+
Monitor.prototype.Updated = function () {
|
|
132
|
+
if (!this.updatedEvent) {
|
|
133
|
+
this.updatedEvent = new bruceModels.BruceEvent();
|
|
196
134
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
135
|
+
return this.updatedEvent;
|
|
136
|
+
};
|
|
137
|
+
Monitor.prototype.GetBounds = function () {
|
|
138
|
+
return this.bounds;
|
|
139
|
+
};
|
|
140
|
+
Monitor.prototype.GetTarget = function () {
|
|
141
|
+
return this.target;
|
|
142
|
+
};
|
|
143
|
+
Monitor.prototype.DoUpdate = function () {
|
|
144
|
+
this.tryEmitUpdate();
|
|
145
|
+
};
|
|
146
|
+
Monitor.prototype.Dispose = function () {
|
|
147
|
+
if (this.disposed) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.disposed = true;
|
|
151
|
+
clearInterval(this.checkInterval);
|
|
152
|
+
this.destroyEntity();
|
|
153
|
+
};
|
|
154
|
+
Monitor.prototype.tryDoUpdate = function () {
|
|
155
|
+
var _a;
|
|
156
|
+
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
157
|
+
this.Dispose();
|
|
158
|
+
return ESearchStatus.LocationMissing;
|
|
159
|
+
}
|
|
160
|
+
var viewRect = null;
|
|
161
|
+
var center = null;
|
|
162
|
+
var camera = this.viewer.camera;
|
|
163
|
+
var terrainHeight = this.viewer.scene.globe.getHeight(camera.positionCartographic);
|
|
164
|
+
var cameraPosition = this.viewer.camera.positionCartographic;
|
|
165
|
+
// We are almost at the ground, screw horizon, just load around.
|
|
166
|
+
if (terrainHeight && ((cameraPosition.height - terrainHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
167
|
+
// View area calculation.
|
|
168
|
+
viewRect = {};
|
|
201
169
|
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
202
|
-
if (viewRectRad
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
viewRect.
|
|
170
|
+
if (viewRectRad &&
|
|
171
|
+
viewRectRad.east &&
|
|
172
|
+
viewRectRad.west &&
|
|
173
|
+
viewRectRad.north &&
|
|
174
|
+
viewRectRad.south) {
|
|
175
|
+
viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
176
|
+
viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
177
|
+
viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
178
|
+
viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
208
179
|
}
|
|
180
|
+
else {
|
|
181
|
+
viewRect.east = cameraPosition.longitude;
|
|
182
|
+
viewRect.west = cameraPosition.longitude;
|
|
183
|
+
viewRect.south = cameraPosition.latitude;
|
|
184
|
+
viewRect.north = cameraPosition.latitude;
|
|
185
|
+
}
|
|
186
|
+
center = {};
|
|
187
|
+
center.latitude = Cesium.Math.toDegrees(camera.positionCartographic.latitude);
|
|
188
|
+
center.longitude = Cesium.Math.toDegrees(camera.positionCartographic.longitude);
|
|
209
189
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
190
|
+
else {
|
|
191
|
+
// View area calculation.
|
|
192
|
+
var windowPosition = new Cesium.Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
193
|
+
var intersection = getAdjustedGroundIntersectionOfCameraRay(this.viewer, windowPosition);
|
|
194
|
+
var point = null;
|
|
195
|
+
if (intersection) {
|
|
196
|
+
point = Cesium.Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
197
|
+
}
|
|
198
|
+
if (point) {
|
|
199
|
+
center = {};
|
|
200
|
+
center.latitude = Cesium.Math.toDegrees(point.latitude);
|
|
201
|
+
center.longitude = Cesium.Math.toDegrees(point.longitude);
|
|
202
|
+
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
203
|
+
if (viewRectRad) {
|
|
204
|
+
viewRect = {};
|
|
205
|
+
viewRect.east = Cesium.Math.toDegrees(viewRectRad.east);
|
|
206
|
+
viewRect.west = Cesium.Math.toDegrees(viewRectRad.west);
|
|
207
|
+
viewRect.south = Cesium.Math.toDegrees(viewRectRad.south);
|
|
208
|
+
viewRect.north = Cesium.Math.toDegrees(viewRectRad.north);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
227
211
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
};
|
|
247
|
-
CesiumViewMonitor.prototype.queuePosition = function (lag) {
|
|
248
|
-
var _this = this;
|
|
249
|
-
if (this.pendingTimeout) {
|
|
250
|
-
clearTimeout(this.pendingTimeout);
|
|
251
|
-
}
|
|
252
|
-
this.pendingTimeout = setTimeout(function () {
|
|
253
|
-
if (!_this.disposed) {
|
|
254
|
-
_this.tryEmitUpdate();
|
|
212
|
+
// Minimal field of view.
|
|
213
|
+
if (viewRect) {
|
|
214
|
+
var centerLong = (viewRect.east + viewRect.west) / 2;
|
|
215
|
+
var centerLat = (viewRect.north + viewRect.south) / 2;
|
|
216
|
+
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
217
|
+
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
218
|
+
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
219
|
+
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
220
|
+
viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
|
|
221
|
+
}
|
|
222
|
+
if (center && viewRect) {
|
|
223
|
+
if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
|
|
224
|
+
(!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
|
|
225
|
+
this.target = center;
|
|
226
|
+
this.bounds = viewRect;
|
|
227
|
+
return ESearchStatus.LocationChanged;
|
|
228
|
+
}
|
|
229
|
+
return ESearchStatus.LocationFound;
|
|
255
230
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
231
|
+
return ESearchStatus.LocationMissing;
|
|
232
|
+
};
|
|
233
|
+
Monitor.prototype.tryEmitUpdate = function () {
|
|
234
|
+
var _a;
|
|
235
|
+
var searchResult = this.tryDoUpdate();
|
|
236
|
+
if (searchResult == ESearchStatus.LocationChanged) {
|
|
237
|
+
var interest = {
|
|
238
|
+
bounds: this.bounds,
|
|
239
|
+
target: this.target
|
|
240
|
+
};
|
|
241
|
+
//this.createEntity();
|
|
242
|
+
(_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
|
|
243
|
+
}
|
|
244
|
+
else if (searchResult == ESearchStatus.LocationMissing) {
|
|
245
|
+
this.updateQueue();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
Monitor.prototype.queuePosition = function (lag) {
|
|
249
|
+
var _this = this;
|
|
250
|
+
if (this.pendingTimeout) {
|
|
251
|
+
clearTimeout(this.pendingTimeout);
|
|
252
|
+
}
|
|
253
|
+
this.pendingTimeout = setTimeout(function () {
|
|
254
|
+
if (!_this.disposed) {
|
|
255
|
+
_this.tryEmitUpdate();
|
|
256
|
+
}
|
|
257
|
+
}, lag);
|
|
258
|
+
};
|
|
259
|
+
Monitor.prototype.updateQueue = function () {
|
|
260
|
+
this.queuePosition(TIME_LAG);
|
|
261
|
+
};
|
|
262
|
+
return Monitor;
|
|
263
|
+
}());
|
|
264
|
+
CesiumViewMonitor.Monitor = Monitor;
|
|
265
|
+
})(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
|
|
263
266
|
|
|
264
267
|
/*! *****************************************************************************
|
|
265
268
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7565,6 +7568,94 @@
|
|
|
7565
7568
|
EntitiesRenderManager.Manager = Manager;
|
|
7566
7569
|
})(exports.EntitiesRenderManager || (exports.EntitiesRenderManager = {}));
|
|
7567
7570
|
|
|
7571
|
+
var MAX_AREA_IN_DEGREES = 90;
|
|
7572
|
+
var GETTER_DELAY = 50;
|
|
7573
|
+
/**
|
|
7574
|
+
* This is a batched "arbitrary data" getter.
|
|
7575
|
+
* You feed it an array of data, then it will emit that data in batches when the view changes.
|
|
7576
|
+
*/
|
|
7577
|
+
var BatchedDataGetter;
|
|
7578
|
+
(function (BatchedDataGetter) {
|
|
7579
|
+
var Getter = /** @class */ (function () {
|
|
7580
|
+
function Getter(data, viewPort, batchSize) {
|
|
7581
|
+
this.viewPortRemoval = null;
|
|
7582
|
+
this.viewRect = null;
|
|
7583
|
+
this.viewCenter = null;
|
|
7584
|
+
this.onUpdate = null;
|
|
7585
|
+
this.data = data;
|
|
7586
|
+
this.viewPort = viewPort;
|
|
7587
|
+
this.batchSize = batchSize;
|
|
7588
|
+
}
|
|
7589
|
+
Object.defineProperty(Getter.prototype, "OnUpdate", {
|
|
7590
|
+
get: function () {
|
|
7591
|
+
if (!this.onUpdate) {
|
|
7592
|
+
this.onUpdate = new bruceModels.BruceEvent();
|
|
7593
|
+
}
|
|
7594
|
+
return this.onUpdate;
|
|
7595
|
+
},
|
|
7596
|
+
enumerable: false,
|
|
7597
|
+
configurable: true
|
|
7598
|
+
});
|
|
7599
|
+
Getter.prototype.Start = function () {
|
|
7600
|
+
var _this = this;
|
|
7601
|
+
this.viewPortRemoval = this.viewPort.Updated().Subscribe(function () {
|
|
7602
|
+
_this.updateViewport();
|
|
7603
|
+
});
|
|
7604
|
+
this.updateViewport();
|
|
7605
|
+
};
|
|
7606
|
+
Getter.prototype.Dispose = function () {
|
|
7607
|
+
var _a;
|
|
7608
|
+
(_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7609
|
+
};
|
|
7610
|
+
Getter.prototype.updateViewport = function () {
|
|
7611
|
+
this.updateBounds();
|
|
7612
|
+
this.startGetterLoop();
|
|
7613
|
+
};
|
|
7614
|
+
Getter.prototype.updateBounds = function () {
|
|
7615
|
+
var viewRect = this.viewPort.GetBounds();
|
|
7616
|
+
var poi = this.viewPort.GetTarget();
|
|
7617
|
+
if (viewRect && poi) {
|
|
7618
|
+
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES) {
|
|
7619
|
+
return;
|
|
7620
|
+
}
|
|
7621
|
+
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES) {
|
|
7622
|
+
return;
|
|
7623
|
+
}
|
|
7624
|
+
this.viewRect = viewRect;
|
|
7625
|
+
this.viewCenter = poi;
|
|
7626
|
+
}
|
|
7627
|
+
};
|
|
7628
|
+
Getter.prototype.startGetterLoop = function () {
|
|
7629
|
+
var _this = this;
|
|
7630
|
+
clearInterval(this.getterInterval);
|
|
7631
|
+
if (!this.viewRect || !this.viewCenter) {
|
|
7632
|
+
return;
|
|
7633
|
+
}
|
|
7634
|
+
var index = 0;
|
|
7635
|
+
var onTick = function () {
|
|
7636
|
+
_this.processBatch(_this.data.slice(index, index + _this.batchSize));
|
|
7637
|
+
index += _this.batchSize;
|
|
7638
|
+
return index >= _this.data.length;
|
|
7639
|
+
};
|
|
7640
|
+
if (!onTick()) {
|
|
7641
|
+
this.getterInterval = setInterval(function () {
|
|
7642
|
+
if (onTick()) {
|
|
7643
|
+
clearInterval(_this.getterInterval);
|
|
7644
|
+
}
|
|
7645
|
+
}, GETTER_DELAY);
|
|
7646
|
+
}
|
|
7647
|
+
};
|
|
7648
|
+
Getter.prototype.processBatch = function (batch) {
|
|
7649
|
+
var _a;
|
|
7650
|
+
if (batch.length > 0) {
|
|
7651
|
+
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
|
|
7652
|
+
}
|
|
7653
|
+
};
|
|
7654
|
+
return Getter;
|
|
7655
|
+
}());
|
|
7656
|
+
BatchedDataGetter.Getter = Getter;
|
|
7657
|
+
})(BatchedDataGetter || (BatchedDataGetter = {}));
|
|
7658
|
+
|
|
7568
7659
|
var BATCH_SIZE$1 = 500;
|
|
7569
7660
|
var CHECK_BATCH_SIZE$1 = 250;
|
|
7570
7661
|
(function (EntitiesLoadedRenderManager) {
|
|
@@ -7688,7 +7779,7 @@
|
|
|
7688
7779
|
var _this = this;
|
|
7689
7780
|
var _a;
|
|
7690
7781
|
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7691
|
-
this.getter = new
|
|
7782
|
+
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
|
|
7692
7783
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
7693
7784
|
var _a;
|
|
7694
7785
|
for (var _i = 0, entities_1 = entities; _i < entities_1.length; _i++) {
|
|
@@ -7952,7 +8043,7 @@
|
|
|
7952
8043
|
}
|
|
7953
8044
|
];
|
|
7954
8045
|
}
|
|
7955
|
-
this.getter = new
|
|
8046
|
+
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
|
|
7956
8047
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
7957
8048
|
_this.onGetterUpdate(ids);
|
|
7958
8049
|
});
|
|
@@ -8172,7 +8263,7 @@
|
|
|
8172
8263
|
}
|
|
8173
8264
|
];
|
|
8174
8265
|
}
|
|
8175
|
-
this.getter = new
|
|
8266
|
+
this.getter = new BatchedDataGetter.Getter([this.item.BruceEntity.EntityId], this.monitor, 1);
|
|
8176
8267
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
8177
8268
|
_this.onGetterUpdate(ids[0]);
|
|
8178
8269
|
});
|
|
@@ -9576,6 +9667,521 @@
|
|
|
9576
9667
|
TilesetCadRenderManager.Manager = Manager;
|
|
9577
9668
|
})(exports.TilesetCadRenderManager || (exports.TilesetCadRenderManager = {}));
|
|
9578
9669
|
|
|
9670
|
+
/**
|
|
9671
|
+
* This is a helper for making entity requests based on a grid area.
|
|
9672
|
+
* It will return grid cells based on given view-area then will remember when stuff-
|
|
9673
|
+
* was fully-fetched for those cells to avoid making duplicate requests.
|
|
9674
|
+
*/
|
|
9675
|
+
var EntityGlobe;
|
|
9676
|
+
(function (EntityGlobe) {
|
|
9677
|
+
var Cell = /** @class */ (function () {
|
|
9678
|
+
function Cell() {
|
|
9679
|
+
this.Fetched = false;
|
|
9680
|
+
this.IsFetched = null;
|
|
9681
|
+
this.FetchPageIndex = 0;
|
|
9682
|
+
this.Boundaries = null;
|
|
9683
|
+
this.Fetching = false;
|
|
9684
|
+
}
|
|
9685
|
+
Cell.prototype.GetBounds = function () {
|
|
9686
|
+
// Entity data works in -180 to 180 range.
|
|
9687
|
+
function prepareRangeForBounds(range) {
|
|
9688
|
+
if (range > 180) {
|
|
9689
|
+
return range - 360;
|
|
9690
|
+
}
|
|
9691
|
+
return range;
|
|
9692
|
+
}
|
|
9693
|
+
// Add minor decimal as API crashes when giving it whole numbers.
|
|
9694
|
+
var maxLon = prepareRangeForBounds(this.Boundaries.maxLongitude) + 0.00001;
|
|
9695
|
+
var minLon = prepareRangeForBounds(this.Boundaries.minLongitude) - 0.00001;
|
|
9696
|
+
var maxLat = prepareRangeForBounds(this.Boundaries.maxLatitude) + 0.00001;
|
|
9697
|
+
var minLat = prepareRangeForBounds(this.Boundaries.minLatitude) - 0.00001;
|
|
9698
|
+
return {
|
|
9699
|
+
east: maxLon,
|
|
9700
|
+
north: maxLat,
|
|
9701
|
+
south: minLat,
|
|
9702
|
+
west: minLon
|
|
9703
|
+
};
|
|
9704
|
+
};
|
|
9705
|
+
return Cell;
|
|
9706
|
+
}());
|
|
9707
|
+
EntityGlobe.Cell = Cell;
|
|
9708
|
+
var Grid = /** @class */ (function () {
|
|
9709
|
+
function Grid() {
|
|
9710
|
+
this.cells = {};
|
|
9711
|
+
}
|
|
9712
|
+
Grid.prototype.GetCellsForView = function (cameraPos, viewRect) {
|
|
9713
|
+
var cells = [];
|
|
9714
|
+
var minLat = viewRect.south;
|
|
9715
|
+
var minLon = viewRect.west;
|
|
9716
|
+
var maxLat = viewRect.north;
|
|
9717
|
+
var maxLon = viewRect.east;
|
|
9718
|
+
var MAX_CELLS = 150;
|
|
9719
|
+
var cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
|
|
9720
|
+
var curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
|
|
9721
|
+
var curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
|
|
9722
|
+
// For larger views we add additional padding because our view-area culling is too strong.
|
|
9723
|
+
if (cellDegreeSize >= 2) {
|
|
9724
|
+
curMinLon -= cellDegreeSize;
|
|
9725
|
+
curMinLat -= cellDegreeSize;
|
|
9726
|
+
}
|
|
9727
|
+
var centerX = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.longitude;
|
|
9728
|
+
var centerY = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.latitude;
|
|
9729
|
+
if (isNaN(centerX) || isNaN(centerY)) {
|
|
9730
|
+
centerX = (minLon + maxLon) / 2;
|
|
9731
|
+
centerY = (minLat + maxLat) / 2;
|
|
9732
|
+
}
|
|
9733
|
+
var width = Math.ceil((maxLon - curMinLon) / cellDegreeSize);
|
|
9734
|
+
var height = Math.ceil((maxLat - curMinLat) / cellDegreeSize);
|
|
9735
|
+
// For larger views we add additional padding because our view-area culling is too strong.
|
|
9736
|
+
if (cellDegreeSize >= 2) {
|
|
9737
|
+
width += 1;
|
|
9738
|
+
height += 1;
|
|
9739
|
+
}
|
|
9740
|
+
var cellDistances = [];
|
|
9741
|
+
for (var x = 0; x < width; x++) {
|
|
9742
|
+
for (var y = 0; y < height; y++) {
|
|
9743
|
+
var lon = x * cellDegreeSize + curMinLon;
|
|
9744
|
+
var lat = y * cellDegreeSize + curMinLat;
|
|
9745
|
+
var cellCenterX = lon + cellDegreeSize / 2;
|
|
9746
|
+
var cellCenterY = lat + cellDegreeSize / 2;
|
|
9747
|
+
var dist = Math.sqrt(Math.pow(cellCenterX - centerX, 2) + Math.pow(cellCenterY - centerY, 2));
|
|
9748
|
+
cellDistances.push({ x: x, y: y, dist: dist });
|
|
9749
|
+
}
|
|
9750
|
+
}
|
|
9751
|
+
cellDistances.sort(function (a, b) { return a.dist - b.dist; });
|
|
9752
|
+
for (var _i = 0, cellDistances_1 = cellDistances; _i < cellDistances_1.length; _i++) {
|
|
9753
|
+
var _a = cellDistances_1[_i], x = _a.x, y = _a.y;
|
|
9754
|
+
var lon = x * cellDegreeSize + curMinLon;
|
|
9755
|
+
var lat = y * cellDegreeSize + curMinLat;
|
|
9756
|
+
var _b = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize), cell = _b[1];
|
|
9757
|
+
cells.push(cell);
|
|
9758
|
+
if (cells.length >= MAX_CELLS) {
|
|
9759
|
+
break;
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
return cells;
|
|
9763
|
+
};
|
|
9764
|
+
return Grid;
|
|
9765
|
+
}());
|
|
9766
|
+
EntityGlobe.Grid = Grid;
|
|
9767
|
+
})(EntityGlobe || (EntityGlobe = {}));
|
|
9768
|
+
function floorValueToCellSize(size, value) {
|
|
9769
|
+
return Math.floor(value / size) * size;
|
|
9770
|
+
}
|
|
9771
|
+
function getCellSizeFromHeight(height) {
|
|
9772
|
+
if (height < 1000) {
|
|
9773
|
+
return 0.01;
|
|
9774
|
+
}
|
|
9775
|
+
if (height < 5000) {
|
|
9776
|
+
return 0.025;
|
|
9777
|
+
}
|
|
9778
|
+
else if (height < 10000) {
|
|
9779
|
+
return 0.05;
|
|
9780
|
+
}
|
|
9781
|
+
else if (height < 30000) {
|
|
9782
|
+
return 0.1;
|
|
9783
|
+
}
|
|
9784
|
+
else if (height < 70000) {
|
|
9785
|
+
return 0.2;
|
|
9786
|
+
}
|
|
9787
|
+
else if (height < 100000) {
|
|
9788
|
+
return 0.3;
|
|
9789
|
+
}
|
|
9790
|
+
else if (height < 150000) {
|
|
9791
|
+
return 0.4;
|
|
9792
|
+
}
|
|
9793
|
+
else if (height < 200000) {
|
|
9794
|
+
return 0.5;
|
|
9795
|
+
}
|
|
9796
|
+
else if (height < 300000) {
|
|
9797
|
+
return 0.6;
|
|
9798
|
+
}
|
|
9799
|
+
else if (height < 500000) {
|
|
9800
|
+
return 1;
|
|
9801
|
+
}
|
|
9802
|
+
else if (height < 1000000) {
|
|
9803
|
+
return 1.3;
|
|
9804
|
+
}
|
|
9805
|
+
else if (height < 1200000) {
|
|
9806
|
+
return 1.8;
|
|
9807
|
+
}
|
|
9808
|
+
return 4;
|
|
9809
|
+
}
|
|
9810
|
+
function isCellFetched(cell) {
|
|
9811
|
+
if (cell.Fetched) {
|
|
9812
|
+
return true;
|
|
9813
|
+
}
|
|
9814
|
+
return false;
|
|
9815
|
+
}
|
|
9816
|
+
function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
|
|
9817
|
+
var id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
|
|
9818
|
+
var cell = cells[id];
|
|
9819
|
+
if (!cell) {
|
|
9820
|
+
cell = cells[id] = new EntityGlobe.Cell();
|
|
9821
|
+
cell.Boundaries = {
|
|
9822
|
+
minLatitude: lat,
|
|
9823
|
+
maxLatitude: maxLat,
|
|
9824
|
+
minLongitude: lon,
|
|
9825
|
+
maxLongitude: maxLon
|
|
9826
|
+
};
|
|
9827
|
+
cell.IsFetched = function () { return isCellFetched(cell); };
|
|
9828
|
+
}
|
|
9829
|
+
return [id, cell];
|
|
9830
|
+
}
|
|
9831
|
+
|
|
9832
|
+
var MAX_AREA_IN_DEGREES$1 = 90;
|
|
9833
|
+
var MAX_RETRY_ATTEMPTS = 1;
|
|
9834
|
+
var RETRY_DELAY_INCREMENT = 500;
|
|
9835
|
+
var REQUEST_PAGE_DELAY = 50;
|
|
9836
|
+
var regMenuItemGetter = /** @class */ (function () {
|
|
9837
|
+
function regMenuItemGetter(tagIds, minHeight, maxHeight) {
|
|
9838
|
+
this.TagIds = tagIds;
|
|
9839
|
+
this.MinHeight = minHeight;
|
|
9840
|
+
this.MaxHeight = maxHeight;
|
|
9841
|
+
}
|
|
9842
|
+
return regMenuItemGetter;
|
|
9843
|
+
}());
|
|
9844
|
+
function delay(milliseconds) {
|
|
9845
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9846
|
+
return __generator(this, function (_a) {
|
|
9847
|
+
return [2 /*return*/, new Promise(function (res) {
|
|
9848
|
+
setTimeout(function () {
|
|
9849
|
+
res();
|
|
9850
|
+
}, milliseconds);
|
|
9851
|
+
})];
|
|
9852
|
+
});
|
|
9853
|
+
});
|
|
9854
|
+
}
|
|
9855
|
+
/**
|
|
9856
|
+
* This is a batched entity getter.
|
|
9857
|
+
* It will scan for entity records in a view-area and emit them in batches.
|
|
9858
|
+
* It will restart scanning if the camera moves.
|
|
9859
|
+
*/
|
|
9860
|
+
var EntityFilterGetter;
|
|
9861
|
+
(function (EntityFilterGetter) {
|
|
9862
|
+
var EStatus;
|
|
9863
|
+
(function (EStatus) {
|
|
9864
|
+
EStatus["Scanning"] = "SCANNING";
|
|
9865
|
+
EStatus["Loading"] = "LOADING";
|
|
9866
|
+
})(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
|
|
9867
|
+
var Getter = /** @class */ (function () {
|
|
9868
|
+
function Getter(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
|
|
9869
|
+
this.onUpdate = null;
|
|
9870
|
+
this.LastStateUpdates = {};
|
|
9871
|
+
this.onStateUpdate = null;
|
|
9872
|
+
this.onScanUpdate = null;
|
|
9873
|
+
this.viewPortChangeRemoval = null;
|
|
9874
|
+
this.cells = null;
|
|
9875
|
+
this.registeredItems = {};
|
|
9876
|
+
this.getterLoopId = 0;
|
|
9877
|
+
this.tagIds = null;
|
|
9878
|
+
this.minHeight = 0;
|
|
9879
|
+
this.maxHeight = 100000;
|
|
9880
|
+
this.viewRect = null;
|
|
9881
|
+
this.viewCenter = null;
|
|
9882
|
+
this.api = api;
|
|
9883
|
+
this.typeId = typeId;
|
|
9884
|
+
this.viaCdn = Boolean(viaCdn);
|
|
9885
|
+
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
9886
|
+
this.viewPort = viewPort;
|
|
9887
|
+
this.attrFilter = attrFilter;
|
|
9888
|
+
this.updateBounds();
|
|
9889
|
+
}
|
|
9890
|
+
Object.defineProperty(Getter.prototype, "OnUpdate", {
|
|
9891
|
+
get: function () {
|
|
9892
|
+
if (!this.onUpdate) {
|
|
9893
|
+
this.onUpdate = new bruceModels.BruceEvent();
|
|
9894
|
+
}
|
|
9895
|
+
return this.onUpdate;
|
|
9896
|
+
},
|
|
9897
|
+
enumerable: false,
|
|
9898
|
+
configurable: true
|
|
9899
|
+
});
|
|
9900
|
+
Object.defineProperty(Getter.prototype, "OnStateUpdate", {
|
|
9901
|
+
get: function () {
|
|
9902
|
+
if (!this.onStateUpdate) {
|
|
9903
|
+
this.onStateUpdate = new bruceModels.BruceEvent();
|
|
9904
|
+
}
|
|
9905
|
+
return this.onStateUpdate;
|
|
9906
|
+
},
|
|
9907
|
+
enumerable: false,
|
|
9908
|
+
configurable: true
|
|
9909
|
+
});
|
|
9910
|
+
Object.defineProperty(Getter.prototype, "OnScanUpdate", {
|
|
9911
|
+
get: function () {
|
|
9912
|
+
if (!this.onScanUpdate) {
|
|
9913
|
+
this.onScanUpdate = new bruceModels.BruceEvent();
|
|
9914
|
+
}
|
|
9915
|
+
return this.onScanUpdate;
|
|
9916
|
+
},
|
|
9917
|
+
enumerable: false,
|
|
9918
|
+
configurable: true
|
|
9919
|
+
});
|
|
9920
|
+
/**
|
|
9921
|
+
* Returns id that represents the combined menu item parameters.
|
|
9922
|
+
* If integrity changes while a request is running, the request will not emit a response.
|
|
9923
|
+
* @returns
|
|
9924
|
+
*/
|
|
9925
|
+
Getter.prototype.getIntegrityId = function () {
|
|
9926
|
+
return this.tagIds == null ? "" : this.tagIds.join();
|
|
9927
|
+
};
|
|
9928
|
+
Getter.prototype.viewAreaSub = function () {
|
|
9929
|
+
var _this = this;
|
|
9930
|
+
this.viewAreaDispose();
|
|
9931
|
+
this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(function () {
|
|
9932
|
+
_this.updateBounds();
|
|
9933
|
+
_this.startGetterLoop();
|
|
9934
|
+
});
|
|
9935
|
+
};
|
|
9936
|
+
Getter.prototype.viewAreaDispose = function () {
|
|
9937
|
+
var _a;
|
|
9938
|
+
(_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
9939
|
+
};
|
|
9940
|
+
Getter.prototype.GetMenuItems = function () {
|
|
9941
|
+
return Object.keys(this.registeredItems);
|
|
9942
|
+
};
|
|
9943
|
+
Getter.prototype.IncludeMenuItem = function (menuItemId, layerIds, minHeight, maxHeight) {
|
|
9944
|
+
this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
|
|
9945
|
+
this.updateState();
|
|
9946
|
+
};
|
|
9947
|
+
Getter.prototype.ExcludeMenuItem = function (menuItemId) {
|
|
9948
|
+
this.registeredItems[menuItemId] = null;
|
|
9949
|
+
delete this.registeredItems[menuItemId];
|
|
9950
|
+
this.updateState();
|
|
9951
|
+
};
|
|
9952
|
+
Getter.prototype.updateBounds = function () {
|
|
9953
|
+
var viewRect = this.viewPort.GetBounds();
|
|
9954
|
+
var poi = this.viewPort.GetTarget();
|
|
9955
|
+
if (viewRect && poi) {
|
|
9956
|
+
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
|
|
9957
|
+
return;
|
|
9958
|
+
}
|
|
9959
|
+
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
|
|
9960
|
+
return;
|
|
9961
|
+
}
|
|
9962
|
+
this.viewRect = viewRect;
|
|
9963
|
+
this.viewCenter = poi;
|
|
9964
|
+
}
|
|
9965
|
+
};
|
|
9966
|
+
Getter.prototype.updateState = function () {
|
|
9967
|
+
var tagIds = [];
|
|
9968
|
+
var menuItemIds = this.GetMenuItems();
|
|
9969
|
+
var minHeight = null;
|
|
9970
|
+
var maxHeight = null;
|
|
9971
|
+
for (var i = 0; i < menuItemIds.length; i++) {
|
|
9972
|
+
var menuItem = this.registeredItems[menuItemIds[i]];
|
|
9973
|
+
if (menuItem) {
|
|
9974
|
+
if (maxHeight == null || maxHeight < menuItem.MaxHeight) {
|
|
9975
|
+
maxHeight = menuItem.MaxHeight;
|
|
9976
|
+
}
|
|
9977
|
+
if (minHeight == null || minHeight > menuItem.MinHeight) {
|
|
9978
|
+
minHeight = menuItem.MinHeight;
|
|
9979
|
+
}
|
|
9980
|
+
var itemLayerIds = menuItem.TagIds;
|
|
9981
|
+
if (itemLayerIds) {
|
|
9982
|
+
for (var j = 0; j < itemLayerIds.length; j++) {
|
|
9983
|
+
var itemLayerId = itemLayerIds[j];
|
|
9984
|
+
if (!tagIds.includes(itemLayerId)) {
|
|
9985
|
+
tagIds.push(itemLayerId);
|
|
9986
|
+
}
|
|
9987
|
+
}
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
}
|
|
9991
|
+
if (menuItemIds.length > 0) {
|
|
9992
|
+
// Reset cells so none are marked as fetched.
|
|
9993
|
+
this.cells = new EntityGlobe.Grid();
|
|
9994
|
+
this.tagIds = tagIds;
|
|
9995
|
+
this.minHeight = minHeight;
|
|
9996
|
+
this.maxHeight = maxHeight;
|
|
9997
|
+
this.updateBounds();
|
|
9998
|
+
this.startGetterLoop();
|
|
9999
|
+
this.viewAreaSub();
|
|
10000
|
+
}
|
|
10001
|
+
else {
|
|
10002
|
+
this.getterLoopId += 1;
|
|
10003
|
+
this.viewAreaDispose();
|
|
10004
|
+
}
|
|
10005
|
+
};
|
|
10006
|
+
Getter.prototype.postStatus = function (status) {
|
|
10007
|
+
var _a;
|
|
10008
|
+
this.LastStateUpdates[status.msg] = status;
|
|
10009
|
+
(_a = this.onStateUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(status);
|
|
10010
|
+
};
|
|
10011
|
+
Getter.prototype.startGetterLoop = function () {
|
|
10012
|
+
var _this = this;
|
|
10013
|
+
// Increase id so that existing loops stop.
|
|
10014
|
+
this.getterLoopId += 1;
|
|
10015
|
+
var loopId = this.getterLoopId;
|
|
10016
|
+
var loopIntegrity = this.getIntegrityId();
|
|
10017
|
+
new Promise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
10018
|
+
var MIN_HEIGHT, MAX_HEIGHT, PAGE_SIZE, retryAttempts, retryDelay, prevFirstId, prevLastId, prevTicks, alt, cells, curCellIndex, postedScanning, postedLoading, total, curCell, entities, integrity, first, last, e_1;
|
|
10019
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10020
|
+
return __generator(this, function (_j) {
|
|
10021
|
+
switch (_j.label) {
|
|
10022
|
+
case 0:
|
|
10023
|
+
// Minor delay to stop 50 menu items enabling doing their first request all together.
|
|
10024
|
+
// This gives it time to recognize only 1 request is needed.
|
|
10025
|
+
// Would be better to not use this delay but we're on a clock.
|
|
10026
|
+
return [4 /*yield*/, delay(100)];
|
|
10027
|
+
case 1:
|
|
10028
|
+
// Minor delay to stop 50 menu items enabling doing their first request all together.
|
|
10029
|
+
// This gives it time to recognize only 1 request is needed.
|
|
10030
|
+
// Would be better to not use this delay but we're on a clock.
|
|
10031
|
+
_j.sent();
|
|
10032
|
+
MIN_HEIGHT = this.minHeight;
|
|
10033
|
+
MAX_HEIGHT = this.maxHeight;
|
|
10034
|
+
PAGE_SIZE = this.batchSize;
|
|
10035
|
+
retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
10036
|
+
retryDelay = 0;
|
|
10037
|
+
prevFirstId = "";
|
|
10038
|
+
prevLastId = "";
|
|
10039
|
+
prevTicks = 0;
|
|
10040
|
+
_j.label = 2;
|
|
10041
|
+
case 2:
|
|
10042
|
+
if (!((!this.viewCenter || !this.viewRect) && this.getterLoopId == loopId)) return [3 /*break*/, 4];
|
|
10043
|
+
return [4 /*yield*/, delay(RETRY_DELAY_INCREMENT)];
|
|
10044
|
+
case 3:
|
|
10045
|
+
_j.sent();
|
|
10046
|
+
return [3 /*break*/, 2];
|
|
10047
|
+
case 4:
|
|
10048
|
+
if (this.getterLoopId != loopId) {
|
|
10049
|
+
return [2 /*return*/];
|
|
10050
|
+
}
|
|
10051
|
+
alt = this.viewRect.alt;
|
|
10052
|
+
if (alt > MAX_HEIGHT || (alt < MIN_HEIGHT && MIN_HEIGHT > 0)) {
|
|
10053
|
+
return [2 /*return*/];
|
|
10054
|
+
}
|
|
10055
|
+
cells = this.cells.GetCellsForView(this.viewCenter, this.viewRect);
|
|
10056
|
+
(_a = this.onScanUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(cells);
|
|
10057
|
+
curCellIndex = cells.length > 0 ? 0 : null;
|
|
10058
|
+
postedScanning = false;
|
|
10059
|
+
postedLoading = false;
|
|
10060
|
+
total = 0;
|
|
10061
|
+
_j.label = 5;
|
|
10062
|
+
case 5:
|
|
10063
|
+
if (!(retryAttempts > 0 && curCellIndex != null)) return [3 /*break*/, 13];
|
|
10064
|
+
if (!(retryDelay > 0)) return [3 /*break*/, 7];
|
|
10065
|
+
return [4 /*yield*/, delay(retryDelay)];
|
|
10066
|
+
case 6:
|
|
10067
|
+
_j.sent();
|
|
10068
|
+
_j.label = 7;
|
|
10069
|
+
case 7:
|
|
10070
|
+
if (this.getterLoopId != loopId) {
|
|
10071
|
+
return [3 /*break*/, 13];
|
|
10072
|
+
}
|
|
10073
|
+
if (!postedScanning) {
|
|
10074
|
+
this.postStatus({ msg: EStatus.Scanning, revoking: false });
|
|
10075
|
+
postedScanning = true;
|
|
10076
|
+
}
|
|
10077
|
+
curCell = cells[curCellIndex];
|
|
10078
|
+
if (curCell.IsFetched()) {
|
|
10079
|
+
curCell.Fetching = false;
|
|
10080
|
+
curCellIndex += 1;
|
|
10081
|
+
if (cells[curCellIndex]) {
|
|
10082
|
+
cells[curCellIndex].Fetching = true;
|
|
10083
|
+
}
|
|
10084
|
+
else {
|
|
10085
|
+
curCellIndex = null;
|
|
10086
|
+
}
|
|
10087
|
+
(_b = this.onScanUpdate) === null || _b === void 0 ? void 0 : _b.Trigger(cells);
|
|
10088
|
+
return [3 /*break*/, 5];
|
|
10089
|
+
}
|
|
10090
|
+
_j.label = 8;
|
|
10091
|
+
case 8:
|
|
10092
|
+
_j.trys.push([8, 10, , 11]);
|
|
10093
|
+
return [4 /*yield*/, bruceModels.Entity.GetList({
|
|
10094
|
+
api: this.api,
|
|
10095
|
+
filter: {
|
|
10096
|
+
pageSize: PAGE_SIZE,
|
|
10097
|
+
pageIndex: curCell.FetchPageIndex,
|
|
10098
|
+
entityTypeId: this.typeId,
|
|
10099
|
+
layerIds: this.tagIds,
|
|
10100
|
+
// Any tag specified will be allowed.
|
|
10101
|
+
layerIdsOperator: "in",
|
|
10102
|
+
bounds: curCell.GetBounds(),
|
|
10103
|
+
sortOrder: bruceModels.Api.ESortOrder.Asc,
|
|
10104
|
+
entityTypeConditions: this.attrFilter
|
|
10105
|
+
},
|
|
10106
|
+
viaCdn: this.viaCdn,
|
|
10107
|
+
req: {
|
|
10108
|
+
noCache: true
|
|
10109
|
+
}
|
|
10110
|
+
})];
|
|
10111
|
+
case 9:
|
|
10112
|
+
entities = (_j.sent()).entities;
|
|
10113
|
+
integrity = this.getIntegrityId();
|
|
10114
|
+
if (loopIntegrity == integrity && entities) {
|
|
10115
|
+
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
|
|
10116
|
+
}
|
|
10117
|
+
if (this.getterLoopId != loopId) {
|
|
10118
|
+
return [3 /*break*/, 13];
|
|
10119
|
+
}
|
|
10120
|
+
if (entities.length) {
|
|
10121
|
+
total += entities.length;
|
|
10122
|
+
}
|
|
10123
|
+
if (!postedLoading) {
|
|
10124
|
+
this.postStatus({ msg: EStatus.Loading, revoking: false });
|
|
10125
|
+
postedLoading = true;
|
|
10126
|
+
}
|
|
10127
|
+
// Only mark as fetched when ALL pages are done.
|
|
10128
|
+
// Known issue where external sources may return less than page size.
|
|
10129
|
+
// Right now we're making it as fetched as we're siding with the majority use-case.
|
|
10130
|
+
if (entities.length <= 0 || entities.length < PAGE_SIZE) {
|
|
10131
|
+
curCell.Fetched = true;
|
|
10132
|
+
curCell.Fetching = false;
|
|
10133
|
+
(_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
|
|
10134
|
+
return [3 /*break*/, 5];
|
|
10135
|
+
}
|
|
10136
|
+
// Checking to make sure it's not just the same batch over and over again.
|
|
10137
|
+
if (entities.length > 0) {
|
|
10138
|
+
first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
|
|
10139
|
+
last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
|
|
10140
|
+
if (prevFirstId == first && prevLastId == last) {
|
|
10141
|
+
prevTicks += 1;
|
|
10142
|
+
if (prevTicks > 3) {
|
|
10143
|
+
return [3 /*break*/, 13];
|
|
10144
|
+
}
|
|
10145
|
+
}
|
|
10146
|
+
else {
|
|
10147
|
+
prevFirstId = first;
|
|
10148
|
+
prevLastId = last;
|
|
10149
|
+
prevTicks = 0;
|
|
10150
|
+
}
|
|
10151
|
+
}
|
|
10152
|
+
curCell.FetchPageIndex++;
|
|
10153
|
+
// Request passed so let's assume it was server hiccup and refresh counts.
|
|
10154
|
+
retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
10155
|
+
retryDelay = 0;
|
|
10156
|
+
return [3 /*break*/, 11];
|
|
10157
|
+
case 10:
|
|
10158
|
+
e_1 = _j.sent();
|
|
10159
|
+
console.error(e_1);
|
|
10160
|
+
// Request failed so let's add a delay and try again soon.
|
|
10161
|
+
retryDelay += RETRY_DELAY_INCREMENT;
|
|
10162
|
+
retryAttempts -= 1;
|
|
10163
|
+
return [3 /*break*/, 11];
|
|
10164
|
+
case 11: return [4 /*yield*/, delay(REQUEST_PAGE_DELAY)];
|
|
10165
|
+
case 12:
|
|
10166
|
+
_j.sent();
|
|
10167
|
+
return [3 /*break*/, 5];
|
|
10168
|
+
case 13:
|
|
10169
|
+
if (postedLoading) {
|
|
10170
|
+
this.postStatus({ msg: EStatus.Loading, revoking: true });
|
|
10171
|
+
}
|
|
10172
|
+
if (postedScanning) {
|
|
10173
|
+
this.postStatus({ msg: EStatus.Scanning, revoking: true });
|
|
10174
|
+
}
|
|
10175
|
+
return [2 /*return*/];
|
|
10176
|
+
}
|
|
10177
|
+
});
|
|
10178
|
+
}); });
|
|
10179
|
+
};
|
|
10180
|
+
return Getter;
|
|
10181
|
+
}());
|
|
10182
|
+
EntityFilterGetter.Getter = Getter;
|
|
10183
|
+
})(EntityFilterGetter || (EntityFilterGetter = {}));
|
|
10184
|
+
|
|
9579
10185
|
function createFilterGetterCacheKey(params) {
|
|
9580
10186
|
var cacheKey = "";
|
|
9581
10187
|
cacheKey += params.api.GetBaseUrl();
|
|
@@ -9597,7 +10203,7 @@
|
|
|
9597
10203
|
var cacheKey = createFilterGetterCacheKey(params);
|
|
9598
10204
|
var getter = this.data[cacheKey];
|
|
9599
10205
|
if (!getter) {
|
|
9600
|
-
getter = new
|
|
10206
|
+
getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.cdn);
|
|
9601
10207
|
this.data[cacheKey] = getter;
|
|
9602
10208
|
if (params.viewer && params.debugShowBounds) {
|
|
9603
10209
|
// Cell id -> entity.
|
|
@@ -11678,7 +12284,7 @@
|
|
|
11678
12284
|
}
|
|
11679
12285
|
this.visualsRegister = visualsRegister;
|
|
11680
12286
|
this.sharedGetters = new exports.SharedGetters.Cache();
|
|
11681
|
-
this.sharedMonitor = new CesiumViewMonitor(this.viewer);
|
|
12287
|
+
this.sharedMonitor = new exports.CesiumViewMonitor.Monitor(this.viewer);
|
|
11682
12288
|
}
|
|
11683
12289
|
Object.defineProperty(Manager.prototype, "Getters", {
|
|
11684
12290
|
get: function () {
|
|
@@ -17510,10 +18116,9 @@
|
|
|
17510
18116
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
17511
18117
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
17512
18118
|
|
|
17513
|
-
var VERSION$1 = "
|
|
18119
|
+
var VERSION$1 = "3.0.0";
|
|
17514
18120
|
|
|
17515
18121
|
exports.VERSION = VERSION$1;
|
|
17516
|
-
exports.CesiumViewMonitor = CesiumViewMonitor;
|
|
17517
18122
|
exports.CesiumParabola = CesiumParabola;
|
|
17518
18123
|
exports.CESIUM_INSPECTOR_KEY = CESIUM_INSPECTOR_KEY;
|
|
17519
18124
|
exports.Draw3dPolygon = Draw3dPolygon;
|