bruce-models 4.6.6 → 4.6.8
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 +23 -19
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +23 -19
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/geometry.js +22 -18
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -4520,8 +4520,9 @@
|
|
|
4520
4520
|
// Converts polygons to GeoJSON coordinates.
|
|
4521
4521
|
// This will close the polygon if it's not already closed and remove consecutive duplicates.
|
|
4522
4522
|
const coordinates = closePolygonCoordinates(sortedPolygons.map(polygon => {
|
|
4523
|
-
|
|
4524
|
-
|
|
4523
|
+
const points = ParsePoints(polygon.LinearRing);
|
|
4524
|
+
return removeConsecutiveDuplicates(points.map(coord => {
|
|
4525
|
+
const { longitude: lon, latitude: lat, altitude: alt } = coord;
|
|
4525
4526
|
return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
|
|
4526
4527
|
}));
|
|
4527
4528
|
}));
|
|
@@ -4533,8 +4534,9 @@
|
|
|
4533
4534
|
}
|
|
4534
4535
|
}
|
|
4535
4536
|
if (!jGeometry && geometry.LineString) {
|
|
4536
|
-
const
|
|
4537
|
-
|
|
4537
|
+
const points = ParsePoints(geometry.LineString);
|
|
4538
|
+
const coordinates = removeConsecutiveDuplicates(points.map(coord => {
|
|
4539
|
+
const { longitude: lon, latitude: lat, altitude: alt } = coord;
|
|
4538
4540
|
return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
|
|
4539
4541
|
}));
|
|
4540
4542
|
if (coordinates.length >= 2) {
|
|
@@ -4545,12 +4547,15 @@
|
|
|
4545
4547
|
}
|
|
4546
4548
|
}
|
|
4547
4549
|
if (!jGeometry && geometry.Point) {
|
|
4548
|
-
const
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
coordinates:
|
|
4552
|
-
|
|
4553
|
-
|
|
4550
|
+
const points = ParsePoints(geometry.Point);
|
|
4551
|
+
if (points.length) {
|
|
4552
|
+
const { longitude: lon, latitude: lat, altitude: alt } = points[0];
|
|
4553
|
+
const coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
|
|
4554
|
+
jGeometry = {
|
|
4555
|
+
coordinates: coordinates,
|
|
4556
|
+
type: exports.GeoJson.EType.Point
|
|
4557
|
+
};
|
|
4558
|
+
}
|
|
4554
4559
|
}
|
|
4555
4560
|
if (jGeometry) {
|
|
4556
4561
|
collection.push(jGeometry);
|
|
@@ -4611,15 +4616,11 @@
|
|
|
4611
4616
|
// This will append to the "full" object as it goes.
|
|
4612
4617
|
const traverse = (feature) => {
|
|
4613
4618
|
// Geometry collections don't have coords so we have to cast as any.
|
|
4614
|
-
const { type, coordinates, properties } = feature.geometry;
|
|
4619
|
+
const { type, coordinates, properties, geometries } = feature.geometry;
|
|
4615
4620
|
// Unknown thing. Ignoring.
|
|
4616
4621
|
if (!type) {
|
|
4617
4622
|
return;
|
|
4618
4623
|
}
|
|
4619
|
-
// No coordinates. Ignoring.
|
|
4620
|
-
if (!coordinates) {
|
|
4621
|
-
return;
|
|
4622
|
-
}
|
|
4623
4624
|
// Simple properties merge.
|
|
4624
4625
|
// Doesn't handle nested properties very well.
|
|
4625
4626
|
if (properties) {
|
|
@@ -4628,9 +4629,8 @@
|
|
|
4628
4629
|
// We'll first match cases of nested collections and handle them early.
|
|
4629
4630
|
// Then we'll be left with simple geometry cases.
|
|
4630
4631
|
if (type === exports.GeoJson.EType.GeometryCollection) {
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
const geo = collection.geometries[i];
|
|
4632
|
+
for (let i = 0; i < geometries.length; i++) {
|
|
4633
|
+
const geo = geometries[i];
|
|
4634
4634
|
traverse({
|
|
4635
4635
|
type: exports.GeoJson.EType.Feature,
|
|
4636
4636
|
geometry: geo,
|
|
@@ -4646,6 +4646,10 @@
|
|
|
4646
4646
|
}
|
|
4647
4647
|
return;
|
|
4648
4648
|
}
|
|
4649
|
+
// No coordinates. Ignoring.
|
|
4650
|
+
if (!coordinates) {
|
|
4651
|
+
return;
|
|
4652
|
+
}
|
|
4649
4653
|
const geometry = {};
|
|
4650
4654
|
switch (type) {
|
|
4651
4655
|
case exports.GeoJson.EType.Polygon:
|
|
@@ -13746,7 +13750,7 @@
|
|
|
13746
13750
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13747
13751
|
|
|
13748
13752
|
// This is updated with the package.json version on build.
|
|
13749
|
-
const VERSION = "4.6.
|
|
13753
|
+
const VERSION = "4.6.8";
|
|
13750
13754
|
|
|
13751
13755
|
exports.VERSION = VERSION;
|
|
13752
13756
|
exports.AbstractApi = AbstractApi;
|