bruce-models 0.7.1 → 0.7.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.
Files changed (80) hide show
  1. package/dist/bruce-models.es5.js.map +1 -1
  2. package/dist/bruce-models.umd.js.map +1 -1
  3. package/dist/lib/account/account.js +244 -244
  4. package/dist/lib/ann-document/ann-document.js +116 -116
  5. package/dist/lib/api/abstract-api.js +267 -267
  6. package/dist/lib/api/api.js +85 -85
  7. package/dist/lib/api/bruce-api.js +202 -202
  8. package/dist/lib/api/cam-api.js +132 -132
  9. package/dist/lib/api/global-api.js +131 -131
  10. package/dist/lib/api/idm-api.js +132 -132
  11. package/dist/lib/bruce-models.js +83 -83
  12. package/dist/lib/calculator/calculator.js +158 -158
  13. package/dist/lib/client-file/client-file.js +188 -188
  14. package/dist/lib/common/bounds.js +2 -2
  15. package/dist/lib/common/bruce-event.js +48 -48
  16. package/dist/lib/common/bruce-variable.js +54 -54
  17. package/dist/lib/common/cache.js +86 -86
  18. package/dist/lib/common/camera.js +11 -11
  19. package/dist/lib/common/cartes.js +55 -55
  20. package/dist/lib/common/carto.js +60 -60
  21. package/dist/lib/common/color.js +86 -86
  22. package/dist/lib/common/delay-queue.js +60 -60
  23. package/dist/lib/common/dictionary.js +2 -2
  24. package/dist/lib/common/geometry.js +120 -120
  25. package/dist/lib/common/transform.js +2 -2
  26. package/dist/lib/common/utc.js +39 -39
  27. package/dist/lib/custom-form/custom-form.js +136 -136
  28. package/dist/lib/data-lab/data-lab.js +90 -90
  29. package/dist/lib/entity/entity-attachment-type.js +132 -132
  30. package/dist/lib/entity/entity-attachment.js +208 -208
  31. package/dist/lib/entity/entity-comment.js +132 -132
  32. package/dist/lib/entity/entity-link.js +132 -132
  33. package/dist/lib/entity/entity-lod.js +189 -189
  34. package/dist/lib/entity/entity-relation-type.js +150 -150
  35. package/dist/lib/entity/entity-relation.js +189 -189
  36. package/dist/lib/entity/entity-source.js +176 -176
  37. package/dist/lib/entity/entity-tag.js +229 -229
  38. package/dist/lib/entity/entity-type.js +163 -163
  39. package/dist/lib/entity/entity-type.js.map +1 -1
  40. package/dist/lib/entity/entity.js +349 -349
  41. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  42. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  43. package/dist/lib/entity/getters/entity-globe.js +135 -135
  44. package/dist/lib/entity/getters/view-monitor.js +2 -2
  45. package/dist/lib/import/import-cad.js +82 -82
  46. package/dist/lib/import/import-csv.js +51 -51
  47. package/dist/lib/import/import-json.js +51 -51
  48. package/dist/lib/import/import-kml.js +51 -51
  49. package/dist/lib/import/imported-file.js +121 -121
  50. package/dist/lib/markup/markup.js +40 -40
  51. package/dist/lib/program-key/program-key.js +152 -152
  52. package/dist/lib/project/menu-item.js +115 -115
  53. package/dist/lib/project/project-view-bookmark.js +172 -172
  54. package/dist/lib/project/project-view-tile-source.js +115 -115
  55. package/dist/lib/project/project-view.js +166 -166
  56. package/dist/lib/project/zoom-control.js +17 -17
  57. package/dist/lib/server/pending-action.js +106 -106
  58. package/dist/lib/server/task.js +113 -113
  59. package/dist/lib/style/style.js +152 -152
  60. package/dist/lib/tileset/tileset-cad.js +2 -2
  61. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  62. package/dist/lib/tileset/tileset-entities.js +2 -2
  63. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  64. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  65. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  66. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  67. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  68. package/dist/lib/tileset/tileset.js +403 -403
  69. package/dist/lib/ucs/ucs.js +135 -135
  70. package/dist/lib/user/permission.js +20 -20
  71. package/dist/lib/user/session.js +160 -160
  72. package/dist/lib/user/user-group.js +139 -139
  73. package/dist/lib/user/user.js +451 -451
  74. package/dist/lib/util/encrypt-utils.js +20 -20
  75. package/dist/lib/util/math-utils.js +41 -41
  76. package/dist/lib/util/object-utils.js +17 -17
  77. package/dist/lib/util/path-utils.js +61 -61
  78. package/dist/lib/util/url-utils.js +107 -107
  79. package/dist/types/entity/entity-type.d.ts +1 -0
  80. package/package.json +1 -1
