bruce-models 0.6.5 → 0.6.8

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 (96) hide show
  1. package/dist/bruce-models.es5.js +292 -57
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +276 -50
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +244 -230
  6. package/dist/lib/account/account.js.map +1 -1
  7. package/dist/lib/ann-document/ann-document.js +116 -116
  8. package/dist/lib/api/abstract-api.js +267 -267
  9. package/dist/lib/api/api.js +85 -85
  10. package/dist/lib/api/bruce-api.js +202 -140
  11. package/dist/lib/api/bruce-api.js.map +1 -1
  12. package/dist/lib/api/cam-api.js +132 -132
  13. package/dist/lib/api/global-api.js +131 -131
  14. package/dist/lib/api/idm-api.js +132 -132
  15. package/dist/lib/bruce-models.js +83 -78
  16. package/dist/lib/bruce-models.js.map +1 -1
  17. package/dist/lib/calculator/calculator.js +158 -158
  18. package/dist/lib/client-file/client-file.js +185 -185
  19. package/dist/lib/common/bounds.js +2 -2
  20. package/dist/lib/common/bruce-event.js +48 -48
  21. package/dist/lib/common/bruce-variable.js +54 -54
  22. package/dist/lib/common/cache.js +86 -86
  23. package/dist/lib/common/camera.js +11 -11
  24. package/dist/lib/common/cartes.js +55 -55
  25. package/dist/lib/common/carto.js +60 -60
  26. package/dist/lib/common/color.js +86 -86
  27. package/dist/lib/common/delay-queue.js +60 -60
  28. package/dist/lib/common/dictionary.js +2 -2
  29. package/dist/lib/common/geometry.js +120 -120
  30. package/dist/lib/common/transform.js +2 -2
  31. package/dist/lib/common/utc.js +39 -39
  32. package/dist/lib/custom-form/custom-form.js +136 -136
  33. package/dist/lib/data-lab/data-lab.js +90 -90
  34. package/dist/lib/entity/entity-attachment-type.js +132 -132
  35. package/dist/lib/entity/entity-attachment.js +208 -208
  36. package/dist/lib/entity/entity-comment.js +132 -132
  37. package/dist/lib/entity/entity-link.js +132 -132
  38. package/dist/lib/entity/entity-lod.js +189 -189
  39. package/dist/lib/entity/entity-relation-type.js +150 -150
  40. package/dist/lib/entity/entity-relation.js +189 -189
  41. package/dist/lib/entity/entity-source.js +176 -176
  42. package/dist/lib/entity/entity-tag.js +229 -229
  43. package/dist/lib/entity/entity-type.js +163 -163
  44. package/dist/lib/entity/entity.js +349 -349
  45. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  46. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  47. package/dist/lib/entity/getters/entity-globe.js +135 -135
  48. package/dist/lib/entity/getters/view-monitor.js +2 -2
  49. package/dist/lib/import/import-cad.js +83 -0
  50. package/dist/lib/import/import-cad.js.map +1 -0
  51. package/dist/lib/import/import-csv.js +52 -0
  52. package/dist/lib/import/import-csv.js.map +1 -0
  53. package/dist/lib/import/import-json.js +52 -0
  54. package/dist/lib/import/import-json.js.map +1 -0
  55. package/dist/lib/import/import-kml.js +52 -0
  56. package/dist/lib/import/import-kml.js.map +1 -0
  57. package/dist/lib/import/imported-file.js +121 -121
  58. package/dist/lib/import/imported-file.js.map +1 -1
  59. package/dist/lib/markup/markup.js +40 -40
  60. package/dist/lib/program-key/program-key.js +152 -152
  61. package/dist/lib/project/menu-item.js +115 -115
  62. package/dist/lib/project/project-view-bookmark.js +172 -172
  63. package/dist/lib/project/project-view-tile-source.js +115 -115
  64. package/dist/lib/project/project-view.js +166 -166
  65. package/dist/lib/project/zoom-control.js +17 -17
  66. package/dist/lib/server/pending-action.js +106 -106
  67. package/dist/lib/server/task.js +113 -113
  68. package/dist/lib/style/style.js +152 -152
  69. package/dist/lib/tileset/tileset-cad.js +2 -2
  70. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  71. package/dist/lib/tileset/tileset-entities.js +2 -2
  72. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  73. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  74. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  75. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  76. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  77. package/dist/lib/tileset/tileset.js +397 -397
  78. package/dist/lib/ucs/ucs.js +135 -135
  79. package/dist/lib/user/permission.js +20 -20
  80. package/dist/lib/user/session.js +160 -160
  81. package/dist/lib/user/user-group.js +139 -139
  82. package/dist/lib/user/user.js +451 -451
  83. package/dist/lib/util/encrypt-utils.js +20 -20
  84. package/dist/lib/util/math-utils.js +41 -41
  85. package/dist/lib/util/object-utils.js +17 -17
  86. package/dist/lib/util/path-utils.js +61 -61
  87. package/dist/lib/util/url-utils.js +107 -107
  88. package/dist/types/account/account.d.ts +11 -2
  89. package/dist/types/api/bruce-api.d.ts +2 -0
  90. package/dist/types/bruce-models.d.ts +5 -0
  91. package/dist/types/import/import-cad.d.ts +39 -0
  92. package/dist/types/import/import-csv.d.ts +26 -0
  93. package/dist/types/import/import-json.d.ts +21 -0
  94. package/dist/types/import/import-kml.d.ts +14 -0
  95. package/dist/types/import/imported-file.d.ts +2 -1
  96. package/package.json +1 -1
