bruce-models 0.0.3 → 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.
- package/dist/bruce-models.es5.js +65 -61
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +64 -62
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/entity/getters/entity-loaded-getter.js +65 -62
- package/dist/lib/entity/getters/entity-loaded-getter.js.map +1 -1
- package/dist/types/entity/getters/entity-loaded-getter.d.ts +17 -15
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3083,72 +3083,75 @@
|
|
|
3083
3083
|
|
|
3084
3084
|
var MAX_AREA_IN_DEGREES$1 = 90;
|
|
3085
3085
|
var GETTER_DELAY = 50;
|
|
3086
|
-
|
|
3087
|
-
function
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
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
|
|
3099
3111
|
});
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
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;
|
|
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;
|
|
3121
3128
|
}
|
|
3122
|
-
|
|
3129
|
+
};
|
|
3130
|
+
Getter.prototype.startGetterLoop = function () {
|
|
3131
|
+
var _this = this;
|
|
3132
|
+
clearInterval(this.getterInterval);
|
|
3133
|
+
if (!this.viewRect || !this.viewCenter) {
|
|
3123
3134
|
return;
|
|
3124
3135
|
}
|
|
3125
|
-
|
|
3126
|
-
this.
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
index += _this.batchSize;
|
|
3139
|
-
if (index >= _this.entities.length) {
|
|
3140
|
-
clearInterval(_this.getterInterval);
|
|
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);
|
|
3141
3149
|
}
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
|
|
3148
|
-
}
|
|
3149
|
-
};
|
|
3150
|
-
return EntityLoadedGetter;
|
|
3151
|
-
}());
|
|
3150
|
+
};
|
|
3151
|
+
return Getter;
|
|
3152
|
+
}());
|
|
3153
|
+
EntityLoadedGetter.Getter = Getter;
|
|
3154
|
+
})(exports.EntityLoadedGetter || (exports.EntityLoadedGetter = {}));
|
|
3152
3155
|
|
|
3153
3156
|
(function (ClientFile) {
|
|
3154
3157
|
function GetCacheKey(fileId) {
|
|
@@ -4751,7 +4754,6 @@
|
|
|
4751
4754
|
exports.BruceEvent = BruceEvent;
|
|
4752
4755
|
exports.CacheControl = CacheControl;
|
|
4753
4756
|
exports.DelayQueue = DelayQueue;
|
|
4754
|
-
exports.EntityLoadedGetter = EntityLoadedGetter;
|
|
4755
4757
|
|
|
4756
4758
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4757
4759
|
|