bruce-cesium 2.8.0 → 2.8.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.
@@ -4241,20 +4241,33 @@
4241
4241
  /**
4242
4242
  * Locates a visual corresponding to a given entity id.
4243
4243
  * If no menu item id is provided, then it will pick the "best" one.
4244
- * @param entityId
4245
- * @param menuItemId
4244
+ * @param params
4246
4245
  * @returns
4247
4246
  */
4248
4247
  Register.prototype.GetRego = function (params) {
4249
- var entityId = params.entityId, menuItemId = params.menuItemId;
4250
- var entityRegos = this.rego[entityId];
4251
- if (!entityRegos) {
4252
- return [];
4248
+ var entityId = params.entityId, menuItemId = params.menuItemId, relation = params.relation;
4249
+ if (relation) {
4250
+ var relationKey_1 = RelationRenderEngine.GetRenderGroupId(relation);
4251
+ for (var entityId_1 in this.rego) {
4252
+ var entityRegos = this.rego[entityId_1];
4253
+ if (entityRegos) {
4254
+ var rego = entityRegos.find(function (r) { return r.relation && RelationRenderEngine.GetRenderGroupId(r.relation) == relationKey_1; });
4255
+ if (rego) {
4256
+ return rego;
4257
+ }
4258
+ }
4259
+ }
4253
4260
  }
4254
- if (menuItemId) {
4255
- return entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
4261
+ else {
4262
+ var entityRegos = this.rego[entityId];
4263
+ if (!entityRegos) {
4264
+ return [];
4265
+ }
4266
+ if (menuItemId) {
4267
+ return entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
4268
+ }
4269
+ return entityRegos.find(function (x) { return x.best; });
4256
4270
  }
4257
- return entityRegos.find(function (x) { return x.best; });
4258
4271
  };
4259
4272
  /**
4260
4273
  * Returns regos matching given criteria.
@@ -4267,8 +4280,8 @@
4267
4280
  // Currently this was made by merging two functions.
4268
4281
  var entityId = params.entityId, menuItemId = params.menuItemId;
4269
4282
  if (entityId) {
4270
- var entityId_1 = params.entityId;
4271
- var entityRegos = this.rego[entityId_1];
4283
+ var entityId_2 = params.entityId;
4284
+ var entityRegos = this.rego[entityId_2];
4272
4285
  if (!entityRegos) {
4273
4286
  return [];
4274
4287
  }
@@ -4277,8 +4290,8 @@
4277
4290
  else if (menuItemId) {
4278
4291
  var menuItemId_1 = params.menuItemId;
4279
4292
  var visuals = [];
4280
- for (var entityId_2 in this.rego) {
4281
- var entityRegos = this.rego[entityId_2];
4293
+ for (var entityId_3 in this.rego) {
4294
+ var entityRegos = this.rego[entityId_3];
4282
4295
  if (entityRegos) {
4283
4296
  var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId_1; });
4284
4297
  if (rego) {
@@ -4307,8 +4320,8 @@
4307
4320
  // TODO: refactor.
4308
4321
  // Currently this was made by merging two functions.
4309
4322
  if (menuItemId && !entityId) {
4310
- for (var entityId_3 in this.rego) {
4311
- var entityRegos = this.rego[entityId_3];
4323
+ for (var entityId_4 in this.rego) {
4324
+ var entityRegos = this.rego[entityId_4];
4312
4325
  if (entityRegos) {
4313
4326
  var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
4314
4327
  if (!rego) {
@@ -4320,9 +4333,9 @@
4320
4333
  continue;
4321
4334
  }
4322
4335
  removeEntity(this.viewer, rego.visual);
4323
- var doesInclude = this.rego[entityId_3].find(function (r) { return r.menuItemId === menuItemId; });
4336
+ var doesInclude = this.rego[entityId_4].find(function (r) { return r.menuItemId === menuItemId; });
4324
4337
  if (doesInclude) {
4325
- this.rego[entityId_3] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
4338
+ this.rego[entityId_4] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
4326
4339
  }
4327
4340
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
4328
4341
  type: EVisualUpdateType.Remove,
@@ -4330,7 +4343,7 @@
4330
4343
  rego: rego
4331
4344
  });
4332
4345
  if (doesInclude) {
4333
- updateEntity(this.viewer, entityId_3, this);
4346
+ updateEntity(this.viewer, entityId_4, this);
4334
4347
  }
4335
4348
  }
4336
4349
  }
@@ -4366,23 +4379,23 @@
4366
4379
  }
4367
4380
  }
4368
4381
  else if (relation) {
4369
- var relationKey_1 = RelationRenderEngine.GetRenderGroupId(relation);
4370
- for (var entityId_4 in this.rego) {
4371
- var entityRegos = this.rego[entityId_4];
4382
+ var relationKey_2 = RelationRenderEngine.GetRenderGroupId(relation);
4383
+ for (var entityId_5 in this.rego) {
4384
+ var entityRegos = this.rego[entityId_5];
4372
4385
  if (entityRegos) {
4373
- var rego = entityRegos.find(function (r) { return r.relation && RelationRenderEngine.GetRenderGroupId(r.relation) == relationKey_1; });
4386
+ var rego = entityRegos.find(function (r) { return r.relation && RelationRenderEngine.GetRenderGroupId(r.relation) == relationKey_2; });
4374
4387
  if (!rego) {
4375
4388
  continue;
4376
4389
  }
4377
4390
  removeEntity(this.viewer, rego.visual);
4378
- this.rego[entityId_4] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
4391
+ this.rego[entityId_5] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
4379
4392
  (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({
4380
4393
  type: EVisualUpdateType.Remove,
4381
4394
  entityId: rego.entityId,
4382
4395
  rego: rego
4383
4396
  });
4384
4397
  if (doUpdate && menuItemId) {
4385
- updateEntity(this.viewer, entityId_4, this);
4398
+ updateEntity(this.viewer, entityId_5, this);
4386
4399
  }
4387
4400
  }
4388
4401
  }
@@ -9092,6 +9105,9 @@
9092
9105
  // If true, this menu item is disposed and should not be used.
9093
9106
  // Any rendering will be ignored.
9094
9107
  this.disposed = false;
9108
+ // Record of the currently drawn entity IDs.
9109
+ // This is to avoid re-queueing already drawn entities when Init is called multiple times.
9110
+ this.drawnIds = [];
9095
9111
  var apiGetter = params.apiGetter, item = params.item, register = params.register, viewer = params.viewer;
9096
9112
  this.apiGetter = apiGetter;
9097
9113
  this.item = item;
@@ -9112,6 +9128,7 @@
9112
9128
  * @returns
9113
9129
  */
9114
9130
  Manager.prototype.Init = function (params) {
9131
+ var _this = this;
9115
9132
  var _a;
9116
9133
  if (this.disposed) {
9117
9134
  return;
@@ -9124,8 +9141,6 @@
9124
9141
  var regos = this.register.GetRegos({
9125
9142
  menuItemId: this.item.id
9126
9143
  });
9127
- var drawnIds = [];
9128
- var toDrawIds = [];
9129
9144
  var entityIds = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.EntityIds;
9130
9145
  if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
9131
9146
  entityIds = [];
@@ -9140,26 +9155,12 @@
9140
9155
  requestRender: false
9141
9156
  });
9142
9157
  }
9143
- else {
9144
- drawnIds.push(rego.entityId);
9145
- if (rego.relation) {
9146
- drawnIds.push(rego.relation["Principal.Entity.ID"]);
9147
- }
9148
- }
9149
9158
  }
