bruce-cesium 4.1.9 → 4.2.1
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 +461 -318
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +460 -317
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +46 -44
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +64 -36
- 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 +53 -36
- 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 +68 -40
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/utils/simplify-geometry.js +250 -160
- package/dist/lib/utils/simplify-geometry.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/utils/simplify-geometry.d.ts +3 -2
- 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, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, HeadingPitchRange, Ion, Cesium3DTileStyle, Cesium3DTileColorBlendMode, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4654,14 +4654,19 @@ var SimplifyGeometry;
|
|
|
4654
4654
|
/**
|
|
4655
4655
|
* Returns the total number of points in the geometry.
|
|
4656
4656
|
* @param geometry
|
|
4657
|
+
* @param limit number to count up to before returning.
|
|
4657
4658
|
* @returns
|
|
4658
4659
|
*/
|
|
4659
|
-
function CountPoints(geometry) {
|
|
4660
|
+
function CountPoints(geometry, limit) {
|
|
4660
4661
|
var count = 0;
|
|
4661
4662
|
var traverse = function (geometry) {
|
|
4662
4663
|
if (geometry.MultiGeometry) {
|
|
4663
4664
|
for (var i = 0; i < geometry.MultiGeometry.length; i++) {
|
|
4664
4665
|
traverse(geometry.MultiGeometry[i]);
|
|
4666
|
+
// Reached the limit, return.
|
|
4667
|
+
if (limit && count >= limit) {
|
|
4668
|
+
return;
|
|
4669
|
+
}
|
|
4665
4670
|
}
|
|
4666
4671
|
}
|
|
4667
4672
|
else if (geometry.Polygon) {
|
|
@@ -4686,193 +4691,278 @@ var SimplifyGeometry;
|
|
|
4686
4691
|
* This will turn it into GeoJSON, run it through turf, then back to Bruce geometry.
|
|
4687
4692
|
* @param geometry
|
|
4688
4693
|
*/
|
|
4689
|
-
function Simplify(geometry, tolerance) {
|
|
4690
|
-
|
|
4694
|
+
function Simplify(entityId, geometry, tolerance) {
|
|
4695
|
+
var _a;
|
|
4696
|
+
if (!geometry || !turf || !turf.simplify) {
|
|
4691
4697
|
return geometry;
|
|
4692
4698
|
}
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
geoJson.features.forEach(function (feature) {
|
|
4697
|
-
var unioned = false;
|
|
4698
|
-
for (var i = 0; i < combinedFeatures.length; i++) {
|
|
4699
|
-
try {
|
|
4700
|
-
var unionResult = turf.union(combinedFeatures[i], feature);
|
|
4701
|
-
if (unionResult) {
|
|
4702
|
-
combinedFeatures[i] = unionResult;
|
|
4703
|
-
unioned = true;
|
|
4704
|
-
break;
|
|
4705
|
-
}
|
|
4706
|
-
}
|
|
4707
|
-
catch (error) {
|
|
4708
|
-
// Ignore the error if union fails, and continue
|
|
4709
|
-
}
|
|
4710
|
-
}
|
|
4711
|
-
if (!unioned) {
|
|
4712
|
-
combinedFeatures.push(feature);
|
|
4713
|
-
}
|
|
4699
|
+
// Convert to geojson so that we can interact with turf.
|
|
4700
|
+
var gFeature = Geometry.ToGeoJsonFeature({
|
|
4701
|
+
geometry: geometry
|
|
4714
4702
|
});
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
//
|
|
4720
|
-
|
|
4721
|
-
|
|
4703
|
+
// Unkink the geometry.
|
|
4704
|
+
// This removes overlapping polygons before we start merging and simplifying.
|
|
4705
|
+
// Commented out because it has crashes and doesn't handle holes.
|
|
4706
|
+
untangleFeature(gFeature);
|
|
4707
|
+
// Union the geometry.
|
|
4708
|
+
// This merges overlapping polygons.
|
|
4709
|
+
unionFeature(gFeature);
|
|
4710
|
+
// Simplify the geometry.
|
|
4711
|
+
if (tolerance > 0) {
|
|
4712
|
+
gFeature.geometry = turf.simplify(gFeature.geometry, {
|
|
4713
|
+
tolerance: tolerance,
|
|
4714
|
+
highQuality: true,
|
|
4715
|
+
mutate: true
|
|
4716
|
+
});
|
|
4717
|
+
}
|
|
4718
|
+
// Converting back to Bruce geometry.
|
|
4719
|
+
geometry = (_a = Geometry.FromGeoJson({
|
|
4720
|
+
geoJson: gFeature
|
|
4721
|
+
})) === null || _a === void 0 ? void 0 : _a.geometry;
|
|
4722
|
+
return geometry;
|
|
4722
4723
|
}
|
|
4723
4724
|
SimplifyGeometry.Simplify = Simplify;
|
|
4724
4725
|
})(SimplifyGeometry || (SimplifyGeometry = {}));
|
|
4725
4726
|
/**
|
|
4726
|
-
*
|
|
4727
|
-
* @param
|
|
4728
|
-
* @returns
|
|
4727
|
+
* Runs through all found polygons and runs unkink through turf on them.
|
|
4728
|
+
* @param feature
|
|
4729
4729
|
*/
|
|
4730
|
-
function
|
|
4731
|
-
|
|
4732
|
-
var
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
};
|
|
4736
|
-
var removeConsecutiveDuplicates = function (coordinates) {
|
|
4737
|
-
return coordinates.filter(function (coord, index, array) {
|
|
4738
|
-
return index === 0 || !areCoordinatesEqual(coord, array[index - 1]);
|
|
4739
|
-
});
|
|
4730
|
+
function untangleFeature(feature) {
|
|
4731
|
+
// Collection to add to because the result might be multiple from an unkink.
|
|
4732
|
+
var collection = {
|
|
4733
|
+
geometries: [],
|
|
4734
|
+
type: "GeometryCollection"
|
|
4740
4735
|
};
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4736
|
+
// Runs a dedupe and unkink on the coordinates.
|
|
4737
|
+
// Returns if the coordinates were added to the collection.
|
|
4738
|
+
var processCoordinates = function (coords) {
|
|
4739
|
+
try {
|
|
4740
|
+
// Dedupe the coordinates to avoid issues with unkink.
|
|
4741
|
+
coords = dedupeCoordinates(coords);
|
|
4742
|
+
var outer = [];
|
|
4743
|
+
var inner = [];
|
|
4744
|
+
// We'll unkink each ring separately as this is killing the holes when it is done as a whole.
|
|
4745
|
+
// So we'll do it separate then recombine.
|
|
4746
|
+
for (var i = 0; i < coords.length; i++) {
|
|
4747
|
+
var ring = coords[i];
|
|
4748
|
+
var unkink = turf.unkinkPolygon({
|
|
4749
|
+
type: "Polygon",
|
|
4750
|
+
coordinates: [ring]
|
|
4751
|
+
});
|
|
4752
|
+
if (unkink.type == "FeatureCollection") {
|
|
4753
|
+
var target = i == 0 ? outer : inner;
|
|
4754
|
+
for (var j = 0; j < unkink.features.length; j++) {
|
|
4755
|
+
var unkinked = unkink.features[j].geometry.coordinates;
|
|
4756
|
+
if (unkinked.length > 0) {
|
|
4757
|
+
target.push(unkinked[0]);
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
else {
|
|
4762
|
+
console.error("Unexpected unkink result.", unkink);
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
// Recreate the rings and reapply to the collection.
|
|
4766
|
+
if (outer.length > 0) {
|
|
4767
|
+
var combinedCoords = [outer[0]];
|
|
4768
|
+
for (var i = 0; i < inner.length; i++) {
|
|
4769
|
+
combinedCoords.push(inner[i]);
|
|
4770
|
+
}
|
|
4771
|
+
// Add the combined coordinates to the collection
|
|
4772
|
+
var polygon = {
|
|
4773
|
+
type: "Polygon",
|
|
4774
|
+
coordinates: combinedCoords
|
|
4775
|
+
};
|
|
4776
|
+
// Ensure right-hand rule is followed.
|
|
4777
|
+
ensureRightHandRule(polygon);
|
|
4778
|
+
// Add to the collection.
|
|
4779
|
+
collection.geometries.push(polygon);
|
|
4780
|
+
return true;
|
|
4781
|
+
}
|
|
4745
4782
|
}
|
|
4746
|
-
|
|
4783
|
+
catch (e) {
|
|
4784
|
+
// console.error("Failed to unkink polygon.", e);
|
|
4785
|
+
}
|
|
4786
|
+
return false;
|
|
4747
4787
|
};
|
|
4748
4788
|
var processGeometry = function (geometry) {
|
|
4749
|
-
var
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
properties: {},
|
|
4753
|
-
geometry: null
|
|
4754
|
-
};
|
|
4755
|
-
if ((_a = geometry.MultiGeometry) === null || _a === void 0 ? void 0 : _a.length) {
|
|
4756
|
-
geometry.MultiGeometry.forEach(function (geo) { return processGeometry(geo); });
|
|
4757
|
-
return;
|
|
4789
|
+
var added = false;
|
|
4790
|
+
if (geometry.type == "Polygon") {
|
|
4791
|
+
added = processCoordinates(geometry.coordinates);
|
|
4758
4792
|
}
|
|
4759
|
-
else if (
|
|
4760
|
-
var
|
|
4761
|
-
|
|
4762
|
-
});
|
|
4763
|
-
var coordinates = sortedPolygons.map(function (polygonRing) {
|
|
4764
|
-
return closePolygonCoordinates(removeConsecutiveDuplicates(polygonRing.LinearRing.split(' ').map(function (coord) {
|
|
4765
|
-
var _a = coord.split(',').map(Number), lon = _a[0], lat = _a[1], alt = _a[2];
|
|
4766
|
-
return [lon, lat, alt !== undefined ? alt : 0];
|
|
4767
|
-
})));
|
|
4768
|
-
});
|
|
4769
|
-
// Check if the polygon has at least 4 points.
|
|
4770
|
-
var isValidPolygon = coordinates.every(function (polygon) { return polygon.length >= 4; });
|
|
4771
|
-
if (!isValidPolygon) {
|
|
4772
|
-
// Perhaps try other geometry instead of returning?
|
|
4773
|
-
return;
|
|
4793
|
+
else if (geometry.type == "MultiPolygon") {
|
|
4794
|
+
for (var i = 0; i < geometry.coordinates.length; i++) {
|
|
4795
|
+
added = processCoordinates(geometry.coordinates[i]) || added;
|
|
4774
4796
|
}
|
|
4775
|
-
feature.geometry = {
|
|
4776
|
-
type: "Polygon",
|
|
4777
|
-
coordinates: coordinates,
|
|
4778
|
-
};
|
|
4779
|
-
}
|
|
4780
|
-
else if (geometry.LineString) {
|
|
4781
|
-
var coordinates = removeConsecutiveDuplicates(geometry.LineString.split(' ').map(function (coord) {
|
|
4782
|
-
var _a = coord.split(',').map(Number), lon = _a[0], lat = _a[1], alt = _a[2];
|
|
4783
|
-
return [lon, lat, alt !== undefined ? alt : 0];
|
|
4784
|
-
}));
|
|
4785
|
-
// Check if the polyline has at least 2 points.
|
|
4786
|
-
if (coordinates.length < 2) {
|
|
4787
|
-
// Perhaps try other geometry instead of returning?
|
|
4788
|
-
return;
|
|
4789
|
-
}
|
|
4790
|
-
feature.geometry = {
|
|
4791
|
-
type: "LineString",
|
|
4792
|
-
coordinates: coordinates,
|
|
4793
|
-
};
|
|
4794
|
-
}
|
|
4795
|
-
else if (geometry.Point) {
|
|
4796
|
-
var _c = geometry.Point.split(',').map(Number), lon = _c[0], lat = _c[1], alt = _c[2];
|
|
4797
|
-
var coordinates = excludeAltitude ? [lon, lat] : [lon, lat, alt !== undefined ? alt : 0];
|
|
4798
|
-
feature.geometry = {
|
|
4799
|
-
type: "Point",
|
|
4800
|
-
coordinates: coordinates,
|
|
4801
|
-
};
|
|
4802
4797
|
}
|
|
4803
|
-
if (
|
|
4804
|
-
|
|
4798
|
+
if (!added) {
|
|
4799
|
+
// Adding original since we can't unkink it.
|
|
4800
|
+
collection.geometries.push(geometry);
|
|
4805
4801
|
}
|
|
4806
4802
|
};
|
|
4807
|
-
|
|
4808
|
-
|
|
4803
|
+
if (feature.geometry.type == "GeometryCollection") {
|
|
4804
|
+
feature.geometry.geometries.forEach(function (geometry) {
|
|
4805
|
+
processGeometry(geometry);
|
|
4806
|
+
});
|
|
4809
4807
|
}
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4808
|
+
else {
|
|
4809
|
+
processGeometry(feature.geometry);
|
|
4810
|
+
}
|
|
4811
|
+
// Re-assign the geometry.
|
|
4812
|
+
if (collection.geometries.length == 1) {
|
|
4813
|
+
feature.geometry = collection.geometries[0];
|
|
4814
|
+
}
|
|
4815
|
+
else {
|
|
4816
|
+
feature.geometry = collection;
|
|
4813
4817
|
}
|
|
4814
|
-
var geoJson = {
|
|
4815
|
-
type: "FeatureCollection",
|
|
4816
|
-
features: features,
|
|
4817
|
-
};
|
|
4818
|
-
return geoJson;
|
|
4819
4818
|
}
|
|
4820
4819
|
/**
|
|
4821
|
-
*
|
|
4822
|
-
*
|
|
4823
|
-
* @
|
|
4820
|
+
* Runs through all found polygons and unions them using turf.
|
|
4821
|
+
* Failed unions are ignored and the original is kept.
|
|
4822
|
+
* @param feature
|
|
4824
4823
|
*/
|
|
4825
|
-
function
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
Polygon: [],
|
|
4831
|
-
MultiGeometry: []
|
|
4824
|
+
function unionFeature(feature) {
|
|
4825
|
+
// Collection to add to because the result might be multiple from an unkink.
|
|
4826
|
+
var collection = {
|
|
4827
|
+
geometries: [],
|
|
4828
|
+
type: "GeometryCollection"
|
|
4832
4829
|
};
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4830
|
+
// We'll turn each geometry into a feature and union them.
|
|
4831
|
+
var tmpCollection = {
|
|
4832
|
+
features: [],
|
|
4833
|
+
type: "FeatureCollection"
|
|
4834
|
+
};
|
|
4835
|
+
if (feature.geometry.type == "GeometryCollection") {
|
|
4836
|
+
feature.geometry.geometries.forEach(function (geometry) {
|
|
4837
|
+
if (geometry.type == "Polygon") {
|
|
4838
|
+
tmpCollection.features.push({
|
|
4839
|
+
type: "Feature",
|
|
4840
|
+
geometry: geometry,
|
|
4841
|
+
properties: {}
|
|
4842
|
+
});
|
|
4843
|
+
}
|
|
4844
|
+
else if (geometry.type == "MultiPolygon") {
|
|
4845
|
+
for (var i = 0; i < geometry.coordinates.length; i++) {
|
|
4846
|
+
tmpCollection.features.push({
|
|
4847
|
+
type: "Feature",
|
|
4848
|
+
geometry: {
|
|
4849
|
+
type: "Polygon",
|
|
4850
|
+
coordinates: geometry.coordinates[i]
|
|
4851
|
+
},
|
|
4852
|
+
properties: {}
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
// Only focusing on polygons.
|
|
4857
|
+
else {
|
|
4858
|
+
collection.geometries.push(geometry);
|
|
4859
|
+
}
|
|
4840
4860
|
});
|
|
4841
|
-
return geometry;
|
|
4842
4861
|
}
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4862
|
+
else if (feature.geometry.type == "Polygon") {
|
|
4863
|
+
tmpCollection.features.push({
|
|
4864
|
+
type: "Feature",
|
|
4865
|
+
geometry: feature.geometry,
|
|
4866
|
+
properties: {}
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
else if (feature.geometry.type == "MultiPolygon") {
|
|
4870
|
+
for (var i = 0; i < feature.geometry.coordinates.length; i++) {
|
|
4871
|
+
tmpCollection.features.push({
|
|
4872
|
+
type: "Feature",
|
|
4873
|
+
geometry: {
|
|
4874
|
+
type: "Polygon",
|
|
4875
|
+
coordinates: feature.geometry.coordinates[i]
|
|
4876
|
+
},
|
|
4877
|
+
properties: {}
|
|
4853
4878
|
});
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
// No polygons to union.
|
|
4882
|
+
// Need at least 2 to union.
|
|
4883
|
+
if (tmpCollection.features.length < 2) {
|
|
4884
|
+
return;
|
|
4885
|
+
}
|
|
4886
|
+
// Now we'll union them.
|
|
4887
|
+
try {
|
|
4888
|
+
var union = turf.union(tmpCollection);
|
|
4889
|
+
if (union.geometry.type == "Polygon") {
|
|
4890
|
+
collection.geometries.push(union.geometry);
|
|
4891
|
+
}
|
|
4892
|
+
else if (union.geometry.type == "MultiPolygon") {
|
|
4893
|
+
for (var i = 0; i < union.geometry.coordinates.length; i++) {
|
|
4894
|
+
collection.geometries.push({
|
|
4895
|
+
type: "Polygon",
|
|
4896
|
+
coordinates: union.geometry.coordinates[i]
|
|
4870
4897
|
});
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
else {
|
|
4901
|
+
// Returning early because the result is unexpected.
|
|
4902
|
+
return;
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
4905
|
+
catch (e) {
|
|
4906
|
+
// console.error("Failed to union polygons.", e);
|
|
4907
|
+
return;
|
|
4874
4908
|
}
|
|
4875
|
-
|
|
4909
|
+
// Re-assign the geometry.
|
|
4910
|
+
if (collection.geometries.length == 1) {
|
|
4911
|
+
feature.geometry = collection.geometries[0];
|
|
4912
|
+
}
|
|
4913
|
+
else {
|
|
4914
|
+
feature.geometry = collection;
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
function dedupeCoordinates(inputCoords) {
|
|
4918
|
+
return inputCoords.map(function (ring) {
|
|
4919
|
+
if (ring.length < 2) {
|
|
4920
|
+
return ring;
|
|
4921
|
+
}
|
|
4922
|
+
var dedupeCoords = [];
|
|
4923
|
+
var uniqueCoords = new Set();
|
|
4924
|
+
// Dedupe the points.
|
|
4925
|
+
ring.forEach(function (coord) {
|
|
4926
|
+
var key = coord.join(',');
|
|
4927
|
+
if (!uniqueCoords.has(key)) {
|
|
4928
|
+
uniqueCoords.add(key);
|
|
4929
|
+
dedupeCoords.push(coord);
|
|
4930
|
+
}
|
|
4931
|
+
});
|
|
4932
|
+
// Make sure the last point matches the first.
|
|
4933
|
+
if (dedupeCoords.length > 1) {
|
|
4934
|
+
if (dedupeCoords[0][0] != dedupeCoords[dedupeCoords.length - 1][0] ||
|
|
4935
|
+
dedupeCoords[0][1] != dedupeCoords[dedupeCoords.length - 1][1]) {
|
|
4936
|
+
dedupeCoords.push(dedupeCoords[0]);
|
|
4937
|
+
}
|
|
4938
|
+
}
|
|
4939
|
+
return dedupeCoords;
|
|
4940
|
+
});
|
|
4941
|
+
}
|
|
4942
|
+
function ensureRightHandRule(polygon) {
|
|
4943
|
+
// Ensure the outer ring follows the right-hand rule
|
|
4944
|
+
if (polygon.coordinates.length > 0) {
|
|
4945
|
+
var outerRing = polygon.coordinates[0];
|
|
4946
|
+
if (isClockwise(outerRing)) {
|
|
4947
|
+
polygon.coordinates[0] = outerRing.reverse();
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
// Ensure any inner rings (holes) follow the right-hand rule
|
|
4951
|
+
for (var i = 1; i < polygon.coordinates.length; i++) {
|
|
4952
|
+
var innerRing = polygon.coordinates[i];
|
|
4953
|
+
if (!isClockwise(innerRing)) {
|
|
4954
|
+
polygon.coordinates[i] = innerRing.reverse();
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
function isClockwise(ring) {
|
|
4959
|
+
var sum = 0;
|
|
4960
|
+
for (var i = 0; i < ring.length - 1; i++) {
|
|
4961
|
+
var p1 = ring[i];
|
|
4962
|
+
var p2 = ring[i + 1];
|
|
4963
|
+
sum += (p2[0] - p1[0]) * (p2[1] + p1[1]);
|
|
4964
|
+
}
|
|
4965
|
+
return sum > 0;
|
|
4876
4966
|
}
|
|
4877
4967
|
|
|
4878
4968
|
function colorToCColor(color) {
|
|
@@ -5548,11 +5638,11 @@ function compareColorMaterials(viewer, a, b) {
|
|
|
5548
5638
|
var EntityRenderEngine;
|
|
5549
5639
|
(function (EntityRenderEngine) {
|
|
5550
5640
|
function Render(params) {
|
|
5551
|
-
var _a, _b, _c, _d, _e, _f
|
|
5641
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5552
5642
|
return __awaiter(this, void 0, void 0, function () {
|
|
5553
|
-
var groupRenderParams,
|
|
5554
|
-
return __generator(this, function (
|
|
5555
|
-
switch (
|
|
5643
|
+
var groupRenderParams, updated, cEntities, models, multiGeometry, polygons, polylines, points, prepareGeometry, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, geometry, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
|
|
5644
|
+
return __generator(this, function (_g) {
|
|
5645
|
+
switch (_g.label) {
|
|
5556
5646
|
case 0:
|
|
5557
5647
|
groupRenderParams = {
|
|
5558
5648
|
apiGetter: params.apiGetter,
|
|
@@ -5562,10 +5652,16 @@ var EntityRenderEngine;
|
|
|
5562
5652
|
menuItemId: params.menuItemId,
|
|
5563
5653
|
visualRegister: params.visualRegister
|
|
5564
5654
|
};
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5655
|
+
updated = new Map();
|
|
5656
|
+
cEntities = new Map();
|
|
5657
|
+
models = [];
|
|
5658
|
+
multiGeometry = [];
|
|
5659
|
+
polygons = [];
|
|
5660
|
+
polylines = [];
|
|
5661
|
+
points = [];
|
|
5662
|
+
prepareGeometry = function (entity) {
|
|
5663
|
+
var _a;
|
|
5664
|
+
var geometry = Entity$1.GetValue({
|
|
5569
5665
|
entity: entity,
|
|
5570
5666
|
path: ["Bruce", "VectorGeometry"]
|
|
5571
5667
|
});
|
|
@@ -5574,20 +5670,19 @@ var EntityRenderEngine;
|
|
|
5574
5670
|
// Note that this modifies the Entity object.
|
|
5575
5671
|
if (params.optimizeGeometry) {
|
|
5576
5672
|
if (params.optimizeMinPoints == null) {
|
|
5577
|
-
params.optimizeMinPoints =
|
|
5673
|
+
params.optimizeMinPoints = 500;
|
|
5578
5674
|
}
|
|
5579
|
-
if (geometry && SimplifyGeometry.CountPoints(geometry) >= params.optimizeMinPoints) {
|
|
5675
|
+
if (geometry && SimplifyGeometry.CountPoints(geometry, params.optimizeMinPoints) >= params.optimizeMinPoints) {
|
|
5580
5676
|
if (params.optimizeTolerance == null) {
|
|
5581
|
-
params.optimizeTolerance = 0.
|
|
5677
|
+
params.optimizeTolerance = 0.00001;
|
|
5582
5678
|
}
|
|
5583
|
-
optimized = SimplifyGeometry.Simplify(geometry, params.optimizeTolerance);
|
|
5679
|
+
var optimized = SimplifyGeometry.Simplify(entity.Bruce.ID, geometry, params.optimizeTolerance);
|
|
5584
5680
|
if (optimized) {
|
|
5585
5681
|
// Continue on with the rendering using the optimized geometry.
|
|
5586
5682
|
geometry = optimized;
|
|
5587
5683
|
// Dereference the Entity object now that we have done a destructive operation.
|
|
5588
5684
|
entity = Object.assign({}, entity);
|
|
5589
5685
|
entity.Bruce = Object.assign({}, entity.Bruce);
|
|
5590
|
-
params.entities[i] = entity;
|
|
5591
5686
|
}
|
|
5592
5687
|
}
|
|
5593
5688
|
}
|
|
@@ -5600,14 +5695,8 @@ var EntityRenderEngine;
|
|
|
5600
5695
|
else {
|
|
5601
5696
|
entity.Bruce.VectorGeometry = geometry;
|
|
5602
5697
|
}
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
cEntities = new Map();
|
|
5606
|
-
models = [];
|
|
5607
|
-
multiGeometry = [];
|
|
5608
|
-
polygons = [];
|
|
5609
|
-
polylines = [];
|
|
5610
|
-
points = [];
|
|
5698
|
+
return entity;
|
|
5699
|
+
};
|
|
5611
5700
|
// Initial sorting.
|
|
5612
5701
|
for (i = 0; i < params.entities.length; i++) {
|
|
5613
5702
|
entity = params.entities[i];
|
|
@@ -5631,12 +5720,12 @@ var EntityRenderEngine;
|
|
|
5631
5720
|
menuItemId: params.menuItemId
|
|
5632
5721
|
});
|
|
5633
5722
|
newRenderId = getRenderGroupId(zoomItem);
|
|
5634
|
-
oldRenderId = (
|
|
5723
|
+
oldRenderId = (_a = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _a === void 0 ? void 0 : _a._renderGroup;
|
|
5635
5724
|
if (!params.force &&
|
|
5636
5725
|
newRenderId == oldRenderId &&
|
|
5637
5726
|
!(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
|
|
5638
5727
|
// If historic metadata is different then it's also stale.
|
|
5639
|
-
((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((
|
|
5728
|
+
((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.HistoricDateTime))) {
|
|
5640
5729
|
// No sorting category needed. Already rendered the way we want.
|
|
5641
5730
|
cEntities.set(id, existingRego.visual);
|
|
5642
5731
|
}
|
|
@@ -5647,20 +5736,22 @@ var EntityRenderEngine;
|
|
|
5647
5736
|
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
5648
5737
|
existingRego.stale = false;
|
|
5649
5738
|
// Update metadata for the same reason.
|
|
5650
|
-
existingRego.historicDateTime = (
|
|
5651
|
-
existingRego.historicAttrKey = (
|
|
5739
|
+
existingRego.historicDateTime = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.HistoricDateTime;
|
|
5740
|
+
existingRego.historicAttrKey = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.HistoricAttrKey;
|
|
5652
5741
|
existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
|
|
5653
5742
|
updated.set(id, true);
|
|
5654
5743
|
}
|
|
5655
5744
|
if (displayType == ZoomControl.EDisplayType.Model3D) {
|
|
5745
|
+
entity = params.entities[i] = prepareGeometry(entity);
|
|
5656
5746
|
models.push(entity);
|
|
5657
5747
|
}
|
|
5658
5748
|
else if (displayType == ZoomControl.EDisplayType.Geometry) {
|
|
5749
|
+
entity = params.entities[i] = prepareGeometry(entity);
|
|
5659
5750
|
geometry = Entity$1.GetValue({
|
|
5660
5751
|
entity: entity,
|
|
5661
5752
|
path: ["Bruce", "VectorGeometry"]
|
|
5662
5753
|
});
|
|
5663
|
-
if ((
|
|
5754
|
+
if ((_e = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _e === void 0 ? void 0 : _e.length) {
|
|
5664
5755
|
multiGeometry.push(entity);
|
|
5665
5756
|
}
|
|
5666
5757
|
else {
|
|
@@ -5678,7 +5769,7 @@ var EntityRenderEngine;
|
|
|
5678
5769
|
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models, entitiesHistoric: params.entitiesHistoric });
|
|
5679
5770
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
5680
5771
|
case 1:
|
|
5681
|
-
mEntities =
|
|
5772
|
+
mEntities = _g.sent();
|
|
5682
5773
|
for (i = 0; i < mParams.entities.length; i++) {
|
|
5683
5774
|
entity = mParams.entities[i];
|
|
5684
5775
|
id = entity.Bruce.ID;
|
|
@@ -5690,20 +5781,20 @@ var EntityRenderEngine;
|
|
|
5690
5781
|
multiGeometry.push(entity);
|
|
5691
5782
|
}
|
|
5692
5783
|
}
|
|
5693
|
-
|
|
5784
|
+
_g.label = 2;
|
|
5694
5785
|
case 2:
|
|
5695
5786
|
if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
|
|
5696
5787
|
_loop_1 = function (i) {
|
|
5697
5788
|
var entity, geometry, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
|
|
5698
|
-
return __generator(this, function (
|
|
5699
|
-
switch (
|
|
5789
|
+
return __generator(this, function (_h) {
|
|
5790
|
+
switch (_h.label) {
|
|
5700
5791
|
case 0:
|
|
5701
5792
|
entity = multiGeometry[i];
|
|
5702
5793
|
geometry = Entity$1.GetValue({
|
|
5703
5794
|
entity: entity,
|
|
5704
5795
|
path: ["Bruce", "VectorGeometry"]
|
|
5705
5796
|
});
|
|
5706
|
-
if (!((
|
|
5797
|
+
if (!((_f = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _f === void 0 ? void 0 : _f.length)) {
|
|
5707
5798
|
polygons.push(entity);
|
|
5708
5799
|
return [2 /*return*/, "continue"];
|
|
5709
5800
|
}
|
|
@@ -5717,7 +5808,7 @@ var EntityRenderEngine;
|
|
|
5717
5808
|
}
|
|
5718
5809
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
5719
5810
|
case 1:
|
|
5720
|
-
cPoly =
|
|
5811
|
+
cPoly = _h.sent();
|
|
5721
5812
|
Array.from(cPoly.keys()).forEach(function (key) {
|
|
5722
5813
|
if (cPoly.get(key)) {
|
|
5723
5814
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -5726,7 +5817,7 @@ var EntityRenderEngine;
|
|
|
5726
5817
|
rendered = Array.from(cPoly.values());
|
|
5727
5818
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
5728
5819
|
case 2:
|
|
5729
|
-
cLines =
|
|
5820
|
+
cLines = _h.sent();
|
|
5730
5821
|
Array.from(cLines.keys()).forEach(function (key) {
|
|
5731
5822
|
if (cLines.get(key)) {
|
|
5732
5823
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -5736,9 +5827,9 @@ var EntityRenderEngine;
|
|
|
5736
5827
|
if (!!rendered.length) return [3 /*break*/, 4];
|
|
5737
5828
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
5738
5829
|
case 3:
|
|
5739
|
-
cPoints =
|
|
5830
|
+
cPoints = _h.sent();
|
|
5740
5831
|
rendered = rendered.concat(Array.from(cPoints.values()));
|
|
5741
|
-
|
|
5832
|
+
_h.label = 4;
|
|
5742
5833
|
case 4:
|
|
5743
5834
|
rendered = rendered.filter(function (x) { return x != null; });
|
|
5744
5835
|
if (rendered.length) {
|
|
@@ -5765,13 +5856,13 @@ var EntityRenderEngine;
|
|
|
5765
5856
|
});
|
|
5766
5857
|
};
|
|
5767
5858
|
i = 0;
|
|
5768
|
-
|
|
5859
|
+
_g.label = 3;
|
|
5769
5860
|
case 3:
|
|
5770
5861
|
if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
|
|
5771
5862
|
return [5 /*yield**/, _loop_1(i)];
|
|
5772
5863
|
case 4:
|
|
5773
|
-
|
|
5774
|
-
|
|
5864
|
+
_g.sent();
|
|
5865
|
+
_g.label = 5;
|
|
5775
5866
|
case 5:
|
|
5776
5867
|
i++;
|
|
5777
5868
|
return [3 /*break*/, 3];
|
|
@@ -5780,7 +5871,7 @@ var EntityRenderEngine;
|
|
|
5780
5871
|
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
5781
5872
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
5782
5873
|
case 7:
|
|
5783
|
-
pEntities =
|
|
5874
|
+
pEntities = _g.sent();
|
|
5784
5875
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
5785
5876
|
entity = pParams.entities[i];
|
|
5786
5877
|
cEntity = pEntities.get(entity.Bruce.ID);
|
|
@@ -5791,13 +5882,13 @@ var EntityRenderEngine;
|
|
|
5791
5882
|
polylines.push(entity);
|
|
5792
5883
|
}
|
|
5793
5884
|
}
|
|
5794
|
-
|
|
5885
|
+
_g.label = 8;
|
|
5795
5886
|
case 8:
|
|
5796
5887
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
5797
5888
|
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
5798
5889
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
5799
5890
|
case 9:
|
|
5800
|
-
pEntities =
|
|
5891
|
+
pEntities = _g.sent();
|
|
5801
5892
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
5802
5893
|
entity = pParams.entities[i];
|
|
5803
5894
|
cEntity = pEntities.get(entity.Bruce.ID);
|
|
@@ -5808,13 +5899,13 @@ var EntityRenderEngine;
|
|
|
5808
5899
|
points.push(entity);
|
|
5809
5900
|
}
|
|
5810
5901
|
}
|
|
5811
|
-
|
|
5902
|
+
_g.label = 10;
|
|
5812
5903
|
case 10:
|
|
5813
5904
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
5814
5905
|
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities, entitiesHistoric: params.entitiesHistoric });
|
|
5815
5906
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
5816
5907
|
case 11:
|
|
5817
|
-
pEntities =
|
|
5908
|
+
pEntities = _g.sent();
|
|
5818
5909
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
5819
5910
|
entity = pParams.entities[i];
|
|
5820
5911
|
cEntity = pEntities.get(entity.Bruce.ID);
|
|
@@ -5822,7 +5913,7 @@ var EntityRenderEngine;
|
|
|
5822
5913
|
cEntities.set(entity.Bruce.ID, cEntity);
|
|
5823
5914
|
}
|
|
5824
5915
|
}
|
|
5825
|
-
|
|
5916
|
+
_g.label = 12;
|
|
5826
5917
|
case 12: return [2 /*return*/, {
|
|
5827
5918
|
entities: cEntities,
|
|
5828
5919
|
updated: updated
|
|
@@ -6736,6 +6827,7 @@ var EntityRenderEngine;
|
|
|
6736
6827
|
var points = Geometry.ParsePoints(x.LinearRing);
|
|
6737
6828
|
var holePosses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)); });
|
|
6738
6829
|
holePosses = cullDuplicatePoints(holePosses);
|
|
6830
|
+
Cartes.CloseRing3(holePosses);
|
|
6739
6831
|
return holePosses;
|
|
6740
6832
|
}).filter(function (x) { return x.length >= 4; });
|
|
6741
6833
|
var zIndex = getZIndex(style, entity, params.tags);
|
|
@@ -11249,12 +11341,12 @@ var EntitiesRenderManager;
|
|
|
11249
11341
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
11250
11342
|
*/
|
|
11251
11343
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
11252
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
11344
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11253
11345
|
return __awaiter(this, void 0, void 0, function () {
|
|
11254
|
-
var zoomItem, lods, withLods_1,
|
|
11346
|
+
var zoomItem, lods, withLods_1, individuals_1, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, i, entity, geometry, optimized, collection, i, entity, feature, individuals, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
11255
11347
|
var _this = this;
|
|
11256
|
-
return __generator(this, function (
|
|
11257
|
-
switch (
|
|
11348
|
+
return __generator(this, function (_l) {
|
|
11349
|
+
switch (_l.label) {
|
|
11258
11350
|
case 0:
|
|
11259
11351
|
entities = entities.filter(function (entity) {
|
|
11260
11352
|
var _a;
|
|
@@ -11284,43 +11376,43 @@ var EntitiesRenderManager;
|
|
|
11284
11376
|
}
|
|
11285
11377
|
})];
|
|
11286
11378
|
case 1:
|
|
11287
|
-
lods = (
|
|
11379
|
+
lods = (_l.sent()).lods;
|
|
11288
11380
|
if (this.disposed) {
|
|
11289
11381
|
this.doDispose();
|
|
11290
11382
|
return [2 /*return*/];
|
|
11291
11383
|
}
|
|
11292
11384
|
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
11293
|
-
|
|
11385
|
+
individuals_1 = entities.filter(function (entity) {
|
|
11294
11386
|
var _a;
|
|
11295
11387
|
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
11296
11388
|
});
|
|
11297
|
-
if (
|
|
11298
|
-
this.renderAsIndividuals(
|
|
11389
|
+
if (individuals_1.length) {
|
|
11390
|
+
this.renderAsIndividuals(individuals_1, force);
|
|
11299
11391
|
}
|
|
11300
11392
|
// Now we proceed with what is left.
|
|
11301
11393
|
entities = entities.filter(function (entity) {
|
|
11302
11394
|
var _a;
|
|
11303
11395
|
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
11304
11396
|
});
|
|
11305
|
-
|
|
11397
|
+
_l.label = 2;
|
|
11306
11398
|
case 2:
|
|
11307
11399
|
if (!entities.length) {
|
|
11308
11400
|
return [2 /*return*/];
|
|
11309
11401
|
}
|
|
11310
11402
|
style = null;
|
|
11311
11403
|
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
11312
|
-
|
|
11404
|
+
_l.label = 3;
|
|
11313
11405
|
case 3:
|
|
11314
|
-
|
|
11406
|
+
_l.trys.push([3, 5, , 6]);
|
|
11315
11407
|
return [4 /*yield*/, Style.Get({
|
|
11316
11408
|
api: this.apiGetter.getApi(),
|
|
11317
11409
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
11318
11410
|
})];
|
|
11319
11411
|
case 4:
|
|
11320
|
-
style = (_a = (
|
|
11412
|
+
style = (_a = (_l.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
11321
11413
|
return [3 /*break*/, 6];
|
|
11322
11414
|
case 5:
|
|
11323
|
-
e_4 =
|
|
11415
|
+
e_4 = _l.sent();
|
|
11324
11416
|
console.error(e_4);
|
|
11325
11417
|
return [3 /*break*/, 6];
|
|
11326
11418
|
case 6:
|
|
@@ -11329,15 +11421,15 @@ var EntitiesRenderManager;
|
|
|
11329
11421
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
11330
11422
|
}
|
|
11331
11423
|
if (!entityTypeId) return [3 /*break*/, 12];
|
|
11332
|
-
|
|
11424
|
+
_l.label = 7;
|
|
11333
11425
|
case 7:
|
|
11334
|
-
|
|
11426
|
+
_l.trys.push([7, 11, , 12]);
|
|
11335
11427
|
return [4 /*yield*/, EntityType.Get({
|
|
11336
11428
|
entityTypeId: entityTypeId,
|
|
11337
11429
|
api: this.apiGetter.getApi()
|
|
11338
11430
|
})];
|
|
11339
11431
|
case 8:
|
|
11340
|
-
entityType = (_e = (
|
|
11432
|
+
entityType = (_e = (_l.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
11341
11433
|
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
11342
11434
|
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
11343
11435
|
return [4 /*yield*/, Style.Get({
|
|
@@ -11345,11 +11437,11 @@ var EntitiesRenderManager;
|
|
|
11345
11437
|
styleId: entityType["DisplaySetting.ID"]
|
|
11346
11438
|
})];
|
|
11347
11439
|
case 9:
|
|
11348
|
-
style = (_f = (
|
|
11349
|
-
|
|
11440
|
+
style = (_f = (_l.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
11441
|
+
_l.label = 10;
|
|
11350
11442
|
case 10: return [3 /*break*/, 12];
|
|
11351
11443
|
case 11:
|
|
11352
|
-
e_5 =
|
|
11444
|
+
e_5 = _l.sent();
|
|
11353
11445
|
console.error(e_5);
|
|
11354
11446
|
return [3 /*break*/, 12];
|
|
11355
11447
|
case 12:
|
|
@@ -11379,13 +11471,13 @@ var EntitiesRenderManager;
|
|
|
11379
11471
|
});
|
|
11380
11472
|
if (geometry) {
|
|
11381
11473
|
if (this.item.optimizeMinPoints == null) {
|
|
11382
|
-
this.item.optimizeMinPoints =
|
|
11474
|
+
this.item.optimizeMinPoints = 500;
|
|
11383
11475
|
}
|
|
11384
|
-
if (SimplifyGeometry.CountPoints(geometry)
|
|
11476
|
+
if (SimplifyGeometry.CountPoints(geometry, this.item.optimizeMinPoints) >= this.item.optimizeMinPoints) {
|
|
11385
11477
|
if (this.item.optimizeTolerance == null) {
|
|
11386
|
-
this.item.optimizeTolerance = 0.
|
|
11478
|
+
this.item.optimizeTolerance = 0.00001;
|
|
11387
11479
|
}
|
|
11388
|
-
optimized = SimplifyGeometry.Simplify(geometry, this.item.optimizeTolerance);
|
|
11480
|
+
optimized = SimplifyGeometry.Simplify(entity.Bruce.ID, geometry, this.item.optimizeTolerance);
|
|
11389
11481
|
if (optimized) {
|
|
11390
11482
|
// Dereference the Entity object now that we have done a destructive operation.
|
|
11391
11483
|
entity = Object.assign({}, entity);
|
|
@@ -11402,34 +11494,51 @@ var EntitiesRenderManager;
|
|
|
11402
11494
|
entity.Bruce.VectorGeometry = geometry;
|
|
11403
11495
|
}
|
|
11404
11496
|
}
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11497
|
+
collection = {
|
|
11498
|
+
features: [],
|
|
11499
|
+
type: "FeatureCollection"
|
|
11500
|
+
};
|
|
11501
|
+
for (i = 0; i < entities.length; i++) {
|
|
11502
|
+
entity = entities[i];
|
|
11503
|
+
feature = Geometry.ToGeoJsonFeature({
|
|
11504
|
+
geometry: entity.Bruce.VectorGeometry,
|
|
11505
|
+
noAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
11506
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
11507
|
+
properties: __assign(__assign({}, entity), { Bruce: __assign(__assign({}, entity.Bruce), {
|
|
11508
|
+
// Exclude as we just converted it to geojson.
|
|
11509
|
+
VectorGeometry: null }) })
|
|
11417
11510
|
});
|
|
11511
|
+
if (feature) {
|
|
11512
|
+
collection.features.push(feature);
|
|
11513
|
+
}
|
|
11514
|
+
}
|
|
11515
|
+
individuals = entities.filter(function (entity) {
|
|
11516
|
+
var feature = collection.features.find(function (x) { var _a, _b; return ((_b = (_a = x.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == entity.Bruce.ID; });
|
|
11517
|
+
if (!feature) {
|
|
11518
|
+
return true;
|
|
11519
|
+
}
|
|
11520
|
+
if (feature.geometry.type == "Point") {
|
|
11521
|
+
return true;
|
|
11522
|
+
}
|
|
11523
|
+
return false;
|
|
11418
11524
|
});
|
|
11419
|
-
if (
|
|
11420
|
-
this.renderAsIndividuals(
|
|
11525
|
+
if (individuals.length) {
|
|
11526
|
+
this.renderAsIndividuals(individuals, force);
|
|
11421
11527
|
}
|
|
11422
|
-
|
|
11528
|
+
// Filter out points (the ones we just rendered as individuals).
|
|
11529
|
+
collection.features = collection.features.filter(function (x) { return x.geometry.type != "Point"; });
|
|
11530
|
+
// If there is nothing to render now, return.
|
|
11531
|
+
if (!collection.features.length) {
|
|
11423
11532
|
return [2 /*return*/];
|
|
11424
11533
|
}
|
|
11425
|
-
return [4 /*yield*/, GeoJsonDataSource.load(
|
|
11534
|
+
return [4 /*yield*/, GeoJsonDataSource.load(collection, {
|
|
11426
11535
|
stroke: cLineColor,
|
|
11427
11536
|
fill: cFillColor,
|
|
11428
11537
|
strokeWidth: lineWidthPx,
|
|
11429
11538
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
11430
11539
|
})];
|
|
11431
11540
|
case 13:
|
|
11432
|
-
source =
|
|
11541
|
+
source = _l.sent();
|
|
11433
11542
|
this.viewer.dataSources.add(source);
|
|
11434
11543
|
this.sources.push(source);
|
|
11435
11544
|
if (this.disposed) {
|
|
@@ -12161,12 +12270,12 @@ var EntitiesLoadedRenderManager;
|
|
|
12161
12270
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
12162
12271
|
*/
|
|
12163
12272
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
12164
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
12273
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
12165
12274
|
return __awaiter(this, void 0, void 0, function () {
|
|
12166
|
-
var zoomItem, lods, withLods_1,
|
|
12275
|
+
var zoomItem, lods, withLods_1, individuals_1, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, collection, i, entity, feature, individuals, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
12167
12276
|
var _this = this;
|
|
12168
|
-
return __generator(this, function (
|
|
12169
|
-
switch (
|
|
12277
|
+
return __generator(this, function (_l) {
|
|
12278
|
+
switch (_l.label) {
|
|
12170
12279
|
case 0:
|
|
12171
12280
|
entities = entities.filter(function (entity) {
|
|
12172
12281
|
var _a;
|
|
@@ -12196,43 +12305,43 @@ var EntitiesLoadedRenderManager;
|
|
|
12196
12305
|
}
|
|
12197
12306
|
})];
|
|
12198
12307
|
case 1:
|
|
12199
|
-
lods = (
|
|
12308
|
+
lods = (_l.sent()).lods;
|
|
12200
12309
|
if (this.disposed) {
|
|
12201
12310
|
this.doDispose();
|
|
12202
12311
|
return [2 /*return*/];
|
|
12203
12312
|
}
|
|
12204
12313
|
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
12205
|
-
|
|
12314
|
+
individuals_1 = entities.filter(function (entity) {
|
|
12206
12315
|
var _a;
|
|
12207
12316
|
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
12208
12317
|
});
|
|
12209
|
-
if (
|
|
12210
|
-
this.renderAsIndividuals(
|
|
12318
|
+
if (individuals_1.length) {
|
|
12319
|
+
this.renderAsIndividuals(individuals_1, force);
|
|
12211
12320
|
}
|
|
12212
12321
|
// Now we proceed with what is left.
|
|
12213
12322
|
entities = entities.filter(function (entity) {
|
|
12214
12323
|
var _a;
|
|
12215
12324
|
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
12216
12325
|
});
|
|
12217
|
-
|
|
12326
|
+
_l.label = 2;
|
|
12218
12327
|
case 2:
|
|
12219
12328
|
if (!entities.length) {
|
|
12220
12329
|
return [2 /*return*/];
|
|
12221
12330
|
}
|
|
12222
12331
|
style = null;
|
|
12223
12332
|
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
12224
|
-
|
|
12333
|
+
_l.label = 3;
|
|
12225
12334
|
case 3:
|
|
12226
|
-
|
|
12335
|
+
_l.trys.push([3, 5, , 6]);
|
|
12227
12336
|
return [4 /*yield*/, Style.Get({
|
|
12228
12337
|
api: this.apiGetter.getApi(),
|
|
12229
12338
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
12230
12339
|
})];
|
|
12231
12340
|
case 4:
|
|
12232
|
-
style = (_a = (
|
|
12341
|
+
style = (_a = (_l.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
12233
12342
|
return [3 /*break*/, 6];
|
|
12234
12343
|
case 5:
|
|
12235
|
-
e_3 =
|
|
12344
|
+
e_3 = _l.sent();
|
|
12236
12345
|
console.error(e_3);
|
|
12237
12346
|
return [3 /*break*/, 6];
|
|
12238
12347
|
case 6:
|
|
@@ -12241,15 +12350,15 @@ var EntitiesLoadedRenderManager;
|
|
|
12241
12350
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
12242
12351
|
}
|
|
12243
12352
|
if (!entityTypeId) return [3 /*break*/, 12];
|
|
12244
|
-
|
|
12353
|
+
_l.label = 7;
|
|
12245
12354
|
case 7:
|
|
12246
|
-
|
|
12355
|
+
_l.trys.push([7, 11, , 12]);
|
|
12247
12356
|
return [4 /*yield*/, EntityType.Get({
|
|
12248
12357
|
entityTypeId: entityTypeId,
|
|
12249
12358
|
api: this.apiGetter.getApi()
|
|
12250
12359
|
})];
|
|
12251
12360
|
case 8:
|
|
12252
|
-
entityType = (_e = (
|
|
12361
|
+
entityType = (_e = (_l.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
12253
12362
|
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
12254
12363
|
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
12255
12364
|
return [4 /*yield*/, Style.Get({
|
|
@@ -12257,11 +12366,11 @@ var EntitiesLoadedRenderManager;
|
|
|
12257
12366
|
styleId: entityType["DisplaySetting.ID"]
|
|
12258
12367
|
})];
|
|
12259
12368
|
case 9:
|
|
12260
|
-
style = (_f = (
|
|
12261
|
-
|
|
12369
|
+
style = (_f = (_l.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
12370
|
+
_l.label = 10;
|
|
12262
12371
|
case 10: return [3 /*break*/, 12];
|
|
12263
12372
|
case 11:
|
|
12264
|
-
e_4 =
|
|
12373
|
+
e_4 = _l.sent();
|
|
12265
12374
|
console.error(e_4);
|
|
12266
12375
|
return [3 /*break*/, 12];
|
|
12267
12376
|
case 12:
|
|
@@ -12281,34 +12390,51 @@ var EntitiesLoadedRenderManager;
|
|
|
12281
12390
|
lineWidthPx = 0;
|
|
12282
12391
|
}
|
|
12283
12392
|
lineWidthPx = Math.round(lineWidthPx);
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12393
|
+
collection = {
|
|
12394
|
+
features: [],
|
|
12395
|
+
type: "FeatureCollection"
|
|
12396
|
+
};
|
|
12397
|
+
for (i = 0; i < entities.length; i++) {
|
|
12398
|
+
entity = entities[i];
|
|
12399
|
+
feature = Geometry.ToGeoJsonFeature({
|
|
12400
|
+
geometry: entity.Bruce.VectorGeometry,
|
|
12401
|
+
noAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
12402
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
12403
|
+
properties: __assign(__assign({}, entity), { Bruce: __assign(__assign({}, entity.Bruce), {
|
|
12404
|
+
// Exclude as we just converted it to geojson.
|
|
12405
|
+
VectorGeometry: null }) })
|
|
12296
12406
|
});
|
|
12407
|
+
if (feature) {
|
|
12408
|
+
collection.features.push(feature);
|
|
12409
|
+
}
|
|
12410
|
+
}
|
|
12411
|
+
individuals = entities.filter(function (entity) {
|
|
12412
|
+
var feature = collection.features.find(function (x) { var _a, _b; return ((_b = (_a = x.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == entity.Bruce.ID; });
|
|
12413
|
+
if (!feature) {
|
|
12414
|
+
return true;
|
|
12415
|
+
}
|
|
12416
|
+
if (feature.geometry.type == "Point") {
|
|
12417
|
+
return true;
|
|
12418
|
+
}
|
|
12419
|
+
return false;
|
|
12297
12420
|
});
|
|
12298
|
-
if (
|
|
12299
|
-
this.renderAsIndividuals(
|
|
12421
|
+
if (individuals.length) {
|
|
12422
|
+
this.renderAsIndividuals(individuals, force);
|
|
12300
12423
|
}
|
|
12301
|
-
|
|
12424
|
+
// Filter out points (the ones we just rendered as individuals).
|
|
12425
|
+
collection.features = collection.features.filter(function (x) { return x.geometry.type != "Point"; });
|
|
12426
|
+
// If there is nothing to render now, return.
|
|
12427
|
+
if (!collection.features.length) {
|
|
12302
12428
|
return [2 /*return*/];
|
|
12303
12429
|
}
|
|
12304
|
-
return [4 /*yield*/, GeoJsonDataSource.load(
|
|
12430
|
+
return [4 /*yield*/, GeoJsonDataSource.load(collection, {
|
|
12305
12431
|
stroke: cLineColor,
|
|
12306
12432
|
fill: cFillColor,
|
|
12307
12433
|
strokeWidth: lineWidthPx,
|
|
12308
12434
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
12309
12435
|
})];
|
|
12310
12436
|
case 13:
|
|
12311
|
-
source =
|
|
12437
|
+
source = _l.sent();
|
|
12312
12438
|
this.viewer.dataSources.add(source);
|
|
12313
12439
|
this.sources.push(source);
|
|
12314
12440
|
if (this.disposed) {
|
|
@@ -12784,12 +12910,12 @@ var EntitiesIdsRenderManager;
|
|
|
12784
12910
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
12785
12911
|
*/
|
|
12786
12912
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
12787
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
12913
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
12788
12914
|
return __awaiter(this, void 0, void 0, function () {
|
|
12789
|
-
var zoomItem, lods, withLods_1,
|
|
12915
|
+
var zoomItem, lods, withLods_1, individuals_1, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, collection, i, entity, feature, individuals, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
12790
12916
|
var _this = this;
|
|
12791
|
-
return __generator(this, function (
|
|
12792
|
-
switch (
|
|
12917
|
+
return __generator(this, function (_l) {
|
|
12918
|
+
switch (_l.label) {
|
|
12793
12919
|
case 0:
|
|
12794
12920
|
entities = entities.filter(function (entity) {
|
|
12795
12921
|
var _a;
|
|
@@ -12819,43 +12945,43 @@ var EntitiesIdsRenderManager;
|
|
|
12819
12945
|
}
|
|
12820
12946
|
})];
|
|
12821
12947
|
case 1:
|
|
12822
|
-
lods = (
|
|
12948
|
+
lods = (_l.sent()).lods;
|
|
12823
12949
|
if (this.disposed) {
|
|
12824
12950
|
this.doDispose();
|
|
12825
12951
|
return [2 /*return*/];
|
|
12826
12952
|
}
|
|
12827
12953
|
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
12828
|
-
|
|
12954
|
+
individuals_1 = entities.filter(function (entity) {
|
|
12829
12955
|
var _a;
|
|
12830
12956
|
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
12831
12957
|
});
|
|
12832
|
-
if (
|
|
12833
|
-
this.renderAsIndividuals(
|
|
12958
|
+
if (individuals_1.length) {
|
|
12959
|
+
this.renderAsIndividuals(individuals_1, force);
|
|
12834
12960
|
}
|
|
12835
12961
|
// Now we proceed with what is left.
|
|
12836
12962
|
entities = entities.filter(function (entity) {
|
|
12837
12963
|
var _a;
|
|
12838
12964
|
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
12839
12965
|
});
|
|
12840
|
-
|
|
12966
|
+
_l.label = 2;
|
|
12841
12967
|
case 2:
|
|
12842
12968
|
if (!entities.length) {
|
|
12843
12969
|
return [2 /*return*/];
|
|
12844
12970
|
}
|
|
12845
12971
|
style = null;
|
|
12846
12972
|
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
12847
|
-
|
|
12973
|
+
_l.label = 3;
|
|
12848
12974
|
case 3:
|
|
12849
|
-
|
|
12975
|
+
_l.trys.push([3, 5, , 6]);
|
|
12850
12976
|
return [4 /*yield*/, Style.Get({
|
|
12851
12977
|
api: this.apiGetter.getApi(),
|
|
12852
12978
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
12853
12979
|
})];
|
|
12854
12980
|
case 4:
|
|
12855
|
-
style = (_a = (
|
|
12981
|
+
style = (_a = (_l.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
12856
12982
|
return [3 /*break*/, 6];
|
|
12857
12983
|
case 5:
|
|
12858
|
-
e_3 =
|
|
12984
|
+
e_3 = _l.sent();
|
|
12859
12985
|
console.error(e_3);
|
|
12860
12986
|
return [3 /*break*/, 6];
|
|
12861
12987
|
case 6:
|
|
@@ -12864,15 +12990,15 @@ var EntitiesIdsRenderManager;
|
|
|
12864
12990
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
12865
12991
|
}
|
|
12866
12992
|
if (!entityTypeId) return [3 /*break*/, 12];
|
|
12867
|
-
|
|
12993
|
+
_l.label = 7;
|
|
12868
12994
|
case 7:
|
|
12869
|
-
|
|
12995
|
+
_l.trys.push([7, 11, , 12]);
|
|
12870
12996
|
return [4 /*yield*/, EntityType.Get({
|
|
12871
12997
|
entityTypeId: entityTypeId,
|
|
12872
12998
|
api: this.apiGetter.getApi()
|
|
12873
12999
|
})];
|
|
12874
13000
|
case 8:
|
|
12875
|
-
entityType = (_e = (
|
|
13001
|
+
entityType = (_e = (_l.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
12876
13002
|
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
12877
13003
|
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
12878
13004
|
return [4 /*yield*/, Style.Get({
|
|
@@ -12880,11 +13006,11 @@ var EntitiesIdsRenderManager;
|
|
|
12880
13006
|
styleId: entityType["DisplaySetting.ID"]
|
|
12881
13007
|
})];
|
|
12882
13008
|
case 9:
|
|
12883
|
-
style = (_f = (
|
|
12884
|
-
|
|
13009
|
+
style = (_f = (_l.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
13010
|
+
_l.label = 10;
|
|
12885
13011
|
case 10: return [3 /*break*/, 12];
|
|
12886
13012
|
case 11:
|
|
12887
|
-
e_4 =
|
|
13013
|
+
e_4 = _l.sent();
|
|
12888
13014
|
console.error(e_4);
|
|
12889
13015
|
return [3 /*break*/, 12];
|
|
12890
13016
|
case 12:
|
|
@@ -12904,34 +13030,51 @@ var EntitiesIdsRenderManager;
|
|
|
12904
13030
|
lineWidthPx = 0;
|
|
12905
13031
|
}
|
|
12906
13032
|
lineWidthPx = Math.round(lineWidthPx);
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
13033
|
+
collection = {
|
|
13034
|
+
features: [],
|
|
13035
|
+
type: "FeatureCollection"
|
|
13036
|
+
};
|
|
13037
|
+
for (i = 0; i < entities.length; i++) {
|
|
13038
|
+
entity = entities[i];
|
|
13039
|
+
feature = Geometry.ToGeoJsonFeature({
|
|
13040
|
+
geometry: entity.Bruce.VectorGeometry,
|
|
13041
|
+
noAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
13042
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
13043
|
+
properties: __assign(__assign({}, entity), { Bruce: __assign(__assign({}, entity.Bruce), {
|
|
13044
|
+
// Exclude as we just converted it to geojson.
|
|
13045
|
+
VectorGeometry: null }) })
|
|
12919
13046
|
});
|
|
13047
|
+
if (feature) {
|
|
13048
|
+
collection.features.push(feature);
|
|
13049
|
+
}
|
|
13050
|
+
}
|
|
13051
|
+
individuals = entities.filter(function (entity) {
|
|
13052
|
+
var feature = collection.features.find(function (x) { var _a, _b; return ((_b = (_a = x.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == entity.Bruce.ID; });
|
|
13053
|
+
if (!feature) {
|
|
13054
|
+
return true;
|
|
13055
|
+
}
|
|
13056
|
+
if (feature.geometry.type == "Point") {
|
|
13057
|
+
return true;
|
|
13058
|
+
}
|
|
13059
|
+
return false;
|
|
12920
13060
|
});
|
|
12921
|
-
if (
|
|
12922
|
-
this.renderAsIndividuals(
|
|
13061
|
+
if (individuals.length) {
|
|
13062
|
+
this.renderAsIndividuals(individuals, force);
|
|
12923
13063
|
}
|
|
12924
|
-
|
|
13064
|
+
// Filter out points (the ones we just rendered as individuals).
|
|
13065
|
+
collection.features = collection.features.filter(function (x) { return x.geometry.type != "Point"; });
|
|
13066
|
+
// If there is nothing to render now, return.
|
|
13067
|
+
if (!collection.features.length) {
|
|
12925
13068
|
return [2 /*return*/];
|
|
12926
13069
|
}
|
|
12927
|
-
return [4 /*yield*/, GeoJsonDataSource.load(
|
|
13070
|
+
return [4 /*yield*/, GeoJsonDataSource.load(collection, {
|
|
12928
13071
|
stroke: cLineColor,
|
|
12929
13072
|
fill: cFillColor,
|
|
12930
13073
|
strokeWidth: lineWidthPx,
|
|
12931
13074
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
12932
13075
|
})];
|
|
12933
13076
|
case 13:
|
|
12934
|
-
source =
|
|
13077
|
+
source = _l.sent();
|
|
12935
13078
|
this.viewer.dataSources.add(source);
|
|
12936
13079
|
this.sources.push(source);
|
|
12937
13080
|
if (this.disposed) {
|
|
@@ -25609,7 +25752,7 @@ var ViewRenderEngine;
|
|
|
25609
25752
|
ViewRenderEngine.Render = Render;
|
|
25610
25753
|
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
25611
25754
|
|
|
25612
|
-
var VERSION = "4.1
|
|
25755
|
+
var VERSION = "4.2.1";
|
|
25613
25756
|
|
|
25614
25757
|
export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline };
|
|
25615
25758
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|