@@ -1,173 +1,173 @@
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.ProjectViewBookmark = void 0;
40
- var api_1 = require("../api/api");
41
- /**
42
- * Describe the "Project View Bookmark" concept within Bruce.
43
- * This is referred to as "slides" in older code.
44
- *
45
- * A bookmark is a snapshot of what should be displayed and how in a particular project view.
46
- */
47
- var ProjectViewBookmark;
48
- (function (ProjectViewBookmark) {
49
- function GetCacheKey(viewId, bookmarkId) {
50
- return "" + api_1.Api.ECacheKey.ProjectViewBookmark + api_1.Api.ECacheKey.Id + viewId + api_1.Api.ECacheKey.Id + bookmarkId;
51
- }
52
- ProjectViewBookmark.GetCacheKey = GetCacheKey;
53
- function GetListCacheKey(viewId) {
54
- return "" + api_1.Api.ECacheKey.ProjectViewBookmark + api_1.Api.ECacheKey.Id + viewId;
55
- }
56
- ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
57
- function Get(api, viewId, bookmarkId) {
58
- return __awaiter(this, void 0, void 0, function () {
59
- var key, cacheData, req;
60
- return __generator(this, function (_a) {
61
- if (!viewId || !bookmarkId) {
62
- throw ("View ID and Bookmark ID are required.");
63
- }
64
- key = GetCacheKey(viewId, bookmarkId);
65
- cacheData = api.Cache.Get(key);
66
- if (cacheData) {
67
- return [2 /*return*/, cacheData];
68
- }
69
- req = api.GET("ui.view/" + viewId + "/slide/" + bookmarkId, api_1.Api.PrepReqParams());
70
- api.Cache.Set(key, req, api_1.Api.DEFAULT_CACHE_DURATION);
71
- return [2 /*return*/, req];
72
- });
73
- });
74
- }
75
- ProjectViewBookmark.Get = Get;
76
- function Delete(api, viewId, bookmarkId) {
77
- return __awaiter(this, void 0, void 0, function () {
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0:
81
- if (!viewId || !bookmarkId) {
82
- throw ("View ID and Bookmark ID are required.");
83
- }
84
- return [4 /*yield*/, api.DELETE("ui.view/" + viewId + "/slide/" + bookmarkId, api_1.Api.PrepReqParams())];
85
- case 1:
86
- _a.sent();
87
- api.Cache.Remove(GetCacheKey(viewId, bookmarkId));
88
- api.Cache.Remove(GetListCacheKey(viewId));
89
- return [2 /*return*/];
90
- }
91
- });
92
- });
93
- }
94
- ProjectViewBookmark.Delete = Delete;
95
- function GetList(api, viewId) {
96
- return __awaiter(this, void 0, void 0, function () {
97
- var cacheData, req;
98
- var _this = this;
99
- return __generator(this, function (_a) {
100
- if (!viewId) {
101
- throw ("View ID is required.");
102
- }
103
- cacheData = api.Cache.Get(GetListCacheKey(viewId));
104
- if (cacheData) {
105
- return [2 /*return*/, cacheData];
106
- }
107
- req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
108
- var data, e_1;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
112
- _a.trys.push([0, 2, , 3]);
113
- return [4 /*yield*/, api.GET("ui.view/" + viewId + "/slides", api_1.Api.PrepReqParams())];
114
- case 1:
115
- data = _a.sent();
116
- ;
117
- res(data.Items);
118
- return [3 /*break*/, 3];
119
- case 2:
120
- e_1 = _a.sent();
121
- rej(e_1);
122
- return [3 /*break*/, 3];
123
- case 3: return [2 /*return*/];
124
- }
125
- });
126
- }); });
127
- api.Cache.Set(GetListCacheKey(viewId), req, api_1.Api.DEFAULT_CACHE_DURATION);
128
- return [2 /*return*/, req];
129
- });
130
- });
131
- }
132
- ProjectViewBookmark.GetList = GetList;
133
- function Update(api, viewId, data) {
134
- return __awaiter(this, void 0, void 0, function () {
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0:
138
- if (!(data === null || data === void 0 ? void 0 : data.Title)) {
139
- data.Title = data.ID;
140
- }
141
- return [4 /*yield*/, api.POST("ui.view/" + viewId + "/slide/" + (data.ID ? data.ID : ""), data, api_1.Api.PrepReqParams())];
142
- case 1:
143
- data = _a.sent();
144
- api.Cache.Remove(GetCacheKey(viewId, data.ID));
145
- api.Cache.Remove(GetListCacheKey(viewId));
146
- return [2 /*return*/, data];
147
- }
148
- });
149
- });
150
- }
151
- ProjectViewBookmark.Update = Update;
152
- function SetOrder(api, viewId, bookmarkIds) {
153
- return __awaiter(this, void 0, void 0, function () {
154
- var reqData;
155
- return __generator(this, function (_a) {
156
- switch (_a.label) {
157
- case 0:
158
- reqData = {
159
- "UISlide.ID": bookmarkIds,
160
- "DisplayOrder.Start": 0
161
- };
162
- return [4 /*yield*/, api.POST("ui.view/" + viewId + "/slides/setOrder", reqData, api_1.Api.PrepReqParams())];
163
- case 1:
164
- _a.sent();
165
- api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
166
- return [2 /*return*/];
167
- }
168
- });
169
- });
170
- }
171
- ProjectViewBookmark.SetOrder = SetOrder;
172
- })(ProjectViewBookmark = exports.ProjectViewBookmark || (exports.ProjectViewBookmark = {}));
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.ProjectViewBookmark = void 0;
40
+ var api_1 = require("../api/api");
41
+ /**
42
+ * Describe the "Project View Bookmark" concept within Bruce.
43
+ * This is referred to as "slides" in older code.
44
+ *
45
+ * A bookmark is a snapshot of what should be displayed and how in a particular project view.
46
+ */
47
+ var ProjectViewBookmark;
48
+ (function (ProjectViewBookmark) {
49
+ function GetCacheKey(viewId, bookmarkId) {
50
+ return "" + api_1.Api.ECacheKey.ProjectViewBookmark + api_1.Api.ECacheKey.Id + viewId + api_1.Api.ECacheKey.Id + bookmarkId;
51
+ }
52
+ ProjectViewBookmark.GetCacheKey = GetCacheKey;
53
+ function GetListCacheKey(viewId) {
54
+ return "" + api_1.Api.ECacheKey.ProjectViewBookmark + api_1.Api.ECacheKey.Id + viewId;
55
+ }
56
+ ProjectViewBookmark.GetListCacheKey = GetListCacheKey;
57
+ function Get(api, viewId, bookmarkId) {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ var key, cacheData, req;
60
+ return __generator(this, function (_a) {
61
+ if (!viewId || !bookmarkId) {
62
+ throw ("View ID and Bookmark ID are required.");
63
+ }
64
+ key = GetCacheKey(viewId, bookmarkId);
65
+ cacheData = api.Cache.Get(key);
66
+ if (cacheData) {
67
+ return [2 /*return*/, cacheData];
68
+ }
69
+ req = api.GET("ui.view/" + viewId + "/slide/" + bookmarkId, api_1.Api.PrepReqParams());
70
+ api.Cache.Set(key, req, api_1.Api.DEFAULT_CACHE_DURATION);
71
+ return [2 /*return*/, req];
72
+ });
73
+ });
74
+ }
75
+ ProjectViewBookmark.Get = Get;
76
+ function Delete(api, viewId, bookmarkId) {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ if (!viewId || !bookmarkId) {
82
+ throw ("View ID and Bookmark ID are required.");
83
+ }
84
+ return [4 /*yield*/, api.DELETE("ui.view/" + viewId + "/slide/" + bookmarkId, api_1.Api.PrepReqParams())];
85
+ case 1:
86
+ _a.sent();
87
+ api.Cache.Remove(GetCacheKey(viewId, bookmarkId));
88
+ api.Cache.Remove(GetListCacheKey(viewId));
89
+ return [2 /*return*/];
90
+ }
91
+ });
92
+ });
93
+ }
94
+ ProjectViewBookmark.Delete = Delete;
95
+ function GetList(api, viewId) {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var cacheData, req;
98
+ var _this = this;
99
+ return __generator(this, function (_a) {
100
+ if (!viewId) {
101
+ throw ("View ID is required.");
102
+ }
103
+ cacheData = api.Cache.Get(GetListCacheKey(viewId));
104
+ if (cacheData) {
105
+ return [2 /*return*/, cacheData];
106
+ }
107
+ req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
108
+ var data, e_1;
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
+ case 0:
112
+ _a.trys.push([0, 2, , 3]);
113
+ return [4 /*yield*/, api.GET("ui.view/" + viewId + "/slides", api_1.Api.PrepReqParams())];
114
+ case 1:
115
+ data = _a.sent();
116
+ ;
117
+ res(data.Items);
118
+ return [3 /*break*/, 3];
119
+ case 2:
120
+ e_1 = _a.sent();
121
+ rej(e_1);
122
+ return [3 /*break*/, 3];
123
+ case 3: return [2 /*return*/];
124
+ }
125
+ });
126
+ }); });
127
+ api.Cache.Set(GetListCacheKey(viewId), req, api_1.Api.DEFAULT_CACHE_DURATION);
128
+ return [2 /*return*/, req];
129
+ });
130
+ });
131
+ }
132
+ ProjectViewBookmark.GetList = GetList;
133
+ function Update(api, viewId, data) {
134
+ return __awaiter(this, void 0, void 0, function () {
135
+ return __generator(this, function (_a) {
136
+ switch (_a.label) {
137
+ case 0:
138
+ if (!(data === null || data === void 0 ? void 0 : data.Title)) {
139
+ data.Title = data.ID;
140
+ }
141
+ return [4 /*yield*/, api.POST("ui.view/" + viewId + "/slide/" + (data.ID ? data.ID : ""), data, api_1.Api.PrepReqParams())];
142
+ case 1:
143
+ data = _a.sent();
144
+ api.Cache.Remove(GetCacheKey(viewId, data.ID));
145
+ api.Cache.Remove(GetListCacheKey(viewId));
146
+ return [2 /*return*/, data];
147
+ }
148
+ });
149
+ });
150
+ }
151
+ ProjectViewBookmark.Update = Update;
152
+ function SetOrder(api, viewId, bookmarkIds) {
153
+ return __awaiter(this, void 0, void 0, function () {
154
+ var reqData;
155
+ return __generator(this, function (_a) {
156
+ switch (_a.label) {
157
+ case 0:
158
+ reqData = {
159
+ "UISlide.ID": bookmarkIds,
160
+ "DisplayOrder.Start": 0
161
+ };
162
+ return [4 /*yield*/, api.POST("ui.view/" + viewId + "/slides/setOrder", reqData, api_1.Api.PrepReqParams())];
163
+ case 1:
164
+ _a.sent();
165
+ api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
166
+ return [2 /*return*/];
167
+ }
168
+ });
169
+ });
170
+ }
171
+ ProjectViewBookmark.SetOrder = SetOrder;
172
+ })(ProjectViewBookmark = exports.ProjectViewBookmark || (exports.ProjectViewBookmark = {}));
173
173
  //# sourceMappingURL=project-view-bookmark.js.map
