bruce-models 0.0.8 → 0.0.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-models.es5.js +32 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +32 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/common/carto.js +26 -0
- package/dist/lib/common/carto.js.map +1 -1
- package/dist/lib/common/geometry.js +6 -1
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/types/common/carto.d.ts +1 -0
- package/dist/types/common/geometry.d.ts +9 -1
- package/package.json +2 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -1338,6 +1338,32 @@ var Carto;
|
|
|
1338
1338
|
return true;
|
|
1339
1339
|
}
|
|
1340
1340
|
Carto.IsEqual = IsEqual;
|
|
1341
|
+
function GetCenter(list) {
|
|
1342
|
+
var center = {
|
|
1343
|
+
longitude: 0,
|
|
1344
|
+
latitude: 0,
|
|
1345
|
+
altitude: 0
|
|
1346
|
+
};
|
|
1347
|
+
for (var i = 0; i < list.length; i++) {
|
|
1348
|
+
var carto = list[i];
|
|
1349
|
+
center.longitude += carto.longitude;
|
|
1350
|
+
center.latitude += carto.latitude;
|
|
1351
|
+
if (carto.altitude) {
|
|
1352
|
+
center.altitude += carto.altitude;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
if (center.longitude) {
|
|
1356
|
+
center.longitude /= list.length;
|
|
1357
|
+
}
|
|
1358
|
+
if (center.latitude) {
|
|
1359
|
+
center.latitude /= list.length;
|
|
1360
|
+
}
|
|
1361
|
+
if (center.altitude) {
|
|
1362
|
+
center.altitude /= list.length;
|
|
1363
|
+
}
|
|
1364
|
+
return center;
|
|
1365
|
+
}
|
|
1366
|
+
Carto.GetCenter = GetCenter;
|
|
1341
1367
|
})(Carto || (Carto = {}));
|
|
1342
1368
|
|
|
1343
1369
|
var DelayQueue = /** @class */ (function () {
|
|
@@ -1395,6 +1421,11 @@ var DelayQueue = /** @class */ (function () {
|
|
|
1395
1421
|
|
|
1396
1422
|
var Geometry;
|
|
1397
1423
|
(function (Geometry) {
|
|
1424
|
+
var EPolygonRingType;
|
|
1425
|
+
(function (EPolygonRingType) {
|
|
1426
|
+
EPolygonRingType["Boundaries"] = "out";
|
|
1427
|
+
EPolygonRingType["Hole"] = "in";
|
|
1428
|
+
})(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
|
|
1398
1429
|
function LineStrFromPoints(points) {
|
|
1399
1430
|
if (!points.length) {
|
|
1400
1431
|
throw ("points is empty.");
|
|
@@ -1472,7 +1503,7 @@ var Geometry;
|
|
|
1472
1503
|
var topPoint = positions[0];
|
|
1473
1504
|
newGeometry.Point = topPoint.latitude + "," + topPoint.longitude + (topPoint.altitude != null ? "," + topPoint.altitude : "");
|
|
1474
1505
|
if (positions.length > 1) {
|
|
1475
|
-
newGeometry.Polygon = [{ Facing:
|
|
1506
|
+
newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
|
|
1476
1507
|
}
|
|
1477
1508
|
if (positions.length > 2) {
|
|
1478
1509
|
newGeometry.LineString = LineStrFromPoints(positions);
|