bruce-models 0.4.1 → 0.4.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.
@@ -4668,6 +4668,83 @@ var ProjectView;
4668
4668
  ProjectView.Update = Update;
4669
4669
  })(ProjectView || (ProjectView = {}));
4670
4670
 
4671
+ function getTemplateSettings() {
4672
+ var _a;
4673
+ return __awaiter(this, void 0, void 0, function () {
4674
+ var templateApi, view;
4675
+ return __generator(this, function (_b) {
4676
+ switch (_b.label) {
4677
+ case 0:
4678
+ templateApi = new BruceApi(Api.TEMPLATE_ACCOUNT_ID);
4679
+ return [4 /*yield*/, ProjectView.Get(templateApi, "default")];
4680
+ case 1:
4681
+ view = _b.sent();
4682
+ return [2 /*return*/, (_a = view.Settings) !== null && _a !== void 0 ? _a : {}];
4683
+ }
4684
+ });
4685
+ });
4686
+ }
4687
+ function checkSourceToTemplate(items, templateItem, addIfMissing) {
4688
+ var index = items.findIndex(function (x) { return x.Name === templateItem.Name; });
4689
+ if (index > -1) {
4690
+ templateItem.IsDefault = true;
4691
+ templateItem.IsEnabled = items[index].IsEnabled;
4692
+ items[index] = templateItem;
4693
+ }
4694
+ else if (addIfMissing) {
4695
+ templateItem.IsDefault = true;
4696
+ items.push(templateItem);
4697
+ }
4698
+ }
4699
+ /**
4700
+ * Describes a terrain or map source that are found in project view records.
4701
+ * This is a concept we want to trash as we're moving towards storing tileset ids instead.
4702
+ * This will help at least understand and manage this dying concept.
4703
+ */
4704
+ var ProjectViewTileSource;
4705
+ (function (ProjectViewTileSource) {
4706
+ function MergeMapTemplateData(items, addIfMissing) {
4707
+ var _a;
4708
+ return __awaiter(this, void 0, void 0, function () {
4709
+ var settings, maps, i, mapSource;
4710
+ return __generator(this, function (_b) {
4711
+ switch (_b.label) {
4712
+ case 0: return [4 /*yield*/, getTemplateSettings()];
4713
+ case 1:
4714
+ settings = _b.sent();
4715
+ maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
4716
+ for (i = 0; i < maps.length; i++) {
4717
+ mapSource = maps[i];
4718
+ checkSourceToTemplate(items, mapSource, addIfMissing);
4719
+ }
4720
+ return [2 /*return*/, []];
4721
+ }
4722
+ });
4723
+ });
4724
+ }
4725
+ ProjectViewTileSource.MergeMapTemplateData = MergeMapTemplateData;
4726
+ function MergeTerrainTemplateData(items, addIfMissing) {
4727
+ var _a;
4728
+ return __awaiter(this, void 0, void 0, function () {
4729
+ var settings, terrains, i, terrainSource;
4730
+ return __generator(this, function (_b) {
4731
+ switch (_b.label) {
4732
+ case 0: return [4 /*yield*/, getTemplateSettings()];
4733
+ case 1:
4734
+ settings = _b.sent();
4735
+ terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
4736
+ for (i = 0; i < terrains.length; i++) {
4737
+ terrainSource = terrains[i];
4738
+ checkSourceToTemplate(items, terrainSource, addIfMissing);
4739
+ }
4740
+ return [2 /*return*/, []];
4741
+ }
4742
+ });
4743
+ });
4744
+ }
4745
+ ProjectViewTileSource.MergeTerrainTemplateData = MergeTerrainTemplateData;
4746
+ })(ProjectViewTileSource || (ProjectViewTileSource = {}));
4747
+
4671
4748
  /**
4672
4749
  * Describes the "Pending Action" concept within Bruce.
4673
4750
  * A pending action is a record of a server-side background process.
@@ -6024,5 +6101,5 @@ var DataLab;
6024
6101
  })(Entity = DataLab.Entity || (DataLab.Entity = {}));
6025
6102
  })(DataLab || (DataLab = {}));
6026
6103
 
6027
- export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab };
6104
+ export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewTileSource, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab };
6028
6105
  //# sourceMappingURL=bruce-models.es5.js.map