bruce-models 1.9.8 → 1.9.9

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 (84) hide show
  1. package/dist/bruce-models.es5.js +20 -14
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +20 -14
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account-settings.js +2 -2
  6. package/dist/lib/account/account.js +185 -185
  7. package/dist/lib/ann-document/ann-document.js +86 -86
  8. package/dist/lib/api/abstract-api.js +246 -246
  9. package/dist/lib/api/api-getters.js +134 -134
  10. package/dist/lib/api/api.js +93 -93
  11. package/dist/lib/api/bruce-api.js +216 -216
  12. package/dist/lib/api/cam-api.js +85 -82
  13. package/dist/lib/api/cam-api.js.map +1 -1
  14. package/dist/lib/api/global-api.js +81 -81
  15. package/dist/lib/api/idm-api.js +85 -82
  16. package/dist/lib/api/idm-api.js.map +1 -1
  17. package/dist/lib/bruce-models.js +86 -86
  18. package/dist/lib/calculator/calculator.js +341 -341
  19. package/dist/lib/client-file/client-file.js +245 -245
  20. package/dist/lib/common/bounds.js +61 -61
  21. package/dist/lib/common/bruce-event.js +46 -46
  22. package/dist/lib/common/bruce-variable.js +60 -60
  23. package/dist/lib/common/cache.js +165 -165
  24. package/dist/lib/common/camera.js +11 -11
  25. package/dist/lib/common/cartes.js +123 -123
  26. package/dist/lib/common/carto.js +60 -60
  27. package/dist/lib/common/color.js +86 -86
  28. package/dist/lib/common/delay-queue.js +56 -56
  29. package/dist/lib/common/dictionary.js +2 -2
  30. package/dist/lib/common/geometry.js +120 -120
  31. package/dist/lib/common/transform.js +2 -2
  32. package/dist/lib/common/utc.js +39 -39
  33. package/dist/lib/custom-form/custom-form-content.js +26 -26
  34. package/dist/lib/custom-form/custom-form.js +106 -106
  35. package/dist/lib/data-lab/data-lab.js +49 -49
  36. package/dist/lib/entity/entity-attachment-type.js +83 -83
  37. package/dist/lib/entity/entity-attachment.js +122 -122
  38. package/dist/lib/entity/entity-attribute.js +29 -29
  39. package/dist/lib/entity/entity-comment.js +82 -82
  40. package/dist/lib/entity/entity-coords.js +149 -149
  41. package/dist/lib/entity/entity-link.js +82 -82
  42. package/dist/lib/entity/entity-lod-category.js +100 -100
  43. package/dist/lib/entity/entity-lod.js +185 -185
  44. package/dist/lib/entity/entity-relation-type.js +109 -109
  45. package/dist/lib/entity/entity-relation.js +132 -132
  46. package/dist/lib/entity/entity-source.js +136 -136
  47. package/dist/lib/entity/entity-tag.js +149 -149
  48. package/dist/lib/entity/entity-type-visual-settings.js +13 -13
  49. package/dist/lib/entity/entity-type.js +113 -113
  50. package/dist/lib/entity/entity.js +319 -319
  51. package/dist/lib/entity/getters/batched-data-getter.js +84 -84
  52. package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
  53. package/dist/lib/entity/getters/entity-globe.js +211 -211
  54. package/dist/lib/entity/getters/view-monitor.js +2 -2
  55. package/dist/lib/import/import-cad.js +53 -53
  56. package/dist/lib/import/import-csv.js +23 -23
  57. package/dist/lib/import/import-json.js +23 -23
  58. package/dist/lib/import/import-kml.js +23 -23
  59. package/dist/lib/import/imported-file.js +91 -91
  60. package/dist/lib/internal/uploader.js +76 -76
  61. package/dist/lib/markup/markup.js +185 -185
  62. package/dist/lib/plugin/plugin.js +83 -83
  63. package/dist/lib/program-key/program-key.js +111 -111
  64. package/dist/lib/project/menu-item.js +121 -121
  65. package/dist/lib/project/project-view-bookmark.js +147 -147
  66. package/dist/lib/project/project-view-legacy-tile.js +77 -77
  67. package/dist/lib/project/project-view-tile.js +125 -125
  68. package/dist/lib/project/project-view.js +133 -133
  69. package/dist/lib/project/zoom-control.js +17 -17
  70. package/dist/lib/server/message-broker.js +142 -142
  71. package/dist/lib/server/pending-action.js +71 -71
  72. package/dist/lib/server/task.js +63 -63
  73. package/dist/lib/style/style.js +117 -117
  74. package/dist/lib/tileset/tileset.js +415 -415
  75. package/dist/lib/user/permission.js +20 -20
  76. package/dist/lib/user/session.js +137 -137
  77. package/dist/lib/user/user-group.js +94 -94
  78. package/dist/lib/user/user.js +446 -446
  79. package/dist/lib/util/encrypt-utils.js +19 -19
  80. package/dist/lib/util/math-utils.js +40 -40
  81. package/dist/lib/util/object-utils.js +17 -17
  82. package/dist/lib/util/path-utils.js +61 -61
  83. package/dist/lib/util/url-utils.js +94 -94
  84. package/package.json +3 -2
