bruce-models 0.0.2 → 0.0.4

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.
@@ -1288,6 +1288,26 @@
1288
1288
  return true;
1289
1289
  }
1290
1290
  Cartes.ValidateCartes3 = ValidateCartes3;
1291
+ function IsEqualCartes2(a, b) {
1292
+ if (a.x != b.x) {
1293
+ return false;
1294
+ }
1295
+ else if (a.y != b.y) {
1296
+ return false;
1297
+ }
1298
+ return true;
1299
+ }
1300
+ Cartes.IsEqualCartes2 = IsEqualCartes2;
1301
+ function IsEqualCartes3(a, b) {
1302
+ if (!IsEqualCartes2(a, b)) {
1303
+ return false;
1304
+ }
1305
+ else if (a.z != b.z) {
1306
+ return false;
1307
+ }
1308
+ return true;
1309
+ }
1310
+ Cartes.IsEqualCartes3 = IsEqualCartes3;
1291
1311
  })(exports.Cartes || (exports.Cartes = {}));
1292
1312
 
1293
1313
  (function (Carto) {
@@ -1304,6 +1324,16 @@
1304
1324
  return true;
1305
1325
  }
1306
1326
  Carto.ValidateCarto = ValidateCarto;
1327
+ function IsEqual(a, b) {
1328
+ if (a.longitude != b.longitude) {
1329
+ return false;
1330
+ }
1331
+ else if (a.latitude != b.latitude) {
1332
+ return false;
1333
+ }
1334
+ return true;
1335
+ }
1336
+ Carto.IsEqual = IsEqual;
1307
1337
  })(exports.Carto || (exports.Carto = {}));
1308
1338
 
1309
1339
  var DelayQueue = /** @class */ (function () {
@@ -2850,7 +2880,7 @@
2850
2880
  this.updateState();
2851
2881
  };
2852
2882
  Getter.prototype.updateBounds = function () {
2853
- var viewRect = this.viewPort.GetArea();
2883
+ var viewRect = this.viewPort.GetBounds();
2854
2884
  var poi = this.viewPort.GetTarget();
2855
2885
  if (viewRect && poi) {
2856
2886
  if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES) {
@@ -3051,6 +3081,78 @@
3051
3081
  EntityFilterGetter.Getter = Getter;
3052
3082
  })(exports.EntityFilterGetter || (exports.EntityFilterGetter = {}));
3053
3083
 
3084
+ var MAX_AREA_IN_DEGREES$1 = 90;
3085
+ var GETTER_DELAY = 50;
3086
+ (function (EntityLoadedGetter) {
3087
+ var Getter = /** @class */ (function () {
3088
+ function Getter(entities, viewPort, batchSize) {
3089
+ var _this = this;
3090
+ this.viewPortRemoval = null;
3091
+ this.viewRect = null;
3092
+ this.viewCenter = null;
3093
+ this.onUpdate = null;
3094
+ this.entities = entities;
3095
+ this.viewPort = viewPort;
3096
+ this.batchSize = batchSize;
3097
+ this.viewPortRemoval = this.viewPort.Updated().Subscribe(function () {
3098
+ _this.updateBounds();
3099
+ _this.startGetterLoop();
3100
+ });
3101
+ }
3102
+ Object.defineProperty(Getter.prototype, "OnUpdate", {
3103
+ get: function () {
3104
+ if (!this.onUpdate) {
3105
+ this.onUpdate = new BruceEvent();
3106
+ }
3107
+ return this.onUpdate;
3108
+ },
3109
+ enumerable: false,
3110
+ configurable: true
3111
+ });
3112
+ Getter.prototype.Dispose = function () {
3113
+ var _a;
3114
+ (_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
3115
+ };
3116
+ Getter.prototype.updateBounds = function () {
3117
+ var viewRect = this.viewPort.GetBounds();
3118
+ var poi = this.viewPort.GetTarget();
3119
+ if (viewRect && poi) {
3120
+ if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
3121
+ return;
3122
+ }
3123
+ if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
3124
+ return;
3125
+ }
3126
+ this.viewRect = viewRect;
3127
+ this.viewCenter = poi;
3128
+ }
3129
+ };
3130
+ Getter.prototype.startGetterLoop = function () {
3131
+ var _this = this;
3132
+ clearInterval(this.getterInterval);
3133
+ if (!this.viewRect || !this.viewCenter) {
3134
+ return;
3135
+ }
3136
+ var index = 0;
3137
+ this.getterInterval = setInterval(function () {
3138
+ _this.processBatch(_this.entities.slice(index, index + _this.batchSize));
3139
+ index += _this.batchSize;
3140
+ if (index >= _this.entities.length) {
3141
+ clearInterval(_this.getterInterval);
3142
+ }
3143
+ }, GETTER_DELAY);
3144
+ };
3145
+ Getter.prototype.processBatch = function (batch) {
3146
+ var _a;
3147
+ if (batch.length > 0) {
3148
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
3149
+ }
3150
+ };
3151
+ return Getter;
3152
+ }());
3153
+ EntityLoadedGetter.Getter = Getter;
3154
+ })(exports.EntityLoadedGetter || (exports.EntityLoadedGetter = {}));
3155
+
3054
3156
  (function (ClientFile) {
3055
3157
  function GetCacheKey(fileId) {
3056
3158
  return "" + exports.Api.ECacheKey.ClientFile + exports.Api.ECacheKey.Id + fileId;