@aibee/owlly 1.0.25 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/lib/external/lines/line-geometry.d.ts +9 -0
  2. package/lib/external/lines/line-geometry.js +51 -0
  3. package/lib/external/lines/line-material.d.ts +10 -0
  4. package/lib/external/lines/line-material.js +376 -0
  5. package/lib/external/lines/line-segments-2.d.ts +7 -0
  6. package/lib/external/lines/line-segments-2.js +143 -0
  7. package/lib/external/lines/line-segments-geometry.d.ts +15 -0
  8. package/lib/external/lines/line-segments-geometry.js +140 -0
  9. package/lib/external/loaders/gltf-loader.d.ts +77 -0
  10. package/lib/external/loaders/gltf-loader.js +2318 -0
  11. package/lib/external/orbit-controls.d.ts +44 -0
  12. package/lib/external/orbit-controls.js +745 -0
  13. package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
  14. package/lib/external/renderers/css-2d-renderer.js +121 -0
  15. package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
  16. package/lib/external/renderers/css-3d-renderer.js +138 -0
  17. package/lib/external/transform-controls.d.ts +106 -0
  18. package/lib/external/transform-controls.js +1112 -0
  19. package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
  20. package/lib/owlly/controller/aerial-element-controller.js +235 -0
  21. package/lib/owlly/controller/basic-controller.d.ts +324 -0
  22. package/lib/owlly/controller/basic-controller.js +1238 -0
  23. package/lib/owlly/controller/camera-controller.d.ts +37 -0
  24. package/lib/owlly/controller/camera-controller.js +137 -0
  25. package/lib/owlly/controller/controller.d.ts +61 -0
  26. package/lib/owlly/controller/controller.js +23 -0
  27. package/lib/owlly/controller/index.d.ts +2 -0
  28. package/lib/owlly/controller/index.js +13 -0
  29. package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  30. package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
  31. package/lib/owlly/controller/orbit-control.d.ts +147 -0
  32. package/lib/owlly/controller/orbit-control.js +264 -0
  33. package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  34. package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
  35. package/lib/owlly/controller/panorama-controller.d.ts +441 -0
  36. package/lib/owlly/controller/panorama-controller.js +1943 -0
  37. package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
  38. package/lib/owlly/controller/panorama-transform-controller.js +136 -0
  39. package/lib/owlly/controller/plane-controller.d.ts +43 -0
  40. package/lib/owlly/controller/plane-controller.js +173 -0
  41. package/lib/owlly/controller/texture-controller.d.ts +181 -0
  42. package/lib/owlly/controller/texture-controller.js +875 -0
  43. package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
  44. package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
  45. package/lib/owlly/controller/transform-controller.d.ts +106 -0
  46. package/lib/owlly/controller/transform-controller.js +545 -0
  47. package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
  48. package/lib/owlly/element/bottom-nav-element.js +257 -0
  49. package/lib/owlly/element/camera.d.ts +82 -0
  50. package/lib/owlly/element/camera.js +283 -0
  51. package/lib/owlly/element/dom-2d-element.d.ts +35 -0
  52. package/lib/owlly/element/dom-2d-element.js +48 -0
  53. package/lib/owlly/element/dom-3d-element.d.ts +27 -0
  54. package/lib/owlly/element/dom-3d-element.js +33 -0
  55. package/lib/owlly/element/dom-label-2d.d.ts +116 -0
  56. package/lib/owlly/element/dom-label-2d.js +382 -0
  57. package/lib/owlly/element/element.d.ts +53 -0
  58. package/lib/owlly/element/element.js +75 -0
  59. package/lib/owlly/element/floor-model.d.ts +83 -0
  60. package/lib/owlly/element/floor-model.js +227 -0
  61. package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
  62. package/lib/owlly/element/gif-kit/Gif.js +432 -0
  63. package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
  64. package/lib/owlly/element/gif-kit/GifColor.js +37 -0
  65. package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  66. package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
  67. package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  68. package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
  69. package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
  70. package/lib/owlly/element/gif-kit/GifImage.js +7 -0
  71. package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
  72. package/lib/owlly/element/gif-kit/GifParser.js +196 -0
  73. package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  74. package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
  75. package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  76. package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
  77. package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
  78. package/lib/owlly/element/gltf-mesh-element.js +136 -0
  79. package/lib/owlly/element/index.d.ts +20 -0
  80. package/lib/owlly/element/index.js +24 -0
  81. package/lib/owlly/element/map-kit/shape.d.ts +131 -0
  82. package/lib/owlly/element/map-kit/shape.js +189 -0
  83. package/lib/owlly/element/mesh-element.d.ts +22 -0
  84. package/lib/owlly/element/mesh-element.js +63 -0
  85. package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
  86. package/lib/owlly/element/mesh-line-2d.js +887 -0
  87. package/lib/owlly/element/meshline-o.d.ts +64 -0
  88. package/lib/owlly/element/meshline-o.js +678 -0
  89. package/lib/owlly/element/panorama-group.d.ts +241 -0
  90. package/lib/owlly/element/panorama-group.js +966 -0
  91. package/lib/owlly/element/panorama.d.ts +132 -0
  92. package/lib/owlly/element/panorama.js +812 -0
  93. package/lib/owlly/element/path-group.d.ts +69 -0
  94. package/lib/owlly/element/path-group.js +171 -0
  95. package/lib/owlly/element/path.d.ts +99 -0
  96. package/lib/owlly/element/path.js +531 -0
  97. package/lib/owlly/element/placeable-2d.d.ts +158 -0
  98. package/lib/owlly/element/placeable-2d.js +470 -0
  99. package/lib/owlly/element/polygon-mesh.d.ts +107 -0
  100. package/lib/owlly/element/polygon-mesh.js +307 -0
  101. package/lib/owlly/element/ring-element.d.ts +79 -0
  102. package/lib/owlly/element/ring-element.js +383 -0
  103. package/lib/owlly/element/sphere-mesh.d.ts +28 -0
  104. package/lib/owlly/element/sphere-mesh.js +69 -0
  105. package/lib/owlly/element/svg-floor-model.d.ts +22 -0
  106. package/lib/owlly/element/svg-floor-model.js +184 -0
  107. package/lib/owlly/element/svg-floors.d.ts +27 -0
  108. package/lib/owlly/element/svg-floors.js +109 -0
  109. package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
  110. package/lib/owlly/element/tile-panorama-group.js +1006 -0
  111. package/lib/owlly/element/tile-panorama.d.ts +161 -0
  112. package/lib/owlly/element/tile-panorama.js +509 -0
  113. package/lib/owlly/element/tile-plane.d.ts +105 -0
  114. package/lib/owlly/element/tile-plane.js +360 -0
  115. package/lib/owlly/element/video-element.d.ts +33 -0
  116. package/lib/owlly/element/video-element.js +159 -0
  117. package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  118. package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
  119. package/lib/owlly/index.d.ts +13 -0
  120. package/lib/owlly/index.js +16 -0
  121. package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
  122. package/lib/owlly/overlay/canvas-overlay.js +510 -0
  123. package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
  124. package/lib/owlly/overlay/css-2d-overlay.js +35 -0
  125. package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
  126. package/lib/owlly/overlay/css-3d-overlay.js +36 -0
  127. package/lib/owlly/overlay/index.d.ts +6 -0
  128. package/lib/owlly/overlay/index.js +11 -0
  129. package/lib/owlly/overlay/label-overlay.d.ts +62 -0
  130. package/lib/owlly/overlay/label-overlay.js +328 -0
  131. package/lib/owlly/overlay/overlay.d.ts +14 -0
  132. package/lib/owlly/overlay/overlay.js +4 -0
  133. package/lib/owlly/overlay/path-overlay.d.ts +39 -0
  134. package/lib/owlly/overlay/path-overlay.js +124 -0
  135. package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
  136. package/lib/owlly/overlay/path-overlay2.js +118 -0
  137. package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  138. package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
  139. package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
  140. package/lib/owlly/overlay/poi-overlay.js +1411 -0
  141. package/lib/owlly/owlly-2d/index.d.ts +28 -0
  142. package/lib/owlly/owlly-2d/index.js +92 -0
  143. package/lib/owlly/screen/index.d.ts +1 -0
  144. package/lib/owlly/screen/index.js +1 -0
  145. package/lib/owlly/screen/screen.d.ts +73 -0
  146. package/lib/owlly/screen/screen.js +236 -0
  147. package/lib/owlly/stage/externals.d.ts +19 -0
  148. package/lib/owlly/stage/externals.js +24 -0
  149. package/lib/owlly/stage/index.d.ts +4 -0
  150. package/lib/owlly/stage/index.js +6 -0
  151. package/lib/owlly/stage/owlly.d.ts +38 -0
  152. package/lib/owlly/stage/owlly.js +168 -0
  153. package/lib/owlly/stage/stage.d.ts +108 -0
  154. package/lib/owlly/stage/stage.js +234 -0
  155. package/lib/owlly/utils/alignment-utils.d.ts +20 -0
  156. package/lib/owlly/utils/alignment-utils.js +63 -0
  157. package/lib/owlly/utils/basic-calc.d.ts +18 -0
  158. package/lib/owlly/utils/basic-calc.js +129 -0
  159. package/lib/owlly/utils/basic-tools.d.ts +71 -0
  160. package/lib/owlly/utils/basic-tools.js +235 -0
  161. package/lib/owlly/utils/bvh-tree.d.ts +105 -0
  162. package/lib/owlly/utils/bvh-tree.js +539 -0
  163. package/lib/owlly/utils/camera.d.ts +37 -0
  164. package/lib/owlly/utils/camera.js +50 -0
  165. package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
  166. package/lib/owlly/utils/cube-texture-cache.js +143 -0
  167. package/lib/owlly/utils/device-utils.d.ts +18 -0
  168. package/lib/owlly/utils/device-utils.js +41 -0
  169. package/lib/owlly/utils/environment-utils.d.ts +37 -0
  170. package/lib/owlly/utils/environment-utils.js +73 -0
  171. package/lib/owlly/utils/event-hub.d.ts +50 -0
  172. package/lib/owlly/utils/event-hub.js +106 -0
  173. package/lib/owlly/utils/events.d.ts +219 -0
  174. package/lib/owlly/utils/events.js +219 -0
  175. package/lib/owlly/utils/geometry-utils.d.ts +119 -0
  176. package/lib/owlly/utils/geometry-utils.js +622 -0
  177. package/lib/owlly/utils/helper.d.ts +6 -0
  178. package/lib/owlly/utils/helper.js +24 -0
  179. package/lib/owlly/utils/index.d.ts +14 -0
  180. package/lib/owlly/utils/index.js +17 -0
  181. package/lib/owlly/utils/lru-cache.d.ts +26 -0
  182. package/lib/owlly/utils/lru-cache.js +109 -0
  183. package/lib/owlly/utils/map-utils.d.ts +7 -0
  184. package/lib/owlly/utils/map-utils.js +52 -0
  185. package/lib/owlly/utils/number-utils.d.ts +8 -0
  186. package/lib/owlly/utils/number-utils.js +72 -0
  187. package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
  188. package/lib/owlly/utils/panorama-model-util.js +245 -0
  189. package/lib/owlly/utils/path-utils.d.ts +80 -0
  190. package/lib/owlly/utils/path-utils.js +728 -0
  191. package/lib/owlly/utils/svgutils.d.ts +138 -0
  192. package/lib/owlly/utils/svgutils.js +561 -0
  193. package/lib/owlly/utils/texture-cache.d.ts +29 -0
  194. package/lib/owlly/utils/texture-cache.js +115 -0
  195. package/lib/owlly/utils/tile-util.d.ts +187 -0
  196. package/lib/owlly/utils/tile-util.js +456 -0
  197. package/lib/owlly/utils/time-profiler.d.ts +21 -0
  198. package/lib/owlly/utils/time-profiler.js +48 -0
  199. package/lib/owlly/view/camera-view.d.ts +35 -0
  200. package/lib/owlly/view/camera-view.js +101 -0
  201. package/lib/owlly/view/index.d.ts +3 -0
  202. package/lib/owlly/view/index.js +5 -0
  203. package/lib/owlly/view/orthographic-view.d.ts +40 -0
  204. package/lib/owlly/view/orthographic-view.js +94 -0
  205. package/lib/owlly/view/perspective-view.d.ts +40 -0
  206. package/lib/owlly/view/perspective-view.js +95 -0
  207. package/lib/owlly/view/svg-map-view.d.ts +46 -0
  208. package/lib/owlly/view/svg-map-view.js +144 -0
  209. package/lib/owlly/view/view.d.ts +146 -0
  210. package/lib/owlly/view/view.js +317 -0
  211. package/lib/prod/owlly.esm.js +93462 -0
  212. package/lib/prod/owlly.esm.js.map +1 -0
  213. package/lib/prod/owlly.esm.min.js +54 -0
  214. package/lib/prod/owlly.iife.js +93560 -0
  215. package/lib/prod/owlly.iife.js.map +1 -0
  216. package/lib/prod/owlly.iife.min.js +69 -0
  217. package/lib/prod/owlly.miniapp.js +73845 -0
  218. package/lib/prod/owlly.miniapp.js.map +1 -0
  219. package/lib/prod/owlly.miniapp.min.js +63 -0
  220. package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
  221. package/lib/prod/src/external/lines/line-material.d.ts +10 -0
  222. package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
  223. package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
  224. package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
  225. package/lib/prod/src/external/orbit-controls.d.ts +44 -0
  226. package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
  227. package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
  228. package/lib/prod/src/external/transform-controls.d.ts +106 -0
  229. package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
  230. package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
  231. package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
  232. package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
  233. package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
  234. package/lib/prod/src/owlly/controller/index.d.ts +2 -0
  235. package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  236. package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
  237. package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  238. package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
  239. package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
  240. package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
  241. package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
  242. package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
  243. package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
  244. package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
  245. package/lib/prod/src/owlly/element/camera.d.ts +82 -0
  246. package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
  247. package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
  248. package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
  249. package/lib/prod/src/owlly/element/element.d.ts +53 -0
  250. package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
  251. package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
  252. package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
  253. package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  254. package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  255. package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
  256. package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
  257. package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  258. package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  259. package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
  260. package/lib/prod/src/owlly/element/index.d.ts +6 -0
  261. package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
  262. package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
  263. package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
  264. package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
  265. package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
  266. package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
  267. package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
  268. package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
  269. package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
  270. package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
  271. package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
  272. package/lib/prod/src/owlly/element/path.d.ts +99 -0
  273. package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
  274. package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
  275. package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
  276. package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
  277. package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
  278. package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
  279. package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
  280. package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
  281. package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
  282. package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
  283. package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  284. package/lib/prod/src/owlly/index.d.ts +13 -0
  285. package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
  286. package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
  287. package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
  288. package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
  289. package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
  290. package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
  291. package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
  292. package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
  293. package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  294. package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
  295. package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
  296. package/lib/prod/src/owlly/screen/index.d.ts +1 -0
  297. package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
  298. package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
  299. package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
  300. package/lib/prod/src/owlly/stage/index.d.ts +3 -0
  301. package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
  302. package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
  303. package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
  304. package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
  305. package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
  306. package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
  307. package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
  308. package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
  309. package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
  310. package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
  311. package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
  312. package/lib/prod/src/owlly/utils/events.d.ts +219 -0
  313. package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
  314. package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
  315. package/lib/prod/src/owlly/utils/index.d.ts +13 -0
  316. package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
  317. package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
  318. package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
  319. package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
  320. package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
  321. package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
  322. package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
  323. package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
  324. package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
  325. package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
  326. package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
  327. package/lib/prod/src/owlly/view/index.d.ts +3 -0
  328. package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
  329. package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
  330. package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
  331. package/lib/prod/src/owlly/view/view.d.ts +146 -0
  332. package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
  333. package/lib/src/owlly/controller/texture-controller.js +16 -1
  334. package/lib/src/owlly/controller/texture-controller.js.map +1 -1
  335. package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
  336. package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
  337. package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
  338. package/lib/src/owlly/element/tile-panorama.js +16 -3
  339. package/lib/src/owlly/element/tile-panorama.js.map +1 -1
  340. package/lib/src/owlly/element/tile-plane.d.ts +9 -0
  341. package/lib/src/owlly/element/tile-plane.js +27 -0
  342. package/lib/src/owlly/element/tile-plane.js.map +1 -1
  343. package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
  344. package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
  345. package/lib/src/owlly/stage/owlly.js +7 -1
  346. package/lib/src/owlly/stage/owlly.js.map +1 -1
  347. package/lib/src/owlly/stage/stage.js +2 -0
  348. package/lib/src/owlly/stage/stage.js.map +1 -1
  349. package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
  350. package/package.json +16 -7
  351. package/src/owlly/controller/texture-controller.ts +18 -1
  352. package/src/owlly/controller/tile-panorama-controller.ts +3 -1
  353. package/src/owlly/element/tile-panorama.ts +14 -0
  354. package/src/owlly/element/tile-plane.ts +26 -0
  355. package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
  356. package/src/owlly/overlay/poi-overlay.ts +0 -4
  357. package/src/owlly/stage/owlly.ts +6 -1
  358. package/src/owlly/stage/stage.ts +2 -0
  359. package/src/web/main.rpeng.mes.plane.ts +0 -6
