csyjk 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. package/.babelrc +7 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/xx.iml +12 -0
  4. package/dist/app.js +43 -0
  5. package/{index.html → dist/index.html} +0 -0
  6. package/{style.css → dist/style.css} +1 -1
  7. package/package.json +40 -5
  8. package/public/gltf.js +2241 -0
  9. package/public/index.html +10 -0
  10. package/src/index.js +3 -0
  11. package/src/lib/gltf/assets/check.jpg +0 -0
  12. package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
  13. package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
  14. package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
  15. package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
  16. package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
  17. package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
  18. package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
  19. package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
  20. package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
  21. package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
  22. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
  23. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
  24. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
  25. package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
  26. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
  27. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
  28. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
  29. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  30. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
  31. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
  32. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
  33. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  34. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
  35. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
  36. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  37. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
  38. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
  39. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
  40. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  41. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
  42. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
  43. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
  44. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
  45. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
  46. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
  47. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  48. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
  49. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
  50. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
  51. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  52. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  53. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
  54. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  55. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
  56. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  57. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
  58. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  59. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  60. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  61. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
  62. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
  63. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  64. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
  65. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  66. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  67. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  68. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
  69. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
  70. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
  71. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
  72. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
  73. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
  74. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
  75. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  76. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
  77. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
  78. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
  79. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
  80. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
  81. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
  82. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
  83. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
  84. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
  85. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  86. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
  87. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
  88. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
  89. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  90. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  91. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  92. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  93. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  94. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  95. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  96. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  97. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  98. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  99. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  100. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  101. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  102. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
  103. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
  104. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
  105. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
  106. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
  107. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
  108. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
  109. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
  110. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  111. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
  112. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
  113. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
  114. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
  115. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
  116. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
  117. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  118. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  119. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
  120. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
  121. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
  122. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  123. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
  124. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  125. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
  126. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
  127. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
  128. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
  129. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
  130. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
  131. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
  132. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  133. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
  134. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
  135. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
  136. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
  137. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
  138. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
  139. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
  140. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
  141. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
  142. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
  143. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
  144. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
  145. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
  146. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
  147. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
  148. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
  149. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
  150. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
  151. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
  152. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
  153. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
  154. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
  155. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
  156. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
  157. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
  158. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
  159. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
  160. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
  161. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
  162. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
  163. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
  164. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
  165. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
  166. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
  167. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
  168. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
  169. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
  170. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
  171. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
  172. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
  173. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
  174. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
  175. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
  176. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
  177. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
  178. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
  179. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
  180. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
  181. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
  182. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
  183. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
  184. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
  185. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
  186. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
  187. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
  188. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
  189. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
  190. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
  191. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
  192. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
  193. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
  194. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
  195. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
  196. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
  197. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
  198. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
  199. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  200. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
  201. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  202. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
  203. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
  204. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
  205. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
  206. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
  207. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
  208. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
  209. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
  210. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
  211. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
  212. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
  213. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  214. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  215. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  216. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  217. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  218. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  219. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  220. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  221. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
  222. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
  223. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
  224. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  225. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  226. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
  227. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
  228. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
  229. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
  230. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
  231. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
  232. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
  233. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
  234. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
  235. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
  236. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
  237. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
  238. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
  239. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
  240. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
  241. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  242. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
  243. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
  244. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
  245. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
  246. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
  247. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  248. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
  249. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
  250. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  251. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
  252. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
  253. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
  254. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  255. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
  256. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
  257. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
  258. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
  259. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
  260. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
  261. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  262. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
  263. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
  264. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
  265. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
  266. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  267. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
  268. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  269. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
  270. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
  271. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  272. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  273. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  274. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
  275. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  276. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
  277. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  278. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
  279. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
  280. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
  281. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
  282. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  283. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
  284. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
  285. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  286. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
  287. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
  288. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
  289. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
  290. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  291. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
  292. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
  293. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
  294. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
  295. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
  296. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
  297. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
  298. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
  299. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
  300. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  301. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
  302. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
  303. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
  304. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
  305. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
  306. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
  307. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
  308. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
  309. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
  310. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
  311. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
  312. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
  313. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
  314. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  315. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
  316. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
  317. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
  318. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
  319. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
  320. package/src/lib/gltf/gltf.css +392 -0
  321. package/src/lib/gltf/gltf.js +2241 -0
  322. package/webpack.config.js +70 -0
  323. package/app.js +0 -43
