@team-geospan/struct3d 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,465 @@
1
+ {
2
+ "kind": "structurecollection",
3
+ "structures": [
4
+ {
5
+ "kind": "structure",
6
+ "projection": "planar",
7
+ "points": {
8
+ "c101": {
9
+ "kind": "corner",
10
+ "coordinates": [
11
+ -0.0,
12
+ 0.101,
13
+ 3.370403808593778
14
+ ]
15
+ },
16
+ "c102": {
17
+ "kind": "corner",
18
+ "coordinates": [
19
+ 0.129,
20
+ 11.677,
21
+ 3.370403808593778
22
+ ]
23
+ },
24
+ "c103": {
25
+ "kind": "corner",
26
+ "coordinates": [
27
+ 4.579,
28
+ 7.122,
29
+ 5.351403808593773
30
+ ]
31
+ },
32
+ "c104": {
33
+ "kind": "corner",
34
+ "coordinates": [
35
+ 4.55,
36
+ 4.546,
37
+ 5.351403808593773
38
+ ]
39
+ },
40
+ "c105": {
41
+ "kind": "corner",
42
+ "coordinates": [
43
+ 9.129,
44
+ 11.576,
45
+ 3.370403808593778
46
+ ]
47
+ },
48
+ "c106": {
49
+ "kind": "corner",
50
+ "coordinates": [
51
+ 9.0,
52
+ 0.0,
53
+ 3.370403808593778
54
+ ]
55
+ },
56
+ "ground": {
57
+ "kind": "ground",
58
+ "coordinates": [
59
+ -0.0,
60
+ 0.0,
61
+ 0.00040380859377364686
62
+ ]
63
+ }
64
+ },
65
+ "edges": {
66
+ "e101": {
67
+ "kind": "eave",
68
+ "points": [
69
+ "c101",
70
+ "c102"
71
+ ],
72
+ "properties": {
73
+ "attachments": [
74
+ "gutter"
75
+ ],
76
+ "length": 11.577
77
+ }
78
+ },
79
+ "e102": {
80
+ "kind": "hip",
81
+ "points": [
82
+ "c102",
83
+ "c103"
84
+ ],
85
+ "properties": {
86
+ "length": 6.669
87
+ }
88
+ },
89
+ "e108": {
90
+ "kind": "eave",
91
+ "points": [
92
+ "c102",
93
+ "c105"
94
+ ],
95
+ "properties": {
96
+ "attachments": [
97
+ "gutter"
98
+ ],
99
+ "length": 9.001
100
+ }
101
+ },
102
+ "e103": {
103
+ "kind": "hip",
104
+ "points": [
105
+ "c104",
106
+ "c101"
107
+ ],
108
+ "properties": {
109
+ "length": 6.663
110
+ }
111
+ },
112
+ "e107": {
113
+ "kind": "hip",
114
+ "points": [
115
+ "c104",
116
+ "c106"
117
+ ],
118
+ "properties": {
119
+ "length": 6.663
120
+ }
121
+ },
122
+ "e104": {
123
+ "kind": "ridge",
124
+ "points": [
125
+ "c103",
126
+ "c104"
127
+ ],
128
+ "properties": {
129
+ "length": 2.576
130
+ }
131
+ },
132
+ "e105": {
133
+ "kind": "eave",
134
+ "points": [
135
+ "c105",
136
+ "c106"
137
+ ],
138
+ "properties": {
139
+ "attachments": [
140
+ "gutter"
141
+ ],
142
+ "length": 11.577
143
+ }
144
+ },
145
+ "e106": {
146
+ "kind": "hip",
147
+ "points": [
148
+ "c105",
149
+ "c103"
150
+ ],
151
+ "properties": {
152
+ "length": 6.669
153
+ }
154
+ },
155
+ "e109": {
156
+ "kind": "eave",
157
+ "points": [
158
+ "c106",
159
+ "c101"
160
+ ],
161
+ "properties": {
162
+ "attachments": [
163
+ "gutter"
164
+ ],
165
+ "length": 9.001
166
+ }
167
+ }
168
+ },
169
+ "surfaces": {
170
+ "surface1": {
171
+ "kind": "roof",
172
+ "edges": [
173
+ [
174
+ "e101",
175
+ "e102",
176
+ "e103",
177
+ "e104"
178
+ ]
179
+ ],
180
+ "properties": {
181
+ "material": "asphalt",
182
+ "pitch": 5,
183
+ "area": 34.799
184
+ }
185
+ },
186
+ "surface2": {
187
+ "kind": "roof",
188
+ "edges": [
189
+ [
190
+ "e105",
191
+ "e106",
192
+ "e107",
193
+ "e104"
194
+ ]
195
+ ],
196
+ "properties": {
197
+ "material": "asphalt",
198
+ "pitch": 5,
199
+ "area": 34.799
200
+ }
201
+ },
202
+ "surface3": {
203
+ "kind": "roof",
204
+ "edges": [
205
+ [
206
+ "e108",
207
+ "e106",
208
+ "e102"
209
+ ]
210
+ ],
211
+ "properties": {
212
+ "material": "asphalt",
213
+ "pitch": 5,
214
+ "area": 22.149
215
+ }
216
+ },
217
+ "surface4": {
218
+ "kind": "roof",
219
+ "edges": [
220
+ [
221
+ "e109",
222
+ "e107",
223
+ "e103"
224
+ ]
225
+ ],
226
+ "properties": {
227
+ "material": "asphalt",
228
+ "pitch": 5,
229
+ "area": 22.112
230
+ }
231
+ }
232
+ },
233
+ "components": {
234
+ "roof": {
235
+ "surfaces": [
236
+ "surface1",
237
+ "surface2",
238
+ "surface3",
239
+ "surface4"
240
+ ]
241
+ }
242
+ }
243
+ },
244
+ {
245
+ "kind": "structure",
246
+ "projection": "planar",
247
+ "points": {
248
+ "c107": {
249
+ "kind": "corner",
250
+ "coordinates": [
251
+ 15.606,
252
+ 4.39,
253
+ 4.419403808593756
254
+ ]
255
+ },
256
+ "c108": {
257
+ "kind": "corner",
258
+ "coordinates": [
259
+ 19.581,
260
+ 0.44,
261
+ 2.5904038085937486
262
+ ]
263
+ },
264
+ "c109": {
265
+ "kind": "corner",
266
+ "coordinates": [
267
+ 11.656,
268
+ 0.415,
269
+ 2.5904038085937486
270
+ ]
271
+ },
272
+ "c110": {
273
+ "kind": "corner",
274
+ "coordinates": [
275
+ 19.556,
276
+ 8.365,
277
+ 2.5904038085937486
278
+ ]
279
+ },
280
+ "c111": {
281
+ "kind": "corner",
282
+ "coordinates": [
283
+ 11.631,
284
+ 8.34,
285
+ 2.5904038085937486
286
+ ]
287
+ },
288
+ "ground": {
289
+ "kind": "ground",
290
+ "coordinates": [
291
+ 11.631,
292
+ 0.415,
293
+ 0.00040380859377364686
294
+ ]
295
+ }
296
+ },
297
+ "edges": {
298
+ "e110": {
299
+ "kind": "eave",
300
+ "points": [
301
+ "c108",
302
+ "c109"
303
+ ],
304
+ "properties": {
305
+ "attachments": [
306
+ "gutter"
307
+ ],
308
+ "length": 7.926
309
+ }
310
+ },
311
+ "e112": {
312
+ "kind": "hip",
313
+ "points": [
314
+ "c108",
315
+ "c107"
316
+ ],
317
+ "properties": {
318
+ "length": 5.895
319
+ }
320
+ },
321
+ "e111": {
322
+ "kind": "hip",
323
+ "points": [
324
+ "c107",
325
+ "c109"
326
+ ],
327
+ "properties": {
328
+ "length": 5.895
329
+ }
330
+ },
331
+ "e113": {
332
+ "kind": "eave",
333
+ "points": [
334
+ "c110",
335
+ "c108"
336
+ ],
337
+ "properties": {
338
+ "attachments": [
339
+ "gutter"
340
+ ],
341
+ "length": 7.926
342
+ }
343
+ },
344
+ "e114": {
345
+ "kind": "hip",
346
+ "points": [
347
+ "c110",
348
+ "c107"
349
+ ],
350
+ "properties": {
351
+ "length": 5.895
352
+ }
353
+ },
354
+ "e115": {
355
+ "kind": "eave",
356
+ "points": [
357
+ "c110",
358
+ "c111"
359
+ ],
360
+ "properties": {
361
+ "attachments": [
362
+ "gutter"
363
+ ],
364
+ "length": 7.926
365
+ }
366
+ },
367
+ "e116": {
368
+ "kind": "hip",
369
+ "points": [
370
+ "c111",
371
+ "c107"
372
+ ],
373
+ "properties": {
374
+ "length": 5.895
375
+ }
376
+ },
377
+ "e117": {
378
+ "kind": "eave",
379
+ "points": [
380
+ "c111",
381
+ "c109"
382
+ ],
383
+ "properties": {
384
+ "attachments": [
385
+ "gutter"
386
+ ],
387
+ "length": 7.926
388
+ }
389
+ }
390
+ },
391
+ "surfaces": {
392
+ "surface5": {
393
+ "kind": "roof",
394
+ "edges": [
395
+ [
396
+ "e110",
397
+ "e111",
398
+ "e112"
399
+ ]
400
+ ],
401
+ "properties": {
402
+ "material": "asphalt",
403
+ "pitch": 6,
404
+ "area": 17.296
405
+ }
406
+ },
407
+ "surface6": {
408
+ "kind": "roof",
409
+ "edges": [
410
+ [
411
+ "e113",
412
+ "e112",
413
+ "e114"
414
+ ]
415
+ ],
416
+ "properties": {
417
+ "material": "asphalt",
418
+ "pitch": 6,
419
+ "area": 17.296
420
+ }
421
+ },
422
+ "surface7": {
423
+ "kind": "roof",
424
+ "edges": [
425
+ [
426
+ "e115",
427
+ "e116",
428
+ "e114"
429
+ ]
430
+ ],
431
+ "properties": {
432
+ "material": "asphalt",
433
+ "pitch": 6,
434
+ "area": 17.295
435
+ }
436
+ },
437
+ "surface8": {
438
+ "kind": "roof",
439
+ "edges": [
440
+ [
441
+ "e117",
442
+ "e111",
443
+ "e116"
444
+ ]
445
+ ],
446
+ "properties": {
447
+ "material": "asphalt",
448
+ "pitch": 6,
449
+ "area": 17.295
450
+ }
451
+ }
452
+ },
453
+ "components": {
454
+ "roof": {
455
+ "surfaces": [
456
+ "surface5",
457
+ "surface6",
458
+ "surface7",
459
+ "surface8"
460
+ ]
461
+ }
462
+ }
463
+ }
464
+ ]
465
+ }
package/lib/draw.js CHANGED
@@ -178,7 +178,7 @@ export function createFacets(structureCollection, baseElevation, facetColors) {
178
178
 
179
179
  const material = new THREE.MeshPhongMaterial({
180
180
  side: THREE.DoubleSide,
181
- color: facetColors[surface.properties.material || "asphalt"],
181
+ color: facetColors[surface.properties?.material || "asphalt"],
182
182
  flatShading: true,
183
183
  shininess: 30,
184
184
  });
package/lib/index.js CHANGED
@@ -176,7 +176,10 @@ export default function StructureThreeD({
176
176
  }).coordinates;
177
177
  });
