bruce-cesium 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +85 -8
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +84 -7
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +50 -4
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +3 -3
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/viewer/cesium-view-monitor.js +31 -0
- package/dist/lib/viewer/cesium-view-monitor.js.map +1 -1
- package/dist/types/viewer/cesium-view-monitor.d.ts +3 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, BatchedDataGetter, EntityRelationType, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartesian2, Cartographic, Math as Math$1,
|
|
3
|
+
import { Cartesian2, Cartographic, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, JulianDate, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Cesium3DTileset, Matrix4, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -83,6 +83,7 @@ var CesiumViewMonitor = /** @class */ (function () {
|
|
|
83
83
|
this.bounds = null;
|
|
84
84
|
this.disposed = false;
|
|
85
85
|
this.updatedEvent = null;
|
|
86
|
+
this.entity = null;
|
|
86
87
|
this.viewer = viewer;
|
|
87
88
|
this.tryEmitUpdate();
|
|
88
89
|
this.checkInterval = setInterval(function () {
|
|
@@ -96,6 +97,34 @@ var CesiumViewMonitor = /** @class */ (function () {
|
|
|
96
97
|
enumerable: false,
|
|
97
98
|
configurable: true
|
|
98
99
|
});
|
|
100
|
+
CesiumViewMonitor.prototype.createEntity = function () {
|
|
101
|
+
var _this = this;
|
|
102
|
+
if (this.entity) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.entity = this.viewer.entities.add({
|
|
106
|
+
position: new CallbackProperty(function () {
|
|
107
|
+
return _this.target ? Cartesian3.fromDegrees(_this.target.longitude, _this.target.latitude) : null;
|
|
108
|
+
}, false),
|
|
109
|
+
point: {
|
|
110
|
+
pixelSize: 8,
|
|
111
|
+
color: Color.ORANGE
|
|
112
|
+
},
|
|
113
|
+
rectangle: {
|
|
114
|
+
coordinates: new CallbackProperty(function () {
|
|
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
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
CesiumViewMonitor.prototype.destroyEntity = function () {
|
|
123
|
+
if (this.entity && this.viewer.entities.contains(this.entity)) {
|
|
124
|
+
this.viewer.entities.remove(this.entity);
|
|
125
|
+
}
|
|
126
|
+
this.entity = null;
|
|
127
|
+
};
|
|
99
128
|
CesiumViewMonitor.prototype.Updated = function () {
|
|
100
129
|
if (!this.updatedEvent) {
|
|
101
130
|
this.updatedEvent = new BruceEvent();
|
|
@@ -117,6 +146,7 @@ var CesiumViewMonitor = /** @class */ (function () {
|
|
|
117
146
|
}
|
|
118
147
|
this.disposed = true;
|
|
119
148
|
clearInterval(this.checkInterval);
|
|
149
|
+
this.destroyEntity();
|
|
120
150
|
};
|
|
121
151
|
CesiumViewMonitor.prototype.tryDoUpdate = function () {
|
|
122
152
|
var _a;
|
|
@@ -205,6 +235,7 @@ var CesiumViewMonitor = /** @class */ (function () {
|
|
|
205
235
|
bounds: this.bounds,
|
|
206
236
|
target: this.target
|
|
207
237
|
};
|
|
238
|
+
//this.createEntity();
|
|
208
239
|
(_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
|
|
209
240
|
}
|
|
210
241
|
else if (searchResult == ESearchStatus.LocationMissing) {
|
|
@@ -2524,11 +2555,11 @@ var EntitiesRenderManager;
|
|
|
2524
2555
|
configurable: true
|
|
2525
2556
|
});
|
|
2526
2557
|
Manager.prototype.Init = function (params) {
|
|
2527
|
-
var _a, _b, _c, _d, _e;
|
|
2558
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2528
2559
|
return __awaiter(this, void 0, void 0, function () {
|
|
2529
2560
|
var isTagItem, tagsToRender, shouldRender, api, minMax;
|
|
2530
2561
|
var _this = this;
|
|
2531
|
-
return __generator(this, function (
|
|
2562
|
+
return __generator(this, function (_g) {
|
|
2532
2563
|
if (this.disposed) {
|
|
2533
2564
|
throw (new Error("This item is disposed."));
|
|
2534
2565
|
}
|
|
@@ -2567,7 +2598,7 @@ var EntitiesRenderManager;
|
|
|
2567
2598
|
typeId: this.item.BruceEntity["EntityType.ID"],
|
|
2568
2599
|
monitor: this.monitor,
|
|
2569
2600
|
viewer: this.viewer,
|
|
2570
|
-
debugShowBounds:
|
|
2601
|
+
debugShowBounds: Boolean((_f = window) === null || _f === void 0 ? void 0 : _f.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
|
|
2571
2602
|
cdn: this.item.cdnEnabled
|
|
2572
2603
|
});
|
|
2573
2604
|
minMax = RenderManager.GetZoomMinMax({
|
|
@@ -5655,22 +5686,68 @@ var SharedGetters;
|
|
|
5655
5686
|
getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.cdn);
|
|
5656
5687
|
this.data[cacheKey] = getter;
|
|
5657
5688
|
if (params.viewer && params.debugShowBounds) {
|
|
5689
|
+
// Cell id -> entity.
|
|
5690
|
+
var cellCache_1 = {};
|
|
5658
5691
|
getter.OnScanUpdate.Subscribe(function (cells) {
|
|
5692
|
+
if (window.ON_SCAN_UPDATE_PAUSED == true) {
|
|
5693
|
+
return;
|
|
5694
|
+
}
|
|
5695
|
+
var curCellIds = [];
|
|
5696
|
+
var fetchingCellId = null;
|
|
5697
|
+
var fetchedCells = {};
|
|
5659
5698
|
cells.forEach(function (cell) {
|
|
5699
|
+
var _a;
|
|
5660
5700
|
var bounds = cell.GetBounds();
|
|
5661
5701
|
var id = bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
|
|
5662
|
-
|
|
5702
|
+
curCellIds.push(id);
|
|
5703
|
+
fetchedCells[id] = cell.IsFetched();
|
|
5704
|
+
fetchingCellId = cell.Fetching ? id : fetchingCellId;
|
|
5705
|
+
var material = null;
|
|
5706
|
+
if (fetchedCells[id]) {
|
|
5707
|
+
material = Color.LIGHTGREEN.clone().withAlpha(0.3);
|
|
5708
|
+
}
|
|
5709
|
+
else if (fetchingCellId == id) {
|
|
5710
|
+
material = Color.LIGHTBLUE.clone().withAlpha(0.3);
|
|
5711
|
+
}
|
|
5712
|
+
else {
|
|
5713
|
+
material = Color.GOLD.clone().withAlpha(0.3);
|
|
5714
|
+
}
|
|
5715
|
+
if (cellCache_1[id]) {
|
|
5716
|
+
var rect_1 = (_a = cellCache_1[id]) === null || _a === void 0 ? void 0 : _a.rectangle;
|
|
5717
|
+
if (rect_1) {
|
|
5718
|
+
rect_1.material = material;
|
|
5719
|
+
}
|
|
5663
5720
|
return;
|
|
5664
5721
|
}
|
|
5665
5722
|
var rect = new Rectangle(Math$1.toRadians(bounds.west), Math$1.toRadians(bounds.south), Math$1.toRadians(bounds.east), Math$1.toRadians(bounds.north));
|
|
5666
|
-
params.viewer.entities.add(new Entity({
|
|
5723
|
+
var entity = params.viewer.entities.add(new Entity({
|
|
5667
5724
|
id: id,
|
|
5668
5725
|
rectangle: {
|
|
5669
5726
|
coordinates: rect,
|
|
5670
5727
|
fill: true,
|
|
5671
|
-
material: Color.fromRandom().withAlpha(0.3)
|
|
5672
|
-
|
|
5728
|
+
//material: Cesium.Color.fromRandom().withAlpha(0.3),
|
|
5729
|
+
material: material,
|
|
5730
|
+
zIndex: 0
|
|
5731
|
+
},
|
|
5732
|
+
// point: {
|
|
5733
|
+
// pixelSize: 15,
|
|
5734
|
+
// outlineColor: Cesium.Color.WHITE,
|
|
5735
|
+
// outlineWidth: 2,
|
|
5736
|
+
// color: Cesium.Color.fromRandom().withAlpha(0.5),
|
|
5737
|
+
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
|
|
5738
|
+
// },
|
|
5739
|
+
position: Cartesian3.fromRadians((rect.east + rect.west) / 2, (rect.north + rect.south) / 2)
|
|
5673
5740
|
}));
|
|
5741
|
+
cellCache_1[id] = entity;
|
|
5742
|
+
});
|
|
5743
|
+
Object.keys(cellCache_1).forEach(function (id) {
|
|
5744
|
+
if (curCellIds.indexOf(id) == -1) {
|
|
5745
|
+
var entity = cellCache_1[id];
|
|
5746
|
+
if (entity && params.viewer.entities.contains(entity)) {
|
|
5747
|
+
params.viewer.entities.remove(entity);
|
|
5748
|
+
}
|
|
5749
|
+
delete cellCache_1[id];
|
|
5750
|
+
}
|
|
5674
5751
|
});
|
|
5675
5752
|
});
|
|
5676
5753
|
}
|