@@ -0,0 +1,822 @@
1
+ import {Plugin} from "../../viewer/Plugin.js";
2
+ import {Storey} from "./Storey.js";
3
+ import {IFCStoreyPlanObjectStates} from "./IFCStoreyPlanObjectStates.js";
4
+ import {math} from "../../viewer/scene/math/math.js";
5
+ import {ObjectsMemento} from "../../viewer/scene/mementos/ObjectsMemento.js";
6
+ import {CameraMemento} from "../../viewer/scene/mementos/CameraMemento.js";
7
+ import {StoreyMap} from "./StoreyMap.js";
8
+ import {utils} from "../../viewer/scene/utils.js";
9
+
10
+ const tempVec3a = math.vec3();
11
+ const tempMat4 = math.mat4();
12
+
13
+ const EMPTY_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
14
+
15
+
16
+ /**
17
+ * @desc A {@link Viewer} plugin that provides methods for visualizing IfcBuildingStoreys.
18
+ *
19
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_recipe2"><img src="http://yjkkit.io/img/docs/StoreyViewsPlugin/minimap.gif"></a>
20
+ *
21
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_recipe2)]
22
+ *
23
+ * ## Overview
24
+ *
25
+ * StoreyViewsPlugin provides a flexible set of methods for visualizing building storeys in 3D and 2D.
26
+ *
27
+ * Use the first two methods to set up 3D views of storeys:
28
+ *
29
+ * * [showStoreyObjects](#instance-method-showStoreyObjects) - shows the {@link Entity}s within a storey, and
30
+ * * [gotoStoreyCamera](#instance-method-gotoStoreyCamera) - positions the {@link Camera} for a plan view of the Entitys within a storey.
31
+ * <br> <br>
32
+ *
33
+ * Use the second two methods to create 2D plan view mini-map images:
34
+ *
35
+ * * [createStoreyMap](#instance-method-createStoreyMap) - creates a 2D plan view image of a storey, and
36
+ * * [pickStoreyMap](#instance-method-pickStoreyMap) - picks the {@link Entity} at the given 2D pixel coordinates within a plan view image.
37
+ *
38
+ * ## Usage
39
+ *
40
+ * Let's start by creating a {@link Viewer} with a StoreyViewsPlugin and an {@link XKTLoaderPlugin}.
41
+ *
42
+ * Then we'll load a BIM building model from an ```.xkt``` file.
43
+ *
44
+ * ````javascript
45
+ * import {Viewer, XKTLoaderPlugin, StoreyViewsPlugin} from "yjkkit-sdk.es.js";
46
+ *
47
+ * // Create a Viewer, arrange the camera
48
+ *
49
+ * const viewer = new Viewer({
50
+ * canvasId: "myCanvas",
51
+ * transparent: true
52
+ * });
53
+ *
54
+ * viewer.camera.eye = [-2.56, 8.38, 8.27];
55
+ * viewer.camera.look = [13.44, 3.31, -14.83];
56
+ * viewer.camera.up = [0.10, 0.98, -0.14];
57
+ *
58
+ * // Add an XKTLoaderPlugin
59
+ *
60
+ * const xktLoader = new XKTLoaderPlugin(viewer);
61
+ *
62
+ * // Add a StoreyViewsPlugin
63
+ *
64
+ * const storeyViewsPlugin = new StoreyViewsPlugin(viewer);
65
+ *
66
+ * // Load a BIM model from .xkt format
67
+ *
68
+ * const model = xktLoader.load({
69
+ * id: "myModel",
70
+ * src: "./models/xkt/Schependomlaan.xkt",
71
+ * edges: true
72
+ * });
73
+ * ````
74
+ *
75
+ * ## Finding Storeys
76
+ *
77
+ * Getting information on a storey in our model:
78
+ *
79
+ * ````javascript
80
+ * const storey = storeyViewsPlugin.storeys["2SWZMQPyD9pfT9q87pgXa1"]; // ID of the IfcBuildingStorey
81
+ *
82
+ * const modelId = storey.modelId; // "myModel"
83
+ * const storeyId = storey.storeyId; // "2SWZMQPyD9pfT9q87pgXa1"
84
+ * const aabb = storey.aabb; // Axis-aligned 3D World-space boundary of the IfcBuildingStorey
85
+ * ````
86
+ *
87
+ * We can also get a "storeys" event every time the set of storeys changes, ie. every time a storey is created or destroyed:
88
+ *
89
+ * ````javascript
90
+ * storeyViewsPlugin.on("storeys", ()=> {
91
+ * const storey = storeyViewsPlugin.storeys["2SWZMQPyD9pfT9q87pgXa1"];
92
+ * //...
93
+ * });
94
+ * ````
95
+ *
96
+ * ## Showing Entitys within Storeys
97
+ *
98
+ * Showing the {@link Entity}s within a storey:
99
+ *
100
+ * ````javascript
101
+ * storeyViewsPlugin.showStoreyObjects("2SWZMQPyD9pfT9q87pgXa1");
102
+ * ````
103
+ *
104
+ * Showing **only** the Entitys in a storey, hiding all others:
105
+ *
106
+ * ````javascript
107
+ * storeyViewsPlugin.showStoreyObjects("2SWZMQPyD9pfT9q87pgXa1", {
108
+ * hideOthers: true
109
+ * });
110
+ * ````
111
+ * Showing only the storey Entitys, applying custom appearances configured on {@link StoreyViewsPlugin#objectStates}:
112
+ *
113
+ * ````javascript
114
+ * storeyViewsPlugin.showStoreyObjects("2SWZMQPyD9pfT9q87pgXa1", {
115
+ * hideOthers: true,
116
+ * useObjectStates: true
117
+ * });
118
+ * ````
119
+ *
120
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_showStoreyObjects"><img src="http://yjkkit.io/img/docs/StoreyViewsPlugin/showStoreyObjects.gif"></a>
121
+ *
122
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_showStoreyObjects)]
123
+ *
124
+ * When using this option, at some point later you'll probably want to restore all Entitys to their original visibilities and
125
+ * appearances.
126
+ *
127
+ * To do that, save their visibility and appearance states in an {@link ObjectsMemento} beforehand, from
128
+ * which you can restore them later:
129
+ *
130
+ * ````javascript
131
+ * const objectsMemento = new ObjectsMemento();
132
+ *
133
+ * // Save all Entity visibility and appearance states
134
+ *
135
+ * objectsMemento.saveObjects(viewer.scene);
136
+ *
137
+ * // Show storey view Entitys, with custom appearances as configured for IFC types
138
+ *
139
+ * storeyViewsPlugin.showStoreyObjects("2SWZMQPyD9pfT9q87pgXa1", {
140
+ * useObjectStates: true // <<--------- Apply custom appearances
141
+ * });
142
+ *
143
+ * //...
144
+ *
145
+ * // Later, restore all Entitys to their saved visibility and appearance states
146
+ * objectsMemento.restoreObjects(viewer.scene);
147
+ * ````
148
+ *
149
+ * ## Arranging the Camera for Storey Plan Views
150
+ *
151
+ * The {@link StoreyViewsPlugin#gotoStoreyCamera} method positions the {@link Camera} for a plan view of
152
+ * the {@link Entity}s within the given storey.
153
+ *
154
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_gotoStoreyCamera"><img src="http://yjkkit.io/img/docs/StoreyViewsPlugin/gotoStoreyCamera.gif"></a>
155
+ *
156
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_gotoStoreyCamera)]
157
+ *
158
+ * Let's fly the {@link Camera} to a downward-looking orthographic view of the Entitys within our storey.
159
+ *
160
+ * ````javascript
161
+ * storeyViewsPlugin.gotoStoreyCamera("2SWZMQPyD9pfT9q87pgXa1", {
162
+ * projection: "ortho", // Orthographic projection
163
+ * duration: 2.5, // 2.5 second transition
164
+ * done: () => {
165
+ * viewer.cameraControl.planView = true; // Disable rotation
166
+ * }
167
+ * });
168
+ * ````
169
+ *
170
+ * Note that we also set {@link CameraControl#planView} ````true````, which prevents the CameraControl from rotating
171
+ * or orbiting. In orthographic mode, this effectively makes the {@link Viewer} behave as if it were a 2D viewer, with
172
+ * picking, panning and zooming still enabled.
173
+ *
174
+ * If you need to be able to restore the Camera to its previous state, you can save it to a {@link CameraMemento}
175
+ * beforehand, from which you can restore it later:
176
+ *
177
+ * ````javascript
178
+ * const cameraMemento = new CameraMemento();
179
+ *
180
+ * // Save camera state
181
+ *
182
+ * cameraMemento.saveCamera(viewer.scene);
183
+ *
184
+ * // Position camera for a downward-looking orthographic view of our storey
185
+ *
186
+ * storeyViewsPlugin.gotoStoreyCamera("2SWZMQPyD9pfT9q87pgXa1", {
187
+ * projection: "ortho",
188
+ * duration: 2.5,
189
+ * done: () => {
190
+ * viewer.cameraControl.planView = true; // Disable rotation
191
+ * }
192
+ * });
193
+ *
194
+ * //...
195
+ *
196
+ * // Later, restore the Camera to its saved state
197
+ * cameraMemento.restoreCamera(viewer.scene);
198
+ * ````
199
+ *
200
+ * ## Creating StoreyMaps
201
+ *
202
+ * The {@link StoreyViewsPlugin#createStoreyMap} method creates a 2D orthographic plan image of the given storey.
203
+ *
204
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_createStoreyMap"><img src="http://yjkkit.io/img/docs/StoreyViewsPlugin/createStoreyMap.png"></a>
205
+ *
206
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_createStoreyMap)]
207
+ *
208
+ * This method creates a {@link StoreyMap}, which provides the plan image as a Base64-encoded string.
209
+ *
210
+ * Let's create a 2D plan image of our building storey:
211
+ *
212
+ * ````javascript
213
+ * const storeyMap = storeyViewsPlugin.createStoreyMap("2SWZMQPyD9pfT9q87pgXa1", {
214
+ * width: 300,
215
+ * format: "png"
216
+ * });
217
+ *
218
+ * const imageData = storeyMap.imageData; // Base64-encoded image data string
219
+ * const width = storeyMap.width; // 300
220
+ * const height = storeyMap.height; // Automatically derived from width
221
+ * const format = storeyMap.format; // "png"
222
+ * ````
223
+ *
224
+ * As with ````showStoreyEntitys````, We also have the option to customize the appearance of the Entitys in our plan
225
+ * images according to their IFC types, using the lookup table configured on {@link StoreyViewsPlugin#objectStates}.
226
+ *
227
+ * For example, we usually want to show only element types like ````IfcWall````, ````IfcDoor```` and
228
+ * ````IfcFloor```` in our plan images.
229
+ *
230
+ * Let's create another StoreyMap, this time applying the custom appearances:
231
+ *
232
+ * ````javascript
233
+ * const storeyMap = storeyViewsPlugin.createStoreyMap("2SWZMQPyD9pfT9q87pgXa1", {
234
+ * width: 300,
235
+ * format: "png",
236
+ * useObjectStates: true // <<--------- Apply custom appearances
237
+ * });
238
+ *````
239
+ *
240
+ * We can also specify a ````height```` for the plan image, as an alternative to ````width````:
241
+ *
242
+ * ````javascript
243
+ * const storeyMap = storeyViewsPlugin.createStoreyMap("2SWZMQPyD9pfT9q87pgXa1", {
244
+ * height: 200,
245
+ * format: "png",
246
+ * useObjectStates: true
247
+ * });
248
+ * ````
249
+ *
250
+ * ## Picking Entities in StoreyMaps
251
+ *
252
+ * We can use {@link StoreyViewsPlugin#pickStoreyMap} to pick Entities in our building storey, using 2D coordinates from mouse or touch events on our {@link StoreyMap}'s 2D plan image.
253
+ *
254
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_recipe2"><img src="http://yjkkit.io/img/docs/StoreyViewsPlugin/recipe2.gif"></a>
255
+ *
256
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#storeyViews_StoreyViewsPlugin_recipe2)]
257
+ *
258
+ * Let's programmatically pick the Entity at the given 2D pixel coordinates within our image:
259
+ *
260
+ * ````javascript
261
+ * const mouseCoords = [65, 120]; // Mouse coords within the image extents
262
+ *
263
+ * const pickResult = storeyViewsPlugin.pickStoreyMap(storeyMap, mouseCoords);
264
+ *
265
+ * if (pickResult && pickResult.entity) {
266
+ * pickResult.entity.highlighted = true;
267
+ * }
268
+ * ````
269
+ */
270
+ class StoreyViewsPlugin extends Plugin {
271
+
272
+ /**
273
+ * @constructor
274
+ *
275
+ * @param {Viewer} viewer The Viewer.
276
+ * @param {Object} cfg Plugin configuration.
277
+ * @param {String} [cfg.id="StoreyViews"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
278
+ * @param {Object} [cfg.objectStates] Map of visual states for the {@link Entity}s as rendered within each {@link Storey}. Default value is {@link IFCStoreyPlanObjectStates}.
279
+ */
280
+ constructor(viewer, cfg = {}) {
281
+
282
+ super("StoreyViews", viewer);
283
+
284
+ this._objectsMemento = new ObjectsMemento();
285
+ this._cameraMemento = new CameraMemento();
286
+
287
+ /**
288
+ * A {@link Storey} for each ````IfcBuildingStorey```.
289
+ *
290
+ * There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals "IfcBuildingStorey".
291
+ *
292
+ * These are created and destroyed automatically as models are loaded and destroyed.
293
+ *
294
+ * @type {{String:Storey}}
295
+ */
296
+ this.storeys = {};
297
+
298
+ /**
299
+ * A set of {@link Storey}s for each {@link MetaModel}.
300
+ *
301
+ * These are created and destroyed automatically as models are loaded and destroyed.
302
+ *
303
+ * @type {{String: {String:Storey}}}
304
+ */
305
+ this.modelStoreys = {};
306
+
307
+ this.objectStates = cfg.objectStates;
308
+
309
+ this._onModelLoaded = this.viewer.scene.on("modelLoaded", (modelId) => {
310
+ this._registerModelStoreys(modelId);
311
+ this.fire("storeys", this.storeys);
312
+ });
313
+ }
314
+
315
+ _registerModelStoreys(modelId) {
316
+ const viewer = this.viewer;
317
+ const scene = viewer.scene;
318
+ const metaScene = viewer.metaScene;
319
+ const metaModel = metaScene.metaModels[modelId];
320
+ const model = scene.models[modelId];
321
+ if (!metaModel || !metaModel.rootMetaObject) {
322
+ return;
323
+ }
324
+ const storeyIds = metaModel.rootMetaObject.getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);
325
+ for (let i = 0, len = storeyIds.length; i < len; i++) {
326
+ const storeyId = storeyIds[i];
327
+ const metaObject = metaScene.metaObjects[storeyId];
328
+ const childObjectIds = metaObject.getObjectIDsInSubtree();
329
+ const aabb = scene.getAABB(childObjectIds);
330
+ const numObjects = (Math.random() > 0.5) ? childObjectIds.length : 0;
331
+ const storey = new Storey(this, aabb, modelId, storeyId, numObjects);
332
+ storey._onModelDestroyed = model.once("destroyed", () => {
333
+ this._deregisterModelStoreys(modelId);
334
+ this.fire("storeys", this.storeys);
335
+ });
336
+ this.storeys[storeyId] = storey;
337
+ if (!this.modelStoreys[modelId]) {
338
+ this.modelStoreys[modelId] = {};
339
+ }
340
+ this.modelStoreys[modelId][storeyId] = storey;
341
+ }
342
+ }
343
+
344
+ _deregisterModelStoreys(modelId) {
345
+ const storeys = this.modelStoreys[modelId];
346
+ if (storeys) {
347
+ const scene = this.viewer.scene;
348
+ for (let storyObjectId in storeys) {
349
+ if (storeys.hasOwnProperty(storyObjectId)) {
350
+ const storey = storeys[storyObjectId];
351
+ const model = scene.models[storey.modelId];
352
+ if (model) {
353
+ model.off(storey._onModelDestroyed);
354
+ }
355
+ delete this.storeys[storyObjectId];
356
+ }
357
+ }
358
+ delete this.modelStoreys[modelId];
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Sets map of visual states for the {@link Entity}s as rendered within each {@link Storey}.
364
+ *
365
+ * Default value is {@link IFCStoreyPlanObjectStates}.
366
+ *
367
+ * @type {{String: Object}}
368
+ */
369
+ set objectStates(value) {
370
+ this._objectStates = value || IFCStoreyPlanObjectStates;
371
+ }
372
+
373
+ /**
374
+ * Gets map of visual states for the {@link Entity}s as rendered within each {@link Storey}.
375
+ *
376
+ * Default value is {@link IFCStoreyPlanObjectStates}.
377
+ *
378
+ * @type {{String: Object}}
379
+ */
380
+ get objectStates() {
381
+ return this._objectStates;
382
+ }
383
+
384
+ /**
385
+ * Arranges the {@link Camera} for a 3D orthographic view of the {@link Entity}s within the given storey.
386
+ *
387
+ * See also: {@link CameraMemento}, which saves and restores the state of the {@link Scene}'s {@link Camera}
388
+ *
389
+ * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
390
+ * @param {*} [options] Options for arranging the Camera.
391
+ * @param {String} [options.projection] Projection type to transition the Camera to. Accepted values are "perspective" and "ortho".
392
+ * @param {Function} [options.done] Callback to fire when the Camera has arrived. When provided, causes an animated flight to the saved state. Otherwise jumps to the saved state.
393
+ */
394
+ gotoStoreyCamera(storeyId, options = {}) {
395
+
396
+ const storey = this.storeys[storeyId];
397
+
398
+ if (!storey) {
399
+ this.error("IfcBuildingStorey not found with this ID: " + storeyId);
400
+ if (options.done) {
401
+ options.done();
402
+ }
403
+ return;
404
+ }
405
+
406
+ const viewer = this.viewer;
407
+ const scene = viewer.scene;
408
+ const camera = scene.camera;
409
+ const aabb = storey.aabb;
410
+
411
+ if (aabb[3] < aabb[0] || aabb[4] < aabb[1] || aabb[5] < aabb[2]) { // Don't fly to an inverted boundary
412
+ if (options.done) {
413
+ options.done();
414
+ }
415
+ return;
416
+ }
417
+ if (aabb[3] === aabb[0] && aabb[4] === aabb[1] && aabb[5] === aabb[2]) { // Don't fly to an empty boundary
418
+ if (options.done) {
419
+ options.done();
420
+ }
421
+ return;
422
+ }
423
+ const look2 = math.getAABB3Center(aabb);
424
+ const diag = math.getAABB3Diag(aabb);
425
+ const fitFOV = 45; // fitFOV;
426
+ const sca = Math.abs(diag / Math.tan(fitFOV * math.DEGTORAD));
427
+
428
+ const orthoScale2 = diag * 1.3;
429
+
430
+ const eye2 = tempVec3a;
431
+
432
+ eye2[0] = look2[0] + (camera.worldUp[0] * sca);
433
+ eye2[1] = look2[1] + (camera.worldUp[1] * sca);
434
+ eye2[2] = look2[2] + (camera.worldUp[2] * sca);
435
+
436
+ const up2 = camera.worldForward;
437
+
438
+ if (options.done) {
439
+
440
+ viewer.cameraFlight.flyTo(utils.apply(options, {
441
+ eye: eye2,
442
+ look: look2,
443
+ up: up2,
444
+ orthoScale: orthoScale2
445
+ }), () => {
446
+ options.done();
447
+ });
448
+
449
+ } else {
450
+
451
+ viewer.cameraFlight.jumpTo(utils.apply(options, {
452
+ eye: eye2,
453
+ look: look2,
454
+ up: up2,
455
+ orthoScale: orthoScale2
456
+ }));
457
+
458
+ viewer.camera.ortho.scale = orthoScale2;
459
+ }
460
+ }
461
+
462
+ /**
463
+ * Shows the {@link Entity}s within the given storey.
464
+ *
465
+ * Optionally hides all other Entitys.
466
+ *
467
+ * Optionally sets the visual appearance of each of the Entitys according to its IFC type. The appearance of
468
+ * IFC types in plan views is configured by {@link StoreyViewsPlugin#objectStates}.
469
+ *
470
+ * See also: {@link ObjectsMemento}, which saves and restores a memento of the visual state
471
+ * of the {@link Entity}'s that represent objects within a {@link Scene}.
472
+ *
473
+ * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
474
+ * @param {*} [options] Options for showing the Entitys within the storey.
475
+ * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
476
+ * @param {Boolean} [options.useObjectStates=false] When ````true````, apply the custom visibilities and appearances configured for IFC types in {@link StoreyViewsPlugin#objectStates}.
477
+ */
478
+ showStoreyObjects(storeyId, options = {}) {
479
+
480
+ const storey = this.storeys[storeyId];
481
+
482
+ if (!storey) {
483
+ this.error("IfcBuildingStorey not found with this ID: " + storeyId);
484
+ return;
485
+ }
486
+
487
+ const viewer = this.viewer;
488
+ const scene = viewer.scene;
489
+ const metaScene = viewer.metaScene;
490
+ const storeyMetaObject = metaScene.metaObjects[storeyId];
491
+
492
+ if (!storeyMetaObject) {
493
+ return;
494
+ }
495
+
496
+ if (options.hideOthers) {
497
+ scene.setObjectsVisible(viewer.scene.visibleObjectIds, false);
498
+ }
499
+
500
+ this.withStoreyObjects(storeyId, (entity, metaObject) => {
501
+ if (entity) {
502
+ if (options.useObjectStates) {
503
+ const props = this._objectStates[metaObject.type] || this._objectStates["DEFAULT"];
504
+ if (props) {
505
+ entity.visible = props.visible;
506
+ entity.edges = props.edges;
507
+ // entity.xrayed = props.xrayed; // FIXME: Buggy
508
+ // entity.highlighted = props.highlighted;
509
+ // entity.selected = props.selected;
510
+ if (props.colorize) {
511
+ entity.colorize = props.colorize;
512
+ }
513
+ if (props.opacity !== null && props.opacity !== undefined) {
514
+ entity.opacity = props.opacity;
515
+ }
516
+ }
517
+ } else {
518
+ entity.visible = true;
519
+ }
520
+ }
521
+ });
522
+ }
523
+
524
+ /**
525
+ * Executes a callback on each of the objects within the given storey.
526
+ *
527
+ * ## Usage
528
+ *
529
+ * In the example below, we'll show all the {@link Entity}s, within the given ````IfcBuildingStorey````,
530
+ * that have {@link MetaObject}s with type ````IfcSpace````. Note that the callback will only be given
531
+ * an {@link Entity} when one exists for the given {@link MetaObject}.
532
+ *
533
+ * ````JavaScript
534
+ * myStoreyViewsPlugin.withStoreyObjects(storeyId, (entity, metaObject) => {
535
+ * if (entity && metaObject && metaObject.type === "IfcSpace") {
536
+ * entity.visible = true;
537
+ * }
538
+ * });
539
+ * ````
540
+ *
541
+ * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
542
+ * @param {Function} callback The callback.
543
+ */
544
+ withStoreyObjects(storeyId, callback) {
545
+ const viewer = this.viewer;
546
+ const scene = viewer.scene;
547
+ const metaScene = viewer.metaScene;
548
+ const rootMetaObject = metaScene.metaObjects[storeyId];
549
+ if (!rootMetaObject) {
550
+ return;
551
+ }
552
+ const storeySubObjects = rootMetaObject.getObjectIDsInSubtree();
553
+ for (var i = 0, len = storeySubObjects.length; i < len; i++) {
554
+ const objectId = storeySubObjects[i];
555
+ const metaObject = metaScene.metaObjects[objectId];
556
+ const entity = scene.objects[objectId];
557
+ if (entity) {
558
+ callback(entity, metaObject);
559
+ }
560
+ }
561
+ }
562
+
563
+ /**
564
+ * Creates a 2D map of the given storey.
565
+ *
566
+ * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
567
+ * @param {*} [options] Options for creating the image.
568
+ * @param {Number} [options.width=300] Image width in pixels. Height will be automatically determined from this, if not given.
569
+ * @param {Number} [options.height=300] Image height in pixels, as an alternative to width. Width will be automatically determined from this, if not given.
570
+ * @param {String} [options.format="png"] Image format. Accepted values are "png" and "jpeg".
571
+ * @returns {StoreyMap} The StoreyMap.
572
+ */
573
+ createStoreyMap(storeyId, options = {}) {
574
+
575
+ const storey = this.storeys[storeyId];
576
+ if (!storey) {
577
+ this.error("IfcBuildingStorey not found with this ID: " + storeyId);
578
+ return EMPTY_IMAGE;
579
+ }
580
+
581
+ const viewer = this.viewer;
582
+ const scene = viewer.scene;
583
+ const format = options.format || "png";
584
+ const aabb = storey.aabb;
585
+ const aspect = (aabb[5] - aabb[2]) / (aabb[3] - aabb[0]);
586
+ const padding = options.padding || 0;
587
+
588
+ let width;
589
+ let height;
590
+
591
+ if (options.width && options.height) {
592
+ width = options.width;
593
+ height = options.height;
594
+
595
+ } else if (options.height) {
596
+ height = options.height;
597
+ width = height / aspect;
598
+
599
+ } else if (options.width) {
600
+ width = options.width;
601
+ height = width * aspect;
602
+
603
+ } else {
604
+ width = 300;
605
+ height = width * aspect;
606
+ }
607
+
608
+ this._objectsMemento.saveObjects(scene);
609
+ this._cameraMemento.saveCamera(scene);
610
+
611
+ viewer.beginSnapshot();
612
+
613
+ this.showStoreyObjects(storeyId, utils.apply(options, {
614
+ useObjectStates: true,
615
+ hideOthers: true
616
+ }));
617
+
618
+ this._arrangeStoreyMapCamera(storey);
619
+
620
+ const src = viewer.getSnapshot({
621
+ width: width,
622
+ height: height,
623
+ format: format,
624
+ });
625
+
626
+ this._objectsMemento.restoreObjects(scene);
627
+ this._cameraMemento.restoreCamera(scene);
628
+
629
+ viewer.endSnapshot();
630
+
631
+ return new StoreyMap(storeyId, src, format, width, height, padding);
632
+ }
633
+
634
+ _arrangeStoreyMapCamera(storey) {
635
+ const viewer = this.viewer;
636
+ const scene = viewer.scene;
637
+ const camera = scene.camera;
638
+ const aabb = storey.aabb;
639
+ const look = math.getAABB3Center(aabb);
640
+ const sca = 0.5;
641
+ const eye = tempVec3a;
642
+ eye[0] = look[0] + (camera.worldUp[0] * sca);
643
+ eye[1] = look[1] + (camera.worldUp[1] * sca);
644
+ eye[2] = look[2] + (camera.worldUp[2] * sca);
645
+ const up = camera.worldForward;
646
+ viewer.cameraFlight.jumpTo({eye: eye, look: look, up: up});
647
+ const xHalfSize = (aabb[3] - aabb[0]) / 2;
648
+ const yHalfSize = (aabb[4] - aabb[1]) / 2;
649
+ const zHalfSize = (aabb[5] - aabb[2]) / 2;
650
+ const xmin = -xHalfSize;
651
+ const xmax = +xHalfSize;
652
+ const ymin = -yHalfSize;
653
+ const ymax = +yHalfSize;
654
+ const zmin = -zHalfSize;
655
+ const zmax = +zHalfSize;
656
+ viewer.camera.customProjection.matrix = math.orthoMat4c(xmin, xmax, zmin, zmax, ymin, ymax, tempMat4);
657
+ viewer.camera.projection = "customProjection";
658
+ }
659
+
660
+ /**
661
+ * Attempts to pick an {@link Entity} at the given pixel coordinates within a StoreyMap image.
662
+ *
663
+ * @param {StoreyMap} storeyMap The StoreyMap.
664
+ * @param {Number[]} imagePos 2D pixel coordinates within the bounds of {@link StoreyMap#imageData}.
665
+ * @param {*} [options] Picking options.
666
+ * @param {Boolean} [options.pickSurface=false] Whether to return the picked position on the surface of the Entity.
667
+ * @returns {PickResult} The pick result, if an Entity was successfully picked, else null.
668
+ */
669
+ pickStoreyMap(storeyMap, imagePos, options = {}) {
670
+
671
+ const storeyId = storeyMap.storeyId;
672
+ const storey = this.storeys[storeyId];
673
+
674
+ if (!storey) {
675
+ this.error("IfcBuildingStorey not found with this ID: " + storeyId);
676
+ return null
677
+ }
678
+
679
+ const normX = 1.0 - (imagePos[0] / storeyMap.width);
680
+ const normZ = 1.0 - (imagePos[1] / storeyMap.height);
681
+
682
+ const aabb = storey.aabb;
683
+
684
+ const xmin = aabb[0];
685
+ const ymin = aabb[1];
686
+ const zmin = aabb[2];
687
+ const xmax = aabb[3];
688
+ const ymax = aabb[4];
689
+ const zmax = aabb[5];
690
+
691
+ const xWorldSize = xmax - xmin;
692
+ const yWorldSize = ymax - ymin;
693
+ const zWorldSize = zmax - zmin;
694
+
695
+ const origin = math.vec3([xmin + (xWorldSize * normX), ymin + (yWorldSize * 0.5), zmin + (zWorldSize * normZ)]);
696
+ const direction = math.vec3([0, -1, 0]);
697
+ const look = math.addVec3(origin, direction, tempVec3a);
698
+ const worldForward = this.viewer.camera.worldForward;
699
+ const matrix = math.lookAtMat4v(origin, look, worldForward, tempMat4);
700
+
701
+ const pickResult = this.viewer.scene.pick({ // Picking with arbitrarily-positioned ray
702
+ pickSurface: options.pickSurface,
703
+ pickInvisible: true,
704
+ matrix: matrix
705
+ });
706
+
707
+ if (pickResult) {
708
+ const metaObject = this.viewer.metaScene.metaObjects[pickResult.entity.id];
709
+ const objectState = this.objectStates[metaObject.type];
710
+ if (!objectState || !objectState.visible) {
711
+ return null;
712
+ }
713
+ }
714
+
715
+ return pickResult;
716
+ }
717
+
718
+ /**
719
+ * Gets the ID of the storey that contains the given 3D World-space position.
720
+ *.
721
+ * @param {Number[]} worldPos 3D World-space position.
722
+ * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
723
+ */
724
+ getStoreyContainingWorldPos(worldPos) {
725
+ for (var storeyId in this.storeys) {
726
+ const storey = this.storeys[storeyId];
727
+ if (math.point3AABB3Intersect(storey.aabb, worldPos)) {
728
+ return storeyId;
729
+ }
730
+ }
731
+ return null;
732
+ }
733
+
734
+ /**
735
+ * Converts a 3D World-space position to a 2D position within a StoreyMap image.
736
+ *
737
+ * Use {@link StoreyViewsPlugin#pickStoreyMap} to convert 2D image positions to 3D world-space.
738
+ *
739
+ * @param {StoreyMap} storeyMap The StoreyMap.
740
+ * @param {Number[]} worldPos 3D World-space position within the storey.
741
+ * @param {Number[]} imagePos 2D pixel position within the {@link StoreyMap#imageData}.
742
+ * @returns {Boolean} True if ````imagePos```` is within the bounds of the {@link StoreyMap#imageData}, else ````false```` if it falls outside.
743
+ */
744
+ worldPosToStoreyMap(storeyMap, worldPos, imagePos) {
745
+
746
+ const storeyId = storeyMap.storeyId;
747
+ const storey = this.storeys[storeyId];
748
+
749
+ if (!storey) {
750
+ this.error("IfcBuildingStorey not found with this ID: " + storeyId);
751
+ return false
752
+ }
753
+
754
+ const aabb = storey.aabb;
755
+
756
+ const xmin = aabb[0];
757
+ const ymin = aabb[1];
758
+ const zmin = aabb[2];
759
+
760
+ const xmax = aabb[3];
761
+ const ymax = aabb[4];
762
+ const zmax = aabb[5];
763
+
764
+ const xWorldSize = xmax - xmin;
765
+ const yWorldSize = ymax - ymin;
766
+ const zWorldSize = zmax - zmin;
767
+
768
+ const camera = this.viewer.camera;
769
+ const worldUp = camera.worldUp;
770
+
771
+ const xUp = worldUp[0] > worldUp[1] && worldUp[0] > worldUp[2];
772
+ const yUp = !xUp && worldUp[1] > worldUp[0] && worldUp[1] > worldUp[2];
773
+ const zUp = !xUp && !yUp && worldUp[2] > worldUp[0] && worldUp[2] > worldUp[1];
774
+
775
+ const ratioX = (storeyMap.width / xWorldSize);
776
+ const ratioY = yUp ? (storeyMap.height / zWorldSize) : (storeyMap.height / yWorldSize); // Assuming either Y or Z is "up", but never X
777
+
778
+ imagePos[0] = Math.floor(storeyMap.width - ((worldPos[0] - xmin) * ratioX));
779
+ imagePos[1] = Math.floor(storeyMap.height - ((worldPos[2] - zmin) * ratioY));
780
+
781
+ return (imagePos[0] >= 0 && imagePos[0] < storeyMap.width && imagePos[1] >= 0 && imagePos[1] <= storeyMap.height);
782
+ }
783
+
784
+ /**
785
+ * Converts a 3D World-space direction vector to a 2D vector within a StoreyMap image.
786
+ *
787
+ * @param {StoreyMap} storeyMap The StoreyMap.
788
+ * @param {Number[]} worldDir 3D World-space direction vector.
789
+ * @param {Number[]} imageDir Normalized 2D direction vector.
790
+ */
791
+ worldDirToStoreyMap(storeyMap, worldDir, imageDir) {
792
+ const camera = this.viewer.camera;
793
+ const eye = camera.eye;
794
+ const look = camera.look;
795
+ const eyeLookDir = math.subVec3(look, eye, tempVec3a);
796
+ const worldUp = camera.worldUp;
797
+ const xUp = worldUp[0] > worldUp[1] && worldUp[0] > worldUp[2];
798
+ const yUp = !xUp && worldUp[1] > worldUp[0] && worldUp[1] > worldUp[2];
799
+ const zUp = !xUp && !yUp && worldUp[2] > worldUp[0] && worldUp[2] > worldUp[1];
800
+ if (xUp) {
801
+ imageDir[0] = eyeLookDir[1];
802
+ imageDir[1] = eyeLookDir[2];
803
+ } else if (yUp) {
804
+ imageDir[0] = eyeLookDir[0];
805
+ imageDir[1] = eyeLookDir[2];
806
+ } else {
807
+ imageDir[0] = eyeLookDir[0];
808
+ imageDir[1] = eyeLookDir[1];
809
+ }
810
+ math.normalizeVec2(imageDir);
811
+ }
812
+
813
+ /**
814
+ * Destroys this StoreyViewsPlugin.
815
+ */
816
+ destroy() {
817
+ this.viewer.scene.off(this._onModelLoaded);
818
+ super.destroy();
819
+ }
820
+ }
821
+
822
+ export {StoreyViewsPlugin}