bruce-models 0.0.7 → 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);
@@ -2296,7 +2327,7 @@
2296
2327
  });
2297
2328
  }); });
2298
2329
  _loop_1 = function (i) {
2299
- var req = new Promise(function (rej, res) { return __awaiter(_this, void 0, void 0, function () {
2330
+ var req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
2300
2331
  var sources, e_2;
2301
2332
  return __generator(this, function (_a) {
2302
2333
  switch (_a.label) {
@@ -2433,7 +2464,8 @@
2433
2464
  });
2434
2465
  }); });
2435
2466
  _loop_1 = function (i) {
2436
- var req = new Promise(function (rej, res) { return __awaiter(_this, void 0, void 0, function () {
2467
+ var id = reqIds[i];
2468
+ var req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
2437
2469
  var tags, tag, e_2;
2438
2470
  return __generator(this, function (_a) {
2439
2471
  switch (_a.label) {
@@ -2442,7 +2474,7 @@
2442
2474
  return [4 /*yield*/, prom_1];
2443
2475
  case 1:
2444
2476
  tags = _a.sent();
2445
- tag = tags.find(function (t) { return t.ID === reqIds[i]; });
2477
+ tag = tags.find(function (t) { return t.ID === id; });
2446
2478
  res(tag);
2447
2479
  return [3 /*break*/, 3];
2448
2480
  case 2:
@@ -2453,7 +2485,7 @@
2453
2485
  }
2454
2486
  });
2455
2487
  }); });
2456
- api.Cache.Set(GetCacheKey(reqIds[i]), req, exports.Api.DEFAULT_CACHE_DURATION);
2488
+ api.Cache.Set(GetCacheKey(id), req, exports.Api.DEFAULT_CACHE_DURATION);
2457
2489
  reqs.push(req);
2458
2490
  };
2459
2491
  for (i = 0; i < reqIds.length; i++) {