@@ -1,47 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BruceEvent = void 0;
4
- /**
5
- * Simple event utility.
6
- * Instantiate the model, then subscribe and trigger events.
7
- */
8
- class BruceEvent {
9
- constructor() {
10
- // Counter to help differentiate subscriptions.
11
- this._counter = 0;
12
- // Record of all callback subscriptions for this event.
13
- this.callbacks = [];
14
- }
15
- Subscribe(callback) {
16
- let id = this._counter++;
17
- let newBruceEventCallback = {
18
- _id: id,
19
- removeCallback: () => {
20
- this.Unsubscribe(id);
21
- },
22
- callback: callback
23
- };
24
- this.callbacks.push(newBruceEventCallback);
25
- return newBruceEventCallback.removeCallback;
26
- }
27
- Unsubscribe(id) {
28
- let index = this.callbacks.findIndex(x => x._id == id);
29
- if (index > -1) {
30
- this.callbacks.splice(index, 1);
31
- }
32
- }
33
- Trigger(data) {
34
- let callbacks = this.callbacks;
35
- for (let i = 0; i < callbacks.length; i++) {
36
- let callback = callbacks[i];
37
- if (callback.callback) {
38
- callback.callback(data);
39
- }
40
- }
41
- }
42
- Clear() {
43
- this.callbacks = [];
44
- }
45
- }
46
- exports.BruceEvent = BruceEvent;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BruceEvent = void 0;
4
+ /**
5
+ * Simple event utility.
6
+ * Instantiate the model, then subscribe and trigger events.
7
+ */
8
+ class BruceEvent {
9
+ constructor() {
10
+ // Counter to help differentiate subscriptions.
11
+ this._counter = 0;
12
+ // Record of all callback subscriptions for this event.
13
+ this.callbacks = [];
14
+ }
15
+ Subscribe(callback) {
16
+ let id = this._counter++;
17
+ let newBruceEventCallback = {
18
+ _id: id,
19
+ removeCallback: () => {
20
+ this.Unsubscribe(id);
21
+ },
22
+ callback: callback
23
+ };
24
+ this.callbacks.push(newBruceEventCallback);
25
+ return newBruceEventCallback.removeCallback;
26
+ }
27
+ Unsubscribe(id) {
28
+ let index = this.callbacks.findIndex(x => x._id == id);
29
+ if (index > -1) {
30
+ this.callbacks.splice(index, 1);
31
+ }
32
+ }
33
+ Trigger(data) {
34
+ let callbacks = this.callbacks;
35
+ for (let i = 0; i < callbacks.length; i++) {
36
+ let callback = callbacks[i];
37
+ if (callback.callback) {
38
+ callback.callback(data);
39
+ }
40
+ }
41
+ }
42
+ Clear() {
43
+ this.callbacks = [];
44
+ }
45
+ }
46
+ exports.BruceEvent = BruceEvent;
47
47
  //# sourceMappingURL=bruce-event.js.map
