@configura/web-core 2.0.0-alpha.8 → 2.0.0

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 (173) hide show
  1. package/.eslintrc.json +5 -0
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/cm/basic/Color.d.ts +16 -16
  5. package/dist/cm/basic/Color.js +18 -18
  6. package/dist/cm/basic/ColorF.d.ts +9 -9
  7. package/dist/cm/basic/ColorF.js +10 -10
  8. package/dist/cm/basic/boolean.d.ts +2 -2
  9. package/dist/cm/basic/boolean.js +11 -11
  10. package/dist/cm/basic/number.d.ts +3 -3
  11. package/dist/cm/basic/number.js +18 -18
  12. package/dist/cm/basic/string.d.ts +2 -2
  13. package/dist/cm/basic/string.js +11 -11
  14. package/dist/cm/core3D/ATriMeshF.d.ts +96 -96
  15. package/dist/cm/core3D/ATriMeshF.js +197 -197
  16. package/dist/cm/core3D/GMaterial3D.d.ts +62 -62
  17. package/dist/cm/core3D/GMaterial3D.js +112 -112
  18. package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
  19. package/dist/cm/core3D/GMaterialClassic.js +171 -171
  20. package/dist/cm/core3D/GMaterialPBR.d.ts +73 -73
  21. package/dist/cm/core3D/GMaterialPBR.js +314 -314
  22. package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
  23. package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
  24. package/dist/cm/core3D/uvmapper/UVMapEnv.d.ts +19 -19
  25. package/dist/cm/core3D/uvmapper/UVMapEnv.js +47 -47
  26. package/dist/cm/core3D/uvmapper/UVMapper.d.ts +41 -41
  27. package/dist/cm/core3D/uvmapper/UVMapper.js +94 -94
  28. package/dist/cm/core3D/uvmapper/UVMapperBox.d.ts +4 -4
  29. package/dist/cm/core3D/uvmapper/UVMapperBox.js +181 -181
  30. package/dist/cm/core3D/uvmapper/UVMapperCylinder.d.ts +9 -9
  31. package/dist/cm/core3D/uvmapper/UVMapperCylinder.js +96 -96
  32. package/dist/cm/core3D/uvmapper/UVMapperPlane.d.ts +3 -3
  33. package/dist/cm/core3D/uvmapper/UVMapperPlane.js +84 -84
  34. package/dist/cm/core3D/uvmapper/UVTransformer.d.ts +5 -5
  35. package/dist/cm/core3D/uvmapper/UVTransformer.js +5 -5
  36. package/dist/cm/core3D/uvmapper/instantiateUVMapper.d.ts +3 -3
  37. package/dist/cm/core3D/uvmapper/instantiateUVMapper.js +4 -4
  38. package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
  39. package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
  40. package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
  41. package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
  42. package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
  43. package/dist/cm/format/cmsym/SymInv.js +17 -15
  44. package/dist/cm/format/cmsym/SymNode.d.ts +94 -93
  45. package/dist/cm/format/cmsym/SymNode.js +652 -652
  46. package/dist/cm/format/cmsym/components/SymBox.d.ts +15 -15
  47. package/dist/cm/format/cmsym/components/SymBox.js +39 -39
  48. package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
  49. package/dist/cm/format/cmsym/components/SymComponent.js +56 -54
  50. package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
  51. package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
  52. package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
  53. package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
  54. package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
  55. package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
  56. package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
  57. package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
  58. package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +17 -17
  59. package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +22 -22
  60. package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
  61. package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
  62. package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
  63. package/dist/cm/format/cmsym/components/SymLODGroup.js +13 -11
  64. package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
  65. package/dist/cm/format/cmsym/components/SymLight.js +10 -10
  66. package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
  67. package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
  68. package/dist/cm/format/cmsym/components/SymMeasure.d.ts +33 -33
  69. package/dist/cm/format/cmsym/components/SymMeasure.js +149 -149
  70. package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
  71. package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
  72. package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
  73. package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
  74. package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
  75. package/dist/cm/format/cmsym/components/SymMultiSelector.js +48 -48
  76. package/dist/cm/format/cmsym/components/SymParams.d.ts +16 -16
  77. package/dist/cm/format/cmsym/components/SymParams.js +58 -58
  78. package/dist/cm/format/cmsym/components/SymPlane.d.ts +15 -14
  79. package/dist/cm/format/cmsym/components/SymPlane.js +30 -30
  80. package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
  81. package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
  82. package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
  83. package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
  84. package/dist/cm/format/cmsym/components/SymProgs.d.ts +32 -32
  85. package/dist/cm/format/cmsym/components/SymProgs.js +120 -120
  86. package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
  87. package/dist/cm/format/cmsym/components/SymProps.js +171 -170
  88. package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
  89. package/dist/cm/format/cmsym/components/SymRep.js +28 -28
  90. package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
  91. package/dist/cm/format/cmsym/components/SymReps.js +230 -229
  92. package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
  93. package/dist/cm/format/cmsym/components/SymShape.js +17 -17
  94. package/dist/cm/format/cmsym/components/SymSphere.d.ts +18 -18
  95. package/dist/cm/format/cmsym/components/SymSphere.js +33 -33
  96. package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
  97. package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
  98. package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
  99. package/dist/cm/format/cmsym/components/SymTags.js +20 -20
  100. package/dist/cm/format/cmsym/components/SymText2D.d.ts +5 -5
  101. package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
  102. package/dist/cm/format/cmsym/components/SymText3D.d.ts +5 -5
  103. package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
  104. package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
  105. package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
  106. package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
  107. package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
  108. package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
  109. package/dist/cm/format/cmsym/components/instantiate.js +121 -121
  110. package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
  111. package/dist/cm/format/cmsym/components/legacy.js +27 -27
  112. package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
  113. package/dist/cm/format/cmsym/components/mesh.js +28 -28
  114. package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
  115. package/dist/cm/format/cmsym/invalidation.js +72 -72
  116. package/dist/cm/format/dex/DexIRef.d.ts +9 -9
  117. package/dist/cm/format/dex/DexIRef.js +18 -18
  118. package/dist/cm/format/dex/DexInt.d.ts +11 -11
  119. package/dist/cm/format/dex/DexInt.js +18 -18
  120. package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
  121. package/dist/cm/format/dex/DexInternalizedXRef.js +65 -64
  122. package/dist/cm/format/dex/DexLoader.d.ts +8 -8
  123. package/dist/cm/format/dex/DexLoader.js +12 -12
  124. package/dist/cm/format/dex/DexManager.d.ts +20 -20
  125. package/dist/cm/format/dex/DexManager.js +78 -78
  126. package/dist/cm/format/dex/DexObj.d.ts +15 -15
  127. package/dist/cm/format/dex/DexObj.js +86 -86
  128. package/dist/cm/format/dex/DexReader.d.ts +90 -90
  129. package/dist/cm/format/dex/DexReader.js +532 -532
  130. package/dist/cm/format/dex/DexRef.d.ts +6 -6
  131. package/dist/cm/format/dex/DexRef.js +8 -8
  132. package/dist/cm/format/dex/DexReplacedXRefs.d.ts +9 -8
  133. package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
  134. package/dist/cm/format/dex/DexURL.d.ts +4 -4
  135. package/dist/cm/format/dex/DexURL.js +5 -5
  136. package/dist/cm/format/dex/DexVersion.d.ts +15 -15
  137. package/dist/cm/format/dex/DexVersion.js +53 -53
  138. package/dist/cm/format/dex/DexXRef.d.ts +18 -18
  139. package/dist/cm/format/dex/DexXRef.js +51 -51
  140. package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
  141. package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
  142. package/dist/cm/geometry/Angle.d.ts +9 -9
  143. package/dist/cm/geometry/Angle.js +18 -18
  144. package/dist/cm/geometry/AngleF.d.ts +5 -5
  145. package/dist/cm/geometry/AngleF.js +8 -8
  146. package/dist/cm/geometry/Box.d.ts +7 -7
  147. package/dist/cm/geometry/Box.js +9 -9
  148. package/dist/cm/geometry/DetailMask.d.ts +37 -37
  149. package/dist/cm/geometry/DetailMask.js +114 -114
  150. package/dist/cm/geometry/LayerExpr.d.ts +2 -2
  151. package/dist/cm/geometry/LayerExpr.js +2 -2
  152. package/dist/cm/geometry/Matrix22.d.ts +7 -7
  153. package/dist/cm/geometry/Matrix22.js +9 -9
  154. package/dist/cm/geometry/Matrix33.d.ts +42 -42
  155. package/dist/cm/geometry/Matrix33.js +124 -124
  156. package/dist/cm/geometry/Orientation.d.ts +7 -7
  157. package/dist/cm/geometry/Orientation.js +7 -7
  158. package/dist/cm/geometry/Plane.d.ts +8 -8
  159. package/dist/cm/geometry/Plane.js +14 -14
  160. package/dist/cm/geometry/Point.d.ts +21 -21
  161. package/dist/cm/geometry/Point.js +65 -65
  162. package/dist/cm/geometry/Point2D.d.ts +9 -9
  163. package/dist/cm/geometry/Point2D.js +23 -23
  164. package/dist/cm/geometry/PointF.d.ts +11 -11
  165. package/dist/cm/geometry/PointF.js +27 -27
  166. package/dist/cm/geometry/Transform.d.ts +11 -11
  167. package/dist/cm/geometry/Transform.js +61 -61
  168. package/dist/cm/geometry/Transform2D.d.ts +7 -7
  169. package/dist/cm/geometry/Transform2D.js +6 -6
  170. package/dist/cm/io/Semver.d.ts +18 -18
  171. package/dist/cm/io/Semver.js +61 -61
  172. package/dist/index.js +1 -1
  173. package/package.json +4 -4
