bruce-models 3.4.1 → 3.4.3
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-models.es5.js +69 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +69 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/geometry.js +68 -0
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/common/geometry.d.ts +5 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3830,6 +3830,74 @@
|
|
|
3830
3830
|
return geometry;
|
|
3831
3831
|
}
|
|
3832
3832
|
Geometry.ParseGeometry = ParseGeometry;
|
|
3833
|
+
function ToGeoJson(params) {
|
|
3834
|
+
const { entities, excludeAltitude } = params;
|
|
3835
|
+
const features = [];
|
|
3836
|
+
const processGeometry = (geometry, ID) => {
|
|
3837
|
+
if (geometry.Polygon) {
|
|
3838
|
+
const sortedPolygons = geometry.Polygon.sort((a, b) => a.Facing === EPolygonRingType.Boundaries ? -1 : 1);
|
|
3839
|
+
const coordinates = sortedPolygons.map(polygonRing => polygonRing.LinearRing.split(' ').map(coord => {
|
|
3840
|
+
const [lon, lat, alt] = coord.split(',').map(Number);
|
|
3841
|
+
return excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
|
|
3842
|
+
}));
|
|
3843
|
+
features.push({
|
|
3844
|
+
type: 'Feature',
|
|
3845
|
+
properties: { ID },
|
|
3846
|
+
geometry: {
|
|
3847
|
+
type: 'Polygon',
|
|
3848
|
+
coordinates: coordinates,
|
|
3849
|
+
}
|
|
3850
|
+
});
|
|
3851
|
+
}
|
|
3852
|
+
if (geometry.Point) {
|
|
3853
|
+
const [lon, lat, alt] = geometry.Point.split(',').map(Number);
|
|
3854
|
+
const coordinates = excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
|
|
3855
|
+
features.push({
|
|
3856
|
+
type: 'Feature',
|
|
3857
|
+
properties: { ID },
|
|
3858
|
+
geometry: {
|
|
3859
|
+
type: 'Point',
|
|
3860
|
+
coordinates,
|
|
3861
|
+
}
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
if (geometry.LineString) {
|
|
3865
|
+
const coordinates = geometry.LineString.split(' ').map(coord => {
|
|
3866
|
+
const [lon, lat, alt] = coord.split(',').map(Number);
|
|
3867
|
+
return excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
|
|
3868
|
+
});
|
|
3869
|
+
features.push({
|
|
3870
|
+
type: 'Feature',
|
|
3871
|
+
properties: { ID },
|
|
3872
|
+
geometry: {
|
|
3873
|
+
type: 'LineString',
|
|
3874
|
+
coordinates,
|
|
3875
|
+
}
|
|
3876
|
+
});
|
|
3877
|
+
}
|
|
3878
|
+
if (geometry.MultiGeometry) {
|
|
3879
|
+
geometry.MultiGeometry.forEach(geo => processGeometry(geo, ID));
|
|
3880
|
+
}
|
|
3881
|
+
};
|
|
3882
|
+
entities.forEach(entity => {
|
|
3883
|
+
var _a, _b, _c;
|
|
3884
|
+
if (!((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID)) {
|
|
3885
|
+
return;
|
|
3886
|
+
}
|
|
3887
|
+
let geometry = entity.geometry;
|
|
3888
|
+
if (!geometry && (((_b = entity.location) === null || _b === void 0 ? void 0 : _b.longitude) && ((_c = entity.location) === null || _c === void 0 ? void 0 : _c.latitude))) {
|
|
3889
|
+
geometry = {
|
|
3890
|
+
Point: `${entity.location.longitude},${entity.location.latitude}` + (entity.location.altitude != null ? `,${entity.location.altitude}` : ""),
|
|
3891
|
+
};
|
|
3892
|
+
}
|
|
3893
|
+
processGeometry(geometry, entity.Bruce.ID);
|
|
3894
|
+
});
|
|
3895
|
+
return {
|
|
3896
|
+
type: 'FeatureCollection',
|
|
3897
|
+
features,
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3900
|
+
Geometry.ToGeoJson = ToGeoJson;
|
|
3833
3901
|
})(exports.Geometry || (exports.Geometry = {}));
|
|
3834
3902
|
|
|
3835
3903
|
(function (Bounds) {
|
|
@@ -10457,7 +10525,7 @@
|
|
|
10457
10525
|
DataSource.GetList = GetList;
|
|
10458
10526
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
10459
10527
|
|
|
10460
|
-
const VERSION = "3.4.
|
|
10528
|
+
const VERSION = "3.4.3";
|
|
10461
10529
|
|
|
10462
10530
|
exports.VERSION = VERSION;
|
|
10463
10531
|
exports.AbstractApi = AbstractApi;
|