bruce-cesium 2.9.7 → 2.9.9
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 +797 -183
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +798 -186
- 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-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/visual-register-culler.js +12 -5
- package/dist/lib/rendering/visual-register-culler.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/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-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/viewer/cesium-view-monitor.d.ts +32 -26
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BruceEvent, Cartes, ProjectViewTile, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue,
|
|
1
|
+
import { BruceEvent, Cartes, ProjectViewTile, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1,
|
|
3
|
+
import { Cartographic, JulianDate, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, SceneMode, HeadingPitchRange, Cesium3DTileColorBlendMode, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, PolygonPipeline, Cesium3DTileset, Matrix4, Matrix3, IonResource, Ion, EllipsoidTerrainProvider, CesiumInspector, defined, ColorMaterialProperty, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, ScreenSpaceEventHandler, ScreenSpaceEventType, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, BoundingSphere, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -73,191 +73,195 @@ function areBoundsEqual(a, b) {
|
|
|
73
73
|
function arePosEqual(a, b) {
|
|
74
74
|
return a.latitude == b.latitude && a.longitude == b.longitude;
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
get: function () {
|
|
95
|
-
return this.disposed;
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
CesiumViewMonitor.prototype.createEntity = function () {
|
|
101
|
-
var _this = this;
|
|
102
|
-
if (this.entity) {
|
|
103
|
-
return;
|
|
76
|
+
var CesiumViewMonitor;
|
|
77
|
+
(function (CesiumViewMonitor) {
|
|
78
|
+
/**
|
|
79
|
+
* Monitors and emits events when the Cesium view changes.
|
|
80
|
+
*/
|
|
81
|
+
var Monitor = /** @class */ (function () {
|
|
82
|
+
function Monitor(viewer) {
|
|
83
|
+
var _this = this;
|
|
84
|
+
this.target = null;
|
|
85
|
+
this.bounds = null;
|
|
86
|
+
this.disposed = false;
|
|
87
|
+
this.updatedEvent = null;
|
|
88
|
+
this.entity = null;
|
|
89
|
+
this.viewer = viewer;
|
|
90
|
+
this.tryEmitUpdate();
|
|
91
|
+
this.checkInterval = setInterval(function () {
|
|
92
|
+
_this.updateQueue();
|
|
93
|
+
}, POSITION_CHECK_TIMER);
|
|
104
94
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
}, false),
|
|
109
|
-
point: {
|
|
110
|
-
pixelSize: 8,
|
|
111
|
-
color: Color.ORANGE
|
|
95
|
+
Object.defineProperty(Monitor.prototype, "Disposed", {
|
|
96
|
+
get: function () {
|
|
97
|
+
return this.disposed;
|
|
112
98
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return _this.bounds ? Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
116
|
-
}, false),
|
|
117
|
-
material: Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
118
|
-
zIndex: 1
|
|
119
|
-
}
|
|
99
|
+
enumerable: false,
|
|
100
|
+
configurable: true
|
|
120
101
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
this.entity = null;
|
|
127
|
-
};
|
|
128
|
-
CesiumViewMonitor.prototype.Updated = function () {
|
|
129
|
-
if (!this.updatedEvent) {
|
|
130
|
-
this.updatedEvent = new BruceEvent();
|
|
131
|
-
}
|
|
132
|
-
return this.updatedEvent;
|
|
133
|
-
};
|
|
134
|
-
CesiumViewMonitor.prototype.GetBounds = function () {
|
|
135
|
-
return this.bounds;
|
|
136
|
-
};
|
|
137
|
-
CesiumViewMonitor.prototype.GetTarget = function () {
|
|
138
|
-
return this.target;
|
|
139
|
-
};
|
|
140
|
-
CesiumViewMonitor.prototype.DoUpdate = function () {
|
|
141
|
-
this.tryEmitUpdate();
|
|
142
|
-
};
|
|
143
|
-
CesiumViewMonitor.prototype.Dispose = function () {
|
|
144
|
-
if (this.disposed) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this.disposed = true;
|
|
148
|
-
clearInterval(this.checkInterval);
|
|
149
|
-
this.destroyEntity();
|
|
150
|
-
};
|
|
151
|
-
CesiumViewMonitor.prototype.tryDoUpdate = function () {
|
|
152
|
-
var _a;
|
|
153
|
-
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
154
|
-
this.Dispose();
|
|
155
|
-
return ESearchStatus.LocationMissing;
|
|
156
|
-
}
|
|
157
|
-
var viewRect = null;
|
|
158
|
-
var center = null;
|
|
159
|
-
var camera = this.viewer.camera;
|
|
160
|
-
var terrainHeight = this.viewer.scene.globe.getHeight(camera.positionCartographic);
|
|
161
|
-
var cameraPosition = this.viewer.camera.positionCartographic;
|
|
162
|
-
// We are almost at the ground, screw horizon, just load around.
|
|
163
|
-
if (terrainHeight && ((cameraPosition.height - terrainHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
164
|
-
// View area calculation.
|
|
165
|
-
viewRect = {};
|
|
166
|
-
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
167
|
-
if (viewRectRad &&
|
|
168
|
-
viewRectRad.east &&
|
|
169
|
-
viewRectRad.west &&
|
|
170
|
-
viewRectRad.north &&
|
|
171
|
-
viewRectRad.south) {
|
|
172
|
-
viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
173
|
-
viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
174
|
-
viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
175
|
-
viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
102
|
+
Monitor.prototype.createEntity = function () {
|
|
103
|
+
var _this = this;
|
|
104
|
+
if (this.entity) {
|
|
105
|
+
return;
|
|
176
106
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
107
|
+
this.entity = this.viewer.entities.add({
|
|
108
|
+
position: new CallbackProperty(function () {
|
|
109
|
+
return _this.target ? Cartesian3.fromDegrees(_this.target.longitude, _this.target.latitude) : null;
|
|
110
|
+
}, false),
|
|
111
|
+
point: {
|
|
112
|
+
pixelSize: 8,
|
|
113
|
+
color: Color.ORANGE
|
|
114
|
+
},
|
|
115
|
+
rectangle: {
|
|
116
|
+
coordinates: new CallbackProperty(function () {
|
|
117
|
+
return _this.bounds ? Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
118
|
+
}, false),
|
|
119
|
+
material: Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
120
|
+
zIndex: 1
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
Monitor.prototype.destroyEntity = function () {
|
|
125
|
+
if (this.entity && this.viewer.entities.contains(this.entity)) {
|
|
126
|
+
this.viewer.entities.remove(this.entity);
|
|
182
127
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// View area calculation.
|
|
189
|
-
var windowPosition = new Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
190
|
-
var intersection = getAdjustedGroundIntersectionOfCameraRay(this.viewer, windowPosition);
|
|
191
|
-
var point = null;
|
|
192
|
-
if (intersection) {
|
|
193
|
-
point = Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
128
|
+
this.entity = null;
|
|
129
|
+
};
|
|
130
|
+
Monitor.prototype.Updated = function () {
|
|
131
|
+
if (!this.updatedEvent) {
|
|
132
|
+
this.updatedEvent = new BruceEvent();
|
|
194
133
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
134
|
+
return this.updatedEvent;
|
|
135
|
+
};
|
|
136
|
+
Monitor.prototype.GetBounds = function () {
|
|
137
|
+
return this.bounds;
|
|
138
|
+
};
|
|
139
|
+
Monitor.prototype.GetTarget = function () {
|
|
140
|
+
return this.target;
|
|
141
|
+
};
|
|
142
|
+
Monitor.prototype.DoUpdate = function () {
|
|
143
|
+
this.tryEmitUpdate();
|
|
144
|
+
};
|
|
145
|
+
Monitor.prototype.Dispose = function () {
|
|
146
|
+
if (this.disposed) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.disposed = true;
|
|
150
|
+
clearInterval(this.checkInterval);
|
|
151
|
+
this.destroyEntity();
|
|
152
|
+
};
|
|
153
|
+
Monitor.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 = {};
|
|
199
168
|
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
200
|
-
if (viewRectRad
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
viewRect.
|
|
169
|
+
if (viewRectRad &&
|
|
170
|
+
viewRectRad.east &&
|
|
171
|
+
viewRectRad.west &&
|
|
172
|
+
viewRectRad.north &&
|
|
173
|
+
viewRectRad.south) {
|
|
174
|
+
viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
175
|
+
viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
176
|
+
viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
177
|
+
viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
viewRect.east = cameraPosition.longitude;
|
|
181
|
+
viewRect.west = cameraPosition.longitude;
|
|
182
|
+
viewRect.south = cameraPosition.latitude;
|
|
183
|
+
viewRect.north = cameraPosition.latitude;
|
|
206
184
|
}
|
|
185
|
+
center = {};
|
|
186
|
+
center.latitude = Math$1.toDegrees(camera.positionCartographic.latitude);
|
|
187
|
+
center.longitude = Math$1.toDegrees(camera.positionCartographic.longitude);
|
|
207
188
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
189
|
+
else {
|
|
190
|
+
// View area calculation.
|
|
191
|
+
var windowPosition = new 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 = Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
196
|
+
}
|
|
197
|
+
if (point) {
|
|
198
|
+
center = {};
|
|
199
|
+
center.latitude = Math$1.toDegrees(point.latitude);
|
|
200
|
+
center.longitude = Math$1.toDegrees(point.longitude);
|
|
201
|
+
var viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
202
|
+
if (viewRectRad) {
|
|
203
|
+
viewRect = {};
|
|
204
|
+
viewRect.east = Math$1.toDegrees(viewRectRad.east);
|
|
205
|
+
viewRect.west = Math$1.toDegrees(viewRectRad.west);
|
|
206
|
+
viewRect.south = Math$1.toDegrees(viewRectRad.south);
|
|
207
|
+
viewRect.north = Math$1.toDegrees(viewRectRad.north);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
225
210
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
};
|
|
245
|
-
CesiumViewMonitor.prototype.queuePosition = function (lag) {
|
|
246
|
-
var _this = this;
|
|
247
|
-
if (this.pendingTimeout) {
|
|
248
|
-
clearTimeout(this.pendingTimeout);
|
|
249
|
-
}
|
|
250
|
-
this.pendingTimeout = setTimeout(function () {
|
|
251
|
-
if (!_this.disposed) {
|
|
252
|
-
_this.tryEmitUpdate();
|
|
211
|
+
// Minimal field of view.
|
|
212
|
+
if (viewRect) {
|
|
213
|
+
var centerLong = (viewRect.east + viewRect.west) / 2;
|
|
214
|
+
var centerLat = (viewRect.north + viewRect.south) / 2;
|
|
215
|
+
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
216
|
+
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
217
|
+
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
218
|
+
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
219
|
+
viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
|
|
220
|
+
}
|
|
221
|
+
if (center && viewRect) {
|
|
222
|
+
if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
|
|
223
|
+
(!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
|
|
224
|
+
this.target = center;
|
|
225
|
+
this.bounds = viewRect;
|
|
226
|
+
return ESearchStatus.LocationChanged;
|
|
227
|
+
}
|
|
228
|
+
return ESearchStatus.LocationFound;
|
|
253
229
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
230
|
+
return ESearchStatus.LocationMissing;
|
|
231
|
+
};
|
|
232
|
+
Monitor.prototype.tryEmitUpdate = function () {
|
|
233
|
+
var _a;
|
|
234
|
+
var searchResult = this.tryDoUpdate();
|
|
235
|
+
if (searchResult == ESearchStatus.LocationChanged) {
|
|
236
|
+
var interest = {
|
|
237
|
+
bounds: this.bounds,
|
|
238
|
+
target: this.target
|
|
239
|
+
};
|
|
240
|
+
//this.createEntity();
|
|
241
|
+
(_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
|
|
242
|
+
}
|
|
243
|
+
else if (searchResult == ESearchStatus.LocationMissing) {
|
|
244
|
+
this.updateQueue();
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
Monitor.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();
|
|
255
|
+
}
|
|
256
|
+
}, lag);
|
|
257
|
+
};
|
|
258
|
+
Monitor.prototype.updateQueue = function () {
|
|
259
|
+
this.queuePosition(TIME_LAG);
|
|
260
|
+
};
|
|
261
|
+
return Monitor;
|
|
262
|
+
}());
|
|
263
|
+
CesiumViewMonitor.Monitor = Monitor;
|
|
264
|
+
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
261
265
|
|
|
262
266
|
/*! *****************************************************************************
|
|
263
267
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5052,7 +5056,7 @@ function getPositionsFromEntity(viewer, entity) {
|
|
|
5052
5056
|
var semiMinorAxis = getValue$2(viewer, entity.ellipse.semiMinorAxis);
|
|
5053
5057
|
var rotation = getValue$2(viewer, entity.ellipse.rotation);
|
|
5054
5058
|
// More subdivisions means a more accurate ellipse but worse performance.
|
|
5055
|
-
var numberOfSubdivisions =
|
|
5059
|
+
var numberOfSubdivisions = 5;
|
|
5056
5060
|
var positions = [];
|
|
5057
5061
|
for (var i = 0; i < numberOfSubdivisions; i++) {
|
|
5058
5062
|
var theta = i * (2 * Math.PI / numberOfSubdivisions);
|
|
@@ -5097,7 +5101,7 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5097
5101
|
if (positions) {
|
|
5098
5102
|
boundingSphere = computeBoundingSphereFromPositions(positions);
|
|
5099
5103
|
if (cEntity.model) {
|
|
5100
|
-
//
|
|
5104
|
+
// We don't know how large models are so we'll just add a tolerance.
|
|
5101
5105
|
boundingSphere.radius += Math.sqrt(MODEL_SIZE_TOLERANCE);
|
|
5102
5106
|
}
|
|
5103
5107
|
boundingSphereCache[cEntity.id] = boundingSphere;
|
|
@@ -5110,17 +5114,24 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5110
5114
|
var visibility = cullingVolume.computeVisibility(boundingSphere);
|
|
5111
5115
|
return visibility !== Intersect.INSIDE && visibility !== Intersect.INTERSECTING;
|
|
5112
5116
|
}
|
|
5117
|
+
// Amount of entities to check per interval.
|
|
5113
5118
|
var CHECK_BATCH = 500;
|
|
5114
|
-
var LAST_RECHECK_KEY = Symbol("LAST_RECHECK_KEY");
|
|
5115
5119
|
var checkInterval = null;
|
|
5116
5120
|
var checkWaiting = false;
|
|
5121
|
+
// We will store the last recheck data on the camera.
|
|
5122
|
+
// This will allow us to check if the camera has moved enough to warrant a recheck.
|
|
5123
|
+
var LAST_RECHECK_KEY = Symbol("LAST_RECHECK_KEY");
|
|
5117
5124
|
/**
|
|
5118
5125
|
* We will recheck if the camera has turned or moved enough.
|
|
5119
5126
|
* @param viewer
|
|
5120
5127
|
* @returns
|
|
5121
5128
|
*/
|
|
5122
5129
|
function shouldRecheck(viewer) {
|
|
5130
|
+
var _a;
|
|
5123
5131
|
var camera = viewer.scene.camera;
|
|
5132
|
+
if (!((_a = camera === null || camera === void 0 ? void 0 : camera.position) === null || _a === void 0 ? void 0 : _a.x)) {
|
|
5133
|
+
return false;
|
|
5134
|
+
}
|
|
5124
5135
|
var lastRecheck = camera[LAST_RECHECK_KEY];
|
|
5125
5136
|
if (!lastRecheck) {
|
|
5126
5137
|
camera[LAST_RECHECK_KEY] = {
|
|
@@ -5129,7 +5140,7 @@ function shouldRecheck(viewer) {
|
|
|
5129
5140
|
};
|
|
5130
5141
|
return true;
|
|
5131
5142
|
}
|
|
5132
|
-
var
|
|
5143
|
+
var _b = lastRecheck, position = _b.position, direction = _b.direction;
|
|
5133
5144
|
var posDiff = Cartesian3.magnitude(Cartesian3.subtract(position, camera.position, new Cartesian3()));
|
|
5134
5145
|
var dirDiff = Cartesian3.magnitude(Cartesian3.subtract(direction, camera.direction, new Cartesian3()));
|
|
5135
5146
|
var recheck = posDiff > 100 || dirDiff > 0.01;
|
|
@@ -5230,7 +5241,7 @@ var VisualRegisterCuller;
|
|
|
5230
5241
|
(_a = checkQueue.Call) === null || _a === void 0 ? void 0 : _a.call(checkQueue);
|
|
5231
5242
|
});
|
|
5232
5243
|
var RENDER_SECS_PASSED = 5;
|
|
5233
|
-
var updateRemoval = register.Viewer.scene.
|
|
5244
|
+
var updateRemoval = register.Viewer.scene.postUpdate.addEventListener(function () {
|
|
5234
5245
|
var _a;
|
|
5235
5246
|
var now = new Date();
|
|
5236
5247
|
if (lastCullCheck == null || (now.getTime() - lastCullCheck.getTime()) > RENDER_SECS_PASSED * 1000) {
|
|
@@ -7576,6 +7587,94 @@ var EntitiesRenderManager;
|
|
|
7576
7587
|
EntitiesRenderManager.Manager = Manager;
|
|
7577
7588
|
})(EntitiesRenderManager || (EntitiesRenderManager = {}));
|
|
7578
7589
|
|
|
7590
|
+
var MAX_AREA_IN_DEGREES = 90;
|
|
7591
|
+
var GETTER_DELAY = 50;
|
|
7592
|
+
/**
|
|
7593
|
+
* This is a batched "arbitrary data" getter.
|
|
7594
|
+
* You feed it an array of data, then it will emit that data in batches when the view changes.
|
|
7595
|
+
*/
|
|
7596
|
+
var BatchedDataGetter;
|
|
7597
|
+
(function (BatchedDataGetter) {
|
|
7598
|
+
var Getter = /** @class */ (function () {
|
|
7599
|
+
function Getter(data, viewPort, batchSize) {
|
|
7600
|
+
this.viewPortRemoval = null;
|
|
7601
|
+
this.viewRect = null;
|
|
7602
|
+
this.viewCenter = null;
|
|
7603
|
+
this.onUpdate = null;
|
|
7604
|
+
this.data = data;
|
|
7605
|
+
this.viewPort = viewPort;
|
|
7606
|
+
this.batchSize = batchSize;
|
|
7607
|
+
}
|
|
7608
|
+
Object.defineProperty(Getter.prototype, "OnUpdate", {
|
|
7609
|
+
get: function () {
|
|
7610
|
+
if (!this.onUpdate) {
|
|
7611
|
+
this.onUpdate = new BruceEvent();
|
|
7612
|
+
}
|
|
7613
|
+
return this.onUpdate;
|
|
7614
|
+
},
|
|
7615
|
+
enumerable: false,
|
|
7616
|
+
configurable: true
|
|
7617
|
+
});
|
|
7618
|
+
Getter.prototype.Start = function () {
|
|
7619
|
+
var _this = this;
|
|
7620
|
+
this.viewPortRemoval = this.viewPort.Updated().Subscribe(function () {
|
|
7621
|
+
_this.updateViewport();
|
|
7622
|
+
});
|
|
7623
|
+
this.updateViewport();
|
|
7624
|
+
};
|
|
7625
|
+
Getter.prototype.Dispose = function () {
|
|
7626
|
+
var _a;
|
|
7627
|
+
(_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7628
|
+
};
|
|
7629
|
+
Getter.prototype.updateViewport = function () {
|
|
7630
|
+
this.updateBounds();
|
|
7631
|
+
this.startGetterLoop();
|
|
7632
|
+
};
|
|
7633
|
+
Getter.prototype.updateBounds = function () {
|
|
7634
|
+
var viewRect = this.viewPort.GetBounds();
|
|
7635
|
+
var poi = this.viewPort.GetTarget();
|
|
7636
|
+
if (viewRect && poi) {
|
|
7637
|
+
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES) {
|
|
7638
|
+
return;
|
|
7639
|
+
}
|
|
7640
|
+
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES) {
|
|
7641
|
+
return;
|
|
7642
|
+
}
|
|
7643
|
+
this.viewRect = viewRect;
|
|
7644
|
+
this.viewCenter = poi;
|
|
7645
|
+
}
|
|
7646
|
+
};
|
|
7647
|
+
Getter.prototype.startGetterLoop = function () {
|
|
7648
|
+
var _this = this;
|
|
7649
|
+
clearInterval(this.getterInterval);
|
|
7650
|
+
if (!this.viewRect || !this.viewCenter) {
|
|
7651
|
+
return;
|
|
7652
|
+
}
|
|
7653
|
+
var index = 0;
|
|
7654
|
+
var onTick = function () {
|
|
7655
|
+
_this.processBatch(_this.data.slice(index, index + _this.batchSize));
|
|
7656
|
+
index += _this.batchSize;
|
|
7657
|
+
return index >= _this.data.length;
|
|
7658
|
+
};
|
|
7659
|
+
if (!onTick()) {
|
|
7660
|
+
this.getterInterval = setInterval(function () {
|
|
7661
|
+
if (onTick()) {
|
|
7662
|
+
clearInterval(_this.getterInterval);
|
|
7663
|
+
}
|
|
7664
|
+
}, GETTER_DELAY);
|
|
7665
|
+
}
|
|
7666
|
+
};
|
|
7667
|
+
Getter.prototype.processBatch = function (batch) {
|
|
7668
|
+
var _a;
|
|
7669
|
+
if (batch.length > 0) {
|
|
7670
|
+
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
|
|
7671
|
+
}
|
|
7672
|
+
};
|
|
7673
|
+
return Getter;
|
|
7674
|
+
}());
|
|
7675
|
+
BatchedDataGetter.Getter = Getter;
|
|
7676
|
+
})(BatchedDataGetter || (BatchedDataGetter = {}));
|
|
7677
|
+
|
|
7579
7678
|
var BATCH_SIZE$1 = 500;
|
|
7580
7679
|
var CHECK_BATCH_SIZE$1 = 250;
|
|
7581
7680
|
/**
|
|
@@ -9608,6 +9707,521 @@ var TilesetCadRenderManager;
|
|
|
9608
9707
|
TilesetCadRenderManager.Manager = Manager;
|
|
9609
9708
|
})(TilesetCadRenderManager || (TilesetCadRenderManager = {}));
|
|
9610
9709
|
|
|
9710
|
+
/**
|
|
9711
|
+
* This is a helper for making entity requests based on a grid area.
|
|
9712
|
+
* It will return grid cells based on given view-area then will remember when stuff-
|
|
9713
|
+
* was fully-fetched for those cells to avoid making duplicate requests.
|
|
9714
|
+
*/
|
|
9715
|
+
var EntityGlobe;
|
|
9716
|
+
(function (EntityGlobe) {
|
|
9717
|
+
var Cell = /** @class */ (function () {
|
|
9718
|
+
function Cell() {
|
|
9719
|
+
this.Fetched = false;
|
|
9720
|
+
this.IsFetched = null;
|
|
9721
|
+
this.FetchPageIndex = 0;
|
|
9722
|
+
this.Boundaries = null;
|
|
9723
|
+
this.Fetching = false;
|
|
9724
|
+
}
|
|
9725
|
+
Cell.prototype.GetBounds = function () {
|
|
9726
|
+
// Entity data works in -180 to 180 range.
|
|
9727
|
+
function prepareRangeForBounds(range) {
|
|
9728
|
+
if (range > 180) {
|
|
9729
|
+
return range - 360;
|
|
9730
|
+
}
|
|
9731
|
+
return range;
|
|
9732
|
+
}
|
|
9733
|
+
// Add minor decimal as API crashes when giving it whole numbers.
|
|
9734
|
+
var maxLon = prepareRangeForBounds(this.Boundaries.maxLongitude) + 0.00001;
|
|
9735
|
+
var minLon = prepareRangeForBounds(this.Boundaries.minLongitude) - 0.00001;
|
|
9736
|
+
var maxLat = prepareRangeForBounds(this.Boundaries.maxLatitude) + 0.00001;
|
|
9737
|
+
var minLat = prepareRangeForBounds(this.Boundaries.minLatitude) - 0.00001;
|
|
9738
|
+
return {
|
|
9739
|
+
east: maxLon,
|
|
9740
|
+
north: maxLat,
|
|
9741
|
+
south: minLat,
|
|
9742
|
+
west: minLon
|
|
9743
|
+
};
|
|
9744
|
+
};
|
|
9745
|
+
return Cell;
|
|
9746
|
+
}());
|
|
9747
|
+
EntityGlobe.Cell = Cell;
|
|
9748
|
+
var Grid = /** @class */ (function () {
|
|
9749
|
+
function Grid() {
|
|
9750
|
+
this.cells = {};
|
|
9751
|
+
}
|
|
9752
|
+
Grid.prototype.GetCellsForView = function (cameraPos, viewRect) {
|
|
9753
|
+
var cells = [];
|
|
9754
|
+
var minLat = viewRect.south;
|
|
9755
|
+
var minLon = viewRect.west;
|
|
9756
|
+
var maxLat = viewRect.north;
|
|
9757
|
+
var maxLon = viewRect.east;
|
|
9758
|
+
var MAX_CELLS = 150;
|
|
9759
|
+
var cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
|
|
9760
|
+
var curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
|
|
9761
|
+
var curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
|
|
9762
|
+
// For larger views we add additional padding because our view-area culling is too strong.
|
|
9763
|
+
if (cellDegreeSize >= 2) {
|
|
9764
|
+
curMinLon -= cellDegreeSize;
|
|
9765
|
+
curMinLat -= cellDegreeSize;
|
|
9766
|
+
}
|
|
9767
|
+
var centerX = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.longitude;
|
|
9768
|
+
var centerY = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.latitude;
|
|
9769
|
+
if (isNaN(centerX) || isNaN(centerY)) {
|
|
9770
|
+
centerX = (minLon + maxLon) / 2;
|
|
9771
|
+
centerY = (minLat + maxLat) / 2;
|
|
9772
|
+
}
|
|
9773
|
+
var width = Math.ceil((maxLon - curMinLon) / cellDegreeSize);
|
|
9774
|
+
var height = Math.ceil((maxLat - curMinLat) / cellDegreeSize);
|
|
9775
|
+
// For larger views we add additional padding because our view-area culling is too strong.
|
|
9776
|
+
if (cellDegreeSize >= 2) {
|
|
9777
|
+
width += 1;
|
|
9778
|
+
height += 1;
|
|
9779
|
+
}
|
|
9780
|
+
var cellDistances = [];
|
|
9781
|
+
for (var x = 0; x < width; x++) {
|
|
9782
|
+
for (var y = 0; y < height; y++) {
|
|
9783
|
+
var lon = x * cellDegreeSize + curMinLon;
|
|
9784
|
+
var lat = y * cellDegreeSize + curMinLat;
|
|
9785
|
+
var cellCenterX = lon + cellDegreeSize / 2;
|
|
9786
|
+
var cellCenterY = lat + cellDegreeSize / 2;
|
|
9787
|
+
var dist = Math.sqrt(Math.pow(cellCenterX - centerX, 2) + Math.pow(cellCenterY - centerY, 2));
|
|
9788
|
+
cellDistances.push({ x: x, y: y, dist: dist });
|
|
9789
|
+
}
|
|
9790
|
+
}
|
|
9791
|
+
cellDistances.sort(function (a, b) { return a.dist - b.dist; });
|
|
9792
|
+
for (var _i = 0, cellDistances_1 = cellDistances; _i < cellDistances_1.length; _i++) {
|
|
9793
|
+
var _a = cellDistances_1[_i], x = _a.x, y = _a.y;
|
|
9794
|
+
var lon = x * cellDegreeSize + curMinLon;
|
|
9795
|
+
var lat = y * cellDegreeSize + curMinLat;
|
|
9796
|
+
var _b = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize), cell = _b[1];
|
|
9797
|
+
cells.push(cell);
|
|
9798
|
+
if (cells.length >= MAX_CELLS) {
|
|
9799
|
+
break;
|
|
9800
|
+
}
|
|
9801
|
+
}
|
|
9802
|
+
return cells;
|
|
9803
|
+
};
|
|
9804
|
+
return Grid;
|
|
9805
|
+
}());
|
|
9806
|
+
EntityGlobe.Grid = Grid;
|
|
9807
|
+
})(EntityGlobe || (EntityGlobe = {}));
|
|
9808
|
+
function floorValueToCellSize(size, value) {
|
|
9809
|
+
return Math.floor(value / size) * size;
|
|
9810
|
+
}
|
|
9811
|
+
function getCellSizeFromHeight(height) {
|
|
9812
|
+
if (height < 1000) {
|
|
9813
|
+
return 0.01;
|
|
9814
|
+
}
|
|
9815
|
+
if (height < 5000) {
|
|
9816
|
+
return 0.025;
|
|
9817
|
+
}
|
|
9818
|
+
else if (height < 10000) {
|
|
9819
|
+
return 0.05;
|
|
9820
|
+
}
|
|
9821
|
+
else if (height < 30000) {
|
|
9822
|
+
return 0.1;
|
|
9823
|
+
}
|
|
9824
|
+
else if (height < 70000) {
|
|
9825
|
+
return 0.2;
|
|
9826
|
+
}
|
|
9827
|
+
else if (height < 100000) {
|
|
9828
|
+
return 0.3;
|
|
9829
|
+
}
|
|
9830
|
+
else if (height < 150000) {
|
|
9831
|
+
return 0.4;
|
|
9832
|
+
}
|
|
9833
|
+
else if (height < 200000) {
|
|
9834
|
+
return 0.5;
|
|
9835
|
+
}
|
|
9836
|
+
else if (height < 300000) {
|
|
9837
|
+
return 0.6;
|
|
9838
|
+
}
|
|
9839
|
+
else if (height < 500000) {
|
|
9840
|
+
return 1;
|
|
9841
|
+
}
|
|
9842
|
+
else if (height < 1000000) {
|
|
9843
|
+
return 1.3;
|
|
9844
|
+
}
|
|
9845
|
+
else if (height < 1200000) {
|
|
9846
|
+
return 1.8;
|
|
9847
|
+
}
|
|
9848
|
+
return 4;
|
|
9849
|
+
}
|
|
9850
|
+
function isCellFetched(cell) {
|
|
9851
|
+
if (cell.Fetched) {
|
|
9852
|
+
return true;
|
|
9853
|
+
}
|
|
9854
|
+
return false;
|
|
9855
|
+
}
|
|
9856
|
+
function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
|
|
9857
|
+
var id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
|
|
9858
|
+
var cell = cells[id];
|
|
9859
|
+
if (!cell) {
|
|
9860
|
+
cell = cells[id] = new EntityGlobe.Cell();
|
|
9861
|
+
cell.Boundaries = {
|
|
9862
|
+
minLatitude: lat,
|
|
9863
|
+
maxLatitude: maxLat,
|
|
9864
|
+
minLongitude: lon,
|
|
9865
|
+
maxLongitude: maxLon
|
|
9866
|
+
};
|
|
9867
|
+
cell.IsFetched = function () { return isCellFetched(cell); };
|
|
9868
|
+
}
|
|
9869
|
+
return [id, cell];
|
|
9870
|
+
}
|
|
9871
|
+
|
|
9872
|
+
var MAX_AREA_IN_DEGREES$1 = 90;
|
|
9873
|
+
var MAX_RETRY_ATTEMPTS = 1;
|
|
9874
|
+
var RETRY_DELAY_INCREMENT = 500;
|
|
9875
|
+
var REQUEST_PAGE_DELAY = 50;
|
|
9876
|
+
var regMenuItemGetter = /** @class */ (function () {
|
|
9877
|
+
function regMenuItemGetter(tagIds, minHeight, maxHeight) {
|
|
9878
|
+
this.TagIds = tagIds;
|
|
9879
|
+
this.MinHeight = minHeight;
|
|
9880
|
+
this.MaxHeight = maxHeight;
|
|
9881
|
+
}
|
|
9882
|
+
return regMenuItemGetter;
|
|
9883
|
+
}());
|
|
9884
|
+
function delay(milliseconds) {
|
|
9885
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9886
|
+
return __generator(this, function (_a) {
|
|
9887
|
+
return [2 /*return*/, new Promise(function (res) {
|
|
9888
|
+
setTimeout(function () {
|
|
9889
|
+
res();
|
|
9890
|
+
}, milliseconds);
|
|
9891
|
+
})];
|
|
9892
|
+
});
|
|
9893
|
+
});
|
|
9894
|
+
}
|
|
9895
|
+
/**
|
|
9896
|
+
* This is a batched entity getter.
|
|
9897
|
+
* It will scan for entity records in a view-area and emit them in batches.
|
|
9898
|
+
* It will restart scanning if the camera moves.
|
|
9899
|
+
*/
|
|
9900
|
+
var EntityFilterGetter;
|
|
9901
|
+
(function (EntityFilterGetter) {
|
|
9902
|
+
var EStatus;
|
|
9903
|
+
(function (EStatus) {
|
|
9904
|
+
EStatus["Scanning"] = "SCANNING";
|
|
9905
|
+
EStatus["Loading"] = "LOADING";
|
|
9906
|
+
})(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
|
|
9907
|
+
var Getter = /** @class */ (function () {
|
|
9908
|
+
function Getter(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
|
|
9909
|
+
this.onUpdate = null;
|
|
9910
|
+
this.LastStateUpdates = {};
|
|
9911
|
+
this.onStateUpdate = null;
|
|
9912
|
+
this.onScanUpdate = null;
|
|
9913
|
+
this.viewPortChangeRemoval = null;
|
|
9914
|
+
this.cells = null;
|
|
9915
|
+
this.registeredItems = {};
|
|
9916
|
+
this.getterLoopId = 0;
|
|
9917
|
+
this.tagIds = null;
|
|
9918
|
+
this.minHeight = 0;
|
|
9919
|
+
this.maxHeight = 100000;
|
|
9920
|
+
this.viewRect = null;
|
|
9921
|
+
this.viewCenter = null;
|
|
9922
|
+
this.api = api;
|
|
9923
|
+
this.typeId = typeId;
|
|
9924
|
+
this.viaCdn = Boolean(viaCdn);
|
|
9925
|
+
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
9926
|
+
this.viewPort = viewPort;
|
|
9927
|
+
this.attrFilter = attrFilter;
|
|
9928
|
+
this.updateBounds();
|
|
9929
|
+
}
|
|
9930
|
+
Object.defineProperty(Getter.prototype, "OnUpdate", {
|
|
9931
|
+
get: function () {
|
|
9932
|
+
if (!this.onUpdate) {
|
|
9933
|
+
this.onUpdate = new BruceEvent();
|
|
9934
|
+
}
|
|
9935
|
+
return this.onUpdate;
|
|
9936
|
+
},
|
|
9937
|
+
enumerable: false,
|
|
9938
|
+
configurable: true
|
|
9939
|
+
});
|
|
9940
|
+
Object.defineProperty(Getter.prototype, "OnStateUpdate", {
|
|
9941
|
+
get: function () {
|
|
9942
|
+
if (!this.onStateUpdate) {
|
|
9943
|
+
this.onStateUpdate = new BruceEvent();
|
|
9944
|
+
}
|
|
9945
|
+
return this.onStateUpdate;
|
|
9946
|
+
},
|
|
9947
|
+
enumerable: false,
|
|
9948
|
+
configurable: true
|
|
9949
|
+
});
|
|
9950
|
+
Object.defineProperty(Getter.prototype, "OnScanUpdate", {
|
|
9951
|
+
get: function () {
|
|
9952
|
+
if (!this.onScanUpdate) {
|
|
9953
|
+
this.onScanUpdate = new BruceEvent();
|
|
9954
|
+
}
|
|
9955
|
+
return this.onScanUpdate;
|
|
9956
|
+
},
|
|
9957
|
+
enumerable: false,
|
|
9958
|
+
configurable: true
|
|
9959
|
+
});
|
|
9960
|
+
/**
|
|
9961
|
+
* Returns id that represents the combined menu item parameters.
|
|
9962
|
+
* If integrity changes while a request is running, the request will not emit a response.
|
|
9963
|
+
* @returns
|
|
9964
|
+
*/
|
|
9965
|
+
Getter.prototype.getIntegrityId = function () {
|
|
9966
|
+
return this.tagIds == null ? "" : this.tagIds.join();
|
|
9967
|
+
};
|
|
9968
|
+
Getter.prototype.viewAreaSub = function () {
|
|
9969
|
+
var _this = this;
|
|
9970
|
+
this.viewAreaDispose();
|
|
9971
|
+
this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(function () {
|
|
9972
|
+
_this.updateBounds();
|
|
9973
|
+
_this.startGetterLoop();
|
|
9974
|
+
});
|
|
9975
|
+
};
|
|
9976
|
+
Getter.prototype.viewAreaDispose = function () {
|
|
9977
|
+
var _a;
|
|
9978
|
+
(_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
9979
|
+
};
|
|
9980
|
+
Getter.prototype.GetMenuItems = function () {
|
|
9981
|
+
return Object.keys(this.registeredItems);
|
|
9982
|
+
};
|
|
9983
|
+
Getter.prototype.IncludeMenuItem = function (menuItemId, layerIds, minHeight, maxHeight) {
|
|
9984
|
+
this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
|
|
9985
|
+
this.updateState();
|
|
9986
|
+
};
|
|
9987
|
+
Getter.prototype.ExcludeMenuItem = function (menuItemId) {
|
|
9988
|
+
this.registeredItems[menuItemId] = null;
|
|
9989
|
+
delete this.registeredItems[menuItemId];
|
|
9990
|
+
this.updateState();
|
|
9991
|
+
};
|
|
9992
|
+
Getter.prototype.updateBounds = function () {
|
|
9993
|
+
var viewRect = this.viewPort.GetBounds();
|
|
9994
|
+
var poi = this.viewPort.GetTarget();
|
|
9995
|
+
if (viewRect && poi) {
|
|
9996
|
+
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
|
|
9997
|
+
return;
|
|
9998
|
+
}
|
|
9999
|
+
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
|
|
10000
|
+
return;
|
|
10001
|
+
}
|
|
10002
|
+
this.viewRect = viewRect;
|
|
10003
|
+
this.viewCenter = poi;
|
|
10004
|
+
}
|
|
10005
|
+
};
|
|
10006
|
+
Getter.prototype.updateState = function () {
|
|
10007
|
+
var tagIds = [];
|
|
10008
|
+
var menuItemIds = this.GetMenuItems();
|
|
10009
|
+
var minHeight = null;
|
|
10010
|
+
var maxHeight = null;
|
|
10011
|
+
for (var i = 0; i < menuItemIds.length; i++) {
|
|
10012
|
+
var menuItem = this.registeredItems[menuItemIds[i]];
|
|
10013
|
+
if (menuItem) {
|
|
10014
|
+
if (maxHeight == null || maxHeight < menuItem.MaxHeight) {
|
|
10015
|
+
maxHeight = menuItem.MaxHeight;
|
|
10016
|
+
}
|
|
10017
|
+
if (minHeight == null || minHeight > menuItem.MinHeight) {
|
|
10018
|
+
minHeight = menuItem.MinHeight;
|
|
10019
|
+
}
|
|
10020
|
+
var itemLayerIds = menuItem.TagIds;
|
|
10021
|
+
if (itemLayerIds) {
|
|
10022
|
+
for (var j = 0; j < itemLayerIds.length; j++) {
|
|
10023
|
+
var itemLayerId = itemLayerIds[j];
|
|
10024
|
+
if (!tagIds.includes(itemLayerId)) {
|
|
10025
|
+
tagIds.push(itemLayerId);
|
|
10026
|
+
}
|
|
10027
|
+
}
|
|
10028
|
+
}
|
|
10029
|
+
}
|
|
10030
|
+
}
|
|
10031
|
+
if (menuItemIds.length > 0) {
|
|
10032
|
+
// Reset cells so none are marked as fetched.
|
|
10033
|
+
this.cells = new EntityGlobe.Grid();
|
|
10034
|
+
this.tagIds = tagIds;
|
|
10035
|
+
this.minHeight = minHeight;
|
|
10036
|
+
this.maxHeight = maxHeight;
|
|
10037
|
+
this.updateBounds();
|
|
10038
|
+
this.startGetterLoop();
|
|
10039
|
+
this.viewAreaSub();
|
|
10040
|
+
}
|
|
10041
|
+
else {
|
|
10042
|
+
this.getterLoopId += 1;
|
|
10043
|
+
this.viewAreaDispose();
|
|
10044
|
+
}
|
|
10045
|
+
};
|
|
10046
|
+
Getter.prototype.postStatus = function (status) {
|
|
10047
|
+
var _a;
|
|
10048
|
+
this.LastStateUpdates[status.msg] = status;
|
|
10049
|
+
(_a = this.onStateUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(status);
|
|
10050
|
+
};
|
|
10051
|
+
Getter.prototype.startGetterLoop = function () {
|
|
10052
|
+
var _this = this;
|
|
10053
|
+
// Increase id so that existing loops stop.
|
|
10054
|
+
this.getterLoopId += 1;
|
|
10055
|
+
var loopId = this.getterLoopId;
|
|
10056
|
+
var loopIntegrity = this.getIntegrityId();
|
|
10057
|
+
new Promise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
10058
|
+
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;
|
|
10059
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10060
|
+
return __generator(this, function (_j) {
|
|
10061
|
+
switch (_j.label) {
|
|
10062
|
+
case 0:
|
|
10063
|
+
// Minor delay to stop 50 menu items enabling doing their first request all together.
|
|
10064
|
+
// This gives it time to recognize only 1 request is needed.
|
|
10065
|
+
// Would be better to not use this delay but we're on a clock.
|
|
10066
|
+
return [4 /*yield*/, delay(100)];
|
|
10067
|
+
case 1:
|
|
10068
|
+
// Minor delay to stop 50 menu items enabling doing their first request all together.
|
|
10069
|
+
// This gives it time to recognize only 1 request is needed.
|
|
10070
|
+
// Would be better to not use this delay but we're on a clock.
|
|
10071
|
+
_j.sent();
|
|
10072
|
+
MIN_HEIGHT = this.minHeight;
|
|
10073
|
+
MAX_HEIGHT = this.maxHeight;
|
|
10074
|
+
PAGE_SIZE = this.batchSize;
|
|
10075
|
+
retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
10076
|
+
retryDelay = 0;
|
|
10077
|
+
prevFirstId = "";
|
|
10078
|
+
prevLastId = "";
|
|
10079
|
+
prevTicks = 0;
|
|
10080
|
+
_j.label = 2;
|
|
10081
|
+
case 2:
|
|
10082
|
+
if (!((!this.viewCenter || !this.viewRect) && this.getterLoopId == loopId)) return [3 /*break*/, 4];
|
|
10083
|
+
return [4 /*yield*/, delay(RETRY_DELAY_INCREMENT)];
|
|
10084
|
+
case 3:
|
|
10085
|
+
_j.sent();
|
|
10086
|
+
return [3 /*break*/, 2];
|
|
10087
|
+
case 4:
|
|
10088
|
+
if (this.getterLoopId != loopId) {
|
|
10089
|
+
return [2 /*return*/];
|
|
10090
|
+
}
|
|
10091
|
+
alt = this.viewRect.alt;
|
|
10092
|
+
if (alt > MAX_HEIGHT || (alt < MIN_HEIGHT && MIN_HEIGHT > 0)) {
|
|
10093
|
+
return [2 /*return*/];
|
|
10094
|
+
}
|
|
10095
|
+
cells = this.cells.GetCellsForView(this.viewCenter, this.viewRect);
|
|
10096
|
+
(_a = this.onScanUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(cells);
|
|
10097
|
+
curCellIndex = cells.length > 0 ? 0 : null;
|
|
10098
|
+
postedScanning = false;
|
|
10099
|
+
postedLoading = false;
|
|
10100
|
+
total = 0;
|
|
10101
|
+
_j.label = 5;
|
|
10102
|
+
case 5:
|
|
10103
|
+
if (!(retryAttempts > 0 && curCellIndex != null)) return [3 /*break*/, 13];
|
|
10104
|
+
if (!(retryDelay > 0)) return [3 /*break*/, 7];
|
|
10105
|
+
return [4 /*yield*/, delay(retryDelay)];
|
|
10106
|
+
case 6:
|
|
10107
|
+
_j.sent();
|
|
10108
|
+
_j.label = 7;
|
|
10109
|
+
case 7:
|
|
10110
|
+
if (this.getterLoopId != loopId) {
|
|
10111
|
+
return [3 /*break*/, 13];
|
|
10112
|
+
}
|
|
10113
|
+
if (!postedScanning) {
|
|
10114
|
+
this.postStatus({ msg: EStatus.Scanning, revoking: false });
|
|
10115
|
+
postedScanning = true;
|
|
10116
|
+
}
|
|
10117
|
+
curCell = cells[curCellIndex];
|
|
10118
|
+
if (curCell.IsFetched()) {
|
|
10119
|
+
curCell.Fetching = false;
|
|
10120
|
+
curCellIndex += 1;
|
|
10121
|
+
if (cells[curCellIndex]) {
|
|
10122
|
+
cells[curCellIndex].Fetching = true;
|
|
10123
|
+
}
|
|
10124
|
+
else {
|
|
10125
|
+
curCellIndex = null;
|
|
10126
|
+
}
|
|
10127
|
+
(_b = this.onScanUpdate) === null || _b === void 0 ? void 0 : _b.Trigger(cells);
|
|
10128
|
+
return [3 /*break*/, 5];
|
|
10129
|
+
}
|
|
10130
|
+
_j.label = 8;
|
|
10131
|
+
case 8:
|
|
10132
|
+
_j.trys.push([8, 10, , 11]);
|
|
10133
|
+
return [4 /*yield*/, Entity$1.GetList({
|
|
10134
|
+
api: this.api,
|
|
10135
|
+
filter: {
|
|
10136
|
+
pageSize: PAGE_SIZE,
|
|
10137
|
+
pageIndex: curCell.FetchPageIndex,
|
|
10138
|
+
entityTypeId: this.typeId,
|
|
10139
|
+
layerIds: this.tagIds,
|
|
10140
|
+
// Any tag specified will be allowed.
|
|
10141
|
+
layerIdsOperator: "in",
|
|
10142
|
+
bounds: curCell.GetBounds(),
|
|
10143
|
+
sortOrder: Api.ESortOrder.Asc,
|
|
10144
|
+
entityTypeConditions: this.attrFilter
|
|
10145
|
+
},
|
|
10146
|
+
viaCdn: this.viaCdn,
|
|
10147
|
+
req: {
|
|
10148
|
+
noCache: true
|
|
10149
|
+
}
|
|
10150
|
+
})];
|
|
10151
|
+
case 9:
|
|
10152
|
+
entities = (_j.sent()).entities;
|
|
10153
|
+
integrity = this.getIntegrityId();
|
|
10154
|
+
if (loopIntegrity == integrity && entities) {
|
|
10155
|
+
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
|
|
10156
|
+
}
|
|
10157
|
+
if (this.getterLoopId != loopId) {
|
|
10158
|
+
return [3 /*break*/, 13];
|
|
10159
|
+
}
|
|
10160
|
+
if (entities.length) {
|
|
10161
|
+
total += entities.length;
|
|
10162
|
+
}
|
|
10163
|
+
if (!postedLoading) {
|
|
10164
|
+
this.postStatus({ msg: EStatus.Loading, revoking: false });
|
|
10165
|
+
postedLoading = true;
|
|
10166
|
+
}
|
|
10167
|
+
// Only mark as fetched when ALL pages are done.
|
|
10168
|
+
// Known issue where external sources may return less than page size.
|
|
10169
|
+
// Right now we're making it as fetched as we're siding with the majority use-case.
|
|
10170
|
+
if (entities.length <= 0 || entities.length < PAGE_SIZE) {
|
|
10171
|
+
curCell.Fetched = true;
|
|
10172
|
+
curCell.Fetching = false;
|
|
10173
|
+
(_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
|
|
10174
|
+
return [3 /*break*/, 5];
|
|
10175
|
+
}
|
|
10176
|
+
// Checking to make sure it's not just the same batch over and over again.
|
|
10177
|
+
if (entities.length > 0) {
|
|
10178
|
+
first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
|
|
10179
|
+
last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
|
|
10180
|
+
if (prevFirstId == first && prevLastId == last) {
|
|
10181
|
+
prevTicks += 1;
|
|
10182
|
+
if (prevTicks > 3) {
|
|
10183
|
+
return [3 /*break*/, 13];
|
|
10184
|
+
}
|
|
10185
|
+
}
|
|
10186
|
+
else {
|
|
10187
|
+
prevFirstId = first;
|
|
10188
|
+
prevLastId = last;
|
|
10189
|
+
prevTicks = 0;
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
curCell.FetchPageIndex++;
|
|
10193
|
+
// Request passed so let's assume it was server hiccup and refresh counts.
|
|
10194
|
+
retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
10195
|
+
retryDelay = 0;
|
|
10196
|
+
return [3 /*break*/, 11];
|
|
10197
|
+
case 10:
|
|
10198
|
+
e_1 = _j.sent();
|
|
10199
|
+
console.error(e_1);
|
|
10200
|
+
// Request failed so let's add a delay and try again soon.
|
|
10201
|
+
retryDelay += RETRY_DELAY_INCREMENT;
|
|
10202
|
+
retryAttempts -= 1;
|
|
10203
|
+
return [3 /*break*/, 11];
|
|
10204
|
+
case 11: return [4 /*yield*/, delay(REQUEST_PAGE_DELAY)];
|
|
10205
|
+
case 12:
|
|
10206
|
+
_j.sent();
|
|
10207
|
+
return [3 /*break*/, 5];
|
|
10208
|
+
case 13:
|
|
10209
|
+
if (postedLoading) {
|
|
10210
|
+
this.postStatus({ msg: EStatus.Loading, revoking: true });
|
|
10211
|
+
}
|
|
10212
|
+
if (postedScanning) {
|
|
10213
|
+
this.postStatus({ msg: EStatus.Scanning, revoking: true });
|
|
10214
|
+
}
|
|
10215
|
+
return [2 /*return*/];
|
|
10216
|
+
}
|
|
10217
|
+
});
|
|
10218
|
+
}); });
|
|
10219
|
+
};
|
|
10220
|
+
return Getter;
|
|
10221
|
+
}());
|
|
10222
|
+
EntityFilterGetter.Getter = Getter;
|
|
10223
|
+
})(EntityFilterGetter || (EntityFilterGetter = {}));
|
|
10224
|
+
|
|
9611
10225
|
function createFilterGetterCacheKey(params) {
|
|
9612
10226
|
var cacheKey = "";
|
|
9613
10227
|
cacheKey += params.api.GetBaseUrl();
|
|
@@ -11722,7 +12336,7 @@ var MenuItemManager;
|
|
|
11722
12336
|
}
|
|
11723
12337
|
this.visualsRegister = visualsRegister;
|
|
11724
12338
|
this.sharedGetters = new SharedGetters.Cache();
|
|
11725
|
-
this.sharedMonitor = new CesiumViewMonitor(this.viewer);
|
|
12339
|
+
this.sharedMonitor = new CesiumViewMonitor.Monitor(this.viewer);
|
|
11726
12340
|
}
|
|
11727
12341
|
Object.defineProperty(Manager.prototype, "Getters", {
|
|
11728
12342
|
get: function () {
|
|
@@ -17561,7 +18175,7 @@ var ViewerUtils;
|
|
|
17561
18175
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
17562
18176
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
17563
18177
|
|
|
17564
|
-
var VERSION$1 = "2.9.
|
|
18178
|
+
var VERSION$1 = "2.9.9";
|
|
17565
18179
|
|
|
17566
18180
|
export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
|
|
17567
18181
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|