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.
@@ -1334,6 +1334,32 @@
1334
1334
  return true;
1335
1335
  }
1336
1336
  Carto.IsEqual = IsEqual;
1337
+ function GetCenter(list) {
1338
+ var center = {
1339
+ longitude: 0,
1340
+ latitude: 0,
1341
+ altitude: 0
1342
+ };
1343
+ for (var i = 0; i < list.length; i++) {
1344
+ var carto = list[i];
1345
+ center.longitude += carto.longitude;
1346
+ center.latitude += carto.latitude;
1347
+ if (carto.altitude) {
1348
+ center.altitude += carto.altitude;
1349
+ }
1350
+ }
1351
+ if (center.longitude) {
1352
+ center.longitude /= list.length;
1353
+ }
1354
+ if (center.latitude) {
1355
+ center.latitude /= list.length;
1356
+ }
1357
+ if (center.altitude) {
1358
+ center.altitude /= list.length;
1359
+ }
1360
+ return center;
1361
+ }
1362
+ Carto.GetCenter = GetCenter;
1337
1363
  })(exports.Carto || (exports.Carto = {}));
1338
1364
 
1339
1365
  var DelayQueue = /** @class */ (function () {
@@ -1390,6 +1416,11 @@
1390
1416
  }());
1391
1417
 
1392
1418
  (function (Geometry) {
1419
+ var EPolygonRingType;
1420
+ (function (EPolygonRingType) {
1421
+ EPolygonRingType["Boundaries"] = "out";
1422
+ EPolygonRingType["Hole"] = "in";
1423
+ })(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
1393
1424
  function LineStrFromPoints(points) {
1394
1425
  if (!points.length) {
1395
1426
  throw ("points is empty.");
@@ -1467,7 +1498,7 @@
1467
1498
  var topPoint = positions[0];
1468
1499
  newGeometry.Point = topPoint.latitude + "," + topPoint.longitude + (topPoint.altitude != null ? "," + topPoint.altitude : "");
1469
1500
  if (positions.length > 1) {
1470
- newGeometry.Polygon = [{ Facing: "out", LinearRing: LineStrFromPoints(positions) }];
1501
+ newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
1471
1502
  }
1472
1503
  if (positions.length > 2) {
1473
1504
  newGeometry.LineString = LineStrFromPoints(positions);