@@ -1,116 +1,116 @@
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.ProjectViewTileSource = void 0;
40
- var api_1 = require("../api/api");
41
- var project_view_1 = require("./project-view");
42
- function getTemplateSettings(apiGetter) {
43
- var _a;
44
- return __awaiter(this, void 0, void 0, function () {
45
- var view;
46
- return __generator(this, function (_b) {
47
- switch (_b.label) {
48
- case 0: return [4 /*yield*/, project_view_1.ProjectView.Get(apiGetter.getApi(api_1.Api.TEMPLATE_ACCOUNT_ID, apiGetter.env), "default")];
49
- case 1:
50
- view = _b.sent();
51
- return [2 /*return*/, (_a = view.Settings) !== null && _a !== void 0 ? _a : {}];
52
- }
53
- });
54
- });
55
- }
56
- function checkSourceToTemplate(items, templateItem, addIfMissing) {
57
- var index = items.findIndex(function (x) { return x.Name === templateItem.Name; });
58
- if (index > -1) {
59
- templateItem.IsDefault = true;
60
- templateItem.IsEnabled = items[index].IsEnabled;
61
- items[index] = templateItem;
62
- }
63
- else if (addIfMissing) {
64
- templateItem.IsDefault = true;
65
- items.push(templateItem);
66
- }
67
- }
68
- /**
69
- * Describes a terrain or map source that are found in project view records.
70
- * This is a concept we want to trash as we're moving towards storing tileset ids instead.
71
- * This will help at least understand and manage this dying concept.
72
- */
73
- var ProjectViewTileSource;
74
- (function (ProjectViewTileSource) {
75
- function MergeMapTemplateData(getter, items, addIfMissing) {
76
- var _a;
77
- return __awaiter(this, void 0, void 0, function () {
78
- var settings, maps, i, mapSource;
79
- return __generator(this, function (_b) {
80
- switch (_b.label) {
81
- case 0: return [4 /*yield*/, getTemplateSettings(getter)];
82
- case 1:
83
- settings = _b.sent();
84
- maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
85
- for (i = 0; i < maps.length; i++) {
86
- mapSource = maps[i];
87
- checkSourceToTemplate(items, mapSource, addIfMissing);
88
- }
89
- return [2 /*return*/, []];
90
- }
91
- });
92
- });
93
- }
94
- ProjectViewTileSource.MergeMapTemplateData = MergeMapTemplateData;
95
- function MergeTerrainTemplateData(getter, items, addIfMissing) {
96
- var _a;
97
- return __awaiter(this, void 0, void 0, function () {
98
- var settings, terrains, i, terrainSource;
99
- return __generator(this, function (_b) {
100
- switch (_b.label) {
101
- case 0: return [4 /*yield*/, getTemplateSettings(getter)];
102
- case 1:
103
- settings = _b.sent();
104
- terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
105
- for (i = 0; i < terrains.length; i++) {
106
- terrainSource = terrains[i];
107
- checkSourceToTemplate(items, terrainSource, addIfMissing);
108
- }
109
- return [2 /*return*/, []];
110
- }
111
- });
112
- });
113
- }
114
- ProjectViewTileSource.MergeTerrainTemplateData = MergeTerrainTemplateData;
115
- })(ProjectViewTileSource = exports.ProjectViewTileSource || (exports.ProjectViewTileSource = {}));
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.ProjectViewTileSource = void 0;
40
+ var api_1 = require("../api/api");
41
+ var project_view_1 = require("./project-view");
42
+ function getTemplateSettings(apiGetter) {
43
+ var _a;
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ var view;
46
+ return __generator(this, function (_b) {
47
+ switch (_b.label) {
48
+ case 0: return [4 /*yield*/, project_view_1.ProjectView.Get(apiGetter.getApi(api_1.Api.TEMPLATE_ACCOUNT_ID, apiGetter.env), "default")];
49
+ case 1:
50
+ view = _b.sent();
51
+ return [2 /*return*/, (_a = view.Settings) !== null && _a !== void 0 ? _a : {}];
52
+ }
53
+ });
54
+ });
55
+ }
56
+ function checkSourceToTemplate(items, templateItem, addIfMissing) {
57
+ var index = items.findIndex(function (x) { return x.Name === templateItem.Name; });
58
+ if (index > -1) {
59
+ templateItem.IsDefault = true;
60
+ templateItem.IsEnabled = items[index].IsEnabled;
61
+ items[index] = templateItem;
62
+ }
63
+ else if (addIfMissing) {
64
+ templateItem.IsDefault = true;
65
+ items.push(templateItem);
66
+ }
67
+ }
68
+ /**
69
+ * Describes a terrain or map source that are found in project view records.
70
+ * This is a concept we want to trash as we're moving towards storing tileset ids instead.
71
+ * This will help at least understand and manage this dying concept.
72
+ */
73
+ var ProjectViewTileSource;
74
+ (function (ProjectViewTileSource) {
75
+ function MergeMapTemplateData(getter, items, addIfMissing) {
76
+ var _a;
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var settings, maps, i, mapSource;
79
+ return __generator(this, function (_b) {
80
+ switch (_b.label) {
81
+ case 0: return [4 /*yield*/, getTemplateSettings(getter)];
82
+ case 1:
83
+ settings = _b.sent();
84
+ maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
85
+ for (i = 0; i < maps.length; i++) {
86
+ mapSource = maps[i];
87
+ checkSourceToTemplate(items, mapSource, addIfMissing);
88
+ }
89
+ return [2 /*return*/, []];
90
+ }
91
+ });
92
+ });
93
+ }
94
+ ProjectViewTileSource.MergeMapTemplateData = MergeMapTemplateData;
95
+ function MergeTerrainTemplateData(getter, items, addIfMissing) {
96
+ var _a;
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var settings, terrains, i, terrainSource;
99
+ return __generator(this, function (_b) {
100
+ switch (_b.label) {
101
+ case 0: return [4 /*yield*/, getTemplateSettings(getter)];
102
+ case 1:
103
+ settings = _b.sent();
104
+ terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
105
+ for (i = 0; i < terrains.length; i++) {
106
+ terrainSource = terrains[i];
107
+ checkSourceToTemplate(items, terrainSource, addIfMissing);
108
+ }
109
+ return [2 /*return*/, []];
110
+ }
111
+ });
112
+ });
113
+ }
114
+ ProjectViewTileSource.MergeTerrainTemplateData = MergeTerrainTemplateData;
115
+ })(ProjectViewTileSource = exports.ProjectViewTileSource || (exports.ProjectViewTileSource = {}));
116
116
  //# sourceMappingURL=project-view-tile-source.js.map