-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1594 lines (1346 loc) · 63 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<title>ifc2gltf</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/svg+xml"
href="data:image/svg+xml,%3Csvg version='1.1' viewBox='0.0 0.0 113.38582677165354 113.38582677165354' fill='none' stroke='none' stroke-linecap='square' stroke-miterlimit='10' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'%3E%3CclipPath id='p.0'%3E%3Cpath d='m0 0l113.385826 0l0 113.385826l-113.385826 0l0 -113.385826z' clip-rule='nonzero'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23p.0)'%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m0 0l113.385826 0l0 113.385826l-113.385826 0z' fill-rule='evenodd'/%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m-3.4105449 -23.45013l129.6063 0l0 89.98425l-129.6063 0z' fill-rule='evenodd'/%3E%3Cpath fill='%2367839a' d='m33.38633 29.939243q0 2.296875 -0.640625 4.15625q-0.625 1.859375 -1.734375 3.296875q-1.109375 1.421875 -2.65625 2.453125q-1.546875 1.03125 -3.40625 1.703125q-1.859375 0.65625 -3.96875 0.96875q-2.109375 0.3125 -4.703125 0.3125l-11.421875 0q-1.09375 0 -1.84375 -0.640625q-0.734375 -0.65625 -0.734375 -2.109375l0 -37.453125q0 -1.46875 0.734375 -2.109375q0.75 -0.65625 1.84375 -0.65625l10.796875 0q3.953125 0 6.6875 0.671875q2.75 0.65625006 4.625 2.0q1.875 1.34375 2.859375 3.4062498q1.0 2.0625 1.0 4.84375q0 1.5625 -0.40625 2.953125q-0.390625 1.375 -1.15625 2.500001q-0.765625 1.125 -1.875 2.0q-1.109375 0.859375 -2.53125 1.390625q1.828125 0.328125 3.359375 1.15625q1.546875 0.828125 2.6875 2.140625q1.15625 1.3125 1.8125 3.078125q0.671875 1.75 0.671875 3.9375zm-11.296875 -18.09375q0 -1.296875 -0.40625 -2.3125q-0.390625 -1.03125 -1.1875 -1.703125q-0.796875 -0.6875 -2.015625 -1.046875q-1.203125 -0.375 -3.21875 -0.375l-4.421875 0l0 11.156251l4.875 0q1.890625 0 3.015625 -0.453125q1.140625 -0.453125 1.890625 -1.218751q0.75 -0.78125 1.109375 -1.828125q0.359375 -1.046875 0.359375 -2.21875zm2.234375 18.40625q0 -1.5 -0.5 -2.671875q-0.5 -1.1875 -1.46875 -1.984375q-0.953125 -0.796875 -2.453125 -1.21875q-1.5 -0.4375 -3.890625 -0.4375l-5.171875 0l0 12.21875l6.3125 0q1.828125 0 3.0625 -0.375q1.25 -0.390625 2.15625 -1.140625q0.921875 -0.75 1.4375 -1.859375q0.515625 -1.109375 0.515625 -2.53125zm24.835938 11.375q0 0.34375 -0.21875 0.609375q-0.21875 0.265625 -0.71875 0.4375q-0.5 0.15625 -1.328125 0.25q-0.828125 0.109375 -2.125 0.109375q-1.265625 0 -2.109375 -0.109375q-0.84375 -0.09375 -1.34375 -0.25q-0.5 -0.171875 -0.71875 -0.4375q-0.203125 -0.265625 -0.203125 -0.609375l0 -40.5625q0 -0.34375006 0.203125 -0.60937506q0.21875 -0.265625 0.734375 -0.421875q0.515625 -0.171875 1.34375 -0.265625q0.828125 -0.109375 2.09375 -0.109375q1.296875 0 2.125 0.109375q0.828125 0.09375 1.328125 0.265625q0.5 0.15625 0.71875 0.421875q0.21875 0.265625 0.21875 0.60937506l0 40.5625zm59.42578 0q0 0.34375 -0.1875 0.609375q-0.171875 0.265625 -0.65625 0.4375q-0.484375 0.15625 -1.28125 0.25q-0.796875 0.109375 -2.015625 0.109375q-1.203125 0 -2.0 -0.109375q-0.796875 -0.09375 -1.265625 -0.25q-0.453125 -0.171875 -0.65625 -0.4375q-0.203125 -0.265625 -0.203125 -0.609375l0 -34.953125l-0.0625 0l-12.453125 34.921875q-0.140625 0.4375 -0.4375 0.71875q-0.296875 0.28125 -0.8125 0.453125q-0.515625 0.15625 -1.3125 0.203125q-0.796875 0.0625 -1.921875 0.0625q-1.125 0 -1.921875 -0.09375q-0.796875 -0.078125 -1.3125 -0.25q-0.515625 -0.1875 -0.8125 -0.453125q-0.296875 -0.265625 -0.40625 -0.640625l-12.015625 -34.921875l-0.0625 0l0 34.953125q0 0.34375 -0.1875 0.609375q-0.1875 0.265625 -0.6875 0.4375q-0.484375 0.15625 -1.265625 0.25q-0.78125 0.109375 -2.015625 0.109375q-1.1875 0 -1.984375 -0.109375q-0.796875 -0.09375 -1.28125 -0.25q-0.484375 -0.171875 -0.671875 -0.4375q-0.171875 -0.265625 -0.171875 -0.609375l0 -38.28125q0 -1.6875 0.890625 -2.578125q0.890625 -0.90625 2.390625 -0.90625l5.71875 0q1.515625 0 2.609375 0.25q1.109375 0.25 1.90625 0.828125q0.796875 0.57812506 1.328125 1.53125q0.53125 0.953125 0.921875 2.3437498l9.296875 25.59375l0.140625 0l9.625 -25.53125q0.421875 -1.3906248 0.9375 -2.3437498q0.515625 -0.96875 1.1875 -1.5625q0.6875 -0.609375 1.609375 -0.859375q0.9375 -0.25 2.171875 -0.25l5.875 0q0.90625 0 1.546875 0.234375q0.640625 0.234375 1.0625 0.6875q0.421875 0.43750006 0.625 1.09375q0.21875 0.640625 0.21875 1.46875l0 38.28125z' fill-rule='nonzero'/%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m31.01181 122.002625l69.76378 0l0 87.27559l-69.76378 0z' fill-rule='evenodd'/%3E%3Cpath fill='%2367839a' d='m66.48056 169.04387q0 0.765625 -0.078125 1.28125q-0.078125 0.515625 -0.25 0.828125q-0.15625 0.3125 -0.375 0.453125q-0.21875 0.140625 -0.46875 0.140625l-8.5 0l0 9.265625q0 0.28125 -0.140625 0.484375q-0.140625 0.203125 -0.46875 0.359375q-0.328125 0.140625 -0.875 0.234375q-0.546875 0.078125 -1.359375 0.078125q-0.828125 0 -1.375 -0.078125q-0.546875 -0.09375 -0.875 -0.234375q-0.328125 -0.15625 -0.484375 -0.359375q-0.140625 -0.203125 -0.140625 -0.484375l0 -9.265625l-8.484375 0q-0.234375 0 -0.453125 -0.140625q-0.203125 -0.140625 -0.375 -0.453125q-0.15625 -0.3125 -0.25 -0.828125q-0.09375 -0.515625 -0.09375 -1.28125q0 -0.75 0.078125 -1.28125q0.09375 -0.53125 0.234375 -0.84375q0.15625 -0.3125 0.34375 -0.453125q0.1875 -0.140625 0.4375 -0.140625l8.5625 0l0 -9.234375q0 -0.28125 0.140625 -0.5q0.15625 -0.234375 0.484375 -0.390625q0.328125 -0.15625 0.875 -0.234375q0.546875 -0.078125 1.375 -0.078125q0.8125 0 1.359375 0.078125q0.546875 0.078125 0.875 0.234375q0.328125 0.15625 0.46875 0.390625q0.140625 0.21875 0.140625 0.5l0 9.234375l8.578125 0q0.21875 0 0.421875 0.140625q0.203125 0.140625 0.359375 0.453125q0.15625 0.3125 0.234375 0.84375q0.078125 0.53125 0.078125 1.28125z' fill-rule='nonzero'/%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m-3.9091837 49.57113l135.52756 0l0 58.897636l-135.52756 0z' fill-rule='evenodd'/%3E%3Cpath fill='%23689543' d='m20.071434 103.0655q-0.140625 0.46875 -0.359375 0.765625q-0.21875 0.28125 -0.71875 0.4375q-0.484375 0.140625 -1.328125 0.1875q-0.84375 0.046875 -2.21875 0.046875q-1.09375 0 -1.875 -0.015625q-0.78125 -0.015625 -1.328125 -0.078125q-0.54687595 -0.046875 -0.89062595 -0.15625q-0.328125 -0.109375 -0.5625 -0.265625q-0.234375 -0.171875 -0.359375 -0.40625q-0.125 -0.234375 -0.234375 -0.59375l-10.53125 -31.359375q-0.328125 -0.984375 -0.390625 -1.5625q-0.0625 -0.578125 0.265625 -0.859375q0.34375 -0.28125 1.15625 -0.34375q0.828125 -0.078125 2.3125 -0.078125q1.2500002 0 1.9531252 0.0625q0.71875 0.046875 1.09375 0.1875q0.390625 0.125 0.546875 0.40625q0.15625 0.265625 0.28125 0.6875l8.625001 27.28125l0.015625 0l8.453125 -27.15625q0.109375 -0.453125 0.265625 -0.734375q0.171875 -0.296875 0.5625 -0.453125q0.40625 -0.171875 1.140625 -0.21875q0.734375 -0.0625 2.03125 -0.0625q1.25 0 1.9375 0.078125q0.703125 0.078125 0.96875 0.40625q0.265625 0.3125 0.15625 0.890625q-0.09375 0.5625 -0.421875 1.515625l-10.546875 31.390625zm21.988281 0.328125q0 0.28125 -0.171875 0.484375q-0.15625 0.203125 -0.5625 0.34375q-0.390625 0.140625 -1.046875 0.203125q-0.65625 0.078125 -1.671875 0.078125q-1.015625 0 -1.671875 -0.078125q-0.65625 -0.0625 -1.046875 -0.203125q-0.390625 -0.140625 -0.5625 -0.34375q-0.15625 -0.203125 -0.15625 -0.484375l0 -24.328125q0 -0.28125 0.15625 -0.484375q0.171875 -0.203125 0.5625 -0.34375q0.390625 -0.15625 1.046875 -0.234375q0.65625 -0.09375 1.671875 -0.09375q1.015625 0 1.671875 0.09375q0.65625 0.078125 1.046875 0.234375q0.40625 0.140625 0.5625 0.34375q0.171875 0.203125 0.171875 0.484375l0 24.328125zm0.515625 -32.640625q0 2.078125 -0.859375 2.875q-0.84375 0.78125 -3.140625 0.78125q-2.3125 0 -3.125 -0.765625q-0.8125 -0.765625 -0.8125 -2.75q0 -2.078125 0.828125 -2.890625q0.84375 -0.8125 3.171875 -0.8125q2.296875 0 3.109375 0.78125q0.828125 0.78125 0.828125 2.78125zm28.878906 19.734375q0 1.265625 -0.5625 1.875q-0.5625 0.59375 -1.546875 0.59375l-14.84375 0q0 1.5625 0.359375 2.828125q0.375 1.265625 1.171875 2.15625q0.8125 0.890625 2.078125 1.359375q1.28125 0.46875 3.0625038 0.46875q1.796875 0 3.1562462 -0.265625q1.375 -0.265625 2.375 -0.578125q1.0 -0.3125 1.65625 -0.5625q0.65625 -0.265625 1.0625 -0.265625q0.25 0 0.40625 0.09375q0.171875 0.09375 0.28125 0.34375q0.109375 0.25 0.140625 0.703125q0.046875 0.4375 0.046875 1.125q0 0.609375 -0.03125 1.03125q-0.015625 0.421875 -0.078125 0.71875q-0.046875 0.296875 -0.15625 0.515625q-0.109375 0.203125 -0.296875 0.390625q-0.171875 0.1875 -0.96875 0.515625q-0.796875 0.328125 -2.03125 0.65625q-1.21875 0.3125 -2.8124962 0.53125q-1.578125 0.234375 -3.390625 0.234375q-3.2500038 0 -5.703129 -0.8125q-2.4375 -0.828125 -4.078125 -2.484375q-1.640625 -1.671875 -2.453125 -4.21875q-0.796875 -2.546875 -0.796875 -5.96875q0 -3.25 0.84375 -5.859375q0.84375 -2.609375 2.453125 -4.421875q1.625 -1.828125 3.921875 -2.78125q2.3125 -0.953125 5.21875 -0.953125q3.0625038 0 5.234375 0.90625q2.171875 0.890625 3.5625 2.5q1.40625 1.59375 2.0625 3.78125q0.65625 2.1875 0.65625 4.75l0 1.09375zm-6.671875 -1.96875q0.078125 -2.890625 -1.1718712 -4.546875q-1.234375 -1.65625 -3.8437538 -1.65625q-1.3125 0 -2.28125 0.5q-0.96875 0.484375 -1.609375 1.328125q-0.640625 0.828125 -0.984375 1.96875q-0.34375 1.125 -0.390625 2.40625l10.28125 0zm49.371086 -9.5625q0 0.296875 -0.078125 0.734375q-0.078125 0.4375 -0.296875 1.265625l-6.515625 22.0625q-0.125 0.46875 -0.34375 0.75q-0.21875 0.28125 -0.671875 0.453125q-0.453125 0.171875 -1.296875 0.21875q-0.828125 0.0625 -2.171875 0.0625q-1.328125 0 -2.1875 -0.078125q-0.84375 -0.0625 -1.328125 -0.21875q-0.46875 -0.171875 -0.6875 -0.453125q-0.21875 -0.296875 -0.328125 -0.734375l-4.109375 -14.828125l-0.046875 -0.234375l-0.0625 0.234375l-3.765625 14.828125q-0.109375 0.46875 -0.3125 0.75q-0.203125 0.28125 -0.703125 0.453125q-0.484375 0.171875 -1.34375 0.21875q-0.84375 0.0625 -2.1875 0.0625q-1.359375 0 -2.203125 -0.078125q-0.828125 -0.0625 -1.3125 -0.21875q-0.46875 -0.171875 -0.6875 -0.453125q-0.21875 -0.296875 -0.328125 -0.734375l-6.453125 -22.0625q-0.25 -0.796875 -0.328125 -1.25q-0.0625 -0.453125 -0.0625 -0.75q0 -0.28125 0.15625 -0.484375q0.15625 -0.203125 0.546875 -0.328125q0.390625 -0.125 1.0625 -0.171875q0.671875 -0.0625 1.6875 -0.0625q1.09375 0 1.765625 0.0625q0.6875 0.046875 1.0625 0.1875q0.390625 0.140625 0.546875 0.375q0.15625 0.234375 0.234375 0.5625l4.84375 17.90625l0.046875 0.328125l0.0625 -0.328125l4.53125 -17.90625q0.078125 -0.328125 0.25 -0.5625q0.1875 -0.234375 0.546875 -0.375q0.359375 -0.140625 1.0 -0.1875q0.640625 -0.0625 1.65625 -0.0625q1.0 0 1.625 0.078125q0.640625 0.0625 1.0 0.1875q0.375 0.125 0.515625 0.328125q0.15625 0.203125 0.25 0.484375l4.859375 18.046875l0.078125 0.296875l0.0625 -0.328125l4.640625 -17.90625q0.0625 -0.328125 0.21875 -0.5625q0.171875 -0.234375 0.546875 -0.375q0.390625 -0.140625 1.046875 -0.1875q0.65625 -0.0625 1.671875 -0.0625q1.0 0 1.640625 0.0625q0.65625 0.046875 1.015625 0.171875q0.375 0.125 0.5 0.328125q0.140625 0.203125 0.140625 0.484375z' fill-rule='nonzero'/%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m3.0 126.50131l106.01575 0' fill-rule='evenodd'/%3E%3Cpath stroke='%23999999' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='butt' d='m3.0 126.50131l106.01575 0' fill-rule='evenodd'/%3E%3Cpath fill='%23000000' fill-opacity='0.0' d='m54.800526 121.19737l0 10.992126' fill-rule='evenodd'/%3E%3Cpath stroke='%23999999' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='butt' d='m54.800526 121.19737l0 10.992126' fill-rule='evenodd'/%3E%3C/g%3E%3C/svg%3E"/>
<!-- Insert this line above script imports -->
<script>if (typeof module === 'object') { window.module = module; module = undefined; }</script>
<link href="main.css" type="text/css" rel="stylesheet">
<script src="js/jquery-3.7.1.min.js"></script>
<script src="js/three.min.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/loaders/GLTFLoader.js"></script>
<script src="js/hummingbird-treeview.js"></script>
<script src="js/WebGL.js"></script>
<script src="treeview.js"></script>
<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>
</head>
<body>
<div id="dropZone"><div>Drop file here (ifc, ifczip, glb)</div><div style="font-size:12px;">(No upload, file stays on your computer)</div><div> Or choose file: <input type="file" id="finput" multiple></div></div>
<div id="containerWebGL" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:2 !important;">
<div id="containerWebGLsmall" style="position:absolute;left:10px;z-index:3 !important;border:#acacac 1px solid;display: none;width:0px;height:0px;"></div>
<div id="splitterMainDiv" class="splitterHorizonal" style="right:150px;"></div>
<div id="treeviewWidget" style="position:absolute;top:0;right:150px;height:100%; z-index: 5 !important;background-color: rgba(243, 247, 248, 0.658);margin:0px;padding:0px;padding-left:1px;border-left:1px solid rgba(171, 199, 192, 0.4)">
<div id="treeviewBuildingStructureScrollArea" style="width:150px;height:75%;position:absolute;top:0px;left:0px;margin:0px;padding:0px;overflow:scroll;overflow:scroll;">
<div id="treeviewBuildingStructure" style="position:absolute;top:0px;left:0px;margin:0px;padding:0px;border:none;">
<div id="treeview" class="hummingbird-treeview-converter"></div>
</div>
</div>
<div id="splitterTreeviewDiv" class="splitterVertical" style="position:absolute;left:0px;"></div>
<div id="treeviewAttributesScrollArea" style="width:150px;height:25%;position:absolute;left:0px;margin:0px;padding:0px;overflow:scroll;overflow:scroll;">
<div id="treeviewAttributes" style="position:absolute;margin:0px;padding:0px;left:0px;top:0px;">
Rotate: left mouse button. Zoom: scroll wheel. Pan: middle mouse button
<div id="treeview2" class="hummingbird-treeview-converter"></div>
</div>
</div>
</div>
<div id="toolbar" style="position:absolute;top:0;left:0;z-index: 7 !important;">
<svg width="36" height="32" viewBox="0 0 96 96" style="padding:2px;float:left;margin:4px;" fill-opacity="0.8" stroke-opacity="0.8">
<path fill="#005895" opacity="1.000000" stroke="none" d="M 79 95 C 75.307 95 71.614 95 67.3 94.622 C 64.743 93.973 62.724 93.965 60.887 93.384 C 53.224 90.962 45.615 88.368 37.801 85.554 C 29.828 80.098 21.486 75.585 14.37 69.612 C -0.13 57.44 -1.641 40.018 12.413 26.795 C 20.474 19.21 29.553 13.548 39.361 8.086 C 45.94 5.767 51.991 2.564 58.391 1.534 C 65.799 0.342 73.515 1.061 80.754 1.099 C 72.652 4.195 64.756 6.828 57.168 10.164 C 45.122 15.46 33.415 21.398 24.216 31.25 C 16.869 39.118 14.497 49.484 19.595 56.687 C 23.095 61.632 27.407 66.317 32.237 69.947 C 47.153 81.161 64.708 87.527 82.501 92.69 C 81.418 93.446 79.934 94.553 79 95 Z"/>
<path fill="#0066AD" opacity="1.000000" stroke="none" d="M 82.436 88.777 C 82.436 88.777 82.774 90.668 82.488 92.767 C 64.159 88.186 47.153 81.161 32.237 69.947 C 27.407 66.317 23.095 61.632 19.595 56.687 C 14.497 49.484 16.869 39.118 24.216 31.25 C 33.415 21.398 45.122 15.46 57.168 10.164 C 64.756 6.828 72.652 4.195 80.754 1.099 C 85.884 3.694 81.554 5.252 80.152 7.527 C 68.003 15.226 55.814 22.348 44.065 30.134 C 40.204 32.692 37.069 36.679 34.343 40.536 C 30.823 45.514 32.355 52.301 36.957 57.509 C 43.624 65.055 51.981 70.26 60.561 75.21 C 66.81 78.815 73.061 82.419 79.886 86.477 C 81.157 86.96 82.07 88.253 82.436 88.777 Z"/>
<path fill="#B79F74" opacity="1.000000" stroke="none" d="M 74.035 21.226 C 80.44 19.443 87.094 18.193 91.184 24.981 C 93.346 28.571 94.675 33.174 94.807 37.369 C 95.082 46.109 95.404 55.107 93.663 63.579 C 91.924 72.037 86.683 76.211 74.337 72.646 C 67.92 67.236 61.622 62.692 56.054 57.383 C 49.809 51.427 49.12 44.754 54.606 38.371 C 59.172 33.058 65.11 28.922 70.447 24.272 C 71.63 23.241 72.838 22.241 74.035 21.226 Z"/>
<path fill="#A08A61" opacity="1.000000" stroke="none" d="M 73.936 21.31 C 73.113 22.405 71.63 23.241 70.447 24.272 C 65.11 28.922 59.172 33.058 54.606 38.371 C 49.12 44.754 49.809 51.427 56.054 57.383 C 61.622 62.692 68.249 67.456 74.295 72.665 C 62.27 69.774 52.092 62.887 44.614 52.941 C 41.35 48.601 42.785 42.054 47.657 36.917 C 54.791 29.395 63.844 24.614 73.936 21.31 Z"/>
</svg>
<button id="zoomToBounds" title="zoom to bounds" class="toolButton" style="position: absolute;top:0px;right:0px;z-index: 15 !important;"><svg viewBox="0 0 1000 1000">
<path fill="#0067b1" d="m 342,591 c -77,77 -155,155 -233,233 -0,-48 0,-97 -0,-146 C 106,647 73,628 46,636 22,641 9,666 12,688 c 0,89 -0,178 0,267 -3,24 21,36 42,34 68,1 137,0 206,0 20,-0 42,1 62,-1 37,-10 46,-73 9,-90 -19,-8 -41,-3 -62,-4 -31,0 -62,0 -93,0 78,-78 156,-156 234,-234 -23,-23 -46,-46 -69,-69 z" />
<path fill="#0067b1" d="m 658,591 c 77,77 155,155 233,233 0,-48 -0,-97 0,-146 1,-29 34,-48 62,-40 23,4 37,29 34,52 -0,89 0,178 -0,267 3,24 -21,36 -42,34 -68,1 -137,0 -206,0 -20,-0 -42,1 -62,-1 -37,-10 -46,-73 -9,-90 19,-8 41,-3 62,-4 31,0 62,0 93,0 -78,-78 -156,-156 -234,-234 23,-23 46,-46 69,-69 z" />
<path fill="#0067b1" d="M 341,409 C 264,331 186,253 109,176 c -0,48 0,97 -0,146 -1,29 -34,48 -62,40 -23,-4 -37,-29 -34,-52 0,-89 -0,-178 0,-267 -3,-24 21,-36 42,-34 68,-1 137,-0 206,-0 20,0 42,-1 62,1 37,10 46,73 9,90 -19,8 -41,3 -62,4 -31,0 -62,0 -93,0 78,78 155,156 233,234 -23,23 -46,46 -69,69 z" />
<path fill="#0067b1" d="m 658,409 c 77,-77 155,-155 233,-233 0,48 -0,97 0,146 1,29 34,48 62,40 23,-4 37,-29 34,-52 -0,-89 0,-178 -0,-267 3,-24 -21,-36 -42,-34 -68,-1 -137,-0 -206,-0 -20,0 -42,-1 -62,1 -37,10 -46,73 -9,90 19,8 41,3 62,4 31,0 62,0 93,0 -78,78 -156,156 -234,234 23,23 46,46 69,69 z" />
</svg></button>
<!--button id="hideSelectedObject" title="hide selected object [del]" class="toolButton" style="display:block;float:right;"><svg viewBox="0 0 850 850">
<path fill="#0067b1" d="m 798,123 c 16,-16 16,-44 0,-61 -16,-16 -44,-16 -61,0 L 62,737 c -16,16 -16,44 0,61 16,16 44,16 61,0 z"/>
<path fill="#0067b1" d="m 62,123 c -16,-16 -16,-44 0,-61 16,-16 44,-16 61,0 L 798,737 c 16,16 16,44 0,61 -16,16 -44,16 -61,0 z"/>
</svg></button-->
<div id="info">
<div id="fileName" style="float:left;padding:13px 16px 0px 16px">
<div style="float:left;padding:0px;font-size: 12pt; opacity: 0.5;color:#2c5679;">Creoox webassembly IFC viewer (beta)</div>
<div id="statushint" style="float:left;padding:6px;">Loading model</div>
<div style="float:right;padding:0px;font-size: 12pt; opacity: 0.5;color:#2c5679;"></div>
</div>
</div>
</div>
<div id="statusbar" style="position: fixed; bottom:0px; height:22px; width:100%; background-color: #b2ccde; opacity: 0.5; z-index: 5 !important; display: flex; align-items: center; justify-content: space-between;">
<div id="progressContainer">
<progress id="progressBar" value="0" max="100"></progress>
<span id="progressPercentage">0%</span>
<span id="progressText"></span>
</div>
<div id="clearBeforeLoadingDiv"><input type="checkbox" id="clearBeforeLoading" checked><label for="clearBeforeLoading">clear before loading</label></div>
<div id="statusbar1" style="padding:1px; min-width: 100px;"><a href="data_privacy.html">Data privacy</a></div>
<div id="statusbar2" style="padding:1px; padding-left:5px;">Click on object to select</div>
<div id="debug" style="padding:1px; padding-left:5px;width:10%;"></div>
</div>
</div>
<script async type="text/javascript" src="ifcdb.js" onload="onWasmLoaded()"></script>
<script>
const m_dom_container = document.getElementById( 'containerWebGL' );
const m_dom_container_small = document.getElementById( 'containerWebGLsmall' );
let m_mainViewer;
let m_smallViewer;
let m_groupCoordinateAxes;
let m_stats;
var m_snapMaterial, m_snappedGUID;
var m_selectMaterial;
var m_selectedObjectsGUID = [];
var m_hasTreeview=true;
var m_maxNumTreeviewItems = 60000;
var m_numModelItems = 0;
var m_numTreeviewItems = 0;
var m_guidInTreeviewLabel = false; // TODO: make that an options
var m_keydown = -1;
var m_mouse_over_treeview = false;
var m_loading = false;
var m_viewerStopped = false;
var m_waitingForGltfChunks = false;
var defaultGltfModel = '';
var metaObjectMap = [];
var metaObjectsRoot;
var propertySetMap=[];
var splitterWidth=6;
var initAllDone = false;
var debug = true;
var expandItemGUID = '';
var expandLevelTop = 0;
var ulInTreeViewCount = 0;
var m_escaped_guid2guid={};
var m_splitterMain={
// mousePosition: {x:0, y:0},
offset : [0,0],
right : -1, // if > 0: value is set manually
div: null,
isDown : false
};
var splitterTreeview={
//mousePosition: {x:0, y:0},
offset : [0,0],
div: null,
isDown : false
};
const m_intersection = {
guid:"",
intersects: false,
point: new THREE.Vector3(),
normal: new THREE.Vector3()
};
const m_vec_intersections = [];
//window.addEventListener( 'load', initAll );
IfcQueryViewer = function ( targetDOMele ) {
var scope = this;
this.renderer = null;
this.scene = null;
this.camera = null;
this.lights = [];
this.headLight = null;
this.rootNode = null;
this.modelNode = null;
this.tempNode = null;
this.domElement = targetDOMele;
this.raycaster = null;
this.initViewer = function (targetDOMele) {
scope.renderer = new THREE.WebGLRenderer({ antialias: true });
scope.renderer.setPixelRatio(window.devicePixelRatio);
scope.renderer.setSize(targetDOMele.innerWidth, targetDOMele.innerHeight);
scope.renderer.setClearColor(0xfcfcfd, 0.88);
targetDOMele.appendChild(scope.renderer.domElement);
scope.renderer.domElement.id = targetDOMele.id;
scope.raycaster = new THREE.Raycaster();
scope.createLights();
scope.rootNode = new THREE.Group();
scope.scene.add(scope.rootNode);
scope.modelNode = new THREE.Group();
scope.scene.add(scope.modelNode);
}
this.createLights = function () {
scope.scene = new THREE.Scene();
scope.camera = new THREE.PerspectiveCamera( 60, targetDOMele.innerWidth / targetDOMele.innerHeight, 0.2, 1000 );
scope.camera.position.set( 120, 120, 80 );
scope.camera.up.set(0,0,1);
scope.controls = new THREE.OrbitControls( scope.camera, scope.renderer.domElement, scope.scene );
scope.controls.minDistance = 0.5;
scope.controls.maxDistance = 200;
scope.controls.enabled = true;
// set some lights
var baseDirectionlLightIntensity = 1.0;
scope.headLight = new THREE.DirectionalLight(0xcccccc, 2.5);
var light0 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+1.5);
var light1 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+1.5);
var light2 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+1.5);
var light3 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+1.5);
var light4 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+0.5);
var light5 = new THREE.DirectionalLight(0xcccccc, baseDirectionlLightIntensity+2.5);
light0.position.set(1, 0, 0);
light1.position.set(0, 1, 0);
light2.position.set(-1, 0, 0);
light3.position.set(0, -1, 0);
light4.position.set(0, 0, -1);
light5.position.set(0, 0, 1);
scope.scene.add(light0);
scope.scene.add(light1);
scope.scene.add(light2);
scope.scene.add(light3);
scope.scene.add(light4);
scope.scene.add(light5);
scope.lights.push(new THREE.PointLight(0xcccccc, 1.0)); // [0]
scope.lights.push(new THREE.PointLight(0xcccccc, 1.0)); // [1]
scope.lights.push(new THREE.PointLight(0xcccccc, 1.0)); // [2]
scope.lights.push(new THREE.PointLight(0xcccccc, 1.0)); // [3]
scope.lights.push(new THREE.PointLight(0xcccccc, 1.0)); // [4]
scope.scene.add(scope.lights[0]);
scope.scene.add(scope.lights[1]);
scope.scene.add(scope.lights[1]);
scope.scene.add(new THREE.AmbientLight(0xf8f8f8));
//scope.scene.add(scope.headLight);
}
this.addToModelNode = function( object3D ){
if( !scope.rootNode ){
scope.rootNode = new THREE.Group();
scope.scene.add(scope.rootNode);
}
scope.modelNode.add( object3D );
}
this.addToTempNode = function( object3D ){
if( !scope.tempNode ){
scope.tempNode = new THREE.Group();
scope.scene.add(scope.tempNode);
}
scope.tempNode.add( object3D );
}
this.updateLightPositions = function (bounds){
var dx = bounds.max.x-bounds.min.x;
var dy = bounds.max.y-bounds.min.y;
var dz = bounds.max.z - bounds.min.z;
const centerX = (bounds.max.x + bounds.min.x) * 0.5;
const centerY = (bounds.max.y + bounds.min.y) * 0.5;
const centerZ = (bounds.max.z + bounds.min.z) * 0.5;
dx = dx * 1.1;
dy = dy * 1.1;
dz = dz * 1.1;
// set the lights
const targetObject = new THREE.Object3D();
targetObject.position.set( centerX, centerY, centerZ );
scope.scene.add(targetObject);
scope.lights[0].target = targetObject;
scope.lights[1].target = targetObject;
scope.lights[2].target = targetObject;
scope.lights[3].target = targetObject;
scope.lights[4].target = targetObject;
scope.headLight.target = targetObject;
targetObject.updateMatrixWorld();
scope.lights[0].position.set(centerX + dx, centerY, centerZ + dz * 0.25);
scope.lights[1].position.set(centerX - dx, centerY, centerZ + dz * 0.25);
scope.lights[2].position.set(centerX, centerY + dy, centerZ + dz * 0.25);
scope.lights[3].position.set(centerX, centerY - dy, centerZ + dz * 0.25);
scope.lights[4].position.set(centerX, centerY, centerZ + dz );
};
function getMouseNormalized(x, y ){
var x1 = x - $(scope.domElement).offset().left;
var y1 = y - $(scope.domElement).offset().top;
const w = scope.domElement.clientWidth;
const h = scope.domElement.clientHeight;
return new THREE.Vector2((x1 / w ) * 2 - 1, - ( y1 / h ) * 2 + 1);
};
this.updateRaycaster = function (event) {
var x = event.clientX;
var y = event.clientY;
const mouse_normalized = getMouseNormalized(x, y);
scope.raycaster.setFromCamera(mouse_normalized, scope.camera);
};
this.toggleVisibility = function (object3D) {
if (object3D) {
if (object3D.type == "Mesh" || object3D.type == "Line") {
object3D.visible = !object3D.visible;
}
}
for (var ii = 0; ii < object3D.children.length; ++ii) {
scope.toggleVisibility(object3D.children[ii]);
}
};
this.setVisibilityToObject3D = function (object3D, visible) {
if (object3D) {
if (object3D.type == "Mesh" || object3D.type == "Line") {
object3D.visible = visible;
}
}
for (var ii = 0; ii < object3D.children.length; ++ii) {
scope.setVisibilityToObject3D(object3D.children[ii], visible);
}
};
this.toggleVisibilityByGUID = function (selectedGUID) {
if (!scope.modelNode) {
return;
}
var guid3D = unescapeGUID(selectedGUID);
var object3D = scope.modelNode.getObjectByName(guid3D, true);
if (object3D) {
scope.toggleVisibility(object3D);
}
};
this.setParentVisible = function (object3D) {
if (!object3D) {
return;
}
if (object3D.parent) {
object3D.parent.visible = true;
scope.setParentVisible(object3D.parent);
}
};
this.setVisibilityByGUID = function (selectedGUID, visible) {
if (!scope.modelNode) {
return;
}
var guid3D = unescapeGUID(selectedGUID);
var object3D = scope.modelNode.getObjectByName(guid3D, true);
if (object3D) {
object3D.visible = visible;
if (visible) {
if (object3D) {
scope.setParentVisible(object3D);
}
}
}
};
this.removeObjectByGUID = function(selectedGUID){
if( !scope.modelNode ){
return;
}
var guid3D = unescapeGUID(selectedGUID);
var object3D = scope.modelNode.getObjectByName( guid3D, true );
if(object3D){
scope.modelNode.remove(object3D);
}
$("#treeview").hummingbird("uncheckNode",{sel:"id", vals:[selectedGUID]});
};
this.clearModelNode = function(){
if( !scope.modelNode ){
return;
}
while(scope.modelNode.children.length ){
scope.modelNode.remove(scope.modelNode.children[0]);
}
};
this.clearTempNode = function(){
if( !scope.tempNode ){
return;
}
while(scope.tempNode.children.length ){
scope.tempNode.remove(scope.tempNode.children[0]);
}
};
this.show = function(){
if (scope.domElement.style.display === "none") {
scope.domElement.style.display = "block";
}
};
this.hide = function(){
scope.domElement.style.display = "none";
};
this.initViewer(targetDOMele);
};
function clear3DViewer (){
unsnapObject();
unselectAll();
m_mainViewer.clearModelNode();
m_smallViewer.clearModelNode();
m_selectedObjectsGUID = [];
m_hasTreeview = true;
m_numModelItems = 0;
m_numTreeviewItems = 0;
m_guidInTreeviewLabel = false;
m_keydown = -1;
m_mouse_over_treeview = false;
m_loading = false;
defaultGltfModel = '';
metaObjectMap = [];
metaObjectsRoot;
propertySetMap=[];
splitterWidth=6;
initAllDone = false;
expandItemGUID = '';
expandLevelTop = 0;
ulInTreeViewCount = 0;
m_escaped_guid2guid={};
}
function getObject3DbyGUID(guid){
var guid3D = unescapeGUID(guid);
var object3D = m_mainViewer.modelNode.getObjectByName( guid3D, true );
return object3D;
}
function setMeshSelected(object3D){
if( object3D.name ){
if( typeof object3D.name != "string" ){
console.log("object3D.name != string ");
}
}
if( object3D.type == "Mesh" || object3D.type == "Line"){
if( !object3D.materialRestore ){
object3D.materialRestore = object3D.material;
}
if (object3D.material) {
if (object3D.material) {
m_selectMaterial = object3D.material.clone();
object3D.material = m_selectMaterial;
if (typeof m_selectMaterial.emissive != "undefined") {
if (m_selectMaterial.emissive.r < 0.4) {
m_selectMaterial.emissive.r += 0.3;
}
}
if (m_selectMaterial.opacity > 0.4) {
m_selectMaterial.opacity -= 0.3;
}
if (m_selectMaterial.color) {
if (m_selectMaterial.color.g < 0.6) {
m_selectMaterial.color.g += 0.3;
}
else {
if (m_selectMaterial.color.b < 0.6) {
m_selectMaterial.color.b += 0.3;
}
else {
if (m_selectMaterial.color.r < 0.6) {
m_selectMaterial.color.r += 0.3;
}
else {
m_selectMaterial.color.r -= 0.5;
}
}
}
}
}
}
if( m_selectMaterial.opacity < 0.5 ) m_selectMaterial.opacity = 0.5;
}
if( object3D.children ){
for( var ii = 0; ii<object3D.children.length; ++ii ){
setMeshSelected(object3D.children[ii]);
}
}
}
function setMeshSnapped(object3D, depthTestOff){
if(object3D.material){
if( !object3D.materialRestore ){
object3D.materialRestore = object3D.material;
}
if (object3D.material) {
m_snapMaterial = object3D.material.clone();
object3D.material = m_snapMaterial;
if (m_snapMaterial.opacity > 0.4) {
m_snapMaterial.opacity -= 0.3;
}
if (m_snapMaterial.color) {
if (m_snapMaterial.color.g < 0.7) {
m_snapMaterial.color.g += 0.25;
}
else {
if (m_snapMaterial.color.b < 0.7) {
m_snapMaterial.color.b += 0.2;
}
else {
if (m_snapMaterial.color.r < 0.7) {
m_snapMaterial.color.r += 0.2;
}
else {
m_snapMaterial.color.r -= 0.4;
}
}
}
}
}
m_snapMaterial.opacity = 0.7;
m_snapMaterial.transparent = true;
m_snapMaterial.depthTest = !depthTestOff;
}
if( object3D.children ){
for( var ii = 0; ii<object3D.children.length; ++ii ){
setMeshSnapped(object3D.children[ii], depthTestOff);
}
}
}
function restoreMesh(object3D){
if(object3D.material){
if( object3D.materialRestore ){
object3D.material = object3D.materialRestore;
}
object3D.selected = false;
}
if( object3D.children ){
for( var ii = 0; ii<object3D.children.length; ++ii ){
restoreMesh(object3D.children[ii]);
}
}
}
function findMeshGUID(object3D) {
var guid = '';
if (object3D) {
if (object3D.hasOwnProperty('name')) {
if (object3D.name.length > 21) {
return object3D.name;
}
}
if (object3D.hasOwnProperty('id')) {
if (object3D.id.length > 21) {
return object3D.id;
}
}
if (object3D.hasOwnProperty('userData')) {
if (object3D.userData.hasOwnProperty('name')) {
if (object3D.userData.name.length > 21) {
return object3D.userData.name;
}
}
}
if (object3D.hasOwnProperty('parent')) {
guid = findMeshGUID(object3D.parent);
}
}
return guid;
}
function unselectAll(){
m_smallViewer.clearModelNode();
m_smallViewer.hide();
m_mainViewer.clearTempNode();
restoreMesh(m_mainViewer.modelNode);
unselectTreeviewItems();
unsnapObject();
}
function setObjectSnappedByGUID(guid, object3D, treeviewItem){
if( typeof guid != "string" ){
return;
}
guid = guid.substring(0, 22);
if( m_snappedGUID != guid ){
unsnapObject();
}
if( isSelected(guid) ){
return;
}
m_snappedGUID = guid;
if( !object3D){
object3D = getObject3DbyGUID( guid );
}
if( object3D ){
var depthTestOff = false;
if( treeviewItem){
depthTestOff = true;
}
setMeshSnapped(object3D, depthTestOff);
}
if( !treeviewItem){
treeviewItem = getTreeViewItemByGUID(guid,object3D);
}
if( treeviewItem){
var treeviewItemElements = getTreeviewItemElements(treeviewItem);
if(treeviewItemElements.labelElement){
treeviewItemElements.labelElement.css({ 'background-color' : '' });
}
if(treeviewItemElements.inputElement){
//treeviewItemElements.inputElement.addClass("treeviewItemSnapped"); // add class to input
}
if(treeviewItemElements.liElement){
treeviewItemElements.liElement.addClass("treeviewItemSnapped"); // add class to li
}
}
}
function pointerOnButton(domElement){
if( domElement.is("input") || domElement.is("svg")){
return true;
}
var nearest = domElement[0].nearestViewportElement;
if( nearest ){
nearest = $(nearest);
if( nearest.is("input") || nearest.is("svg")){
return true;
}
}
return false;
}
let modelString = '';
let metadata = {};
function initAll() {
if(initAllDone){
return;
}
// check if WebGL is available
if ( !THREE.WEBGL.isWebGLAvailable() ) {
const warning = THREE.WEBGL.getWebGLErrorMessage();
document.getElementById( 'fileName' ).appendChild( warning );
return;
}
m_mainViewer = new IfcQueryViewer(m_dom_container);
m_smallViewer = new IfcQueryViewer(m_dom_container_small);
m_smallViewer.renderer.setClearColor( 0xffffff, 0.98);
m_snapMaterial = new THREE.MeshStandardMaterial({ color: 0x229933, side: THREE.DoubleSide, roughness: 0.5, metalness: 0.5 });
m_selectMaterial = new THREE.MeshStandardMaterial({ color: 0x33bb44, side: THREE.DoubleSide, roughness: 0.5, metalness: 0.5 });
// coordinate axes:
m_groupCoordinateAxes = new THREE.Group();
m_mainViewer.scene.add(m_groupCoordinateAxes);
m_groupCoordinateAxes.add(new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(100, 0, 0)]), new THREE.LineBasicMaterial({ color: 0xcc0000 })));
m_groupCoordinateAxes.add( new THREE.Line( new THREE.BufferGeometry().setFromPoints( [new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 100, 0 )] ), new THREE.LineBasicMaterial({color: 0x00cc00}) ) );
m_groupCoordinateAxes.add( new THREE.Line( new THREE.BufferGeometry().setFromPoints( [new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, 100 )] ), new THREE.LineBasicMaterial({color: 0x0000cc}) ) );
//$('#statusbar1').html('Rotate: left mouse button. Zoom: scroll wheel. Pan: right mouse button');
$('#statusbar2').html("Click on object to select");
$('#statushint').html('Loading model');
$('#zoomToBounds').bind('click', function() {
const box = new THREE.Box3();
box.setFromObject( m_mainViewer.modelNode );
m_mainViewer.controls.zoomToBounds(box, m_hasTreeview);
m_mainViewer.updateLightPositions(box);
});
document.body.style.overflow = 'hidden'; // disable scrollbar for 3D viewer
let m_moved = false;
let m_pointer_down = false;
m_mainViewer.controls.addEventListener( 'change', function () { m_moved = true; } );
window.addEventListener( 'pointerdown', function (event) {
if( m_loading ){
return;
}
var pointerOnTreeview = false;
//var guid = "";
var clickedElement = $(event.target);
if( clickedElement.attr('id') == "treeview" || clickedElement.attr('id') == "treeviewPanel"){
pointerOnTreeview = true;
}
if( clickedElement.is("li") || clickedElement.is("i") || clickedElement.is("label") ||
clickedElement.is("input") || clickedElement.is("svg") ){
pointerOnTreeview = true;
//guid = clickedElement.attr("id");
}
// if( ignoreMouseOnElement( clickedElement )){
// pointerOnTreeview = true;
// guid = clickedElement.attr("id");
// }
m_pointer_down = true;
m_mainViewer.updateRaycaster(event);
if( pointerOnTreeview){
// handle treeview stuff on pointerup
return;
}
if( m_intersection.intersects )
{
var point = m_intersection.point;
m_mainViewer.controls.setRotateCenter( point );
//$('#statusbar1').html("intersection: " + point.x.toFixed(2) + ", " + point.y.toFixed(2) + ", " + point.z.toFixed(2) + " " );
}
m_moved = false;
} );
window.addEventListener( 'pointerup', function ( event ) {
if( m_loading ){
return;
}
// handle 3D view clicks on pointerdown
m_pointer_down = false;
m_splitterMain.isDown=false;
splitterTreeview.isDown=false;
var pointerOnTreeview = false;
var guid = "";
var clickedElement = $(event.target);
var clickedElementId = clickedElement.attr('id');
if (checkIfElementOrParentHasId(clickedElement, "treeview2")) {
return;
}
if (clickedElementId == "treeviewAttributesScrollArea") {
return;
}
if( clickedElementId == "containerWebGL"){
// handle click on 3D view on pointerdown
if( m_snappedGUID ){
if( isSelected(m_snappedGUID)){
unselectObject(m_snappedGUID);
return;
}
setObjectSelectedByGUID(m_snappedGUID, "3DView");
}
else{
unselectAll();
}
return;
}
if( clickedElementId == "treeview" || clickedElementId == "treeviewPanel"){
pointerOnTreeview = true;
}
var treeviewItemElements=getTreeviewItemElements(clickedElement);
if(treeviewItemElements.inputElement){
guid = treeviewItemElements.inputElement.attr("id");
pointerOnTreeview = true;
}
if(treeviewItemElements.liElement){
pointerOnTreeview = true;
}
if(treeviewItemElements.labelElement){
pointerOnTreeview = true;
//clickedLabel=treeviewItemElements.inputElement;
}
var guid_unescaped = unescapeGUID(guid);
m_mainViewer.updateRaycaster(event);
fixTreeviewEndNodeMargin();
if( pointerOnTreeview){
if( clickedElement.is("i") ){
// + or - indicator clicked, will be handled elsewhere
return;
}
//treeviewItemElements.inputElement
var checkBoxIsClicked=false;
if( clickedElement.is("input") ){
checkBoxIsClicked = true;
}
if(guid==undefined || guid=="" ){
// object properties treeview clicked
return;
}
if( checkBoxIsClicked ){
var clickedCheckbox=treeviewItemElements.inputElement;
var currentlyChecked = clickedCheckbox.is(':checked'); // check/uncheck has not been completed yet
var checkStateNew=!currentlyChecked;
//clickedCheckbox.prop('checked', currentlyChecked);
//clickedCheckbox.get(0).checked=currentlyChecked;
m_mainViewer.toggleVisibilityByGUID(guid_unescaped);
event.stopPropagation();
return;
}
else{
setObjectSelectedByGUID(guid,"treeview");
}
return;
}
if( m_intersection.intersects )
{
var point = m_intersection.point;
m_mainViewer.controls.setRotateCenter( point );
//$('#statusbar1').html("intersection: " + point.x.toFixed(2) + ", " + point.y.toFixed(2) + ", " + point.z.toFixed(2) + " " );
}
} );
function isJQueryObject(obj) {
return obj && (obj instanceof jQuery || obj.jquery !== undefined || (typeof obj.on === 'function' && typeof obj.off === 'function' && typeof obj.find === 'function'));
}
function checkIfElementOrParentHasId(element, id) {
if (typeof element == "undefined") {
return false;
}
if ( element == null) {
return false;
}
if( !isJQueryObject(element)){
element = $(element);
}
var elementID = "";
if (typeof element.id !== "undefined") {
elementID = element.id;
}
else {
if (typeof element.attr !== "undefined") {
elementID = element.attr('id');
}
}
if (elementID == id) {
return true;
}
if (typeof element.is !== "undefined") {
if (element.is('body')) {
return false;
}
}
else if (typeof element.tagName !== "undefined") {
if (element.tagName == 'body') {
return false;
}
}
var parent = element.parent();
if (typeof parent == "undefined") {
parent = element.parentElement;
}
return checkIfElementOrParentHasId(parent, id);
}
window.addEventListener( 'pointermove', function onPointerMove( event ) {
if( m_loading ){
return;
}
//var mousePosition = { x : event.clientX, y : event.clientY };
if (m_splitterMain.isDown){
var splitterX=event.clientX + m_splitterMain.offset[0];
m_splitterMain.div.css({top: 0, left: splitterX});
var w=$(window).width();
m_splitterMain.right=w-splitterX;
adjustLayout();
}
if (splitterTreeview.isDown){
var splitterY=event.clientY + splitterTreeview.offset[1];
splitterTreeview.div.css({top: splitterY});
adjustLayout();
}
var pointerOnTreeview = false;
var eventElement = $(event.target);
var elementId=eventElement.attr('id');
if(elementId=="win2"||elementId=="win3"||elementId=="win4"||elementId=="win5"||elementId=="treeview2"){
return;
}
if( elementId == "treeview" || elementId == "treeviewPanel"){
pointerOnTreeview = true;
}
if( eventElement.is("li") || eventElement.is("i") || eventElement.is("input")|| eventElement.is("label") ){
var treeviewParentElement=eventElement.closest('div');
if(treeviewParentElement){
var divId=treeviewParentElement.attr('id');
if(divId=="treeview_container2"){
// element attributes
return;
}
}
pointerOnTreeview = true;
}
if( pointerOnTreeview ){
var type=eventElement.get(0).tagName;
//console.log("pointermove element:"+type)
var pointerOnAttributesTreeview = checkIfElementOrParentHasId(eventElement.get(0), "treeviewAttributesScrollArea");
if (pointerOnAttributesTreeview) {
return;
}
var treeviewItemElements = getTreeviewItemElements(eventElement);
if(treeviewItemElements.inputElement){
guid = treeviewItemElements.inputElement.attr('id');
}
if( guid ){
if( eventElement.length > 0 ){
setObjectSnappedByGUID(guid, null, eventElement);
}
}
else{
// nothing intersected, unsnap
if( m_snappedGUID ){
if( !isSelected(m_snappedGUID) ){
unsnapObject();
}
}
}
return true;
}
if ( !event.isPrimary ) {
return;
}
if( m_pointer_down ){
return;
}
if( m_mouse_over_treeview ){
return;
}
var x = event.clientX;
var y = event.clientY;
if(m_splitterMain.div){
var boundingRect = m_splitterMain.div.get(0).getBoundingClientRect();
const viewerWidth = boundingRect.left ; // width of the progressBar = width of the viewer
if( x >= viewerWidth ){
return;
}
}
m_vec_intersections.length = 0;
m_mainViewer.updateRaycaster(event);
m_mainViewer.raycaster.intersectObject( m_mainViewer.modelNode, true, m_vec_intersections );
m_intersection.intersects = false;
for( var ii = 0; ii < m_vec_intersections.length; ++ii ) {
const intersect = m_vec_intersections[ii];
if( !intersect.object ){continue;}
if( intersect.object.type == 'Line' ){
continue;
}
if( intersect.object.visible == false ){
continue;
}
const p = intersect.point;
m_intersection.point.copy( p );
if (intersect.object) {
var guid = findMeshGUID(intersect.object);
/*if (intersect.object.name) {
guid = intersect.object.name;
}
else if (intersect.object.id) {
guid = intersect.object.id;
}
else if (intersect.object.userData) {
if (intersect.object.userData) {
}*/
if( guid != ''){