@@ -1,229 +1,230 @@
1
- import { DetailMask } from "../../../geometry/DetailMask.js";
2
- import { DexInt } from "../../dex/DexInt.js";
3
- import { DexObj } from "../../dex/DexObj.js";
4
- import { invalidate } from "../invalidation.js";
5
- import { SymInv } from "../SymInv.js";
6
- import { SymComponent, SymGfxMode } from "./SymComponent.js";
7
- import { SymPropsInv, SYM_NODE_KEY, SYM_STRUCTURAL_KEY } from "./SymProps.js";
8
- export class SymReps extends SymComponent {
9
- constructor(_details, src) {
10
- super(src);
11
- this._details = _details;
12
- this.id = "symReps";
13
- this.invalid = false;
14
- }
15
- static reps3D(detail, src) {
16
- let mask;
17
- if (detail !== undefined) {
18
- mask = new DetailMask();
19
- mask.set(detail);
20
- }
21
- else {
22
- mask = DetailMask.allSymReps();
23
- }
24
- return this.withDetailMask(SymGfxMode.x3D, mask, src);
25
- }
26
- static withDetailMask(mode, mask, src) {
27
- const details = new Map();
28
- details.set(mode, mask);
29
- return new this(details, src);
30
- }
31
- load(logger, dexObj, _env, _force = false) {
32
- let details = dexObj.get("mask3D");
33
- if (details instanceof DexInt) {
34
- const mask = new DetailMask(details.value);
35
- this.include(SymGfxMode.x3D, mask, false);
36
- }
37
- details = dexObj.get("mask2D");
38
- if (details instanceof DexInt) {
39
- const mask = new DetailMask(details.value);
40
- this.include(SymGfxMode.x2D, mask, false);
41
- }
42
- const propagated = dexObj.get("propagated");
43
- if (propagated instanceof DexObj) {
44
- details = propagated.get("mask3D");
45
- if (details instanceof DexInt) {
46
- const mask = new DetailMask(details.value);
47
- this.includePropagated(SymGfxMode.x3D, mask);
48
- }
49
- details = propagated.get("mask2D");
50
- if (details instanceof DexInt) {
51
- const mask = new DetailMask(details.value);
52
- this.includePropagated(SymGfxMode.x2D, mask);
53
- }
54
- }
55
- dexObj.get("containsAny2D");
56
- dexObj.get("containsAny3D");
57
- }
58
- include(mode, mask, invalidate = true) {
59
- if (this._details === undefined) {
60
- this._details = new Map();
61
- }
62
- const dm = this._details.get(mode);
63
- if (dm !== undefined) {
64
- mask.include(dm);
65
- }
66
- this._details.set(mode, mask);
67
- if (invalidate) {
68
- this.invalidate();
69
- }
70
- }
71
- includePropagated(mode, mask) {
72
- if (this._propagatedDetails === undefined) {
73
- this._propagatedDetails = new Map();
74
- }
75
- const dm = this._propagatedDetails.get(mode);
76
- if (dm !== undefined) {
77
- mask.include(dm);
78
- }
79
- this._propagatedDetails.set(mode, mask);
80
- // no invalidation needed
81
- }
82
- detailLevels(mode) {
83
- return this.detailMask(mode).detailSet();
84
- }
85
- detailMask(mode) {
86
- const result = new DetailMask();
87
- if (this._details !== undefined) {
88
- const mask = this._details.get(mode);
89
- if (mask !== undefined) {
90
- result.include(mask);
91
- }
92
- }
93
- if (this._propagatedDetails !== undefined) {
94
- const mask = this._propagatedDetails.get(mode);
95
- if (mask !== undefined) {
96
- result.include(mask);
97
- }
98
- }
99
- return result;
100
- }
101
- detailsMap() {
102
- const combined = new Map();
103
- if (this._details !== undefined) {
104
- this._details.forEach((mask, mode) => {
105
- combined.set(mode, new DetailMask(mask.mask));
106
- });
107
- }
108
- if (this._propagatedDetails !== undefined) {
109
- this._propagatedDetails.forEach((mask, mode) => {
110
- let existing = combined.get(mode);
111
- if (existing !== undefined) {
112
- existing.include(mask);
113
- }
114
- else {
115
- existing = new DetailMask(mask.mask);
116
- }
117
- combined.set(mode, existing);
118
- });
119
- }
120
- return combined;
121
- }
122
- intersects(other) {
123
- if (this.empty() && other.empty()) {
124
- return true;
125
- }
126
- let found = false;
127
- other.detailsMap().forEach((mask, mode) => {
128
- if (found) {
129
- return;
130
- }
131
- if (this._propagatedDetails !== undefined) {
132
- const dm = this._propagatedDetails.get(mode);
133
- if (dm !== undefined && mask.intersects(dm)) {
134
- found = true;
135
- }
136
- }
137
- if (this._details !== undefined) {
138
- const dm = this._details.get(mode);
139
- if (dm !== undefined) {
140
- found = true;
141
- }
142
- }
143
- });
144
- return found;
145
- }
146
- empty() {
147
- if (this._details !== undefined && this._details.size > 0) {
148
- return false;
149
- }
150
- if (this._propagatedDetails !== undefined && this._propagatedDetails.size > 0) {
151
- return false;
152
- }
153
- return true;
154
- }
155
- removeAllExcept(other) {
156
- if (this._details !== undefined) {
157
- this._details.forEach((mask, mode) => {
158
- const otherMask = other.detailMask(mode);
159
- // tslint:disable-next-line:no-bitwise
160
- mask.mask = mask.mask & otherMask.mask;
161
- if (mask.mask === 0) {
162
- this._details.delete(mode);
163
- }
164
- else {
165
- this._details.set(mode, mask);
166
- }
167
- });
168
- }
169
- }
170
- invalidation(removed) {
171
- return [new SymRepsInv(this)];
172
- }
173
- invalidate() {
174
- this.invalid = true;
175
- if (this._propagatedDetails !== undefined) {
176
- this._propagatedDetails.clear();
177
- this._propagatedDetails = undefined;
178
- }
179
- if (this.node) {
180
- const invalidation = [
181
- new SymRepsInv(this),
182
- new SymPropsInv(SYM_NODE_KEY, undefined, true),
183
- new SymPropsInv(SYM_STRUCTURAL_KEY),
184
- ];
185
- invalidate(this.node, invalidation);
186
- }
187
- }
188
- toString() {
189
- const str = this._details &&
190
- Array.from(this._details.entries())
191
- .map((e) => `${e[0]}=${e[1]}`)
192
- .join(",");
193
- return `SymReps(${str})`;
194
- }
195
- }
196
- // tslint:disable-next-line:max-classes-per-file
197
- export class SymRepsInv extends SymInv {
198
- constructor(reps) {
199
- super();
200
- this.reps = reps;
201
- }
202
- needToInvalidate(node) {
203
- const reps = node.symReps();
204
- if (reps === undefined) {
205
- return true;
206
- }
207
- else if (reps.invalid) {
208
- return false;
209
- }
210
- return true;
211
- }
212
- skip(node) {
213
- return node === this.reps.node;
214
- }
215
- invalidate(node) {
216
- const reps = node.symReps();
217
- if (reps !== undefined) {
218
- reps.invalidate();
219
- }
220
- else {
221
- node.addComponent(invalidSymReps(), false);
222
- }
223
- }
224
- }
225
- export function invalidSymReps() {
226
- const reps = new SymReps();
227
- reps.invalidate();
228
- return reps;
229
- }
1
+ import { DetailMask } from "../../../geometry/DetailMask.js";
2
+ import { DexInt } from "../../dex/DexInt.js";
3
+ import { DexObj } from "../../dex/DexObj.js";
4
+ import { invalidate } from "../invalidation.js";
5
+ import { SymInv } from "../SymInv.js";
6
+ import { SymComponent, SymGfxMode } from "./SymComponent.js";
7
+ import { SymPropsInv, SYM_NODE_KEY, SYM_STRUCTURAL_KEY } from "./SymProps.js";
8
+ export class SymReps extends SymComponent {
9
+ constructor(_details, src) {
10
+ super(src);
11
+ this._details = _details;
12
+ this.id = "symReps";
13
+ this.invalid = false;
14
+ }
15
+ static reps3D(detail, src) {
16
+ let mask;
17
+ if (detail !== undefined) {
18
+ mask = new DetailMask();
19
+ mask.set(detail);
20
+ }
21
+ else {
22
+ mask = DetailMask.allSymReps();
23
+ }
24
+ return this.withDetailMask(SymGfxMode.x3D, mask, src);
25
+ }
26
+ static withDetailMask(mode, mask, src) {
27
+ const details = new Map();
28
+ details.set(mode, mask);
29
+ return new this(details, src);
30
+ }
31
+ load(logger, dexObj, _env, _force = false) {
32
+ let details = dexObj.get("mask3D");
33
+ if (details instanceof DexInt) {
34
+ const mask = new DetailMask(details.value);
35
+ this.include(SymGfxMode.x3D, mask, false);
36
+ }
37
+ details = dexObj.get("mask2D");
38
+ if (details instanceof DexInt) {
39
+ const mask = new DetailMask(details.value);
40
+ this.include(SymGfxMode.x2D, mask, false);
41
+ }
42
+ const propagated = dexObj.get("propagated");
43
+ if (propagated instanceof DexObj) {
44
+ details = propagated.get("mask3D");
45
+ if (details instanceof DexInt) {
46
+ const mask = new DetailMask(details.value);
47
+ this.includePropagated(SymGfxMode.x3D, mask);
48
+ }
49
+ details = propagated.get("mask2D");
50
+ if (details instanceof DexInt) {
51
+ const mask = new DetailMask(details.value);
52
+ this.includePropagated(SymGfxMode.x2D, mask);
53
+ }
54
+ }
55
+ dexObj.get("containsAny2D");
56
+ dexObj.get("containsAny3D");
57
+ }
58
+ include(mode, mask, invalidate = true) {
59
+ if (this._details === undefined) {
60
+ this._details = new Map();
61
+ }
62
+ const dm = this._details.get(mode);
63
+ if (dm !== undefined) {
64
+ mask.include(dm);
65
+ }
66
+ this._details.set(mode, mask);
67
+ if (invalidate) {
68
+ this.invalidate();
69
+ }
70
+ }
71
+ includePropagated(mode, mask) {
72
+ if (this._propagatedDetails === undefined) {
73
+ this._propagatedDetails = new Map();
74
+ }
75
+ const dm = this._propagatedDetails.get(mode);
76
+ if (dm !== undefined) {
77
+ mask.include(dm);
78
+ }
79
+ this._propagatedDetails.set(mode, mask);
80
+ // no invalidation needed
81
+ }
82
+ detailLevels(mode) {
83
+ return this.detailMask(mode).detailSet();
84
+ }
85
+ detailMask(mode) {
86
+ const result = new DetailMask();
87
+ if (this._details !== undefined) {
88
+ const mask = this._details.get(mode);
89
+ if (mask !== undefined) {
90
+ result.include(mask);
91
+ }
92
+ }
93
+ if (this._propagatedDetails !== undefined) {
94
+ const mask = this._propagatedDetails.get(mode);
95
+ if (mask !== undefined) {
96
+ result.include(mask);
97
+ }
98
+ }
99
+ return result;
100
+ }
101
+ detailsMap() {
102
+ const combined = new Map();
103
+ if (this._details !== undefined) {
104
+ this._details.forEach((mask, mode) => {
105
+ combined.set(mode, new DetailMask(mask.mask));
106
+ });
107
+ }
108
+ if (this._propagatedDetails !== undefined) {
109
+ this._propagatedDetails.forEach((mask, mode) => {
110
+ let existing = combined.get(mode);
111
+ if (existing !== undefined) {
112
+ existing.include(mask);
113
+ }
114
+ else {
115
+ existing = new DetailMask(mask.mask);
116
+ }
117
+ combined.set(mode, existing);
118
+ });
119
+ }
120
+ return combined;
121
+ }
122
+ intersects(other) {
123
+ if (this.empty() && other.empty()) {
124
+ return true;
125
+ }
126
+ let found = false;
127
+ other.detailsMap().forEach((mask, mode) => {
128
+ if (found) {
129
+ return;
130
+ }
131
+ if (this._propagatedDetails !== undefined) {
132
+ const dm = this._propagatedDetails.get(mode);
133
+ if (dm !== undefined && mask.intersects(dm)) {
134
+ found = true;
135
+ }
136
+ }
137
+ if (this._details !== undefined) {
138
+ const dm = this._details.get(mode);
139
+ if (dm !== undefined) {
140
+ found = true;
141
+ }
142
+ }
143
+ });
144
+ return found;
145
+ }
146
+ empty() {
147
+ if (this._details !== undefined && this._details.size > 0) {
148
+ return false;
149
+ }
150
+ if (this._propagatedDetails !== undefined && this._propagatedDetails.size > 0) {
151
+ return false;
152
+ }
153
+ return true;
154
+ }
155
+ removeAllExcept(other) {
156
+ const details = this._details;
157
+ if (details !== undefined) {
158
+ details.forEach((mask, mode) => {
159
+ const otherMask = other.detailMask(mode);
160
+ // tslint:disable-next-line:no-bitwise
161
+ mask.mask = mask.mask & otherMask.mask;
162
+ if (mask.mask === 0) {
163
+ details.delete(mode);
164
+ }
165
+ else {
166
+ details.set(mode, mask);
167
+ }
168
+ });
169
+ }
170
+ }
171
+ invalidation(removed) {
172
+ return [new SymRepsInv(this)];
173
+ }
174
+ invalidate() {
175
+ this.invalid = true;
176
+ if (this._propagatedDetails !== undefined) {
177
+ this._propagatedDetails.clear();
178
+ this._propagatedDetails = undefined;
179
+ }
180
+ if (this.node) {
181
+ const invalidation = [
182
+ new SymRepsInv(this),
183
+ new SymPropsInv(SYM_NODE_KEY, undefined, true),
184
+ new SymPropsInv(SYM_STRUCTURAL_KEY),
185
+ ];
186
+ invalidate(this.node, invalidation);
187
+ }
188
+ }
189
+ toString() {
190
+ const str = this._details &&
191
+ Array.from(this._details.entries())
192
+ .map((e) => `${e[0]}=${e[1]}`)
193
+ .join(",");
194
+ return `SymReps(${str})`;
195
+ }
196
+ }
197
+ // tslint:disable-next-line:max-classes-per-file
198
+ export class SymRepsInv extends SymInv {
199
+ constructor(reps) {
200
+ super();
201
+ this.reps = reps;
202
+ }
203
+ needToInvalidate(node) {
204
+ const reps = node.symReps();
205
+ if (reps === undefined) {
206
+ return true;
207
+ }
208
+ else if (reps.invalid) {
209
+ return false;
210
+ }
211
+ return true;
212
+ }
213
+ skip(node) {
214
+ return node === this.reps.node;
215
+ }
216
+ invalidate(node) {
217
+ const reps = node.symReps();
218
+ if (reps !== undefined) {
219
+ reps.invalidate();
220
+ }
221
+ else {
222
+ node.addComponent(invalidSymReps(), false);
223
+ }
224
+ }
225
+ }
226
+ export function invalidSymReps() {
227
+ const reps = new SymReps();
228
+ reps.invalidate();
229
+ return reps;
230
+ }
@@ -1,11 +1,11 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { DexObj } from "../../dex/DexObj.js";
3
- import { SymImportEnv } from "../SymImportEnv.js";
4
- import { SymInv } from "../SymInv.js";
5
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
6
- export declare class SymShape extends SymComponent {
7
- id: SymComponentKey;
8
- load(logger: Logger, obj: DexObj, _env: SymImportEnv, force?: boolean): void;
9
- invalidation(removed: boolean): SymInv[] | undefined;
10
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { DexObj } from "../../dex/DexObj.js";
3
+ import { SymImportEnv } from "../SymImportEnv.js";
4
+ import { SymInv } from "../SymInv.js";
5
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
6
+ export declare class SymShape extends SymComponent {
7
+ id: SymComponentKey;
8
+ load(logger: Logger, obj: DexObj, _env: SymImportEnv, force?: boolean): void;
9
+ invalidation(removed: boolean): SymInv[] | undefined;
10
+ }
11
11
  //# sourceMappingURL=SymShape.d.ts.map
@@ -1,17 +1,17 @@
1
- import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
2
- import { SymComponent } from "./SymComponent.js";
3
- export class SymShape extends SymComponent {
4
- constructor() {
5
- super(...arguments);
6
- this.id = "symShape";
7
- }
8
- load(logger, obj, _env, force = false) {
9
- if (VERBOSE_SYM_LOGGING) {
10
- console.warn("[SymShape.load] not yet implemented");
11
- }
12
- }
13
- invalidation(removed) {
14
- console.warn("[SymShape.invalidation] not yet implemented");
15
- return;
16
- }
17
- }
1
+ import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
2
+ import { SymComponent } from "./SymComponent.js";
3
+ export class SymShape extends SymComponent {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.id = "symShape";
7
+ }
8
+ load(logger, obj, _env, force = false) {
9
+ if (VERBOSE_SYM_LOGGING) {
10
+ console.warn("[SymShape.load] not yet implemented");
11
+ }
12
+ }
13
+ invalidation(removed) {
14
+ console.warn("[SymShape.invalidation] not yet implemented");
15
+ return;
16
+ }
17
+ }
@@ -1,19 +1,19 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { Point } from "../../../geometry/Point.js";
3
- import { DexObj } from "../../dex/DexObj.js";
4
- import { SymImportEnv } from "../SymImportEnv.js";
5
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
6
- /** @see http://web.git.configura.com/webteam/docs/cmsym/#SymSphere */
7
- export declare class SymSphere extends SymComponent {
8
- private _center?;
9
- private _radius?;
10
- private _segments?;
11
- id: SymComponentKey;
12
- constructor(_center?: Point | undefined, _radius?: number | undefined, _segments?: number | undefined, src?: string);
13
- get radius(): number | undefined;
14
- get center(): Point | undefined;
15
- /** How many segments should be used to create the corresponding mesh. */
16
- get segments(): number | undefined;
17
- load(logger: Logger, obj: DexObj, _env: SymImportEnv, force?: boolean): void;
18
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { Point } from "../../../geometry/Point.js";
3
+ import { DexObj } from "../../dex/DexObj.js";
4
+ import { SymImportEnv } from "../SymImportEnv.js";
5
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
6
+ /** @see http://web.git.configura.com/webteam/docs/cmsym/#SymSphere */
7
+ export declare class SymSphere extends SymComponent {
8
+ private _center?;
9
+ private _radius?;
10
+ private _segments?;
11
+ id: SymComponentKey;
12
+ constructor(_center?: Point | undefined, _radius?: number | undefined, _segments?: number | undefined, src?: string);
13
+ get radius(): number | undefined;
14
+ get center(): Point | undefined;
15
+ /** How many segments should be used to create the corresponding mesh. */
16
+ get segments(): number | undefined;
17
+ load(logger: Logger, obj: DexObj, _env: SymImportEnv, force?: boolean): void;
18
+ }
19
19
  //# sourceMappingURL=SymSphere.d.ts.map
@@ -1,33 +1,33 @@
1
- import { fcastNumber } from "../../../basic/number.js";
2
- import { Point } from "../../../geometry/Point.js";
3
- import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
4
- import { SymComponent } from "./SymComponent.js";
5
- /** @see http://web.git.configura.com/webteam/docs/cmsym/#SymSphere */
6
- export class SymSphere extends SymComponent {
7
- constructor(_center, _radius, _segments, src) {
8
- super(src);
9
- this._center = _center;
10
- this._radius = _radius;
11
- this._segments = _segments;
12
- this.id = "symSphere";
13
- }
14
- get radius() {
15
- return this._radius;
16
- }
17
- get center() {
18
- return this._center;
19
- }
20
- /** How many segments should be used to create the corresponding mesh. */
21
- get segments() {
22
- return this._segments;
23
- }
24
- load(logger, obj, _env, force = false) {
25
- this._center = Point.cast(obj.get("center")); // Optional
26
- this._radius = fcastNumber(obj.get("r"));
27
- this._segments = fcastNumber(obj.get("refinementTo"));
28
- // "refinementFrom" is not used here, could be used for lower quality
29
- if (VERBOSE_SYM_LOGGING) {
30
- logger.info(`SymSphere (r ${this._radius}, seg ${this._segments}, center ${this._center})`);
31
- }
32
- }
33
- }
1
+ import { fcastNumber } from "../../../basic/number.js";
2
+ import { Point } from "../../../geometry/Point.js";
3
+ import { VERBOSE_SYM_LOGGING } from "../SymNode.js";
4
+ import { SymComponent } from "./SymComponent.js";
5
+ /** @see http://web.git.configura.com/webteam/docs/cmsym/#SymSphere */
6
+ export class SymSphere extends SymComponent {
7
+ constructor(_center, _radius, _segments, src) {
8
+ super(src);
9
+ this._center = _center;
10
+ this._radius = _radius;
11
+ this._segments = _segments;
12
+ this.id = "symSphere";
13
+ }
14
+ get radius() {
15
+ return this._radius;
16
+ }
17
+ get center() {
18
+ return this._center;
19
+ }
20
+ /** How many segments should be used to create the corresponding mesh. */
21
+ get segments() {
22
+ return this._segments;
23
+ }
24
+ load(logger, obj, _env, force = false) {
25
+ this._center = Point.cast(obj.get("center")); // Optional
26
+ this._radius = fcastNumber(obj.get("r"));
27
+ this._segments = fcastNumber(obj.get("refinementTo"));
28
+ // "refinementFrom" is not used here, could be used for lower quality
29
+ if (VERBOSE_SYM_LOGGING) {
30
+ logger.info(`SymSphere (r ${this._radius}, seg ${this._segments}, center ${this._center})`);
31
+ }
32
+ }
33
+ }
@@ -1,9 +1,9 @@
1
- import { Logger } from "@configura/web-utilities";
2
- import { DexObj } from "../../dex/DexObj.js";
3
- import { SymImportEnv } from "../SymImportEnv.js";
4
- import { SymComponent, SymComponentKey } from "./SymComponent.js";
5
- export declare class SymSpotlight extends SymComponent {
6
- id: SymComponentKey;
7
- load(logger: Logger, _obj: DexObj, _env: SymImportEnv, _force?: boolean): void;
8
- }
1
+ import { Logger } from "@configura/web-utilities";
2
+ import { DexObj } from "../../dex/DexObj.js";
3
+ import { SymImportEnv } from "../SymImportEnv.js";
4
+ import { SymComponent, SymComponentKey } from "./SymComponent.js";
5
+ export declare class SymSpotlight extends SymComponent {
6
+ id: SymComponentKey;
7
+ load(logger: Logger, _obj: DexObj, _env: SymImportEnv, _force?: boolean): void;
8
+ }
9
9
  //# sourceMappingURL=SymSpotlight.d.ts.map