bruce-cesium 0.4.1 → 0.4.2
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-cesium.es5.js +9 -1
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +8 -0
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +30 -30
- package/dist/lib/rendering/entity-render-engine.js +848 -848
- package/dist/lib/rendering/menu-item-manager.js +252 -252
- package/dist/lib/rendering/render-addons/measure-addon.js +186 -186
- package/dist/lib/rendering/render-addons/render-addon.js +2 -2
- package/dist/lib/rendering/render-helper.js +296 -296
- package/dist/lib/rendering/render-managers/common/shared-getters.js +31 -31
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +146 -146
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +143 -143
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +234 -234
- package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +139 -139
- package/dist/lib/rendering/render-managers/render-manager.js +50 -50
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +236 -236
- package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js +320 -320
- package/dist/lib/rendering/tile-render-engine.js +815 -815
- package/dist/lib/rendering/tileset-render-engine.js +499 -499
- package/dist/lib/rendering/view-render-engine.js +305 -305
- package/dist/lib/rendering/visuals-register.js +402 -394
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/drawing-utils.js +42 -42
- package/dist/lib/utils/entity-utils.js +99 -99
- package/dist/lib/utils/measure-utils.js +34 -34
- package/dist/lib/utils/view-utils.js +72 -72
- package/dist/lib/viewer/cesium-view-monitor.js +231 -231
- package/dist/lib/viewer/viewer-utils.js +85 -85
- package/dist/types/rendering/visuals-register.d.ts +2 -0
- package/package.json +76 -76
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SharedGetters = void 0;
|
|
4
|
-
var bruce_models_1 = require("bruce-models");
|
|
5
|
-
function createFilterGetterCacheKey(params) {
|
|
6
|
-
var cacheKey = "";
|
|
7
|
-
cacheKey += params.api.GetBaseUrl();
|
|
8
|
-
cacheKey += params.typeId;
|
|
9
|
-
cacheKey += params.batchSize;
|
|
10
|
-
cacheKey += JSON.stringify(params.attrFilter);
|
|
11
|
-
return cacheKey;
|
|
12
|
-
}
|
|
13
|
-
var SharedGetters;
|
|
14
|
-
(function (SharedGetters) {
|
|
15
|
-
var Cache = /** @class */ (function () {
|
|
16
|
-
function Cache() {
|
|
17
|
-
this.data = {};
|
|
18
|
-
}
|
|
19
|
-
Cache.prototype.GetOrCreateFilterGetter = function (params) {
|
|
20
|
-
var cacheKey = createFilterGetterCacheKey(params);
|
|
21
|
-
var getter = this.data[cacheKey];
|
|
22
|
-
if (!getter) {
|
|
23
|
-
getter = new bruce_models_1.EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter);
|
|
24
|
-
this.data[cacheKey] = getter;
|
|
25
|
-
}
|
|
26
|
-
return getter;
|
|
27
|
-
};
|
|
28
|
-
return Cache;
|
|
29
|
-
}());
|
|
30
|
-
SharedGetters.Cache = Cache;
|
|
31
|
-
})(SharedGetters = exports.SharedGetters || (exports.SharedGetters = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SharedGetters = void 0;
|
|
4
|
+
var bruce_models_1 = require("bruce-models");
|
|
5
|
+
function createFilterGetterCacheKey(params) {
|
|
6
|
+
var cacheKey = "";
|
|
7
|
+
cacheKey += params.api.GetBaseUrl();
|
|
8
|
+
cacheKey += params.typeId;
|
|
9
|
+
cacheKey += params.batchSize;
|
|
10
|
+
cacheKey += JSON.stringify(params.attrFilter);
|
|
11
|
+
return cacheKey;
|
|
12
|
+
}
|
|
13
|
+
var SharedGetters;
|
|
14
|
+
(function (SharedGetters) {
|
|
15
|
+
var Cache = /** @class */ (function () {
|
|
16
|
+
function Cache() {
|
|
17
|
+
this.data = {};
|
|
18
|
+
}
|
|
19
|
+
Cache.prototype.GetOrCreateFilterGetter = function (params) {
|
|
20
|
+
var cacheKey = createFilterGetterCacheKey(params);
|
|
21
|
+
var getter = this.data[cacheKey];
|
|
22
|
+
if (!getter) {
|
|
23
|
+
getter = new bruce_models_1.EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter);
|
|
24
|
+
this.data[cacheKey] = getter;
|
|
25
|
+
}
|
|
26
|
+
return getter;
|
|
27
|
+
};
|
|
28
|
+
return Cache;
|
|
29
|
+
}());
|
|
30
|
+
SharedGetters.Cache = Cache;
|
|
31
|
+
})(SharedGetters = exports.SharedGetters || (exports.SharedGetters = {}));
|
|
32
32
|
//# sourceMappingURL=shared-getters.js.map
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.EntitiesIdsRenderManager = void 0;
|
|
40
|
-
var bruce_models_1 = require("bruce-models");
|
|
41
|
-
var entity_render_engine_1 = require("../../entity-render-engine");
|
|
42
|
-
/**
|
|
43
|
-
* Render manager for rendering an array of entity ids.
|
|
44
|
-
* This will render them in batches to avoid overloading the viewer.
|
|
45
|
-
*/
|
|
46
|
-
var EntitiesIdsRenderManager;
|
|
47
|
-
(function (EntitiesIdsRenderManager) {
|
|
48
|
-
var Manager = /** @class */ (function () {
|
|
49
|
-
function Manager(viewer, visualsManager, apiGetter, monitor, item) {
|
|
50
|
-
this.getter = null;
|
|
51
|
-
this.getterSub = null;
|
|
52
|
-
this.disposed = false;
|
|
53
|
-
this.renderedEntities = {};
|
|
54
|
-
this.viewer = viewer;
|
|
55
|
-
this.apiGetter = apiGetter;
|
|
56
|
-
this.monitor = monitor;
|
|
57
|
-
this.item = item;
|
|
58
|
-
this.visualsManager = visualsManager;
|
|
59
|
-
}
|
|
60
|
-
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
61
|
-
get: function () {
|
|
62
|
-
return this.disposed;
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
Manager.prototype.Init = function () {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var _this = this;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
if (this.disposed) {
|
|
72
|
-
throw (new Error("This item is disposed."));
|
|
73
|
-
}
|
|
74
|
-
this.getter = new bruce_models_1.BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, 500);
|
|
75
|
-
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
76
|
-
_this.onGetterUpdate(ids);
|
|
77
|
-
});
|
|
78
|
-
this.getter.Start();
|
|
79
|
-
return [2 /*return*/];
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
Manager.prototype.Dispose = function () {
|
|
84
|
-
var _a;
|
|
85
|
-
if (this.disposed) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
89
|
-
this.getterSub = null;
|
|
90
|
-
this.disposed = true;
|
|
91
|
-
this.visualsManager.RemoveByMenuItemId(this.item.id);
|
|
92
|
-
};
|
|
93
|
-
Manager.prototype.onGetterUpdate = function (entityIds) {
|
|
94
|
-
var _a;
|
|
95
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var api, entities, cEntities, i, entity, id, cEntity, visual;
|
|
97
|
-
return __generator(this, function (_b) {
|
|
98
|
-
switch (_b.label) {
|
|
99
|
-
case 0:
|
|
100
|
-
if (this.disposed) {
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
api = this.apiGetter.getApi();
|
|
104
|
-
return [4 /*yield*/, bruce_models_1.Entity.GetListByIds(api, entityIds)];
|
|
105
|
-
case 1:
|
|
106
|
-
entities = _b.sent();
|
|
107
|
-
return [4 /*yield*/, entity_render_engine_1.EntityRenderEngine.Render({
|
|
108
|
-
viewer: this.viewer,
|
|
109
|
-
apiGetter: this.apiGetter,
|
|
110
|
-
entities: entities,
|
|
111
|
-
menuItemId: this.item.id,
|
|
112
|
-
visualRegister: this.visualsManager,
|
|
113
|
-
zoomControl: this.item.CameraZoomSettings
|
|
114
|
-
})];
|
|
115
|
-
case 2:
|
|
116
|
-
cEntities = _b.sent();
|
|
117
|
-
for (i = 0; i < entities.length; i++) {
|
|
118
|
-
entity = entities[i];
|
|
119
|
-
id = entity.Bruce.ID;
|
|
120
|
-
cEntity = cEntities[id];
|
|
121
|
-
this.renderedEntities[id] = !!cEntity;
|
|
122
|
-
if (cEntity) {
|
|
123
|
-
visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
|
|
124
|
-
if (!visual || visual != cEntity) {
|
|
125
|
-
this.visualsManager.Add({
|
|
126
|
-
entityId: id,
|
|
127
|
-
menuItemId: this.item.id,
|
|
128
|
-
visual: cEntity,
|
|
129
|
-
priority: 0,
|
|
130
|
-
entityTypeId: entity.Bruce["EntityType.ID"]
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.visualsManager.Remove(id, this.item.id);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return [2 /*return*/];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
return Manager;
|
|
144
|
-
}());
|
|
145
|
-
EntitiesIdsRenderManager.Manager = Manager;
|
|
146
|
-
})(EntitiesIdsRenderManager = exports.EntitiesIdsRenderManager || (exports.EntitiesIdsRenderManager = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.EntitiesIdsRenderManager = void 0;
|
|
40
|
+
var bruce_models_1 = require("bruce-models");
|
|
41
|
+
var entity_render_engine_1 = require("../../entity-render-engine");
|
|
42
|
+
/**
|
|
43
|
+
* Render manager for rendering an array of entity ids.
|
|
44
|
+
* This will render them in batches to avoid overloading the viewer.
|
|
45
|
+
*/
|
|
46
|
+
var EntitiesIdsRenderManager;
|
|
47
|
+
(function (EntitiesIdsRenderManager) {
|
|
48
|
+
var Manager = /** @class */ (function () {
|
|
49
|
+
function Manager(viewer, visualsManager, apiGetter, monitor, item) {
|
|
50
|
+
this.getter = null;
|
|
51
|
+
this.getterSub = null;
|
|
52
|
+
this.disposed = false;
|
|
53
|
+
this.renderedEntities = {};
|
|
54
|
+
this.viewer = viewer;
|
|
55
|
+
this.apiGetter = apiGetter;
|
|
56
|
+
this.monitor = monitor;
|
|
57
|
+
this.item = item;
|
|
58
|
+
this.visualsManager = visualsManager;
|
|
59
|
+
}
|
|
60
|
+
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
61
|
+
get: function () {
|
|
62
|
+
return this.disposed;
|
|
63
|
+
},
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
Manager.prototype.Init = function () {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var _this = this;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
if (this.disposed) {
|
|
72
|
+
throw (new Error("This item is disposed."));
|
|
73
|
+
}
|
|
74
|
+
this.getter = new bruce_models_1.BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, 500);
|
|
75
|
+
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
76
|
+
_this.onGetterUpdate(ids);
|
|
77
|
+
});
|
|
78
|
+
this.getter.Start();
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
Manager.prototype.Dispose = function () {
|
|
84
|
+
var _a;
|
|
85
|
+
if (this.disposed) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
89
|
+
this.getterSub = null;
|
|
90
|
+
this.disposed = true;
|
|
91
|
+
this.visualsManager.RemoveByMenuItemId(this.item.id);
|
|
92
|
+
};
|
|
93
|
+
Manager.prototype.onGetterUpdate = function (entityIds) {
|
|
94
|
+
var _a;
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var api, entities, cEntities, i, entity, id, cEntity, visual;
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (this.disposed) {
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
api = this.apiGetter.getApi();
|
|
104
|
+
return [4 /*yield*/, bruce_models_1.Entity.GetListByIds(api, entityIds)];
|
|
105
|
+
case 1:
|
|
106
|
+
entities = _b.sent();
|
|
107
|
+
return [4 /*yield*/, entity_render_engine_1.EntityRenderEngine.Render({
|
|
108
|
+
viewer: this.viewer,
|
|
109
|
+
apiGetter: this.apiGetter,
|
|
110
|
+
entities: entities,
|
|
111
|
+
menuItemId: this.item.id,
|
|
112
|
+
visualRegister: this.visualsManager,
|
|
113
|
+
zoomControl: this.item.CameraZoomSettings
|
|
114
|
+
})];
|
|
115
|
+
case 2:
|
|
116
|
+
cEntities = _b.sent();
|
|
117
|
+
for (i = 0; i < entities.length; i++) {
|
|
118
|
+
entity = entities[i];
|
|
119
|
+
id = entity.Bruce.ID;
|
|
120
|
+
cEntity = cEntities[id];
|
|
121
|
+
this.renderedEntities[id] = !!cEntity;
|
|
122
|
+
if (cEntity) {
|
|
123
|
+
visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
|
|
124
|
+
if (!visual || visual != cEntity) {
|
|
125
|
+
this.visualsManager.Add({
|
|
126
|
+
entityId: id,
|
|
127
|
+
menuItemId: this.item.id,
|
|
128
|
+
visual: cEntity,
|
|
129
|
+
priority: 0,
|
|
130
|
+
entityTypeId: entity.Bruce["EntityType.ID"]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.visualsManager.Remove(id, this.item.id);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
return Manager;
|
|
144
|
+
}());
|
|
145
|
+
EntitiesIdsRenderManager.Manager = Manager;
|
|
146
|
+
})(EntitiesIdsRenderManager = exports.EntitiesIdsRenderManager || (exports.EntitiesIdsRenderManager = {}));
|
|
147
147
|
//# sourceMappingURL=entities-ids-render-manager.js.map
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.EntitiesLoadedRenderManager = void 0;
|
|
40
|
-
var bruce_models_1 = require("bruce-models");
|
|
41
|
-
var entity_render_engine_1 = require("../../entity-render-engine");
|
|
42
|
-
/**
|
|
43
|
-
* Render manager for a group of pre-loaded entities.
|
|
44
|
-
* The entities may or may not have records.
|
|
45
|
-
* If the entities DON'T have records, it is recommended to avoid using the 3dmodel visualization as it will fail to locate LODs.
|
|
46
|
-
*/
|
|
47
|
-
var EntitiesLoadedRenderManager;
|
|
48
|
-
(function (EntitiesLoadedRenderManager) {
|
|
49
|
-
var Manager = /** @class */ (function () {
|
|
50
|
-
function Manager(viewer, visualsManager, apiGetter, monitor, item) {
|
|
51
|
-
this.getter = null;
|
|
52
|
-
this.getterSub = null;
|
|
53
|
-
this.disposed = false;
|
|
54
|
-
this.renderedEntities = {};
|
|
55
|
-
this.viewer = viewer;
|
|
56
|
-
this.apiGetter = apiGetter;
|
|
57
|
-
this.monitor = monitor;
|
|
58
|
-
this.item = item;
|
|
59
|
-
this.visualsManager = visualsManager;
|
|
60
|
-
}
|
|
61
|
-
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
62
|
-
get: function () {
|
|
63
|
-
return this.disposed;
|
|
64
|
-
},
|
|
65
|
-
enumerable: false,
|
|
66
|
-
configurable: true
|
|
67
|
-
});
|
|
68
|
-
Manager.prototype.Init = function () {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
var _this = this;
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
if (this.disposed) {
|
|
73
|
-
throw (new Error("This item is disposed."));
|
|
74
|
-
}
|
|
75
|
-
this.getter = new bruce_models_1.BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, 500);
|
|
76
|
-
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
77
|
-
_this.onGetterUpdate(entities);
|
|
78
|
-
});
|
|
79
|
-
this.getter.Start();
|
|
80
|
-
return [2 /*return*/];
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
Manager.prototype.Dispose = function () {
|
|
85
|
-
var _a;
|
|
86
|
-
if (this.disposed) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
90
|
-
this.getterSub = null;
|
|
91
|
-
this.disposed = true;
|
|
92
|
-
this.visualsManager.RemoveByMenuItemId(this.item.id);
|
|
93
|
-
};
|
|
94
|
-
Manager.prototype.onGetterUpdate = function (entities) {
|
|
95
|
-
var _a;
|
|
96
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var cEntities, i, entity, id, cEntity, visual;
|
|
98
|
-
return __generator(this, function (_b) {
|
|
99
|
-
switch (_b.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
if (this.disposed) {
|
|
102
|
-
return [2 /*return*/];
|
|
103
|
-
}
|
|
104
|
-
return [4 /*yield*/, entity_render_engine_1.EntityRenderEngine.Render({
|
|
105
|
-
viewer: this.viewer,
|
|
106
|
-
apiGetter: this.apiGetter,
|
|
107
|
-
entities: entities,
|
|
108
|
-
menuItemId: this.item.id,
|
|
109
|
-
visualRegister: this.visualsManager,
|
|
110
|
-
zoomControl: this.item.CameraZoomSettings
|
|
111
|
-
})];
|
|
112
|
-
case 1:
|
|
113
|
-
cEntities = _b.sent();
|
|
114
|
-
for (i = 0; i < entities.length; i++) {
|
|
115
|
-
entity = entities[i];
|
|
116
|
-
id = entity.Bruce.ID;
|
|
117
|
-
cEntity = cEntities[id];
|
|
118
|
-
this.renderedEntities[id] = !!cEntity;
|
|
119
|
-
if (cEntity) {
|
|
120
|
-
visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
|
|
121
|
-
if (!visual || visual != cEntity) {
|
|
122
|
-
this.visualsManager.Add({
|
|
123
|
-
entityId: id,
|
|
124
|
-
menuItemId: this.item.id,
|
|
125
|
-
visual: cEntity,
|
|
126
|
-
priority: 0,
|
|
127
|
-
entityTypeId: entity.Bruce["EntityType.ID"]
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
this.visualsManager.Remove(id, this.item.id);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return [2 /*return*/];
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
return Manager;
|
|
141
|
-
}());
|
|
142
|
-
EntitiesLoadedRenderManager.Manager = Manager;
|
|
143
|
-
})(EntitiesLoadedRenderManager = exports.EntitiesLoadedRenderManager || (exports.EntitiesLoadedRenderManager = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.EntitiesLoadedRenderManager = void 0;
|
|
40
|
+
var bruce_models_1 = require("bruce-models");
|
|
41
|
+
var entity_render_engine_1 = require("../../entity-render-engine");
|
|
42
|
+
/**
|
|
43
|
+
* Render manager for a group of pre-loaded entities.
|
|
44
|
+
* The entities may or may not have records.
|
|
45
|
+
* If the entities DON'T have records, it is recommended to avoid using the 3dmodel visualization as it will fail to locate LODs.
|
|
46
|
+
*/
|
|
47
|
+
var EntitiesLoadedRenderManager;
|
|
48
|
+
(function (EntitiesLoadedRenderManager) {
|
|
49
|
+
var Manager = /** @class */ (function () {
|
|
50
|
+
function Manager(viewer, visualsManager, apiGetter, monitor, item) {
|
|
51
|
+
this.getter = null;
|
|
52
|
+
this.getterSub = null;
|
|
53
|
+
this.disposed = false;
|
|
54
|
+
this.renderedEntities = {};
|
|
55
|
+
this.viewer = viewer;
|
|
56
|
+
this.apiGetter = apiGetter;
|
|
57
|
+
this.monitor = monitor;
|
|
58
|
+
this.item = item;
|
|
59
|
+
this.visualsManager = visualsManager;
|
|
60
|
+
}
|
|
61
|
+
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this.disposed;
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
68
|
+
Manager.prototype.Init = function () {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var _this = this;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
if (this.disposed) {
|
|
73
|
+
throw (new Error("This item is disposed."));
|
|
74
|
+
}
|
|
75
|
+
this.getter = new bruce_models_1.BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, 500);
|
|
76
|
+
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
77
|
+
_this.onGetterUpdate(entities);
|
|
78
|
+
});
|
|
79
|
+
this.getter.Start();
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
Manager.prototype.Dispose = function () {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.disposed) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
90
|
+
this.getterSub = null;
|
|
91
|
+
this.disposed = true;
|
|
92
|
+
this.visualsManager.RemoveByMenuItemId(this.item.id);
|
|
93
|
+
};
|
|
94
|
+
Manager.prototype.onGetterUpdate = function (entities) {
|
|
95
|
+
var _a;
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
var cEntities, i, entity, id, cEntity, visual;
|
|
98
|
+
return __generator(this, function (_b) {
|
|
99
|
+
switch (_b.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
if (this.disposed) {
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
return [4 /*yield*/, entity_render_engine_1.EntityRenderEngine.Render({
|
|
105
|
+
viewer: this.viewer,
|
|
106
|
+
apiGetter: this.apiGetter,
|
|
107
|
+
entities: entities,
|
|
108
|
+
menuItemId: this.item.id,
|
|
109
|
+
visualRegister: this.visualsManager,
|
|
110
|
+
zoomControl: this.item.CameraZoomSettings
|
|
111
|
+
})];
|
|
112
|
+
case 1:
|
|
113
|
+
cEntities = _b.sent();
|
|
114
|
+
for (i = 0; i < entities.length; i++) {
|
|
115
|
+
entity = entities[i];
|
|
116
|
+
id = entity.Bruce.ID;
|
|
117
|
+
cEntity = cEntities[id];
|
|
118
|
+
this.renderedEntities[id] = !!cEntity;
|
|
119
|
+
if (cEntity) {
|
|
120
|
+
visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
|
|
121
|
+
if (!visual || visual != cEntity) {
|
|
122
|
+
this.visualsManager.Add({
|
|
123
|
+
entityId: id,
|
|
124
|
+
menuItemId: this.item.id,
|
|
125
|
+
visual: cEntity,
|
|
126
|
+
priority: 0,
|
|
127
|
+
entityTypeId: entity.Bruce["EntityType.ID"]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.visualsManager.Remove(id, this.item.id);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return [2 /*return*/];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return Manager;
|
|
141
|
+
}());
|
|
142
|
+
EntitiesLoadedRenderManager.Manager = Manager;
|
|
143
|
+
})(EntitiesLoadedRenderManager = exports.EntitiesLoadedRenderManager || (exports.EntitiesLoadedRenderManager = {}));
|
|
144
144
|
//# sourceMappingURL=entities-loaded-render-manager.js.map
|