@@ -1,159 +1,159 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Calculator = void 0;
4
- var color_1 = require("../common/color");
5
- var entity_1 = require("../entity/entity");
6
- var bruce_variable_1 = require("../common/bruce-variable");
7
- var path_utils_1 = require("../util/path-utils");
8
- /**
9
- * Utility for calculating values from Bruce fields.
10
- * These fields are typically found in entity styles.
11
- */
12
- var Calculator;
13
- (function (Calculator) {
14
- var EValueType;
15
- (function (EValueType) {
16
- EValueType[EValueType["Color"] = 0] = "Color";
17
- EValueType[EValueType["Input"] = 1] = "Input";
18
- EValueType[EValueType["Gradient"] = 2] = "Gradient";
19
- EValueType[EValueType["Mapping"] = 3] = "Mapping";
20
- EValueType[EValueType["TagColor"] = 4] = "TagColor";
21
- EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
22
- })(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
23
- /**
24
- * Calculates the value of arbitrary field options.
25
- * The context calling this should validate results and parse stuff if needed.
26
- * @param fields
27
- * @param entity
28
- * @param tags
29
- * @returns
30
- */
31
- function GetValue(fields, entity, tags) {
32
- if (!tags) {
33
- tags = [];
34
- }
35
- if (!entity) {
36
- entity = {};
37
- }
38
- for (var i = 0; i < fields.length; i++) {
39
- var field = fields[i];
40
- var value = void 0;
41
- switch (field.type) {
42
- case EValueType.Color:
43
- value = field.value;
44
- if (value) {
45
- value = color_1.Color.ColorFromStr(value);
46
- }
47
- break;
48
- case EValueType.Gradient:
49
- value = GetGradientValue(field.value, entity);
50
- break;
51
- case EValueType.Input:
52
- value = GetInputValue(field.value, entity);
53
- break;
54
- case EValueType.Mapping:
55
- value = GetMappingValue(field.value, entity);
56
- break;
57
- case EValueType.RandomColor:
58
- value = color_1.Color.RandomColor();
59
- break;
60
- case EValueType.TagColor:
61
- for (var i_1 = 0; i_1 < tags.length; i_1++) {
62
- var tag = tags[i_1];
63
- if (tag.Color) {
64
- value = color_1.Color.ColorFromStr(tag.Color);
65
- break;
66
- }
67
- }
68
- break;
69
- }
70
- if (value || value == 0) {
71
- return value;
72
- }
73
- }
74
- return null;
75
- }
76
- Calculator.GetValue = GetValue;
77
- function GetMappingValue(value, entity) {
78
- var attrPath = path_utils_1.PathUtils.Parse(value.field);
79
- var eValue = +entity_1.Entity.GetValue(entity, attrPath);
80
- for (var i = 0; i < value.values.length; i++) {
81
- var option = value.values[i];
82
- var mapValue = option.fieldValue;
83
- if (+mapValue == eValue) {
84
- return option.appliedValue;
85
- }
86
- var mapSplit = mapValue.split("-");
87
- if (mapSplit.length == 2) {
88
- var min = mapSplit[0];
89
- var max = mapSplit[1];
90
- if (min != "") {
91
- if (eValue < +min) {
92
- continue;
93
- }
94
- }
95
- if (max != "") {
96
- if (eValue > +max) {
97
- continue;
98
- }
99
- }
100
- if (min == "" && max == "") {
101
- continue;
102
- }
103
- return option.appliedValue;
104
- }
105
- }
106
- return null;
107
- }
108
- Calculator.GetMappingValue = GetMappingValue;
109
- function GetGradientValue(value, entity) {
110
- var attrPath = path_utils_1.PathUtils.Parse(value.field);
111
- var eValue = entity_1.Entity.GetValue(entity, attrPath);
112
- eValue = Math.min(Math.max(eValue, value.min), value.max);
113
- if (eValue < value.points[0].position) {
114
- return color_1.Color.ColorFromStr(value.points[0].color);
115
- }
116
- for (var i = 0; i < value.points.length - 1; i++) {
117
- var pointA = value.points[i];
118
- var pointB = value.points[i + 1];
119
- if (eValue >= pointA.position && eValue <= pointB.position) {
120
- if (pointA.position == pointB.position) {
121
- return color_1.Color.ColorFromStr(pointA.color);
122
- }
123
- var distance = (eValue - pointA.position) / (pointB.position - pointA.position);
124
- var colorA = color_1.Color.ColorFromStr(pointA.color);
125
- var colorB = color_1.Color.ColorFromStr(pointB.color);
126
- return {
127
- red: colorA.red + (colorB.red - colorA.red) * distance,
128
- green: colorA.green + (colorB.green - colorA.green) * distance,
129
- blue: colorA.blue + (colorB.blue - colorA.blue) * distance,
130
- alpha: colorA.alpha + (colorB.alpha - colorA.alpha) * distance
131
- };
132
- }
133
- }
134
- return color_1.Color.ColorFromStr(value.points[value.points.length - 1].color);
135
- }
136
- Calculator.GetGradientValue = GetGradientValue;
137
- function GetInputValue(value, entity) {
138
- if (typeof value == "string") {
139
- try {
140
- value = bruce_variable_1.BruceVariable.SwapValues(value, entity);
141
- return eval(value);
142
- }
143
- catch (exception) {
144
- var e = exception;
145
- var suppress = false;
146
- if (e && typeof e == "object") {
147
- var msg = e.message;
148
- suppress = !!msg && msg.includes("Unexpected end");
149
- }
150
- if (!suppress) {
151
- console.error(e);
152
- }
153
- }
154
- }
155
- return value;
156
- }
157
- Calculator.GetInputValue = GetInputValue;
158
- })(Calculator = exports.Calculator || (exports.Calculator = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Calculator = void 0;
4
+ var color_1 = require("../common/color");
5
+ var entity_1 = require("../entity/entity");
6
+ var bruce_variable_1 = require("../common/bruce-variable");
7
+ var path_utils_1 = require("../util/path-utils");
8
+ /**
9
+ * Utility for calculating values from Bruce fields.
10
+ * These fields are typically found in entity styles.
11
+ */
12
+ var Calculator;
13
+ (function (Calculator) {
14
+ var EValueType;
15
+ (function (EValueType) {
16
+ EValueType[EValueType["Color"] = 0] = "Color";
17
+ EValueType[EValueType["Input"] = 1] = "Input";
18
+ EValueType[EValueType["Gradient"] = 2] = "Gradient";
19
+ EValueType[EValueType["Mapping"] = 3] = "Mapping";
20
+ EValueType[EValueType["TagColor"] = 4] = "TagColor";
21
+ EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
22
+ })(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
23
+ /**
24
+ * Calculates the value of arbitrary field options.
25
+ * The context calling this should validate results and parse stuff if needed.
26
+ * @param fields
27
+ * @param entity
28
+ * @param tags
29
+ * @returns
30
+ */
31
+ function GetValue(fields, entity, tags) {
32
+ if (!tags) {
33
+ tags = [];
34
+ }
35
+ if (!entity) {
36
+ entity = {};
37
+ }
38
+ for (var i = 0; i < fields.length; i++) {
39
+ var field = fields[i];
40
+ var value = void 0;
41
+ switch (field.type) {
42
+ case EValueType.Color:
43
+ value = field.value;
44
+ if (value) {
45
+ value = color_1.Color.ColorFromStr(value);
46
+ }
47
+ break;
48
+ case EValueType.Gradient:
49
+ value = GetGradientValue(field.value, entity);
50
+ break;
51
+ case EValueType.Input:
52
+ value = GetInputValue(field.value, entity);
53
+ break;
54
+ case EValueType.Mapping:
55
+ value = GetMappingValue(field.value, entity);
56
+ break;
57
+ case EValueType.RandomColor:
58
+ value = color_1.Color.RandomColor();
59
+ break;
60
+ case EValueType.TagColor:
61
+ for (var i_1 = 0; i_1 < tags.length; i_1++) {
62
+ var tag = tags[i_1];
63
+ if (tag.Color) {
64
+ value = color_1.Color.ColorFromStr(tag.Color);
65
+ break;
66
+ }
67
+ }
68
+ break;
69
+ }
70
+ if (value || value == 0) {
71
+ return value;
72
+ }
73
+ }
74
+ return null;
75
+ }
76
+ Calculator.GetValue = GetValue;
77
+ function GetMappingValue(value, entity) {
78
+ var attrPath = path_utils_1.PathUtils.Parse(value.field);
79
+ var eValue = +entity_1.Entity.GetValue(entity, attrPath);
80
+ for (var i = 0; i < value.values.length; i++) {
81
+ var option = value.values[i];
82
+ var mapValue = option.fieldValue;
83
+ if (+mapValue == eValue) {
84
+ return option.appliedValue;
85
+ }
86
+ var mapSplit = mapValue.split("-");
87
+ if (mapSplit.length == 2) {
88
+ var min = mapSplit[0];
89
+ var max = mapSplit[1];
90
+ if (min != "") {
91
+ if (eValue < +min) {
92
+ continue;
93
+ }
94
+ }
95
+ if (max != "") {
96
+ if (eValue > +max) {
97
+ continue;
98
+ }
99
+ }
100
+ if (min == "" && max == "") {
101
+ continue;
102
+ }
103
+ return option.appliedValue;
104
+ }
105
+ }
106
+ return null;
107
+ }
108
+ Calculator.GetMappingValue = GetMappingValue;
109
+ function GetGradientValue(value, entity) {
110
+ var attrPath = path_utils_1.PathUtils.Parse(value.field);
111
+ var eValue = entity_1.Entity.GetValue(entity, attrPath);
112
+ eValue = Math.min(Math.max(eValue, value.min), value.max);
113
+ if (eValue < value.points[0].position) {
114
+ return color_1.Color.ColorFromStr(value.points[0].color);
115
+ }
116
+ for (var i = 0; i < value.points.length - 1; i++) {
117
+ var pointA = value.points[i];
118
+ var pointB = value.points[i + 1];
119
+ if (eValue >= pointA.position && eValue <= pointB.position) {
120
+ if (pointA.position == pointB.position) {
121
+ return color_1.Color.ColorFromStr(pointA.color);
122
+ }
123
+ var distance = (eValue - pointA.position) / (pointB.position - pointA.position);
124
+ var colorA = color_1.Color.ColorFromStr(pointA.color);
125
+ var colorB = color_1.Color.ColorFromStr(pointB.color);
126
+ return {
127
+ red: colorA.red + (colorB.red - colorA.red) * distance,
128
+ green: colorA.green + (colorB.green - colorA.green) * distance,
129
+ blue: colorA.blue + (colorB.blue - colorA.blue) * distance,
130
+ alpha: colorA.alpha + (colorB.alpha - colorA.alpha) * distance
131
+ };
132
+ }
133
+ }
134
+ return color_1.Color.ColorFromStr(value.points[value.points.length - 1].color);
135
+ }
136
+ Calculator.GetGradientValue = GetGradientValue;
137
+ function GetInputValue(value, entity) {
138
+ if (typeof value == "string") {
139
+ try {
140
+ value = bruce_variable_1.BruceVariable.SwapValues(value, entity);
141
+ return eval(value);
142
+ }
143
+ catch (exception) {
144
+ var e = exception;
145
+ var suppress = false;
146
+ if (e && typeof e == "object") {
147
+ var msg = e.message;
148
+ suppress = !!msg && msg.includes("Unexpected end");
149
+ }
150
+ if (!suppress) {
151
+ console.error(e);
152
+ }
153
+ }
154
+ }
155
+ return value;
156
+ }
157
+ Calculator.GetInputValue = GetInputValue;
158
+ })(Calculator = exports.Calculator || (exports.Calculator = {}));
159
159
  //# sourceMappingURL=calculator.js.map