bruce-models 1.0.4 → 1.0.6

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.
@@ -1646,19 +1646,16 @@ var Entity;
1646
1646
  ]
1647
1647
  };
1648
1648
  }
1649
- let url = "entities" +
1650
- // Page size and index.
1651
- `?PageSize=${filter.pageSize}&PageIndex=${filter.pageIndex}` +
1652
- // Entity type id.
1653
- (filter.entityTypeId ? `&BruceEntityType=${filter.entityTypeId}` : "") +
1654
- // Lod.
1655
- (filter.lodCategoryId ? "&LODType=" + filter.lodCategoryId : "") +
1656
- // Attribute filter.
1657
- (!requestFilter ? "" : "&Filter=" + Api.Encode(JSON.stringify(requestFilter))) +
1658
- // Order by attribute + sort order.
1659
- (!filter.orderBy ? "" : "&OrderBy=" + filter.orderBy) +
1660
- (filter.sortOrder ? `&SortOrder=${filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC"}` : "");
1661
- const data = yield api.GET(url, Api.PrepReqParams(reqParams));
1649
+ const body = {
1650
+ SortOrder: filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC",
1651
+ OrderBy: filter.orderBy,
1652
+ Filter: requestFilter,
1653
+ LODType: filter.lodCategoryId,
1654
+ BruceEntityType: filter.entityTypeId,
1655
+ PageIndex: filter.pageIndex,
1656
+ PageSize: filter.pageSize
1657
+ };
1658
+ const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
1662
1659
  const entities = data.Items;
1663
1660
  for (let i = 0; i < entities.length; i++) {
1664
1661
  const entity = entities[i];
@@ -3332,6 +3329,7 @@ var EntityGlobe;
3332
3329
  const lon2 = lon1 + cellDegreeSize;
3333
3330
  const lat2 = lat1 + cellDegreeSize;
3334
3331
  const [id, cell] = getOrCreateCell(this.cells, cellDegreeSize, lon1, lon2, lat1, lat2);
3332
+ /*
3335
3333
  {
3336
3334
  const cell_bounds = { south: lat1, west: lon1, north: lat2, east: lon2 };
3337
3335
  const subcells = [];
@@ -3358,11 +3356,13 @@ var EntityGlobe;
3358
3356
  cell.Fetched = true;
3359
3357
  return;
3360
3358
  }
3359
+
3361
3360
  let [x2, y2] = max;
3362
3361
  x2 = Math.max(x2, lon2);
3363
3362
  y2 = Math.max(y2, lat2);
3364
3363
  max = [x2, y2];
3365
3364
  }
3365
+ */
3366
3366
  ids.push(id);
3367
3367
  cells.push(cell);
3368
3368
  cells[id] = cell;
@@ -3398,31 +3398,6 @@ function intersects(l, r) {
3398
3398
  const { west: wr, south: sr, north: nr, east: er } = r;
3399
3399
  return !(e <= wr || w >= er || n <= sr || s >= nr);
3400
3400
  }
3401
- function contains(l, r) {
3402
- const { west: w, south: s, north: n, east: e } = l;
3403
- const { west: wr, south: sr, north: nr, east: er } = r;
3404
- return !(er < e || wr > w || nr > n || sr < s);
3405
- }
3406
- function crop(rect, by) {
3407
- let { west: w, south: s, north: n, east: e } = rect;
3408
- const { west: wc, south: sc, north: nc, east: ec } = by;
3409
- w = Math.max(w, ec);
3410
- e = Math.min(e, wc);
3411
- s = Math.max(s, nc);
3412
- n = Math.min(n, sc);
3413
- return { west: w, south: s, north: n, east: e };
3414
- }
3415
- function intersection(l, r) {
3416
- const { west: w, south: s, north: n, east: e } = l;
3417
- const { west: wr, south: sr, north: nr, east: er } = r;
3418
- const x = Math.min(e, er) - Math.max(w, wr);
3419
- const y = Math.min(n, nr) - Math.max(s, sr);
3420
- return (x > 0 && y > 0) ? x * y : 0;
3421
- }
3422
- function area(rect) {
3423
- let { west: w, south: s, north: n, east: e } = rect;
3424
- return Math.abs((e - w) * (n - s));
3425
- }
3426
3401
  function floorValueToCellSize(size, value) {
3427
3402
  return Math.floor(value / size) * size;
3428
3403
  }
@@ -3553,6 +3528,14 @@ var EntityFilterGetter;
3553
3528
  }
3554
3529
  return this.onScanUpdate;
3555
3530
  }
3531
+ /**
3532
+ * Returns id that represents the combined menu item parameters.
3533
+ * If integrity changes while a request is running, the request will not emit a response.
3534
+ * @returns
3535
+ */
3536
+ getIntegrityId() {
3537
+ return this.tagIds == null ? "" : this.tagIds.join();
3538
+ }
3556
3539
  viewAreaSub() {
3557
3540
  this.viewAreaDispose();
3558
3541
  this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(() => {
@@ -3639,6 +3622,7 @@ var EntityFilterGetter;
3639
3622
  // Increase id so that existing loops stop.
3640
3623
  this.getterLoopId += 1;
3641
3624
  const loopId = this.getterLoopId;
3625
+ const loopIntegrity = this.getIntegrityId();
3642
3626
  new Promise(() => __awaiter(this, void 0, void 0, function* () {
3643
3627
  var _a, _b, _c, _d, _e, _f, _g, _h;
3644
3628
  // Minor delay to stop 50 menu items enabling doing their first request all together.
@@ -3697,12 +3681,13 @@ var EntityFilterGetter;
3697
3681
  sortOrder: Api.ESortOrder.Asc,
3698
3682
  entityTypeConditions: this.attrFilter
3699
3683
  });
3684
+ const integrity = this.getIntegrityId();
3685
+ if (loopIntegrity == integrity && page) {
3686
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(page);
3687
+ }
3700
3688
  if (this.getterLoopId != loopId) {
3701
3689
  break;
3702
3690
  }
3703
- if (page) {
3704
- (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(page);
3705
- }
3706
3691
  if (!postedLoading) {
3707
3692
  this.postStatus({ msg: EStatus.Loading, revoking: false });
3708
3693
  postedLoading = true;