bruce-models 0.0.2 → 0.0.3
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 +101 -2
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +101 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/common/cartes.js +20 -0
- package/dist/lib/common/cartes.js.map +1 -1
- package/dist/lib/common/carto.js +10 -0
- package/dist/lib/common/carto.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-loaded-getter.js +74 -0
- package/dist/lib/entity/getters/entity-loaded-getter.js.map +1 -0
- package/dist/types/bruce-models.d.ts +1 -0
- package/dist/types/common/cartes.d.ts +2 -0
- package/dist/types/common/carto.d.ts +1 -0
- package/dist/types/entity/getters/entity-loaded-getter.d.ts +19 -0
- package/dist/types/entity/getters/view-monitor.d.ts +3 -3
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -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.
|
|
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,75 @@
|
|
|
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
|
+
var EntityLoadedGetter = /** @class */ (function () {
|
|
3087
|
+
function EntityLoadedGetter(entities, viewPort, batchSize) {
|
|
3088
|
+
var _this = this;
|
|
3089
|
+
this.viewPortRemoval = null;
|
|
3090
|
+
this.viewRect = null;
|
|
3091
|
+
this.viewCenter = null;
|
|
3092
|
+
this.onUpdate = null;
|
|
3093
|
+
this.entities = entities;
|
|
3094
|
+
this.viewPort = viewPort;
|
|
3095
|
+
this.batchSize = batchSize;
|
|
3096
|
+
this.viewPortRemoval = this.viewPort.Updated().Subscribe(function () {
|
|
3097
|
+
_this.updateBounds();
|
|
3098
|
+
_this.startGetterLoop();
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
Object.defineProperty(EntityLoadedGetter.prototype, "OnUpdate", {
|
|
3102
|
+
get: function () {
|
|
3103
|
+
if (!this.onUpdate) {
|
|
3104
|
+
this.onUpdate = new BruceEvent();
|
|
3105
|
+
}
|
|
3106
|
+
return this.onUpdate;
|
|
3107
|
+
},
|
|
3108
|
+
enumerable: false,
|
|
3109
|
+
configurable: true
|
|
3110
|
+
});
|
|
3111
|
+
EntityLoadedGetter.prototype.Dispose = function () {
|
|
3112
|
+
var _a;
|
|
3113
|
+
(_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
3114
|
+
};
|
|
3115
|
+
EntityLoadedGetter.prototype.updateBounds = function () {
|
|
3116
|
+
var viewRect = this.viewPort.GetBounds();
|
|
3117
|
+
var poi = this.viewPort.GetTarget();
|
|
3118
|
+
if (viewRect && poi) {
|
|
3119
|
+
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
|
|
3120
|
+
return;
|
|
3121
|
+
}
|
|
3122
|
+
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
|
|
3123
|
+
return;
|
|
3124
|
+
}
|
|
3125
|
+
this.viewRect = viewRect;
|
|
3126
|
+
this.viewCenter = poi;
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
EntityLoadedGetter.prototype.startGetterLoop = function () {
|
|
3130
|
+
var _this = this;
|
|
3131
|
+
clearInterval(this.getterInterval);
|
|
3132
|
+
if (!this.viewRect || !this.viewCenter) {
|
|
3133
|
+
return;
|
|
3134
|
+
}
|
|
3135
|
+
var index = 0;
|
|
3136
|
+
this.getterInterval = setInterval(function () {
|
|
3137
|
+
_this.processBatch(_this.entities.slice(index, index + _this.batchSize));
|
|
3138
|
+
index += _this.batchSize;
|
|
3139
|
+
if (index >= _this.entities.length) {
|
|
3140
|
+
clearInterval(_this.getterInterval);
|
|
3141
|
+
}
|
|
3142
|
+
}, GETTER_DELAY);
|
|
3143
|
+
};
|
|
3144
|
+
EntityLoadedGetter.prototype.processBatch = function (batch) {
|
|
3145
|
+
var _a;
|
|
3146
|
+
if (batch.length > 0) {
|
|
3147
|
+
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
return EntityLoadedGetter;
|
|
3151
|
+
}());
|
|
3152
|
+
|
|
3054
3153
|
(function (ClientFile) {
|
|
3055
3154
|
function GetCacheKey(fileId) {
|
|
3056
3155
|
return "" + exports.Api.ECacheKey.ClientFile + exports.Api.ECacheKey.Id + fileId;
|
|
@@ -4652,6 +4751,7 @@
|
|
|
4652
4751
|
exports.BruceEvent = BruceEvent;
|
|
4653
4752
|
exports.CacheControl = CacheControl;
|
|
4654
4753
|
exports.DelayQueue = DelayQueue;
|
|
4754
|
+
exports.EntityLoadedGetter = EntityLoadedGetter;
|
|
4655
4755
|
|
|
4656
4756
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4657
4757
|
|