9150
9159
  this.viewer.scene.requestRender();
9151
- var _loop_1 = function (i) {
9152
- if (!drawnIds.find(function (x) { return x == entityIds[i]; })) {
9153
- toDrawIds.push(entityIds[i]);
9154
- }
9155
- };
9156
- // We'll call a re-render on entity ids that are not drawn.
9157
- for (var i = 0; i < entityIds.length; i++) {
9158
- _loop_1(i);
9159
- }
9160
9160
  this.renderEntityIds({
9161
- entityIds: toDrawIds
9161
+ entityIds: entityIds.filter(function (x) { return !_this.drawnIds.includes(x); })
9162
9162
  });
9163
+ this.drawnIds = [].concat(entityIds);
9163
9164
  };
9164
9165
  Manager.prototype.Dispose = function () {
9165
9166
  if (this.disposed) {
@@ -9172,18 +9173,25 @@
9172
9173
  };
9173
9174
  /**
9174
9175
  * Re-renders specific entity relationships.
9175
- * @TODO: This should re-render all relationships when entityIds=null.
9176
9176
  * @param params
9177
9177
  */
9178
9178
  Manager.prototype.ReRender = function (params) {
9179
9179
  return __awaiter(this, void 0, void 0, function () {
9180
9180
  var entityIds, force;
9181
+ var _this = this;
9181
9182
  return __generator(this, function (_a) {
9182
9183
  entityIds = params.entityIds, force = params.force;
9183
- if (entityIds == null) ;
9184
+ if (entityIds == null) {
9185
+ this.renderEntityIds({
9186
+ entityIds: this.drawnIds
9187
+ });
9188
+ }
9184
9189
  else {
9185
9190
  this.renderEntityIds({
9186
- dataEntityIds: entityIds
9191
+ // TODO: This is a guess and not a proper check.
9192
+ // We need to record rendered relationships and check against them rather than the ID stored as the ID can be a child or parent.
9193
+ dataEntityIds: entityIds.filter(function (x) { return !_this.drawnIds.includes(x); }),
9194
+ entityIds: entityIds.filter(function (x) { return _this.drawnIds.includes(x); })
9187
9195
  });
9188
9196
  }
9189
9197
  return [2 /*return*/];
@@ -9260,7 +9268,7 @@
9260
9268
  }
9261
9269
  }).then(function (data) {
9262
9270
  var relations = data.relations;
9263
- var _loop_2 = function (j) {
9271
+ var _loop_1 = function (j) {
9264
9272
  var relation = relations[j];
9265
9273
  var key = RelationRenderEngine.GetRenderGroupId(relation);
9266
9274
  if (!drawn.find(function (x) { return x == key; })) {
@@ -9273,7 +9281,7 @@
9273
9281
  }
9274
9282
  };
9275
9283
  for (var j = 0; j < relations.length; j++) {
9276
- _loop_2(j);
9284
+ _loop_1(j);
9277
9285
  }
9278
9286
  onResolve();
9279
9287
  }).catch(function (e) {
@@ -9355,7 +9363,7 @@
9355
9363
  cEntity = cEntities[key];
9356
9364
  if (cEntity && this.shouldRenderRelation(relation)) {
9357
9365
  visual = (_a = this.register.GetRego({
9358
- entityId: key,
9366
+ relation: relation,
9359
9367
  menuItemId: this.item.id
9360
9368
  })) === null || _a === void 0 ? void 0 : _a.visual;
9361
9369
  if (!visual || visual != cEntity) {
@@ -13033,7 +13041,7 @@
13033
13041
  ele.setAttribute("style", "\n left: 0px;\n top: 0px;\n position: absolute;\n z-index: 3;\n border-radius: 5px;\n background-color: white;\n display: flex;\n align-items: center;\n padding: 3px 4px;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.24), 0px 18px 36px -4px rgba(18, 22, 25, 0.6);\n ");
13034
13042
  var butt = document.createElement("button");
13035
13043
  butt.setAttribute("style", "\n cursor: pointer;\n border-radius: .375rem;\n padding: 4px 9px;\n transition: opacity 0.3s ease;\n width: 100px;\n width: min-content;\n white-space: nowrap;\n background-color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n flex-shrink: 1;\n height: 100%; \n background-color: #0072c3;\n border: 1px solid #0072c3;\n color: white;\n ");
13036
- butt.innerText = "Finish?";
13044
+ butt.innerText = "Finished?";
13037
13045
  butt.onclick = function () {
13038
13046
  _this.onFinish(_this.GetHierarchy());
13039
13047
  };
@@ -13428,7 +13436,7 @@
13428
13436
  ele.setAttribute("style", "\n left: 0px;\n top: 0px;\n position: absolute;\n z-index: 3;\n border-radius: 5px;\n background-color: white;\n display: flex;\n align-items: center;\n padding: 3px 4px;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.24), 0px 18px 36px -4px rgba(18, 22, 25, 0.6);\n ");
13429
13437
  var butt = document.createElement("button");
13430
13438
  butt.setAttribute("style", "\n cursor: pointer;\n border-radius: .375rem;\n padding: 4px 9px;\n transition: opacity 0.3s ease;\n width: 100px;\n width: min-content;\n white-space: nowrap;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n flex-shrink: 1;\n height: 100%;\n background-color: #0072c3;\n border: 1px solid #0072c3;\n color: white;\n ");
13431
- butt.innerText = "Finish?";
13439
+ butt.innerText = "Finished?";
13432
13440
  butt.onclick = function () {
13433
13441
  _this.onFinish(_this.GetPositions());
13434
13442
  };
@@ -15427,7 +15435,7 @@
15427
15435
  ViewerUtils.CreateWidgets = CreateWidgets;
15428
15436
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15429
15437
 
15430
- var VERSION$1 = "2.8.0";
15438
+ var VERSION$1 = "2.8.2";
15431
15439
 
15432
15440
  exports.VERSION = VERSION$1;
15433
15441
  exports.CesiumViewMonitor = CesiumViewMonitor;