178
178
  structure.projection = "webmerc";
179
- } else if (structure.projection === "webmerc") {
179
+ } else if (
180
+ structure.projection === "webmerc" ||
181
+ structure.project === "planar"
182
+ ) {
180
183
  return structure;
181
184
  } else {
182
185
  // yikes this is unsupported right now!
@@ -286,20 +289,18 @@ export default function StructureThreeD({
286
289
  backgroundColor: "#eee",
287
290
  },
288
291
  },
289
- [
290
- createElement("div", {
291
- ref: divRef,
292
- onClick: handleClick,
293
- className: "struct-3d",
294
- style: {
295
- position: "absolute",
296
- top: 0,
297
- left: 0,
298
- width: "100%",
299
- height: "100%",
300
- },
301
- }),
302
- ],
292
+ createElement("div", {
293
+ ref: divRef,
294
+ onClick: handleClick,
295
+ className: "struct-3d",
296
+ style: {
297
+ position: "absolute",
298
+ top: 0,
299
+ left: 0,
300
+ width: "100%",
301
+ height: "100%",
302
+ },
303
+ }),
303
304
  );
304
305
  }
305
306
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@team-geospan/struct3d",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "The 3D Viewer component for StructuresJSON models.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "GEOSPAN Corp and Contributors",
7
7
  "type": "module",
8
8
  "scripts": {
9
9
  "build:copy-files": "node ./scripts/bundle.js",
10
- "lint": "eslint --report-unused-disable-directives --max-warnings 0 ./lib ./docs --ext .js,.jsx",
10
+ "lint": "eslint --report-unused-disable-directives --max-warnings 0 ./lib ./docs/src --ext .js,.jsx",
11
11
  "lint:fix": "npm run lint -- --fix",
12
12
  "start": "astro dev --root ./docs",
13
13
  "build": "astro build --root ./docs",
Binary file