@@ -0,0 +1,966 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Externals } from '../stage/externals';
11
+ import { Element, ElementFrameContext, } from './element';
12
+ import { Panorama, } from './panorama';
13
+ import { CubeTextureCache } from '../utils/cube-texture-cache';
14
+ import { EventHub } from '../utils/event-hub';
15
+ import { FloorModel } from './floor-model';
16
+ import { OwllyEvents, Events } from '../utils/events';
17
+ import { BasicTools } from '../utils/basic-tools';
18
+ /** 全景点位显示模式
19
+ * 点位的显示/隐藏状态通过[setIndicatorVisibility]方法设置,
20
+ * 但是最终是否显示、以何外观显示,则是结合PanoramaGroup在当前View的显示模式来决定
21
+ * @param AlwaysHide 不论显示/隐藏的设置如何,都不显示
22
+ * @param AlwaysShow 不论显示/隐藏的设置如何,都不显示。该模式主要用于俯视全局视图用
23
+ * @param Editing 编辑模式,隐藏/显示状态的点位用不同的外观显示
24
+ * @param Show 按显示/隐葳的状态设置决定是否显示
25
+ */
26
+ var IndicatorDisplayMode;
27
+ (function (IndicatorDisplayMode) {
28
+ IndicatorDisplayMode[IndicatorDisplayMode["AlwaysHide"] = 0] = "AlwaysHide";
29
+ IndicatorDisplayMode[IndicatorDisplayMode["AlwaysShow"] = 1] = "AlwaysShow";
30
+ IndicatorDisplayMode[IndicatorDisplayMode["Editing"] = 2] = "Editing";
31
+ IndicatorDisplayMode[IndicatorDisplayMode["Show"] = 3] = "Show";
32
+ })(IndicatorDisplayMode || (IndicatorDisplayMode = {}));
33
+ /**
34
+ * 全景图组
35
+ * @noInheritDoc
36
+ */
37
+ class PanoramaGroup extends Element {
38
+ /**
39
+ * @param modelElement 模型对象,通常应该是FloorModel
40
+ * @param groundParams 地面参数对象,若有则在计算地面高度时忽略modelElement,优先使用它
41
+ * @param indicatorImageURL 显示状态全景点地面标识的图片URL
42
+ * @param invisibleIndicatorImageURL 编辑模式下隐藏状态全景点地面标识的图片URL
43
+ * @param indicatorWidth 全景点地面标识宽度
44
+ * @param indicatorHeight 全景点地面标识高度
45
+ * @example
46
+ * ``` typescript
47
+ * panoMgr = new PanoramaGroup(panoramaDataList, 2, {
48
+ * floorModel,
49
+ * groundParams,
50
+ * });
51
+ * stage.bindElement(panoMgr);
52
+ */
53
+ constructor(panoramaDataList, options, initializeAllPanoramas) {
54
+ super();
55
+ const { THREE } = Externals.getInstance();
56
+ this.initialized = false;
57
+ // this.currentPanorama = null;
58
+ const { modelElement, groundParams, indicatorImageURL, invisibleIndicatorImageURL, indicatorWidth, indicatorHeight, indicatorPositionMap, globalScale, } = options || { globalScale: 1 };
59
+ this.currentPanoramaID = -1;
60
+ this.panoramaMap = new Map();
61
+ this.indicatorMap = new Map();
62
+ this.indicatorVisibilityMap = new Map();
63
+ this.indicatorHiddenMap = new Map();
64
+ this.indicatorPositionMap = indicatorPositionMap ? indicatorPositionMap : new Map();
65
+ this.inSightIndicators = [];
66
+ this.indicatorWidth = indicatorWidth || (2 * PanoramaGroup.IndicatorRadius);
67
+ this.indicatorHeight = indicatorHeight || (2 * PanoramaGroup.IndicatorRadius);
68
+ this.maxWorldDistance = 13;
69
+ this.globalScale = globalScale || 1;
70
+ this.group = new THREE.Group();
71
+ this.add(this.group);
72
+ this.viewConfigurations = new Map();
73
+ this.eventListeners = {
74
+ onFloorModelLoaded: (element) => {
75
+ if (element !== this.modelElement)
76
+ return;
77
+ this.updateIndicatorsPositions();
78
+ },
79
+ };
80
+ this.groundParams = groundParams;
81
+ this.bindModelElement(modelElement);
82
+ const vertexShader = [
83
+ 'varying vec2 vUv;',
84
+ 'void main(){',
85
+ ' vUv = uv;',
86
+ ' gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',
87
+ '}',
88
+ ].join('\n');
89
+ const fragmentShader = [
90
+ 'uniform sampler2D map;',
91
+ 'uniform float opacity;',
92
+ 'uniform vec4 blendColor;',
93
+ 'varying vec2 vUv;',
94
+ 'void main(){',
95
+ ' vec4 texColor = texture2D(map, vUv);',
96
+ ' gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);',
97
+ '}',
98
+ ].join('\n');
99
+ this.indicatorShaderUniforms = {
100
+ map: {
101
+ type: 't',
102
+ value: null,
103
+ },
104
+ blendColor: {
105
+ type: 'v4',
106
+ value: new THREE.Vector4(0, 0, 0, 0),
107
+ },
108
+ opacity: { value: 1 },
109
+ };
110
+ this.invisibleIndicatorShaderUniforms = {
111
+ map: {
112
+ type: 't',
113
+ value: null,
114
+ },
115
+ blendColor: {
116
+ type: 'v4',
117
+ value: new THREE.Vector4(1.0, 0.0, 0.0, 0.5),
118
+ },
119
+ opacity: { value: 1 },
120
+ };
121
+ this.indicatorMaterials = new Map();
122
+ let indicatorMaterial;
123
+ let indicatorGeometry;
124
+ if (indicatorImageURL) {
125
+ indicatorGeometry = new THREE.PlaneBufferGeometry(this.indicatorWidth, this.indicatorHeight);
126
+ indicatorMaterial = new THREE.ShaderMaterial({
127
+ // 设置透明属性,这样透过全景图就能看到标签
128
+ transparent: true,
129
+ vertexShader,
130
+ fragmentShader,
131
+ uniforms: this.indicatorShaderUniforms,
132
+ side: THREE.DoubleSide,
133
+ depthTest: false,
134
+ depthWrite: false,
135
+ name: 'indicatorMaterial',
136
+ });
137
+ this.indicatorImageURL = indicatorImageURL;
138
+ new THREE.TextureLoader().load(indicatorImageURL, (texture) => {
139
+ this.indicatorShaderUniforms.map.value = texture;
140
+ });
141
+ }
142
+ else {
143
+ indicatorGeometry = new THREE.CircleGeometry(this.indicatorWidth / 2, 32);
144
+ indicatorMaterial = new THREE.MeshBasicMaterial({ transparent: true });
145
+ indicatorMaterial.side = THREE.DoubleSide;
146
+ indicatorMaterial.depthTest = false;
147
+ indicatorMaterial.depthWrite = false;
148
+ indicatorMaterial.color = new THREE.Color(0xffffff);
149
+ }
150
+ let invisibleIndicatorMaterial;
151
+ const invisibleIndicatorImageURL1 = invisibleIndicatorImageURL || indicatorImageURL;
152
+ if (invisibleIndicatorImageURL1) {
153
+ invisibleIndicatorMaterial = new THREE.ShaderMaterial({
154
+ // 设置透明属性,这样透过全景图就能看到标签
155
+ transparent: true,
156
+ vertexShader,
157
+ fragmentShader,
158
+ uniforms: this.invisibleIndicatorShaderUniforms,
159
+ side: THREE.DoubleSide,
160
+ depthTest: false,
161
+ depthWrite: false,
162
+ name: 'invisibleIndicatorMaterial',
163
+ });
164
+ new THREE.TextureLoader().load(invisibleIndicatorImageURL1, (texture) => {
165
+ this.invisibleIndicatorShaderUniforms.map.value = texture;
166
+ });
167
+ }
168
+ else {
169
+ invisibleIndicatorMaterial = new THREE.MeshBasicMaterial();
170
+ invisibleIndicatorMaterial.side = THREE.DoubleSide;
171
+ invisibleIndicatorMaterial.depthTest = false;
172
+ invisibleIndicatorMaterial.depthWrite = false;
173
+ invisibleIndicatorMaterial.color = new THREE.Color(0xff0000);
174
+ }
175
+ const indicator = new THREE.Mesh(indicatorGeometry, indicatorMaterial);
176
+ this.setIndicatorMeshPrototype(indicator);
177
+ this.setIndicatorMaterial(indicatorMaterial, IndicatorDisplayMode.Editing, true);
178
+ this.setIndicatorMaterial(invisibleIndicatorMaterial, IndicatorDisplayMode.Editing, false);
179
+ this.setIndicatorMaterial(indicatorMaterial, IndicatorDisplayMode.Show, true);
180
+ this.panoramaDatas = new Map();
181
+ panoramaDataList.forEach((item) => {
182
+ this.panoramaDatas.set(item.pid, item);
183
+ });
184
+ this.panoramaCreatingTasks = new Map();
185
+ if (initializeAllPanoramas === true) {
186
+ panoramaDataList.forEach((item) => {
187
+ this.getPanoramaByPID(item.pid);
188
+ });
189
+ }
190
+ if (this.modelElement instanceof FloorModel) {
191
+ if (this.modelElement.isModelLoaded()) {
192
+ this.updateIndicatorsPositions();
193
+ }
194
+ }
195
+ // console.info('#Async# All this.asyncLoadingTasks done', this.asyncLoadingTasks);
196
+ EventHub.on(OwllyEvents.ELEMENT_LOADED, this.eventListeners.onFloorModelLoaded);
197
+ this.initialized = false;
198
+ this.needUpdate = false;
199
+ }
200
+ dispose(exceptForCubeTextureOfPID) {
201
+ super.dispose();
202
+ EventHub.off(OwllyEvents.ELEMENT_LOADED, this.eventListeners.onFloorModelLoaded);
203
+ if (this.panoramaMap) {
204
+ this.panoramaMap.forEach((pano) => {
205
+ // console.info('#PanoCtrl# 5 Will remove pano:', pano.position);
206
+ this.group.remove(pano);
207
+ if (exceptForCubeTextureOfPID !== pano.pid) {
208
+ CubeTextureCache.sharedInstance.recycleCubeTexture(pano.textureURLs);
209
+ }
210
+ pano.dispose();
211
+ });
212
+ this.panoramaMap.clear();
213
+ }
214
+ if (this.indicatorMap) {
215
+ this.indicatorMap.forEach((indicator) => {
216
+ this.group.remove(indicator);
217
+ });
218
+ this.indicatorMap.clear();
219
+ }
220
+ if (this.boundBox) {
221
+ this.group.remove(this.boundBox);
222
+ this.boundBox.geometry.dispose();
223
+ }
224
+ this.remove(this.group);
225
+ }
226
+ /**
227
+ * @ignore
228
+ */
229
+ update() {
230
+ const frameContext = new ElementFrameContext(this);
231
+ if (!this.initialized) {
232
+ this.initialized = true;
233
+ frameContext.needUpdate = true;
234
+ }
235
+ else if (this.needUpdate) {
236
+ const pidPositionMap = this.getPIDPositionMap(this.inSightIndicators);
237
+ pidPositionMap.forEach((p, pid) => {
238
+ const position = this.indicatorPositionMap.get(pid);
239
+ if (!position) {
240
+ if (this.groundParams || this.modelElement instanceof FloorModel) {
241
+ let precisePosition;
242
+ // console.log('## PanoramaGroup.update() will update indicator position');
243
+ if (this.groundParams && this.groundParams.groundPlane) {
244
+ precisePosition = FloorModel.intersectWithGroundPlane(p, this.groundParams);
245
+ }
246
+ else {
247
+ const model = this.modelElement;
248
+ precisePosition = model.intersectGround(p);
249
+ }
250
+ if (precisePosition) {
251
+ this.indicatorPositionMap.set(pid, precisePosition);
252
+ }
253
+ }
254
+ }
255
+ });
256
+ this.inSightIndicators.forEach((pid) => {
257
+ // this.indicatorPositionMap.forEach((indicatorPosition: Vector3, pid: number) => {
258
+ // this.panoramaMap.forEach((pano: Panorama, pid: number) => {
259
+ let indicator = this.indicatorMap.get(pid);
260
+ if (!indicator) {
261
+ indicator = this.indicatorMeshPrototype.clone();
262
+ this.indicatorMap.set(pid, indicator);
263
+ this.group.add(indicator);
264
+ const panoData = this.panoramaDatas.get(pid);
265
+ if (panoData && panoData.position) {
266
+ indicator.position.copy(panoData.position);
267
+ }
268
+ }
269
+ const position = this.indicatorPositionMap.get(pid);
270
+ if (position) {
271
+ indicator.position.copy(position);
272
+ }
273
+ });
274
+ this.needUpdate = false;
275
+ frameContext.needUpdate = true;
276
+ }
277
+ else {
278
+ this.panoramaMap.forEach((pano) => {
279
+ const subFrameContext = pano.update();
280
+ if (subFrameContext.needUpdate) {
281
+ frameContext.needUpdate = true;
282
+ }
283
+ });
284
+ }
285
+ if (this.initialized && !this.parent) {
286
+ frameContext.shouldPlaceElement = true;
287
+ }
288
+ return frameContext;
289
+ }
290
+ /**
291
+ * 绑定模型Element对象(用于创建天空包围盒供全景切换时使用)
292
+ * @param modelElement 模型Element对象
293
+ */
294
+ bindModelElement(modelElement) {
295
+ if (modelElement) {
296
+ this.modelElement = modelElement;
297
+ }
298
+ if (this.boundBox) {
299
+ this.group.remove(this.boundBox);
300
+ this.boundBox = null;
301
+ }
302
+ this.getModelBoundBox();
303
+ }
304
+ static getBoundBox(rootObj) {
305
+ if (!rootObj)
306
+ return null;
307
+ const { THREE } = Externals.getInstance();
308
+ const box = new THREE.Box3().setFromObject(rootObj);
309
+ const size = box.getSize(new THREE.Vector3());
310
+ const sideLength = Math.max(size.x, size.y, size.z); // 外扩10个单位
311
+ // const minX = -sideLength;
312
+ // const maxX = sideLength;
313
+ // const minY = -sideLength;
314
+ // const maxY = sideLength;
315
+ // const minZ = -sideLength;
316
+ // const maxZ = sideLength;
317
+ // const boundBox = new THREE.Mesh(new THREE.BoxBufferGeometry(maxX - minX, maxY - minY, maxZ - minZ));
318
+ // boundBox.position.set((maxX + minX) / 2, (maxY + minY) / 2, (maxZ + minZ) / 2);
319
+ const boundBox = new THREE.Mesh(new THREE.BoxBufferGeometry(sideLength, sideLength, sideLength));
320
+ boundBox.position.copy(box.max.clone().add(box.min).multiplyScalar(0.5));
321
+ return boundBox;
322
+ }
323
+ getModelBoundBox() {
324
+ if (this.boundBox)
325
+ return;
326
+ this.boundBox = PanoramaGroup.getBoundBox(this.modelElement);
327
+ if (this.boundBox) {
328
+ this.boundBox.visible = true;
329
+ // 设置天空盒不被视锥裁剪,这样天空盒资源就能直接加载到GPU里面
330
+ this.boundBox.frustumCulled = false;
331
+ this.boundBox.renderOrder = 100;
332
+ this.group.add(this.boundBox);
333
+ }
334
+ }
335
+ setBoundBoxAppearance(material) {
336
+ this.getModelBoundBox();
337
+ if (!this.boundBox)
338
+ return;
339
+ this.boundBox.material = material;
340
+ this.needUpdate = true;
341
+ }
342
+ setBoundBoxVisible(visible) {
343
+ if (!this.boundBox)
344
+ return;
345
+ this.boundBox.visible = visible;
346
+ }
347
+ /**
348
+ * 加载指定全景图并加入场景(显示要通过PanoramaController)
349
+ * @param panorama 要加载的全景图
350
+ */
351
+ presentPanorama(panorama, hdTiles, ldTiles) {
352
+ return __awaiter(this, void 0, void 0, function* () {
353
+ // await panorama.updateTexture();// /!!!#TiledCube#
354
+ if (!panorama.legacyMode) {
355
+ yield panorama.updateFaceGridsTextures(hdTiles, ldTiles);
356
+ this.needUpdate = true;
357
+ }
358
+ // console.info('#TiledCube# presentPanorama updated tiles:', ldTiles);
359
+ // if (this.currentPanorama) {
360
+ // // this.group.remove(this.currentPanorama);
361
+ // this.currentPanorama.visible = false;
362
+ // }
363
+ // this.currentPanorama = panorama;
364
+ // this.group.add(panorama);
365
+ // panorama.visible = true;
366
+ });
367
+ }
368
+ /**
369
+ * 加载指定PID的全景图并加入场景(显示要通过PanoramaController)
370
+ * @param pid 要加载的全景图ID
371
+ */
372
+ presentPanoramaOfPID(pid, hdTiles, ldTiles) {
373
+ return __awaiter(this, void 0, void 0, function* () {
374
+ const pano = yield this.getPanoramaByPID(pid);
375
+ if (pano) {
376
+ yield this.presentPanorama(pano, hdTiles, ldTiles);
377
+ }
378
+ this.currentPanoramaID = pid;
379
+ this.emit(Events.PANORAMA_PRESENTED, pid);
380
+ });
381
+ }
382
+ /**
383
+ * 获取一组全景点的立方体贴图,若没命中则异步加载
384
+ * @param pids 全景点ID数组
385
+ * @param waitForReadyCount 指定函数必须在pids中的前多少个全景点立方体贴图获取到以后才能返回
386
+ * 比如在即将显示一个全景点时,指定必须等指定全景点的立方体贴图获取到后才能返回,而其周围全景点可以同时预加载但不用等
387
+ */
388
+ preloadCubeTexturesOfPIDs(pids, waitForReadyCount) {
389
+ return __awaiter(this, void 0, void 0, function* () {
390
+ const textureURLsArray = pids.map((pid) => {
391
+ const panoData = this.panoramaDatas.get(pid);
392
+ if (panoData) {
393
+ return panoData.textureURLs;
394
+ }
395
+ return undefined;
396
+ });
397
+ return CubeTextureCache.sharedInstance.preloadCubeTextures(textureURLsArray, waitForReadyCount);
398
+ });
399
+ }
400
+ visibleRadiusOfView(view) {
401
+ if (!view)
402
+ return PanoramaGroup.DefaultVisibleRadius;
403
+ const conf = this.viewConfigurations.get(view);
404
+ if (conf && conf.visibleRadius)
405
+ return conf.visibleRadius;
406
+ return PanoramaGroup.DefaultVisibleRadius;
407
+ }
408
+ allPanoramas() {
409
+ return __awaiter(this, void 0, void 0, function* () {
410
+ const created = Array.from(this.panoramaMap.values());
411
+ const pending = yield Promise.all(Array.from(this.panoramaCreatingTasks.values()));
412
+ return created.concat(pending);
413
+ });
414
+ }
415
+ getAllPanoramas() {
416
+ return __awaiter(this, void 0, void 0, function* () {
417
+ return this.initializePanoramasIfNecessary('all');
418
+ });
419
+ }
420
+ panoramaIDsAround(centerPID, view) {
421
+ const rootNode = this.panoramaDatas.get(centerPID);
422
+ if (!rootNode || !rootNode.position) {
423
+ return null;
424
+ }
425
+ const ret = [centerPID];
426
+ const visibleRadius = this.visibleRadiusOfView(view);
427
+ const neighbours = rootNode.neighbourPanoramaIDs.map((pid) => this.panoramaDatas.get(pid));
428
+ // console.info(`#Async# neighbours(${neighbours.length})`, neighbours);
429
+ neighbours.forEach((neighbour) => {
430
+ if (neighbour && neighbour.position) {
431
+ const distance = rootNode.position.distanceTo(neighbour.position);
432
+ if (distance <= visibleRadius) {
433
+ ret.push(neighbour.pid);
434
+ }
435
+ }
436
+ });
437
+ // const bfsQueue: Panorama[] = [rootNode];
438
+ // const touched: Set<number> = new Set();
439
+ // touched.add(rootNode.pid);
440
+ // let start = 0;
441
+ // while (start < bfsQueue.length) {
442
+ // const node: Panorama = bfsQueue[start];
443
+ // node.neighbourPanoramaIDs.forEach((pid: number) => {
444
+ // if (touched.has(pid)) {
445
+ // return;
446
+ // }
447
+ // touched.add(pid);
448
+ // const neighbour: Panorama|undefined = this.panoramaMap.get(pid);
449
+ // if (neighbour) {
450
+ // bfsQueue.push(neighbour);
451
+ // if (node === rootNode) {
452
+ // const distance = node.position.distanceTo(neighbour.position);
453
+ // if (distance <= visibleRadius) {
454
+ // ret.push(neighbour.pid);
455
+ // }
456
+ // }
457
+ // }
458
+ // });
459
+ // start += 1;
460
+ // }
461
+ // console.info(`## panoramaIDsAround(${centerPID})=`, ret);
462
+ return ret;
463
+ }
464
+ /**
465
+ * 设置当前位于的全景点位。将加载指定全景点并预加载其相邻全景点
466
+ * @param {number} currentPID 全景点位ID
467
+ */
468
+ presentPanoramaAround(currentPID, hdTiles, ldTiles, view) {
469
+ return __awaiter(this, void 0, void 0, function* () {
470
+ const panoIDs = this.panoramaIDsAround(currentPID, view);
471
+ if (panoIDs) {
472
+ // await this.preloadCubeTexturesOfPIDs(panoIDs.slice(1, panoIDs.length), 0);
473
+ yield this.presentPanoramaOfPID(currentPID, hdTiles, ldTiles);
474
+ }
475
+ });
476
+ }
477
+ /** @ignore */
478
+ getPIDPositionMap(pids) {
479
+ const ret = new Map();
480
+ pids.forEach((value) => {
481
+ const panoData = this.panoramaDatas.get(value);
482
+ if (panoData) {
483
+ ret.set(value, panoData.position);
484
+ }
485
+ });
486
+ return ret;
487
+ }
488
+ getIndicatorPosition(pid) {
489
+ return this.indicatorPositionMap.get(pid);
490
+ }
491
+ /**
492
+ * 显示指定全景点位标签
493
+ * @param pidPositionMap 从PID映射到全景点位位置的Map
494
+ */
495
+ presentPanoramaIndicators(pidPositionMap) {
496
+ if (!this.modelElement)
497
+ return;
498
+ this.inSightIndicators = [];
499
+ const { THREE } = Externals.getInstance();
500
+ pidPositionMap.forEach((position, pid) => {
501
+ if (this.groundParams || this.modelElement instanceof FloorModel) {
502
+ const savedPosition = this.indicatorPositionMap.get(pid);
503
+ if (!savedPosition) {
504
+ let p;
505
+ // console.log('## PanoramaGroup.presentPanoramaIndicators() will update indicator position');
506
+ if (this.groundParams && this.groundParams.groundPlane) {
507
+ p = FloorModel.intersectWithGroundPlane(position, this.groundParams);
508
+ }
509
+ else {
510
+ const model = this.modelElement;
511
+ p = model.intersectGround(position);
512
+ }
513
+ if (p) {
514
+ this.indicatorPositionMap.set(pid, p.add(new THREE.Vector3(0, 0, PanoramaGroup.IndicatorOffsetZ)));
515
+ }
516
+ }
517
+ }
518
+ this.inSightIndicators.push(pid);
519
+ });
520
+ this.needUpdate = true;
521
+ }
522
+ updateIndicatorsPositions() {
523
+ return __awaiter(this, void 0, void 0, function* () {
524
+ const { THREE } = Externals.getInstance();
525
+ this.panoramaMap.forEach((pano, pid) => {
526
+ const savedPosition = this.indicatorPositionMap.get(pid);
527
+ if (savedPosition)
528
+ return;
529
+ const { position } = pano;
530
+ let p;
531
+ // console.log('## PanoramaGroup.presentPanoramaIndicators() will update indicator position');
532
+ if (this.groundParams && this.groundParams.groundPlane) {
533
+ p = FloorModel.intersectWithGroundPlane(position, this.groundParams);
534
+ }
535
+ else {
536
+ const model = this.modelElement;
537
+ p = model.intersectGround(position);
538
+ }
539
+ if (p) {
540
+ this.indicatorPositionMap.set(pid, p.add(new THREE.Vector3(0, 0, PanoramaGroup.IndicatorOffsetZ)));
541
+ }
542
+ });
543
+ const pidPositionMap = yield this.getPIDPositionMap(this.inSightIndicators);
544
+ this.presentPanoramaIndicators(pidPositionMap);
545
+ });
546
+ }
547
+ /**
548
+ * 显示指定全景点及其相邻全景点上的标签
549
+ * @param pid “中心”全景点ID,一般指摄像机当前所在的全景点PID
550
+ */
551
+ presentPanoramaIndicatorsAround(pid, view) {
552
+ return __awaiter(this, void 0, void 0, function* () {
553
+ const pids = this.panoramaIDsAround(pid, view);
554
+ if (pids) {
555
+ const pidPositionMap = yield this.getPIDPositionMap(pids);
556
+ this.presentPanoramaIndicators(pidPositionMap);
557
+ }
558
+ });
559
+ }
560
+ getIndicatorVisibility(pid) {
561
+ const visibility = this.indicatorVisibilityMap.get(pid);
562
+ if (undefined === visibility)
563
+ return true;
564
+ return visibility;
565
+ }
566
+ /**
567
+ * 设置指定全景点位的显示/隐藏状态
568
+ * @param visibility 显示/隐藏状态
569
+ * @param pid 可选,可以是全景图点位PID数组,也可以是单个PID,
570
+ * 若不设置则应用到本PanoramaGroup的所有全景点位上
571
+ */
572
+ setIndicatorVisibility(visibility, pid) {
573
+ let pidArray;
574
+ if (pid === undefined) {
575
+ pidArray = [];
576
+ this.indicatorMap.forEach((value, key) => {
577
+ pidArray.push(key);
578
+ });
579
+ }
580
+ else if (Array.isArray(pid)) {
581
+ pidArray = pid;
582
+ }
583
+ else {
584
+ pidArray = [pid];
585
+ }
586
+ pidArray.forEach((value) => {
587
+ this.indicatorVisibilityMap.set(value, visibility);
588
+ const indicator = this.indicatorMap.get(value);
589
+ if (indicator) {
590
+ this.group.remove(indicator);
591
+ this.indicatorMap.delete(value);
592
+ }
593
+ });
594
+ this.needUpdate = true;
595
+ }
596
+ setIndicatorHidden(hidden, pid) {
597
+ let pidArray;
598
+ if (pid === undefined) {
599
+ pidArray = [];
600
+ this.indicatorMap.forEach((value, key) => {
601
+ pidArray.push(key);
602
+ });
603
+ }
604
+ else if (Array.isArray(pid)) {
605
+ pidArray = pid;
606
+ }
607
+ else {
608
+ pidArray = [pid];
609
+ }
610
+ pidArray.forEach((value) => {
611
+ this.indicatorHiddenMap.set(value, hidden);
612
+ const indicator = this.indicatorMap.get(value);
613
+ if (indicator) {
614
+ this.group.remove(indicator);
615
+ this.indicatorMap.delete(value);
616
+ }
617
+ });
618
+ this.needUpdate = true;
619
+ }
620
+ /**
621
+ * 与全景点标志作相交测试
622
+ * 若有任一个全景点标志与射线相交则返回最近一个的相应PID
623
+ * 若没有则返回-1
624
+ * @param rayOrigin 射线起点
625
+ * @param rayDirection 射线方向
626
+ */
627
+ intersectIndicators(rayOrigin, rayDirection) {
628
+ let results = [];
629
+ const v = rayDirection.normalize();
630
+ const radius = Math.min(this.indicatorHeight, this.indicatorWidth) / 2;
631
+ this.indicatorMap.forEach((indicator, pid) => {
632
+ const p = indicator.position;
633
+ if (Number.isNaN(p.x))
634
+ return;
635
+ const u = p.clone().sub(rayOrigin);
636
+ const uDotV = u.dot(v);
637
+ if (uDotV > 0) {
638
+ const uOnV = v.clone().multiplyScalar(uDotV);
639
+ const distance = u.sub(uOnV).length();
640
+ if (distance <= radius) {
641
+ results.push({
642
+ pid,
643
+ distance,
644
+ });
645
+ }
646
+ }
647
+ });
648
+ if (results.length > 0) {
649
+ results = results.sort((a, b) => {
650
+ if (a.distance < b.distance)
651
+ return -1;
652
+ if (a.distance > b.distance)
653
+ return 1;
654
+ return 0;
655
+ });
656
+ return results[0].pid;
657
+ }
658
+ return -1;
659
+ }
660
+ intersectIndicatorsOnScreen(screenPosition, radius, { screenWidth, screenHeight }, camera) {
661
+ const indicatorsEntries = Array.from(this.indicatorMap);
662
+ const indicators = indicatorsEntries.map(([, mesh]) => mesh);
663
+ const intersection = BasicTools.getMouseIntersectionOnScreen(indicators, screenPosition, { screenWidth, screenHeight }, radius, camera, indicators, this.maxWorldDistance);
664
+ if (intersection) {
665
+ const target = indicatorsEntries.find(([, mesh]) => mesh === intersection);
666
+ if (target)
667
+ return target[0];
668
+ }
669
+ return -1;
670
+ }
671
+ /**
672
+ * 添加全景点
673
+ * @param {Panorama} pano 全景图对象
674
+ */
675
+ putPanorama(pano) {
676
+ const oldNode = this.panoramaMap.get(pano.pid);
677
+ if (oldNode) {
678
+ // console.info('#PanoCtrl# 4 Will remove pano:', oldNode.position);
679
+ this.group.remove(oldNode);
680
+ oldNode.dispose();
681
+ }
682
+ this.panoramaMap.set(pano.pid, pano);
683
+ // pano.visible = false;
684
+ this.group.add(pano);
685
+ this.needUpdate = true;
686
+ }
687
+ /**
688
+ * 指定预构建全景对象的顺序策略
689
+ * @param preInitStrategy 多义参数,表示具体的创建顺序
690
+ * 当为'all'时,直接按构造函数中panoramaDataList的顺序创建全部全景对象
691
+ * 当为一个整数值时,表示一个全景PID,将按全景点邻接关系以广度优先搜索的顺序创建全景对象
692
+ * 当为一个整数数组时,以数组指定的PID顺序依次创建
693
+ */
694
+ initializePanoramasIfNecessary(preInitStrategy) {
695
+ return __awaiter(this, void 0, void 0, function* () {
696
+ let pids = [];
697
+ if (Array.isArray(preInitStrategy)) {
698
+ pids = preInitStrategy;
699
+ }
700
+ else if (preInitStrategy === 'all') {
701
+ pids = Array.from(this.panoramaDatas.keys());
702
+ }
703
+ else {
704
+ const pid0 = preInitStrategy;
705
+ pids.push(pid0);
706
+ const visited = new Set();
707
+ visited.add(pid0);
708
+ const bfsQueue = [pid0];
709
+ while (bfsQueue.length > 0) {
710
+ const pid = bfsQueue.splice(0, 1)[0];
711
+ const pano = this.panoramaDatas.get(pid);
712
+ if (pano) {
713
+ pano.neighbourPanoramaIDs.forEach((neighbourPID) => {
714
+ if (!visited.has(neighbourPID)) {
715
+ visited.add(neighbourPID);
716
+ bfsQueue.push(neighbourPID);
717
+ pids.push(neighbourPID);
718
+ }
719
+ });
720
+ }
721
+ }
722
+ }
723
+ const promises = pids.map((pid) => this.getPanoramaByPID(pid));
724
+ return Promise.all(promises);
725
+ });
726
+ }
727
+ /**
728
+ * 获得指定ID的全景点对象
729
+ * @param pid 全景点ID
730
+ */
731
+ getPanoramaByPID(pid) {
732
+ return __awaiter(this, void 0, void 0, function* () {
733
+ const ret = this.panoramaMap.get(pid);
734
+ if (ret) {
735
+ return ret;
736
+ }
737
+ const creatingTask = this.panoramaCreatingTasks.get(pid);
738
+ if (creatingTask) {
739
+ return creatingTask;
740
+ }
741
+ const item = this.panoramaDatas.get(pid);
742
+ if (!item) {
743
+ return undefined;
744
+ }
745
+ const task = new Promise((resolve) => {
746
+ const panorama = new Panorama(item.pid, item.seqID, item.textureURLs, [2, 2], item.neighbourPanoramaIDs, item.highTextureURLs, item.useLowTextureURLsOnly, item.tiledTextureURLRoot, item.position, item.quaternion, !!item.legacyMode);
747
+ panorama.scale.set(this.globalScale, this.globalScale, this.globalScale);
748
+ this.putPanorama(panorama);
749
+ this.panoramaCreatingTasks.delete(item.pid);
750
+ // console.info(`#Async# Tasks#${item.pid} done`);
751
+ resolve(panorama);
752
+ });
753
+ this.panoramaCreatingTasks.set(item.pid, task);
754
+ return task;
755
+ });
756
+ }
757
+ /**
758
+ * 立刻获得指定ID的全景点对象
759
+ * @param pid 全景点ID
760
+ */
761
+ getPanoramaByPIDInstant(pid) {
762
+ const ret = this.panoramaMap.get(pid);
763
+ return ret || null;
764
+ }
765
+ /**
766
+ * @ignore
767
+ * @param rayDirection
768
+ */
769
+ getNeghbourPanoClosestToRay(rayDirection) {
770
+ if (this.currentPanoramaID === -1)
771
+ return -1;
772
+ const pano = this.panoramaMap.get(this.currentPanoramaID);
773
+ if (!pano)
774
+ return -1;
775
+ if (!pano.neighborPanoramaIDs || pano.neighborPanoramaIDs.length === 0)
776
+ return -1;
777
+ const AngleDegreeThreshold = 12.0;
778
+ const direction = rayDirection.clone().normalize();
779
+ let maxCos = -1.0;
780
+ let ret = -1;
781
+ pano.neighborPanoramaIDs.forEach((pid) => {
782
+ const neighbour = this.panoramaMap.get(pid);
783
+ if (!neighbour)
784
+ return;
785
+ const cosin = neighbour.position.clone().sub(pano.position).normalize().dot(direction);
786
+ if (cosin > maxCos) {
787
+ maxCos = cosin;
788
+ ret = pid;
789
+ }
790
+ });
791
+ if (maxCos >= Math.cos(Math.PI * AngleDegreeThreshold / 180.0)) {
792
+ return ret;
793
+ }
794
+ return -1;
795
+ }
796
+ updateIndicatorGeometry() {
797
+ const { THREE } = Externals.getInstance();
798
+ let indicatorGeometry;
799
+ if (this.indicatorImageURL) {
800
+ indicatorGeometry = new THREE.PlaneBufferGeometry(this.indicatorWidth, this.indicatorHeight);
801
+ }
802
+ else {
803
+ indicatorGeometry = new THREE.CircleGeometry(this.indicatorWidth / 2, 32);
804
+ }
805
+ const indicatorSet = new Set();
806
+ Array.from(this.indicatorMap).forEach(([, mesh]) => {
807
+ indicatorSet.add(mesh.geometry);
808
+ mesh.geometry = indicatorGeometry;
809
+ });
810
+ Array.from(indicatorSet).forEach((geometry) => {
811
+ geometry.dispose();
812
+ });
813
+ this.indicatorMeshPrototype.geometry = indicatorGeometry;
814
+ const indicator = new THREE.Mesh(indicatorGeometry, this.indicatorMeshPrototype.material);
815
+ this.setIndicatorMeshPrototype(indicator);
816
+ }
817
+ /**
818
+ * 改变地面全景点标识的尺寸
819
+ * @param width 宽度
820
+ * @param height 高度
821
+ */
822
+ setIndicatorSize(width, height) {
823
+ this.indicatorWidth = width;
824
+ this.indicatorHeight = height;
825
+ this.updateIndicatorGeometry();
826
+ }
827
+ setIndicatorImageURL(url) {
828
+ const { THREE } = Externals.getInstance();
829
+ new THREE.TextureLoader().load(url, (texture) => {
830
+ const vertexShader = [
831
+ 'varying vec2 vUv;',
832
+ 'void main(){',
833
+ ' vUv = uv;',
834
+ ' gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',
835
+ '}',
836
+ ].join('\n');
837
+ const fragmentShader = [
838
+ 'uniform sampler2D map;',
839
+ 'uniform float opacity;',
840
+ 'uniform vec4 blendColor;',
841
+ 'varying vec2 vUv;',
842
+ 'void main(){',
843
+ ' vec4 texColor = texture2D(map, vUv);',
844
+ ' gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);',
845
+ '}',
846
+ ].join('\n');
847
+ let currentMaterial = this.getIndicatorMaterial(IndicatorDisplayMode.Editing, true);
848
+ let newMaterial = new THREE.ShaderMaterial({
849
+ // 设置透明属性,这样透过全景图就能看到标签
850
+ transparent: true,
851
+ vertexShader,
852
+ fragmentShader,
853
+ uniforms: this.indicatorShaderUniforms,
854
+ side: THREE.DoubleSide,
855
+ depthTest: false,
856
+ depthWrite: false,
857
+ name: 'indicatorMaterial',
858
+ });
859
+ this.setIndicatorMaterial(newMaterial, IndicatorDisplayMode.Editing, true);
860
+ currentMaterial.dispose();
861
+ currentMaterial = this.getIndicatorMaterial(IndicatorDisplayMode.Show, true);
862
+ this.setIndicatorMaterial(newMaterial, IndicatorDisplayMode.Show, true);
863
+ currentMaterial.dispose();
864
+ newMaterial = new THREE.ShaderMaterial({
865
+ transparent: true,
866
+ vertexShader,
867
+ fragmentShader,
868
+ uniforms: this.invisibleIndicatorShaderUniforms,
869
+ side: THREE.DoubleSide,
870
+ depthTest: false,
871
+ depthWrite: false,
872
+ name: 'invisibleIndicatorMaterial',
873
+ });
874
+ this.indicatorShaderUniforms.map.value = texture;
875
+ this.invisibleIndicatorShaderUniforms.map.value = texture;
876
+ this.setIndicatorMaterial(newMaterial, IndicatorDisplayMode.Editing, false);
877
+ if (!this.indicatorImageURL) {
878
+ this.setIndicatorMeshPrototype(new THREE.Mesh(new THREE.PlaneBufferGeometry(this.indicatorWidth, this.indicatorHeight), newMaterial));
879
+ }
880
+ this.indicatorImageURL = url;
881
+ this.needUpdate = true;
882
+ this.updateIndicatorGeometry();
883
+ });
884
+ }
885
+ /**
886
+ * 查询当前设置的地面全景点标识尺寸
887
+ * @returns number数组,依次是width, height
888
+ */
889
+ getIndicatorSize() {
890
+ return [this.indicatorWidth, this.indicatorHeight];
891
+ }
892
+ setIndicatorMeshPrototype(mesh) {
893
+ this.indicatorMeshPrototype = mesh;
894
+ this.panoramaMap.forEach((pano, pid) => {
895
+ const indicator = this.indicatorMap.get(pid);
896
+ if (indicator) {
897
+ this.group.remove(indicator);
898
+ this.indicatorMap.delete(pid);
899
+ }
900
+ });
901
+ mesh.renderOrder = 300;
902
+ this.needUpdate = true;
903
+ }
904
+ /**
905
+ * 设定全景点位标签的原型对象,每个全景点位的标签会以该原型对象为母本clone出来
906
+ * @param prototypeObject 点位标签原型Object3D对象
907
+ * @param mode 点位的展示模式
908
+ * @param visibility 点位的显隐状态设置
909
+ */
910
+ setIndicatorMaterial(material, mode, visibility) {
911
+ let map1 = this.indicatorMaterials.get(mode);
912
+ if (!map1) {
913
+ map1 = new Map();
914
+ this.indicatorMaterials.set(mode, map1);
915
+ }
916
+ map1.set(visibility, material);
917
+ this.needUpdate = true;
918
+ }
919
+ getIndicatorMaterial(mode, visibility) {
920
+ let map1 = this.indicatorMaterials.get(mode);
921
+ if (!map1) {
922
+ map1 = new Map();
923
+ this.indicatorMaterials.set(mode, map1);
924
+ }
925
+ return map1.get(visibility);
926
+ }
927
+ /**
928
+ * 配置全景图组在不同view中的显示状态
929
+ * @param configuration 全景图组配置,见[[PanoramaGroupViewConfiguration]]
930
+ */
931
+ addGroupViewConfiguration(configuration) {
932
+ const conf0 = this.viewConfigurations.get(configuration.targetView);
933
+ if (conf0) {
934
+ if (configuration.showBoundBox === undefined && conf0.showBoundBox !== undefined) {
935
+ configuration.showBoundBox = conf0.showBoundBox;
936
+ }
937
+ if (configuration.visibleRadius === undefined && conf0.visibleRadius !== undefined) {
938
+ configuration.visibleRadius = conf0.visibleRadius;
939
+ }
940
+ if (configuration.indicatorDisplayMode === undefined && conf0.indicatorDisplayMode !== undefined) {
941
+ configuration.indicatorDisplayMode = conf0.indicatorDisplayMode;
942
+ }
943
+ }
944
+ this.viewConfigurations.set(configuration.targetView, configuration);
945
+ this.needUpdate = true;
946
+ // /!!!For Debug #Async#
947
+ // this.setBoundBoxVisible(configuration.showBoundBox!);
948
+ }
949
+ /**
950
+ * 配置组中所有全景图在不同view中的显示状态
951
+ * @param configuration 全景图显示配置
952
+ */
953
+ addViewConfiguration(configuration) {
954
+ return __awaiter(this, void 0, void 0, function* () {
955
+ const panos = yield this.allPanoramas();
956
+ panos.forEach((p) => { p.addViewConfiguration(configuration); });
957
+ });
958
+ }
959
+ setMaxWorldDistance(distance) {
960
+ this.maxWorldDistance = distance;
961
+ }
962
+ }
963
+ PanoramaGroup.DefaultVisibleRadius = 10;
964
+ PanoramaGroup.IndicatorRadius = 0.1;
965
+ PanoramaGroup.IndicatorOffsetZ = 0.1;
966
+ export { PanoramaGroup, IndicatorDisplayMode, };