@@ -1,61 +1,61 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BruceVariable = void 0;
4
- const entity_1 = require("../entity/entity");
5
- const path_utils_1 = require("../util/path-utils");
6
- function getVariable(str) {
7
- const start = str.indexOf("${");
8
- if (start > -1) {
9
- const end = str.indexOf("}");
10
- if (end > -1) {
11
- if (start < end) {
12
- const path = str.substring(start + 2, end);
13
- const txt = str.substring(start, end + 1);
14
- return { path: path, text: txt };
15
- }
16
- }
17
- }
18
- return null;
19
- }
20
- /**
21
- * Utilities for parsing "Bruce variables", typically within strings.
22
- *
23
- * A Bruce variable is a string that starts with "${" and ends with "}".
24
- * Within those brackets is a path to an attribute in an entity.
25
- */
26
- var BruceVariable;
27
- (function (BruceVariable) {
28
- /**
29
- * Replaces all Bruce variables in a string with the value of the attribute.
30
- * @param str
31
- * @param data
32
- * @param legacyParse
33
- * @returns
34
- */
35
- function SwapValues(params) {
36
- let { str, entity: data, legacyParse } = params;
37
- if (!legacyParse) {
38
- legacyParse = false;
39
- }
40
- while (true) {
41
- const variable = getVariable(str);
42
- if (variable) {
43
- const path = legacyParse ? path_utils_1.PathUtils.ParseLegacy(variable.path) : path_utils_1.PathUtils.Parse(variable.path);
44
- let value = "";
45
- if (path.length > 0) {
46
- value = entity_1.Entity.GetValue({
47
- entity: data,
48
- path: path
49
- });
50
- }
51
- str = str.replace(variable.text, value);
52
- }
53
- else {
54
- break;
55
- }
56
- }
57
- return str;
58
- }
59
- BruceVariable.SwapValues = SwapValues;
60
- })(BruceVariable = exports.BruceVariable || (exports.BruceVariable = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BruceVariable = void 0;
4
+ const entity_1 = require("../entity/entity");
5
+ const path_utils_1 = require("../util/path-utils");
6
+ function getVariable(str) {
7
+ const start = str.indexOf("${");
8
+ if (start > -1) {
9
+ const end = str.indexOf("}");
10
+ if (end > -1) {
11
+ if (start < end) {
12
+ const path = str.substring(start + 2, end);
13
+ const txt = str.substring(start, end + 1);
14
+ return { path: path, text: txt };
15
+ }
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ /**
21
+ * Utilities for parsing "Bruce variables", typically within strings.
22
+ *
23
+ * A Bruce variable is a string that starts with "${" and ends with "}".
24
+ * Within those brackets is a path to an attribute in an entity.
25
+ */
26
+ var BruceVariable;
27
+ (function (BruceVariable) {
28
+ /**
29
+ * Replaces all Bruce variables in a string with the value of the attribute.
30
+ * @param str
31
+ * @param data
32
+ * @param legacyParse
33
+ * @returns
34
+ */
35
+ function SwapValues(params) {
36
+ let { str, entity: data, legacyParse } = params;
37
+ if (!legacyParse) {
38
+ legacyParse = false;
39
+ }
40
+ while (true) {
41
+ const variable = getVariable(str);
42
+ if (variable) {
43
+ const path = legacyParse ? path_utils_1.PathUtils.ParseLegacy(variable.path) : path_utils_1.PathUtils.Parse(variable.path);
44
+ let value = "";
45
+ if (path.length > 0) {
46
+ value = entity_1.Entity.GetValue({
47
+ entity: data,
48
+ path: path
49
+ });
50
+ }
51
+ str = str.replace(variable.text, value);
52
+ }
53
+ else {
54
+ break;
55
+ }
56
+ }
57
+ return str;
58
+ }
59
+ BruceVariable.SwapValues = SwapValues;
60
+ })(BruceVariable = exports.BruceVariable || (exports.BruceVariable = {}));
61
61
  //# sourceMappingURL=bruce-variable.js.map
@@ -1,166 +1,166 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CacheControl = void 0;
4
- class CacheItem {
5
- /**
6
- * @param id
7
- * @param data
8
- * @param duration in seconds until considered expired.
9
- */
10
- constructor(id, data, duration) {
11
- this.Id = id;
12
- this.Data = data;
13
- this.Duration = duration;
14
- this._created = duration > -1 ? new Date() : null;
15
- }
16
- IsExpired() {
17
- if (this._created == null) {
18
- return false;
19
- }
20
- return (new Date().getTime() - this._created.getTime()) / 1000 > this.Duration;
21
- }
22
- }
23
- // Milliseconds between each data cleaning.
24
- const CLEANER_INTERVAL = 5000;
25
- // Max number of items to clean in each cleaning.
26
- const MAX_CLEAN_BATCH = 100;
27
- // (Default) Max idle time to keep the cleaner alive.
28
- // Set to default API cache duration by default.
29
- const DEFAULT_MAX_CLEAN_IDLE = 60 * 5;
30
- /**
31
- * Simple local cache controller.
32
- */
33
- class CacheControl {
34
- constructor() {
35
- this.data = {};
36
- this.Disabled = false;
37
- this.cleanerInterval = null;
38
- // Max idle time to keep the cleaner alive.
39
- // This value is increased when a new item is added with a larger cache duration.
40
- this.maxCleanIdle = DEFAULT_MAX_CLEAN_IDLE;
41
- }
42
- /**
43
- * @param id
44
- * @param data
45
- * @param duration seconds to keep the data in cache. -1 for infinite.
46
- */
47
- Set(id, data, duration = -1) {
48
- this.data[id + ""] = new CacheItem(id + "", data, duration);
49
- if (duration > -1) {
50
- this.startCleaning();
51
- if (this.maxCleanIdle < duration) {
52
- // Add 5 seconds to be sure cleaner stays alive to get it.
53
- this.maxCleanIdle = duration + 5;
54
- }
55
- }
56
- }
57
- Get(id) {
58
- if (this.Disabled) {
59
- return null;
60
- }
61
- const item = this.data[id + ""];
62
- if (item == null) {
63
- return null;
64
- }
65
- if (item.IsExpired()) {
66
- delete this.data[id + ""];
67
- return null;
68
- }
69
- return item.Data;
70
- }
71
- Clear() {
72
- this.data = {};
73
- this.stopCleaning();
74
- }
75
- Remove(id) {
76
- delete this.data[id + ""];
77
- if (Object.keys(this.data).length <= 0) {
78
- this.stopCleaning();
79
- }
80
- }
81
- RemoveByStartsWith(text) {
82
- for (const key in this.data) {
83
- if (key.startsWith(text)) {
84
- delete this.data[key];
85
- }
86
- }
87
- if (Object.keys(this.data).length <= 0) {
88
- this.stopCleaning();
89
- }
90
- }
91
- RemoveByContains(text) {
92
- for (const key in this.data) {
93
- if (key.includes(text)) {
94
- delete this.data[key];
95
- }
96
- }
97
- if (Object.keys(this.data).length <= 0) {
98
- this.stopCleaning();
99
- }
100
- }
101
- GetKeys() {
102
- if (this.Disabled) {
103
- return [];
104
- }
105
- return Object.keys(this.data);
106
- }
107
- GetValues() {
108
- if (this.Disabled) {
109
- return [];
110
- }
111
- const values = [];
112
- for (const key in this.data) {
113
- const data = this.Get(key);
114
- if (data != null) {
115
- values.push(data);
116
- }
117
- }
118
- return values;
119
- }
120
- startCleaning() {
121
- if (this.cleanerInterval == null) {
122
- let cleanIdleStart = null;
123
- this.cleanerInterval = setInterval(() => {
124
- let cleaned = 0;
125
- for (const key in this.data) {
126
- const item = this.data[key];
127
- if (item.IsExpired()) {
128
- delete this.data[key];
129
- cleaned += 1;
130
- }
131
- if (cleaned >= MAX_CLEAN_BATCH) {
132
- break;
133
- }
134
- }
135
- if (cleaned <= 0) {
136
- // Stop cleaner if nothing in cache.
137
- if (Object.keys(this.data).length <= 0) {
138
- this.stopCleaning();
139
- }
140
- // Stop cleaner if idle time is reached.
141
- else {
142
- if (cleanIdleStart == null) {
143
- cleanIdleStart = new Date().getTime();
144
- }
145
- const now = new Date().getTime();
146
- if (now - cleanIdleStart > this.maxCleanIdle * 1000) {
147
- this.stopCleaning();
148
- }
149
- }
150
- }
151
- else {
152
- cleanIdleStart = null;
153
- }
154
- }, CLEANER_INTERVAL);
155
- }
156
- }
157
- stopCleaning() {
158
- if (this.cleanerInterval != null) {
159
- clearInterval(this.cleanerInterval);
160
- this.cleanerInterval = null;
161
- this.maxCleanIdle = DEFAULT_MAX_CLEAN_IDLE;
162
- }
163
- }
164
- }
165
- exports.CacheControl = CacheControl;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CacheControl = void 0;
4
+ class CacheItem {
5
+ /**
6
+ * @param id
7
+ * @param data
8
+ * @param duration in seconds until considered expired.
9
+ */
10
+ constructor(id, data, duration) {
11
+ this.Id = id;
12
+ this.Data = data;
13
+ this.Duration = duration;
14
+ this._created = duration > -1 ? new Date() : null;
15
+ }
16
+ IsExpired() {
17
+ if (this._created == null) {
18
+ return false;
19
+ }
20
+ return (new Date().getTime() - this._created.getTime()) / 1000 > this.Duration;
21
+ }
22
+ }
23
+ // Milliseconds between each data cleaning.
24
+ const CLEANER_INTERVAL = 5000;
25
+ // Max number of items to clean in each cleaning.
26
+ const MAX_CLEAN_BATCH = 100;
27
+ // (Default) Max idle time to keep the cleaner alive.
28
+ // Set to default API cache duration by default.
29
+ const DEFAULT_MAX_CLEAN_IDLE = 60 * 5;
30
+ /**
31
+ * Simple local cache controller.
32
+ */
33
+ class CacheControl {
34
+ constructor() {
35
+ this.data = {};
36
+ this.Disabled = false;
37
+ this.cleanerInterval = null;
38
+ // Max idle time to keep the cleaner alive.
39
+ // This value is increased when a new item is added with a larger cache duration.
40
+ this.maxCleanIdle = DEFAULT_MAX_CLEAN_IDLE;
41
+ }
42
+ /**
43
+ * @param id
44
+ * @param data
45
+ * @param duration seconds to keep the data in cache. -1 for infinite.
46
+ */
47
+ Set(id, data, duration = -1) {
48
+ this.data[id + ""] = new CacheItem(id + "", data, duration);
49
+ if (duration > -1) {
50
+ this.startCleaning();
51
+ if (this.maxCleanIdle < duration) {
52
+ // Add 5 seconds to be sure cleaner stays alive to get it.
53
+ this.maxCleanIdle = duration + 5;
54
+ }
55
+ }
56
+ }
57
+ Get(id) {
58
+ if (this.Disabled) {
59
+ return null;
60
+ }
61
+ const item = this.data[id + ""];
62
+ if (item == null) {
63
+ return null;
64
+ }
65
+ if (item.IsExpired()) {
66
+ delete this.data[id + ""];
67
+ return null;
68
+ }
69
+ return item.Data;
70
+ }
71
+ Clear() {
72
+ this.data = {};
73
+ this.stopCleaning();
74
+ }
75
+ Remove(id) {
76
+ delete this.data[id + ""];
77
+ if (Object.keys(this.data).length <= 0) {
78
+ this.stopCleaning();
79
+ }
80
+ }
81
+ RemoveByStartsWith(text) {
82
+ for (const key in this.data) {
83
+ if (key.startsWith(text)) {
84
+ delete this.data[key];
85
+ }
86
+ }
87
+ if (Object.keys(this.data).length <= 0) {
88
+ this.stopCleaning();
89
+ }
90
+ }
91
+ RemoveByContains(text) {
92
+ for (const key in this.data) {
93
+ if (key.includes(text)) {
94
+ delete this.data[key];
95
+ }
96
+ }
97
+ if (Object.keys(this.data).length <= 0) {
98
+ this.stopCleaning();
99
+ }
100
+ }
101
+ GetKeys() {
102
+ if (this.Disabled) {
103
+ return [];
104
+ }
105
+ return Object.keys(this.data);
106
+ }
107
+ GetValues() {
108
+ if (this.Disabled) {
109
+ return [];
110
+ }
111
+ const values = [];
112
+ for (const key in this.data) {
113
+ const data = this.Get(key);
114
+ if (data != null) {
115
+ values.push(data);
116
+ }
117
+ }
118
+ return values;
119
+ }
120
+ startCleaning() {
121
+ if (this.cleanerInterval == null) {
122
+ let cleanIdleStart = null;
123
+ this.cleanerInterval = setInterval(() => {
124
+ let cleaned = 0;
125
+ for (const key in this.data) {
126
+ const item = this.data[key];
127
+ if (item.IsExpired()) {
128
+ delete this.data[key];
129
+ cleaned += 1;
130
+ }
131
+ if (cleaned >= MAX_CLEAN_BATCH) {
132
+ break;
133
+ }
134
+ }
135
+ if (cleaned <= 0) {
136
+ // Stop cleaner if nothing in cache.
137
+ if (Object.keys(this.data).length <= 0) {
138
+ this.stopCleaning();
139
+ }
140
+ // Stop cleaner if idle time is reached.
141
+ else {
142
+ if (cleanIdleStart == null) {
143
+ cleanIdleStart = new Date().getTime();
144
+ }
145
+ const now = new Date().getTime();
146
+ if (now - cleanIdleStart > this.maxCleanIdle * 1000) {
147
+ this.stopCleaning();
148
+ }
149
+ }
150
+ }
151
+ else {
152
+ cleanIdleStart = null;
153
+ }
154
+ }, CLEANER_INTERVAL);
155
+ }
156
+ }
157
+ stopCleaning() {
158
+ if (this.cleanerInterval != null) {
159
+ clearInterval(this.cleanerInterval);
160
+ this.cleanerInterval = null;
161
+ this.maxCleanIdle = DEFAULT_MAX_CLEAN_IDLE;
162
+ }
163
+ }
164
+ }
165
+ exports.CacheControl = CacheControl;
166
166
  //# sourceMappingURL=cache.js.map
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Camera = void 0;
4
- var Camera;
5
- (function (Camera) {
6
- let EFrustum;
7
- (function (EFrustum) {
8
- EFrustum[EFrustum["Perspective"] = 0] = "Perspective";
9
- EFrustum[EFrustum["Orthographic"] = 1] = "Orthographic";
10
- })(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
11
- })(Camera = exports.Camera || (exports.Camera = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Camera = void 0;
4
+ var Camera;
5
+ (function (Camera) {
6
+ let EFrustum;
7
+ (function (EFrustum) {
8
+ EFrustum[EFrustum["Perspective"] = 0] = "Perspective";
9
+ EFrustum[EFrustum["Orthographic"] = 1] = "Orthographic";
10
+ })(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
11
+ })(Camera = exports.Camera || (exports.Camera = {}));
12
12
  //# sourceMappingURL=camera.js.map