@mapxus/mapxus-visual-jp 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/bitbucket-pipelines.yml +50 -0
  2. package/config/rollup.js +33 -0
  3. package/config/rollup.serve.config.js +3 -0
  4. package/debug/circlemarker.html +444 -0
  5. package/debug/create_tags.html +474 -0
  6. package/debug/distance.html +220 -0
  7. package/debug/index.html +92 -0
  8. package/debug/integration.html +1084 -0
  9. package/debug/leaflet.html +54 -0
  10. package/debug/markers.html +115 -0
  11. package/debug/multi_monitor_sync.html +377 -0
  12. package/debug/outdoor.html +1026 -0
  13. package/debug/rect_tags.html +147 -0
  14. package/debug/rotate.html +236 -0
  15. package/debug/sample.html +324 -0
  16. package/debug/sequence.html +75 -0
  17. package/debug/tags.html +218 -0
  18. package/package.json +34 -10
  19. package/rollup.config.js +39 -0
  20. package/server.js +35 -0
  21. package/spec/api/APIv3.spec.ts +86 -0
  22. package/spec/component/Component.spec.ts +68 -0
  23. package/spec/component/StatsComponent.spec.ts +33 -0
  24. package/spec/component/direction/DirectionComponent.spec.ts +163 -0
  25. package/spec/component/direction/DirectionDOMRenderer.spec.ts +233 -0
  26. package/spec/component/keyboard/KeyZoomHandler.spec.ts +236 -0
  27. package/spec/component/marker/Marker.spec.ts +104 -0
  28. package/spec/component/marker/MarkerComponent.spec.ts +88 -0
  29. package/spec/component/marker/MarkerScene.spec.ts +223 -0
  30. package/spec/component/marker/MarkerSet.spec.ts +453 -0
  31. package/spec/component/mouse/DoubleClickZoomHandler.spec.ts +211 -0
  32. package/spec/component/popup/Popup.spec.ts +479 -0
  33. package/spec/component/popup/PopupComponent.spec.ts +414 -0
  34. package/spec/component/tag/CreateHandlerBase.spec.ts +83 -0
  35. package/spec/component/tag/CreatePointHandler.spec.ts +190 -0
  36. package/spec/component/tag/OutlineRenderTag.spec.ts +91 -0
  37. package/spec/component/tag/PointGeometry.spec.ts +131 -0
  38. package/spec/component/tag/PolygonGeometry.spec.ts +497 -0
  39. package/spec/component/tag/RectGeometry.spec.ts +1157 -0
  40. package/spec/component/tag/TagComponent.spec.ts +513 -0
  41. package/spec/component/tag/TagScene.spec.ts +346 -0
  42. package/spec/component/tag/TagSet.spec.ts +241 -0
  43. package/spec/component/utils/HandlerBase.spec.ts +203 -0
  44. package/spec/geo/Camera.spec.ts +250 -0
  45. package/spec/geo/GeoCoords.spec.ts +364 -0
  46. package/spec/geo/Spatial.spec.ts +711 -0
  47. package/spec/geo/Transform.spec.ts +850 -0
  48. package/spec/geo/ViewportCoords.spec.ts +534 -0
  49. package/spec/graph/FilterCreator.spec.ts +892 -0
  50. package/spec/graph/Graph.spec.ts +2078 -0
  51. package/spec/graph/GraphCalculator.spec.ts +263 -0
  52. package/spec/graph/GraphService.spec.ts +663 -0
  53. package/spec/graph/Node.spec.ts +373 -0
  54. package/spec/graph/NodeCache.spec.ts +206 -0
  55. package/spec/graph/Sequence.spec.ts +37 -0
  56. package/spec/graph/edge/EdgeCalculator.Pano.spec.ts +963 -0
  57. package/spec/graph/edge/EdgeCalculator.Sequence.spec.ts +108 -0
  58. package/spec/graph/edge/EdgeCalculator.Similar.spec.ts +272 -0
  59. package/spec/graph/edge/EdgeCalculator.Step.spec.ts +383 -0
  60. package/spec/graph/edge/EdgeCalculator.Turn.spec.ts +278 -0
  61. package/spec/graph/edge/EdgeCalculator.spec.ts +747 -0
  62. package/spec/helper/ContainerMockCreator.spec.ts +33 -0
  63. package/spec/helper/DOMRendererMockCreator.spec.ts +22 -0
  64. package/spec/helper/EdgeCalculatorHelper.spec.ts +96 -0
  65. package/spec/helper/EventHelper.spec.ts +92 -0
  66. package/spec/helper/GLRendererMockCreator.spec.ts +23 -0
  67. package/spec/helper/GeoHelper.spec.ts +16 -0
  68. package/spec/helper/ImageLoadingServiceMockCreator.spec.ts +24 -0
  69. package/spec/helper/KeyboardServiceMockCreator.spec.ts +21 -0
  70. package/spec/helper/LoadingServiceMockCreator.spec.ts +21 -0
  71. package/spec/helper/MockCreator.spec.ts +18 -0
  72. package/spec/helper/MockCreatorBase.spec.ts +17 -0
  73. package/spec/helper/MouseServiceMockCreator.spec.ts +38 -0
  74. package/spec/helper/NavigatorMockCreator.spec.ts +28 -0
  75. package/spec/helper/NodeHelper.spec.ts +77 -0
  76. package/spec/helper/NodeMockCreator.spec.ts +19 -0
  77. package/spec/helper/RenderServiceMockCreator.spec.ts +25 -0
  78. package/spec/helper/SpriteServiceMockCreator.spec.ts +22 -0
  79. package/spec/helper/StateServiceMockCreator.spec.ts +33 -0
  80. package/spec/helper/TouchServiceMockCreator.spec.ts +29 -0
  81. package/spec/helper/TransformHelper.spec.ts +17 -0
  82. package/spec/render/DOMRenderer.spec.ts +112 -0
  83. package/spec/render/GLRenderer.spec.ts +453 -0
  84. package/spec/render/RenderCamera.spec.ts +535 -0
  85. package/spec/render/RenderService.spec.ts +531 -0
  86. package/spec/state/StateBase.spec.ts +369 -0
  87. package/spec/state/StateService.spec.ts +9 -0
  88. package/spec/state/TraversingState.spec.ts +262 -0
  89. package/spec/state/WaitingState.spec.ts +319 -0
  90. package/spec/tiles/TextureProvider.spec.ts +653 -0
  91. package/spec/utils/EventEmitter.spec.ts +71 -0
  92. package/spec/utils/Support.spec.ts +54 -0
  93. package/spec/viewer/CacheService.spec.ts +160 -0
  94. package/spec/viewer/ComponentController.spec.ts +310 -0
  95. package/spec/viewer/LoadingService.spec.ts +19 -0
  96. package/spec/viewer/MouseService.spec.ts +1344 -0
  97. package/spec/viewer/Navigator.spec.ts +970 -0
  98. package/spec/viewer/Observer.spec.ts +96 -0
  99. package/spec/viewer/SpriteService.spec.ts +224 -0
  100. package/src/API.ts +3 -0
  101. package/src/Component.ts +77 -0
  102. package/src/Edge.ts +6 -0
  103. package/src/Error.ts +3 -0
  104. package/src/FilterRender.ts +27 -0
  105. package/src/Geo.ts +7 -0
  106. package/src/Graph.ts +19 -0
  107. package/src/MapxusVisual.ts +66 -0
  108. package/src/Render.ts +7 -0
  109. package/src/State.ts +8 -0
  110. package/src/Support.ts +35 -0
  111. package/src/Tiles.ts +5 -0
  112. package/src/Utils.ts +6 -0
  113. package/src/Viewer.ts +16 -0
  114. package/src/api/API.ts +396 -0
  115. package/src/api/Auth.ts +76 -0
  116. package/src/api/AuthStore.ts +11 -0
  117. package/src/api/GraphQLCreator.ts +100 -0
  118. package/src/api/interfaces/IAuth.ts +7 -0
  119. package/src/api/interfaces/IBuildingBase.ts +7 -0
  120. package/src/api/interfaces/IBuildingInfo.ts +19 -0
  121. package/src/api/interfaces/ICoreNode.ts +28 -0
  122. package/src/api/interfaces/IFillNode.ts +96 -0
  123. package/src/api/interfaces/IFloorInfo.ts +10 -0
  124. package/src/api/interfaces/IFullNode.ts +10 -0
  125. package/src/api/interfaces/IGPano.ts +38 -0
  126. package/src/api/interfaces/IImageTagInfo.ts +14 -0
  127. package/src/api/interfaces/IKey.ts +13 -0
  128. package/src/api/interfaces/ILatLon.ts +19 -0
  129. package/src/api/interfaces/IOutdoor.ts +14 -0
  130. package/src/api/interfaces/IPathNode.ts +37 -0
  131. package/src/api/interfaces/IProject.ts +8 -0
  132. package/src/api/interfaces/IQueryBuilding.ts +37 -0
  133. package/src/api/interfaces/IResponse.ts +7 -0
  134. package/src/api/interfaces/ISequence.ts +16 -0
  135. package/src/api/interfaces/IUser.ts +13 -0
  136. package/src/api/interfaces/interfaces.ts +17 -0
  137. package/src/component/AttributionComponent.ts +48 -0
  138. package/src/component/BackgroundComponent.ts +39 -0
  139. package/src/component/BearingComponent.ts +282 -0
  140. package/src/component/CacheComponent.ts +295 -0
  141. package/src/component/Component.ts +130 -0
  142. package/src/component/ComponentService.ts +150 -0
  143. package/src/component/CoverComponent.ts +132 -0
  144. package/src/component/DebugComponent.ts +157 -0
  145. package/src/component/ImageComponent.ts +96 -0
  146. package/src/component/LoadingComponent.ts +85 -0
  147. package/src/component/NavigationComponent.ts +233 -0
  148. package/src/component/RouteComponent.ts +354 -0
  149. package/src/component/StatsComponent.ts +100 -0
  150. package/src/component/direction/DirectionComponent.ts +254 -0
  151. package/src/component/direction/DirectionDOMCalculator.ts +243 -0
  152. package/src/component/direction/DirectionDOMRenderer.ts +631 -0
  153. package/src/component/imageplane/ImagePlaneComponent.ts +497 -0
  154. package/src/component/imageplane/ImagePlaneFactory.ts +314 -0
  155. package/src/component/imageplane/ImagePlaneGLRenderer.ts +247 -0
  156. package/src/component/imageplane/ImagePlaneScene.ts +87 -0
  157. package/src/component/imageplane/ImagePlaneShaders.ts +16 -0
  158. package/src/component/imageplane/SliderComponent.ts +697 -0
  159. package/src/component/imageplane/interfaces/IBBoxShaderMaterial.ts +10 -0
  160. package/src/component/imageplane/interfaces/IShaderMaterial.ts +9 -0
  161. package/src/component/imageplane/interfaces/interfaces.ts +2 -0
  162. package/src/component/imageplane/shaders/equirectangular.fragment.glsl.ts +26 -0
  163. package/src/component/imageplane/shaders/equirectangular.vertex.glsl.ts +15 -0
  164. package/src/component/imageplane/shaders/perspective.fragment.glsl.ts +27 -0
  165. package/src/component/imageplane/shaders/perspective.vertex.glsl.ts +15 -0
  166. package/src/component/interfaces/ICacheConfiguration.ts +72 -0
  167. package/src/component/interfaces/IComponentConfiguration.ts +5 -0
  168. package/src/component/interfaces/ICoverConfiguration.ts +15 -0
  169. package/src/component/interfaces/IDirectionConfiguration.ts +63 -0
  170. package/src/component/interfaces/IImagePlaneConfiguration.ts +17 -0
  171. package/src/component/interfaces/IKeyboardConfiguration.ts +44 -0
  172. package/src/component/interfaces/IMarkerConfiguration.ts +31 -0
  173. package/src/component/interfaces/IMouseConfiguration.ts +52 -0
  174. package/src/component/interfaces/INavigationConfiguration.ts +35 -0
  175. package/src/component/interfaces/IRouteConfiguration.ts +20 -0
  176. package/src/component/interfaces/ISequenceConfiguration.ts +72 -0
  177. package/src/component/interfaces/IShader.ts +6 -0
  178. package/src/component/interfaces/ISliderConfiguration.ts +61 -0
  179. package/src/component/interfaces/ITagConfiguration.ts +40 -0
  180. package/src/component/interfaces/interfaces.ts +17 -0
  181. package/src/component/keyboard/KeySequenceNavigationHandler.ts +86 -0
  182. package/src/component/keyboard/KeySpatialNavigationHandler.ts +216 -0
  183. package/src/component/keyboard/KeyZoomHandler.ts +106 -0
  184. package/src/component/keyboard/KeyboardComponent.ts +125 -0
  185. package/src/component/marker/Marker.ts +5 -0
  186. package/src/component/marker/MarkerComponent.ts +856 -0
  187. package/src/component/marker/MarkerScene.ts +145 -0
  188. package/src/component/marker/MarkerSet.ts +142 -0
  189. package/src/component/marker/interfaces/IArrowMarkerOptions.ts +41 -0
  190. package/src/component/marker/interfaces/ICircleMarkerOptions.ts +30 -0
  191. package/src/component/marker/interfaces/IDotMarkerOptions.ts +18 -0
  192. package/src/component/marker/interfaces/IMarkerEvent.ts +28 -0
  193. package/src/component/marker/interfaces/ISimpleMarkerOptions.ts +54 -0
  194. package/src/component/marker/interfaces/interfaces.ts +5 -0
  195. package/src/component/marker/marker/ArrowMarker.ts +84 -0
  196. package/src/component/marker/marker/CircleMarker.ts +82 -0
  197. package/src/component/marker/marker/DotMarker.ts +68 -0
  198. package/src/component/marker/marker/ImageMarker.ts +45 -0
  199. package/src/component/marker/marker/Marker.ts +99 -0
  200. package/src/component/marker/marker/SimpleMarker.ts +187 -0
  201. package/src/component/mouse/BounceHandler.ts +148 -0
  202. package/src/component/mouse/DoubleClickZoomHandler.ts +106 -0
  203. package/src/component/mouse/DragPanHandler.ts +489 -0
  204. package/src/component/mouse/HandlerTypes.ts +13 -0
  205. package/src/component/mouse/MouseComponent.ts +170 -0
  206. package/src/component/mouse/ScrollZoomHandler.ts +137 -0
  207. package/src/component/mouse/TouchZoomHandler.ts +136 -0
  208. package/src/component/path/PathComponent.ts +75 -0
  209. package/src/component/path/PathEvent.ts +245 -0
  210. package/src/component/path/PathMarker.ts +42 -0
  211. package/src/component/path/PathRender.ts +163 -0
  212. package/src/component/popup/Popup.ts +2 -0
  213. package/src/component/popup/PopupComponent.ts +244 -0
  214. package/src/component/popup/interfaces/IPopupOffset.ts +37 -0
  215. package/src/component/popup/interfaces/IPopupOptions.ts +81 -0
  216. package/src/component/popup/popup/Popup.ts +594 -0
  217. package/src/component/popup/popup/PopupAlignment.ts +3 -0
  218. package/src/component/sequence/SequenceComponent.ts +500 -0
  219. package/src/component/sequence/SequenceDOMInteraction.ts +23 -0
  220. package/src/component/sequence/SequenceDOMRenderer.ts +179 -0
  221. package/src/component/tag/Tag.ts +9 -0
  222. package/src/component/tag/TagComponent.ts +787 -0
  223. package/src/component/tag/TagCreator.ts +138 -0
  224. package/src/component/tag/TagDOMRenderer.ts +35 -0
  225. package/src/component/tag/TagMode.ts +37 -0
  226. package/src/component/tag/TagOperation.ts +7 -0
  227. package/src/component/tag/TagScene.ts +216 -0
  228. package/src/component/tag/TagSet.ts +186 -0
  229. package/src/component/tag/error/GeometryTagError.ts +11 -0
  230. package/src/component/tag/geometry/Geometry.ts +62 -0
  231. package/src/component/tag/geometry/PointGeometry.ts +89 -0
  232. package/src/component/tag/geometry/PolygonGeometry.ts +349 -0
  233. package/src/component/tag/geometry/RectGeometry.ts +759 -0
  234. package/src/component/tag/geometry/VertexGeometry.ts +185 -0
  235. package/src/component/tag/handlers/CreateHandlerBase.ts +81 -0
  236. package/src/component/tag/handlers/CreatePointHandler.ts +35 -0
  237. package/src/component/tag/handlers/CreatePolygonHandler.ts +33 -0
  238. package/src/component/tag/handlers/CreateRectDragHandler.ts +199 -0
  239. package/src/component/tag/handlers/CreateRectHandler.ts +57 -0
  240. package/src/component/tag/handlers/CreateVertexHandler.ts +165 -0
  241. package/src/component/tag/handlers/EditVertexHandler.ts +275 -0
  242. package/src/component/tag/handlers/TagHandlerBase.ts +57 -0
  243. package/src/component/tag/interfaces/IInteraction.ts +14 -0
  244. package/src/component/tag/interfaces/IOutlineCreateTagOptions.ts +15 -0
  245. package/src/component/tag/interfaces/IOutlineTagOptions.ts +89 -0
  246. package/src/component/tag/interfaces/ISpotTagOptions.ts +37 -0
  247. package/src/component/tag/interfaces/interfaces.ts +4 -0
  248. package/src/component/tag/tag/OutlineCreateTag.ts +330 -0
  249. package/src/component/tag/tag/OutlineRenderTag.ts +569 -0
  250. package/src/component/tag/tag/OutlineTag.ts +380 -0
  251. package/src/component/tag/tag/RenderTag.ts +50 -0
  252. package/src/component/tag/tag/SpotRenderTag.ts +160 -0
  253. package/src/component/tag/tag/SpotTag.ts +170 -0
  254. package/src/component/tag/tag/Tag.ts +103 -0
  255. package/src/component/utils/HandlerBase.ts +71 -0
  256. package/src/error/ArgumentBeeviewError.ts +11 -0
  257. package/src/error/BeeviewError.ts +9 -0
  258. package/src/error/GraphBeeviewError.ts +11 -0
  259. package/src/geo/Camera.ts +149 -0
  260. package/src/geo/GeoCoords.ts +280 -0
  261. package/src/geo/GeoRBush.ts +25 -0
  262. package/src/geo/Spatial.ts +259 -0
  263. package/src/geo/Transform.ts +543 -0
  264. package/src/geo/ViewportCoords.ts +518 -0
  265. package/src/geo/interfaces/ILatLonAlt.ts +7 -0
  266. package/src/geo/interfaces/interfaces.ts +1 -0
  267. package/src/graph/FilterCreator.ts +106 -0
  268. package/src/graph/FilterExpression.ts +16 -0
  269. package/src/graph/Graph.ts +1516 -0
  270. package/src/graph/GraphCalculator.ts +197 -0
  271. package/src/graph/GraphService.ts +516 -0
  272. package/src/graph/ImageLoadingService.ts +44 -0
  273. package/src/graph/MeshReader.ts +19 -0
  274. package/src/graph/Node.ts +622 -0
  275. package/src/graph/NodeCache.ts +548 -0
  276. package/src/graph/Sequence.ts +117 -0
  277. package/src/graph/edge/EdgeCalculator.ts +919 -0
  278. package/src/graph/edge/EdgeCalculatorCoefficients.ts +43 -0
  279. package/src/graph/edge/EdgeCalculatorDirections.ts +80 -0
  280. package/src/graph/edge/EdgeCalculatorSettings.ts +61 -0
  281. package/src/graph/edge/EdgeDirection.ts +63 -0
  282. package/src/graph/edge/interfaces/IEdge.ts +26 -0
  283. package/src/graph/edge/interfaces/IEdgeData.ts +22 -0
  284. package/src/graph/edge/interfaces/IPano.ts +8 -0
  285. package/src/graph/edge/interfaces/IPotentialEdge.ts +106 -0
  286. package/src/graph/edge/interfaces/IStep.ts +7 -0
  287. package/src/graph/edge/interfaces/ITurn.ts +7 -0
  288. package/src/graph/edge/interfaces/interfaces.ts +6 -0
  289. package/src/graph/interfaces/IEdgeStatus.ts +25 -0
  290. package/src/graph/interfaces/IGraphConfiguration.ts +26 -0
  291. package/src/graph/interfaces/ILoadStatus.ts +18 -0
  292. package/src/graph/interfaces/ILoadStatusObject.ts +8 -0
  293. package/src/graph/interfaces/IMesh.ts +20 -0
  294. package/src/graph/interfaces/interfaces.ts +5 -0
  295. package/src/render/DOMRenderer.ts +288 -0
  296. package/src/render/GLRenderStage.ts +6 -0
  297. package/src/render/GLRenderer.ts +436 -0
  298. package/src/render/RenderCamera.ts +212 -0
  299. package/src/render/RenderMode.ts +34 -0
  300. package/src/render/RenderService.ts +264 -0
  301. package/src/render/interfaces/IGLRender.ts +10 -0
  302. package/src/render/interfaces/IGLRenderFunction.ts +10 -0
  303. package/src/render/interfaces/IGLRenderHash.ts +8 -0
  304. package/src/render/interfaces/ISize.ts +6 -0
  305. package/src/render/interfaces/IVNodeHash.ts +8 -0
  306. package/src/render/interfaces/interfaces.ts +5 -0
  307. package/src/state/FrameGenerator.ts +36 -0
  308. package/src/state/State.ts +6 -0
  309. package/src/state/StateContext.ts +180 -0
  310. package/src/state/StateService.ts +600 -0
  311. package/src/state/StateTransitionMatrix.ts +58 -0
  312. package/src/state/interfaces/ICurrentState.ts +21 -0
  313. package/src/state/interfaces/IFrame.ts +9 -0
  314. package/src/state/interfaces/IRotation.ts +6 -0
  315. package/src/state/interfaces/IState.ts +11 -0
  316. package/src/state/interfaces/IStateContext.ts +31 -0
  317. package/src/state/interfaces/interfaces.ts +5 -0
  318. package/src/state/states/StateBase.ts +425 -0
  319. package/src/state/states/TraversingState.ts +861 -0
  320. package/src/state/states/WaitingState.ts +109 -0
  321. package/src/tiles/ImageTileLoader.ts +121 -0
  322. package/src/tiles/ImageTileStore.ts +70 -0
  323. package/src/tiles/RegionOfInterestCalculator.ts +158 -0
  324. package/src/tiles/TextureProvider.ts +609 -0
  325. package/src/tiles/interfaces/IBoundingBox.ts +28 -0
  326. package/src/tiles/interfaces/IRegionOfInterest.ts +25 -0
  327. package/src/tiles/interfaces/interfaces.ts +2 -0
  328. package/src/utils/DOM.ts +28 -0
  329. package/src/utils/EventEmitter.ts +61 -0
  330. package/src/utils/Func.ts +3 -0
  331. package/src/utils/Settings.ts +39 -0
  332. package/src/utils/Support.ts +70 -0
  333. package/src/utils/Urls.ts +43 -0
  334. package/src/viewer/Alignment.ts +53 -0
  335. package/src/viewer/CacheService.ts +75 -0
  336. package/src/viewer/ComponentController.ts +237 -0
  337. package/src/viewer/Container.ts +100 -0
  338. package/src/viewer/EventNames.ts +192 -0
  339. package/src/viewer/ImageSize.ts +28 -0
  340. package/src/viewer/KeyboardService.ts +15 -0
  341. package/src/viewer/LoadingService.ts +66 -0
  342. package/src/viewer/MouseService.ts +541 -0
  343. package/src/viewer/Navigator.ts +362 -0
  344. package/src/viewer/Observer.ts +441 -0
  345. package/src/viewer/Projection.ts +162 -0
  346. package/src/viewer/SpriteService.ts +281 -0
  347. package/src/viewer/TouchService.ts +336 -0
  348. package/src/viewer/Viewer.ts +1132 -0
  349. package/src/viewer/interfaces/IComponentOptions.ts +176 -0
  350. package/src/viewer/interfaces/IMouseClaim.ts +6 -0
  351. package/src/viewer/interfaces/IMouseDeferPixels.ts +6 -0
  352. package/src/viewer/interfaces/IPinch.ts +81 -0
  353. package/src/viewer/interfaces/ISpriteAtlas.ts +12 -0
  354. package/src/viewer/interfaces/IUnprojection.ts +9 -0
  355. package/src/viewer/interfaces/IViewerMouseEvent.ts +56 -0
  356. package/src/viewer/interfaces/IViewerOptions.ts +88 -0
  357. package/src/viewer/interfaces/PointOfView.ts +19 -0
  358. package/src/viewer/interfaces/interfaces.ts +9 -0
  359. package/styles/AttributionComponent.css +26 -0
  360. package/styles/BackgroundComponent.css +21 -0
  361. package/styles/BearingComponent.css +48 -0
  362. package/styles/CoverComponent.css +169 -0
  363. package/styles/DebugComponent.css +28 -0
  364. package/styles/DirectionComponent.css +154 -0
  365. package/styles/LoadingComponent.css +14 -0
  366. package/styles/NavigationComponent.css +64 -0
  367. package/styles/NorthBg.png +0 -0
  368. package/styles/PopupComponent.css +188 -0
  369. package/styles/RouteComponent.css +21 -0
  370. package/styles/SequenceComponent.css +120 -0
  371. package/styles/SliderComponent.css +82 -0
  372. package/styles/TagComponent.css +105 -0
  373. package/styles/cover-logo.png +0 -0
  374. package/styles/mapillary-js.css +29 -0
  375. package/styles/pano-indicator.svg +3 -0
  376. package/styles/pano.svg +20 -0
  377. package/styles/pointer-wheat.svg +3 -0
  378. package/styles/pointer-white.svg +3 -0
  379. package/styles/spinner.svg +1 -0
  380. package/styles/stepper-left.svg +1 -0
  381. package/styles/stepper-play.svg +1 -0
  382. package/styles/stepper-right.svg +1 -0
  383. package/styles/stepper-stop.svg +1 -0
  384. package/styles/turn-around.svg +3 -0
  385. package/styles/turn.svg +3 -0
  386. package/tsconfig.json +28 -0
  387. package/tslint.json +81 -0
  388. package/types/graphql/index.d.ts +28 -0
  389. package/types/graphql/language/ast/index.d.ts +7 -0
  390. package/types/images/index.d.ts +7 -0
  391. package/types/pbf/index.d.ts +16 -0
  392. package/types/rbush/index.d.ts +28 -0
  393. package/version/beeview-0.1.0.css +2 -0
  394. package/version/beeview-0.1.0.js +1 -0
  395. package/version/beeview-0.1.1.css +2 -0
  396. package/version/beeview-0.1.1.js +1 -0
  397. package/version/beeview-0.1.2.css +2 -0
  398. package/version/beeview-0.1.2.js +1 -0
  399. package/version/beeview-0.2.0.css +2 -0
  400. package/version/beeview-0.2.0.js +1 -0
  401. package/version/beeview-0.2.1.css +2 -0
  402. package/version/beeview-0.2.1.js +1 -0
  403. package/version/beeview-0.3.0.css +2 -0
  404. package/version/beeview-0.3.0.js +1 -0
  405. package/version/beeview-0.4.0.css +2 -0
  406. package/version/beeview-0.4.0.js +1 -0
  407. package/version/beeview-0.4.1.css +2 -0
  408. package/version/beeview-0.4.1.js +1 -0
  409. package/version/mapxus-visual-1.0.0.css +2 -0
  410. package/version/mapxus-visual-1.0.0.js +1 -0
  411. package/version/mapxus-visual-1.1.0.css +2 -0
  412. package/version/mapxus-visual-1.1.0.js +1 -0
  413. package/version/mapxus-visual-1.1.1.css +2 -0
  414. package/version/mapxus-visual-1.1.1.js +1 -0
  415. package/version/mapxus-visual-1.1.2.css +2 -0
  416. package/version/mapxus-visual-1.1.2.js +1 -0
  417. package/version/mapxus-visual-1.2.0.css +2 -0
  418. package/version/mapxus-visual-1.2.0.js +1 -0
  419. package/version/mapxus-visual-1.3.0.css +2 -0
  420. package/version/mapxus-visual-1.3.0.js +1 -0
  421. package/LICENSE +0 -11
  422. package/README.md +0 -28
  423. package/index.css +0 -2
  424. package/index.d.ts +0 -163
  425. package/index.js +0 -1
@@ -0,0 +1,919 @@
1
+ import * as THREE from "three";
2
+
3
+ import { Node, Sequence } from "../../Graph";
4
+ import type {
5
+ IStep,
6
+ ITurn,
7
+ IPano,
8
+ IEdge,
9
+ IPotentialEdge,
10
+ } from "./interfaces/interfaces";
11
+ import { EdgeDirection } from "./EdgeDirection";
12
+ import { EdgeCalculatorSettings } from "./EdgeCalculatorSettings";
13
+ import { EdgeCalculatorDirections } from "./EdgeCalculatorDirections";
14
+ import { EdgeCalculatorCoefficients } from "./EdgeCalculatorCoefficients";
15
+ import { ArgumentBeeviewError } from "../../Error";
16
+ import { GeoCoords, Spatial } from "../../Geo";
17
+
18
+ /**
19
+ * @class EdgeCalculator
20
+ *
21
+ * @classdesc Represents a class for calculating node edges.
22
+ */
23
+ export class EdgeCalculator {
24
+ private _spatial: Spatial;
25
+ private _geoCoords: GeoCoords;
26
+
27
+ private _settings: EdgeCalculatorSettings;
28
+ private _directions: EdgeCalculatorDirections;
29
+ private _coefficients: EdgeCalculatorCoefficients;
30
+
31
+ /**
32
+ * Create a new edge calculator instance.
33
+ *
34
+ * @param {EdgeCalculatorSettings} settings - Settings struct.
35
+ * @param {EdgeCalculatorDirections} directions - Directions struct.
36
+ * @param {EdgeCalculatorCoefficients} coefficients - Coefficients struct.
37
+ */
38
+ constructor(
39
+ settings?: EdgeCalculatorSettings,
40
+ directions?: EdgeCalculatorDirections,
41
+ coefficients?: EdgeCalculatorCoefficients,
42
+ ) {
43
+ this._spatial = new Spatial();
44
+ this._geoCoords = new GeoCoords();
45
+
46
+ this._settings =
47
+ settings != null ? settings : new EdgeCalculatorSettings();
48
+ this._directions =
49
+ directions != null ? directions : new EdgeCalculatorDirections();
50
+ this._coefficients =
51
+ coefficients != null
52
+ ? coefficients
53
+ : new EdgeCalculatorCoefficients();
54
+ }
55
+
56
+ /**
57
+ * Returns the potential edges to destination nodes for a set
58
+ * of nodes with respect to a source node.
59
+ *
60
+ * @param {Node} node - Source node.
61
+ * @param {Array<Node>} nodes - Potential destination nodes.
62
+ * @param {Array<string>} fallbackKeys - Keys for destination nodes that should
63
+ * be returned even if they do not meet the criteria for a potential edge.
64
+ * @throws {ArgumentBeeviewError} If node is not full.
65
+ */
66
+ public getPotentialEdges(
67
+ node: Node,
68
+ potentialNodes: Node[],
69
+ fallbackKeys: string[],
70
+ ): IPotentialEdge[] {
71
+ if (!node.full) {
72
+ throw new ArgumentBeeviewError("Node has to be full.");
73
+ }
74
+
75
+ if (!node.merged) {
76
+ return [];
77
+ }
78
+
79
+ let currentDirection: THREE.Vector3 = this._spatial.viewingDirection(
80
+ node.rotation,
81
+ );
82
+ let currentVerticalDirection: number = this._spatial.angleToPlane(
83
+ currentDirection.toArray(),
84
+ [0, 0, 1],
85
+ );
86
+
87
+ let potentialEdges: IPotentialEdge[] = [];
88
+
89
+ for (let potential of potentialNodes) {
90
+ if (!potential.merged || potential.key === node.key) {
91
+ continue;
92
+ }
93
+
94
+ let enu: number[] = this._geoCoords.geodeticToEnu(
95
+ potential.latLon.lat,
96
+ potential.latLon.lon,
97
+ potential.alt,
98
+ node.latLon.lat,
99
+ node.latLon.lon,
100
+ node.alt,
101
+ );
102
+
103
+ let motion: THREE.Vector3 = new THREE.Vector3(
104
+ enu[0],
105
+ enu[1],
106
+ enu[2],
107
+ );
108
+ let distance: number = motion.length();
109
+
110
+ if (
111
+ distance > this._settings.maxDistance &&
112
+ fallbackKeys.indexOf(potential.key) < 0
113
+ ) {
114
+ continue;
115
+ }
116
+
117
+ let motionChange: number = this._spatial.angleBetweenVector2(
118
+ currentDirection.x,
119
+ currentDirection.y,
120
+ motion.x,
121
+ motion.y,
122
+ );
123
+
124
+ let verticalMotion: number = this._spatial.angleToPlane(
125
+ motion.toArray(),
126
+ [0, 0, 1],
127
+ );
128
+
129
+ let direction: THREE.Vector3 = this._spatial.viewingDirection(
130
+ potential.rotation,
131
+ );
132
+
133
+ let directionChange: number = this._spatial.angleBetweenVector2(
134
+ currentDirection.x,
135
+ currentDirection.y,
136
+ direction.x,
137
+ direction.y,
138
+ );
139
+
140
+ let verticalDirection: number = this._spatial.angleToPlane(
141
+ direction.toArray(),
142
+ [0, 0, 1],
143
+ );
144
+ let verticalDirectionChange: number =
145
+ verticalDirection - currentVerticalDirection;
146
+
147
+ let rotation: number = this._spatial.relativeRotationAngle(
148
+ node.rotation,
149
+ potential.rotation,
150
+ );
151
+
152
+ let worldMotionAzimuth: number = this._spatial.angleBetweenVector2(
153
+ 1,
154
+ 0,
155
+ motion.x,
156
+ motion.y,
157
+ );
158
+
159
+ let sameSequence: boolean =
160
+ potential.sequenceKey != null &&
161
+ node.sequenceKey != null &&
162
+ potential.sequenceKey === node.sequenceKey;
163
+
164
+ let sameMergeCC: boolean =
165
+ (potential.mergeCC == null && node.mergeCC == null) ||
166
+ potential.mergeCC === node.mergeCC;
167
+
168
+ let sameUser: boolean = potential.userKey === node.userKey;
169
+
170
+ let potentialEdge: IPotentialEdge = {
171
+ capturedAt: potential.capturedAt,
172
+ croppedPano: potential.pano && !potential.fullPano,
173
+ directionChange: directionChange,
174
+ distance: distance,
175
+ fullPano: potential.fullPano,
176
+ key: potential.key,
177
+ motionChange: motionChange,
178
+ rotation: rotation,
179
+ sameMergeCC: sameMergeCC,
180
+ sameSequence: sameSequence,
181
+ sameUser: sameUser,
182
+ sequenceKey: potential.sequenceKey,
183
+ verticalDirectionChange: verticalDirectionChange,
184
+ verticalMotion: verticalMotion,
185
+ worldMotionAzimuth: worldMotionAzimuth,
186
+ };
187
+
188
+ potentialEdges.push(potentialEdge);
189
+ }
190
+
191
+ return potentialEdges;
192
+ }
193
+
194
+ /**
195
+ * Computes the sequence edges for a node.
196
+ *
197
+ * @param {Node} node - Source node.
198
+ * @throws {ArgumentBeeviewError} If node is not full.
199
+ */
200
+ public computeSequenceEdges(node: Node, sequence: Sequence): IEdge[] {
201
+ if (!node.full) {
202
+ throw new ArgumentBeeviewError("Node has to be full.");
203
+ }
204
+
205
+ if (node.sequenceKey !== sequence.key) {
206
+ throw new ArgumentBeeviewError(
207
+ "Node and sequence does not correspond.",
208
+ );
209
+ }
210
+
211
+ let edges: IEdge[] = [];
212
+
213
+ let nextKey: string = sequence.findNextKey(node.key);
214
+ if (nextKey != null) {
215
+ edges.push({
216
+ data: {
217
+ direction: EdgeDirection.Next,
218
+ worldMotionAzimuth: Number.NaN,
219
+ },
220
+ from: node.key,
221
+ to: nextKey,
222
+ });
223
+ }
224
+
225
+ let prevKey: string = sequence.findPrevKey(node.key);
226
+ if (prevKey != null) {
227
+ edges.push({
228
+ data: {
229
+ direction: EdgeDirection.Prev,
230
+ worldMotionAzimuth: Number.NaN,
231
+ },
232
+ from: node.key,
233
+ to: prevKey,
234
+ });
235
+ }
236
+
237
+ return edges;
238
+ }
239
+
240
+ /**
241
+ * Computes the similar edges for a node.
242
+ *
243
+ * @description Similar edges for perspective images and cropped panoramas
244
+ * look roughly in the same direction and are positioned closed to the node.
245
+ * Similar edges for full panoramas only target other full panoramas.
246
+ *
247
+ * @param {Node} node - Source node.
248
+ * @param {Array<IPotentialEdge>} potentialEdges - Potential edges.
249
+ * @throws {ArgumentBeeviewError} If node is not full.
250
+ */
251
+ public computeSimilarEdges(
252
+ node: Node,
253
+ potentialEdges: IPotentialEdge[],
254
+ ): IEdge[] {
255
+ if (!node.full) {
256
+ throw new ArgumentBeeviewError("Node has to be full.");
257
+ }
258
+
259
+ let nodeFullPano: boolean = node.fullPano;
260
+ let sequenceGroups: { [key: string]: IPotentialEdge[] } = {};
261
+
262
+ for (let potentialEdge of potentialEdges) {
263
+ if (potentialEdge.sequenceKey == null) {
264
+ continue;
265
+ }
266
+
267
+ if (potentialEdge.sameSequence || !potentialEdge.sameMergeCC) {
268
+ continue;
269
+ }
270
+
271
+ if (nodeFullPano) {
272
+ if (!potentialEdge.fullPano) {
273
+ continue;
274
+ }
275
+ } else {
276
+ if (
277
+ !potentialEdge.fullPano &&
278
+ Math.abs(potentialEdge.directionChange) >
279
+ this._settings.similarMaxDirectionChange
280
+ ) {
281
+ continue;
282
+ }
283
+ }
284
+
285
+ if (potentialEdge.distance > this._settings.similarMaxDistance) {
286
+ continue;
287
+ }
288
+
289
+ if (
290
+ potentialEdge.sameUser &&
291
+ Math.abs(potentialEdge.capturedAt - node.capturedAt) <
292
+ this._settings.similarMinTimeDifference
293
+ ) {
294
+ continue;
295
+ }
296
+
297
+ if (sequenceGroups[potentialEdge.sequenceKey] == null) {
298
+ sequenceGroups[potentialEdge.sequenceKey] = [];
299
+ }
300
+
301
+ sequenceGroups[potentialEdge.sequenceKey].push(potentialEdge);
302
+ }
303
+
304
+ let similarEdges: IPotentialEdge[] = [];
305
+
306
+ let calculateScore: (potentialEdge: IPotentialEdge) => number =
307
+ node.fullPano
308
+ ? (potentialEdge: IPotentialEdge): number => {
309
+ return potentialEdge.distance;
310
+ }
311
+ : (potentialEdge: IPotentialEdge): number => {
312
+ return (
313
+ this._coefficients.similarDistance *
314
+ potentialEdge.distance +
315
+ this._coefficients.similarRotation *
316
+ potentialEdge.rotation
317
+ );
318
+ };
319
+
320
+ for (let sequenceKey in sequenceGroups) {
321
+ if (!sequenceGroups.hasOwnProperty(sequenceKey)) {
322
+ continue;
323
+ }
324
+
325
+ let lowestScore: number = Number.MAX_VALUE;
326
+ let similarEdge: IPotentialEdge = null;
327
+
328
+ for (let potentialEdge of sequenceGroups[sequenceKey]) {
329
+ let score: number = calculateScore(potentialEdge);
330
+
331
+ if (score < lowestScore) {
332
+ lowestScore = score;
333
+ similarEdge = potentialEdge;
334
+ }
335
+ }
336
+
337
+ if (similarEdge == null) {
338
+ continue;
339
+ }
340
+
341
+ similarEdges.push(similarEdge);
342
+ }
343
+
344
+ return similarEdges.map<IEdge>(
345
+ (potentialEdge: IPotentialEdge): IEdge => {
346
+ return {
347
+ data: {
348
+ direction: EdgeDirection.Similar,
349
+ worldMotionAzimuth: potentialEdge.worldMotionAzimuth,
350
+ },
351
+ from: node.key,
352
+ to: potentialEdge.key,
353
+ };
354
+ },
355
+ );
356
+ }
357
+
358
+ /**
359
+ * Computes the step edges for a perspective node.
360
+ *
361
+ * @description Step edge targets can only be other perspective nodes.
362
+ * Returns an empty array for cropped and full panoramas.
363
+ *
364
+ * @param {Node} node - Source node.
365
+ * @param {Array<IPotentialEdge>} potentialEdges - Potential edges.
366
+ * @param {string} prevKey - Key of previous node in sequence.
367
+ * @param {string} prevKey - Key of next node in sequence.
368
+ * @throws {ArgumentBeeviewError} If node is not full.
369
+ */
370
+ public computeStepEdges(
371
+ node: Node,
372
+ potentialEdges: IPotentialEdge[],
373
+ prevKey: string,
374
+ nextKey: string,
375
+ ): IEdge[] {
376
+ if (!node.full) {
377
+ throw new ArgumentBeeviewError("Node has to be full.");
378
+ }
379
+
380
+ let edges: IEdge[] = [];
381
+
382
+ if (node.pano) {
383
+ return edges;
384
+ }
385
+
386
+ for (let k in this._directions.steps) {
387
+ if (!this._directions.steps.hasOwnProperty(k)) {
388
+ continue;
389
+ }
390
+
391
+ let step: IStep = this._directions.steps[k];
392
+
393
+ let lowestScore: number = Number.MAX_VALUE;
394
+ let edge: IPotentialEdge = null;
395
+ let fallback: IPotentialEdge = null;
396
+
397
+ for (let potential of potentialEdges) {
398
+ if (potential.croppedPano || potential.fullPano) {
399
+ continue;
400
+ }
401
+
402
+ if (
403
+ Math.abs(potential.directionChange) >
404
+ this._settings.stepMaxDirectionChange
405
+ ) {
406
+ continue;
407
+ }
408
+
409
+ let motionDifference: number = this._spatial.angleDifference(
410
+ step.motionChange,
411
+ potential.motionChange,
412
+ );
413
+ let directionMotionDifference: number =
414
+ this._spatial.angleDifference(
415
+ potential.directionChange,
416
+ motionDifference,
417
+ );
418
+ let drift: number = Math.max(
419
+ Math.abs(motionDifference),
420
+ Math.abs(directionMotionDifference),
421
+ );
422
+
423
+ if (Math.abs(drift) > this._settings.stepMaxDrift) {
424
+ continue;
425
+ }
426
+
427
+ let potentialKey: string = potential.key;
428
+ if (
429
+ step.useFallback &&
430
+ (potentialKey === prevKey || potentialKey === nextKey)
431
+ ) {
432
+ fallback = potential;
433
+ }
434
+
435
+ if (potential.distance > this._settings.stepMaxDistance) {
436
+ continue;
437
+ }
438
+
439
+ motionDifference = Math.sqrt(
440
+ motionDifference * motionDifference +
441
+ potential.verticalMotion * potential.verticalMotion,
442
+ );
443
+
444
+ let score: number =
445
+ (this._coefficients.stepPreferredDistance *
446
+ Math.abs(
447
+ potential.distance -
448
+ this._settings.stepPreferredDistance,
449
+ )) /
450
+ this._settings.stepMaxDistance +
451
+ (this._coefficients.stepMotion * motionDifference) /
452
+ this._settings.stepMaxDrift +
453
+ (this._coefficients.stepRotation * potential.rotation) /
454
+ this._settings.stepMaxDirectionChange +
455
+ this._coefficients.stepSequencePenalty *
456
+ (potential.sameSequence ? 0 : 1) +
457
+ this._coefficients.stepMergeCCPenalty *
458
+ (potential.sameMergeCC ? 0 : 1);
459
+
460
+ if (score < lowestScore) {
461
+ lowestScore = score;
462
+ edge = potential;
463
+ }
464
+ }
465
+
466
+ edge = edge == null ? fallback : edge;
467
+ if (edge != null) {
468
+ edges.push({
469
+ data: {
470
+ direction: step.direction,
471
+ worldMotionAzimuth: edge.worldMotionAzimuth,
472
+ },
473
+ from: node.key,
474
+ to: edge.key,
475
+ });
476
+ }
477
+ }
478
+
479
+ return edges;
480
+ }
481
+
482
+ /**
483
+ * Computes the turn edges for a perspective node.
484
+ *
485
+ * @description Turn edge targets can only be other perspective images.
486
+ * Returns an empty array for cropped and full panoramas.
487
+ *
488
+ * @param {Node} node - Source node.
489
+ * @param {Array<IPotentialEdge>} potentialEdges - Potential edges.
490
+ * @throws {ArgumentBeeviewError} If node is not full.
491
+ */
492
+ public computeTurnEdges(
493
+ node: Node,
494
+ potentialEdges: IPotentialEdge[],
495
+ ): IEdge[] {
496
+ if (!node.full) {
497
+ throw new ArgumentBeeviewError("Node has to be full.");
498
+ }
499
+
500
+ let edges: IEdge[] = [];
501
+
502
+ if (node.pano) {
503
+ return edges;
504
+ }
505
+
506
+ for (let k in this._directions.turns) {
507
+ if (!this._directions.turns.hasOwnProperty(k)) {
508
+ continue;
509
+ }
510
+
511
+ let turn: ITurn = this._directions.turns[k];
512
+
513
+ let lowestScore: number = Number.MAX_VALUE;
514
+ let edge: IPotentialEdge = null;
515
+
516
+ for (let potential of potentialEdges) {
517
+ if (potential.croppedPano || potential.fullPano) {
518
+ continue;
519
+ }
520
+
521
+ if (potential.distance > this._settings.turnMaxDistance) {
522
+ continue;
523
+ }
524
+
525
+ let rig: boolean =
526
+ turn.direction !== EdgeDirection.TurnU &&
527
+ potential.distance < this._settings.turnMaxRigDistance &&
528
+ Math.abs(potential.directionChange) >
529
+ this._settings.turnMinRigDirectionChange;
530
+
531
+ let directionDifference: number = this._spatial.angleDifference(
532
+ turn.directionChange,
533
+ potential.directionChange,
534
+ );
535
+
536
+ let score: number;
537
+
538
+ if (
539
+ rig &&
540
+ potential.directionChange * turn.directionChange > 0 &&
541
+ Math.abs(potential.directionChange) <
542
+ Math.abs(turn.directionChange)
543
+ ) {
544
+ score = -Math.PI / 2 + Math.abs(potential.directionChange);
545
+ } else {
546
+ if (
547
+ Math.abs(directionDifference) >
548
+ this._settings.turnMaxDirectionChange
549
+ ) {
550
+ continue;
551
+ }
552
+
553
+ let motionDifference: number = turn.motionChange
554
+ ? this._spatial.angleDifference(
555
+ turn.motionChange,
556
+ potential.motionChange,
557
+ )
558
+ : 0;
559
+
560
+ motionDifference = Math.sqrt(
561
+ motionDifference * motionDifference +
562
+ potential.verticalMotion * potential.verticalMotion,
563
+ );
564
+
565
+ score =
566
+ (this._coefficients.turnDistance * potential.distance) /
567
+ this._settings.turnMaxDistance +
568
+ (this._coefficients.turnMotion * motionDifference) /
569
+ Math.PI +
570
+ this._coefficients.turnSequencePenalty *
571
+ (potential.sameSequence ? 0 : 1) +
572
+ this._coefficients.turnMergeCCPenalty *
573
+ (potential.sameMergeCC ? 0 : 1);
574
+ }
575
+
576
+ if (score < lowestScore) {
577
+ lowestScore = score;
578
+ edge = potential;
579
+ }
580
+ }
581
+
582
+ if (edge != null) {
583
+ edges.push({
584
+ data: {
585
+ direction: turn.direction,
586
+ worldMotionAzimuth: edge.worldMotionAzimuth,
587
+ },
588
+ from: node.key,
589
+ to: edge.key,
590
+ });
591
+ }
592
+ }
593
+
594
+ return edges;
595
+ }
596
+
597
+ /**
598
+ * Computes the pano edges for a perspective node.
599
+ *
600
+ * @description Perspective to pano edge targets can only be
601
+ * full pano nodes. Returns an empty array for cropped and full panoramas.
602
+ *
603
+ * @param {Node} node - Source node.
604
+ * @param {Array<IPotentialEdge>} potentialEdges - Potential edges.
605
+ * @throws {ArgumentBeeviewError} If node is not full.
606
+ */
607
+ public computePerspectiveToPanoEdges(
608
+ node: Node,
609
+ potentialEdges: IPotentialEdge[],
610
+ ): IEdge[] {
611
+ if (!node.full) {
612
+ throw new ArgumentBeeviewError("Node has to be full.");
613
+ }
614
+
615
+ if (node.pano) {
616
+ return [];
617
+ }
618
+
619
+ let lowestScore: number = Number.MAX_VALUE;
620
+ let edge: IPotentialEdge = null;
621
+
622
+ for (let potential of potentialEdges) {
623
+ if (!potential.fullPano) {
624
+ continue;
625
+ }
626
+
627
+ let score: number =
628
+ (this._coefficients.panoPreferredDistance *
629
+ Math.abs(
630
+ potential.distance -
631
+ this._settings.panoPreferredDistance,
632
+ )) /
633
+ this._settings.panoMaxDistance +
634
+ (this._coefficients.panoMotion *
635
+ Math.abs(potential.motionChange)) /
636
+ Math.PI +
637
+ this._coefficients.panoMergeCCPenalty *
638
+ (potential.sameMergeCC ? 0 : 1);
639
+
640
+ if (score < lowestScore) {
641
+ lowestScore = score;
642
+ edge = potential;
643
+ }
644
+ }
645
+
646
+ if (edge == null) {
647
+ return [];
648
+ }
649
+
650
+ return [
651
+ {
652
+ data: {
653
+ direction: EdgeDirection.Pano,
654
+ worldMotionAzimuth: edge.worldMotionAzimuth,
655
+ },
656
+ from: node.key,
657
+ to: edge.key,
658
+ },
659
+ ];
660
+ }
661
+
662
+ /**
663
+ * Computes the full pano and step edges for a full pano node.
664
+ *
665
+ * @description Pano to pano edge targets can only be
666
+ * full pano nodes. Pano to step edge targets can only be perspective
667
+ * nodes.
668
+ * Returns an empty array for cropped panoramas and perspective nodes.
669
+ *
670
+ * @param {Node} node - Source node.
671
+ * @param {Array<IPotentialEdge>} potentialEdges - Potential edges.
672
+ * @throws {ArgumentBeeviewError} If node is not full.
673
+ */
674
+ public computePanoEdges(
675
+ node: Node,
676
+ potentialEdges: IPotentialEdge[],
677
+ ): IEdge[] {
678
+ if (!node.full) {
679
+ throw new ArgumentBeeviewError("Node has to be full.");
680
+ }
681
+
682
+ if (!node.fullPano) {
683
+ return [];
684
+ }
685
+
686
+ let panoEdges: IEdge[] = [];
687
+ let potentialPanos: IPotentialEdge[] = [];
688
+ let potentialSteps: [EdgeDirection, IPotentialEdge][] = [];
689
+
690
+ for (let potential of potentialEdges) {
691
+ if (potential.distance > this._settings.panoMaxDistance) {
692
+ continue;
693
+ }
694
+
695
+ if (potential.fullPano) {
696
+ if (potential.distance < this._settings.panoMinDistance) {
697
+ continue;
698
+ }
699
+
700
+ potentialPanos.push(potential);
701
+ } else {
702
+ if (potential.croppedPano) {
703
+ continue;
704
+ }
705
+
706
+ for (let k in this._directions.panos) {
707
+ if (!this._directions.panos.hasOwnProperty(k)) {
708
+ continue;
709
+ }
710
+
711
+ let pano: IPano = this._directions.panos[k];
712
+
713
+ let turn: number = this._spatial.angleDifference(
714
+ potential.directionChange,
715
+ potential.motionChange,
716
+ );
717
+
718
+ let turnChange: number = this._spatial.angleDifference(
719
+ pano.directionChange,
720
+ turn,
721
+ );
722
+
723
+ if (
724
+ Math.abs(turnChange) >
725
+ this._settings.panoMaxStepTurnChange
726
+ ) {
727
+ continue;
728
+ }
729
+
730
+ potentialSteps.push([pano.direction, potential]);
731
+
732
+ // break if step direction found
733
+ break;
734
+ }
735
+ }
736
+ }
737
+
738
+ let maxRotationDifference: number =
739
+ Math.PI / this._settings.panoMaxItems;
740
+ let occupiedAngles: number[] = [];
741
+ let stepAngles: number[] = [];
742
+
743
+ for (
744
+ let index: number = 0;
745
+ index < this._settings.panoMaxItems;
746
+ index++
747
+ ) {
748
+ let rotation: number =
749
+ (index / this._settings.panoMaxItems) * 2 * Math.PI;
750
+
751
+ let lowestScore: number = Number.MAX_VALUE;
752
+ let edge: IPotentialEdge = null;
753
+
754
+ for (let potential of potentialPanos) {
755
+ let motionDifference: number = this._spatial.angleDifference(
756
+ rotation,
757
+ potential.motionChange,
758
+ );
759
+
760
+ if (Math.abs(motionDifference) > maxRotationDifference) {
761
+ continue;
762
+ }
763
+
764
+ let occupiedDifference: number = Number.MAX_VALUE;
765
+ for (let occupiedAngle of occupiedAngles) {
766
+ let difference: number = Math.abs(
767
+ this._spatial.angleDifference(
768
+ occupiedAngle,
769
+ potential.motionChange,
770
+ ),
771
+ );
772
+ if (difference < occupiedDifference) {
773
+ occupiedDifference = difference;
774
+ }
775
+ }
776
+
777
+ if (occupiedDifference <= maxRotationDifference) {
778
+ continue;
779
+ }
780
+
781
+ let score: number =
782
+ (this._coefficients.panoPreferredDistance *
783
+ Math.abs(
784
+ potential.distance -
785
+ this._settings.panoPreferredDistance,
786
+ )) /
787
+ this._settings.panoMaxDistance +
788
+ (this._coefficients.panoMotion *
789
+ Math.abs(motionDifference)) /
790
+ maxRotationDifference +
791
+ this._coefficients.panoSequencePenalty *
792
+ (potential.sameSequence ? 0 : 1) +
793
+ this._coefficients.panoMergeCCPenalty *
794
+ (potential.sameMergeCC ? 0 : 1);
795
+
796
+ if (score < lowestScore) {
797
+ lowestScore = score;
798
+ edge = potential;
799
+ }
800
+ }
801
+
802
+ if (edge != null) {
803
+ occupiedAngles.push(edge.motionChange);
804
+ panoEdges.push({
805
+ data: {
806
+ direction: EdgeDirection.Pano,
807
+ worldMotionAzimuth: edge.worldMotionAzimuth,
808
+ },
809
+ from: node.key,
810
+ to: edge.key,
811
+ });
812
+ } else {
813
+ stepAngles.push(rotation);
814
+ }
815
+ }
816
+
817
+ let occupiedStepAngles: { [direction: string]: number[] } = {};
818
+ occupiedStepAngles[EdgeDirection.Pano] = occupiedAngles;
819
+ occupiedStepAngles[EdgeDirection.StepForward] = [];
820
+ occupiedStepAngles[EdgeDirection.StepLeft] = [];
821
+ occupiedStepAngles[EdgeDirection.StepBackward] = [];
822
+ occupiedStepAngles[EdgeDirection.StepRight] = [];
823
+
824
+ for (let stepAngle of stepAngles) {
825
+ let occupations: [EdgeDirection, IPotentialEdge][] = [];
826
+
827
+ for (let k in this._directions.panos) {
828
+ if (!this._directions.panos.hasOwnProperty(k)) {
829
+ continue;
830
+ }
831
+
832
+ let pano: IPano = this._directions.panos[k];
833
+
834
+ let allOccupiedAngles: number[] = occupiedStepAngles[
835
+ EdgeDirection.Pano
836
+ ]
837
+ .concat(occupiedStepAngles[pano.direction])
838
+ .concat(occupiedStepAngles[pano.prev])
839
+ .concat(occupiedStepAngles[pano.next]);
840
+
841
+ let lowestScore: number = Number.MAX_VALUE;
842
+ let edge: [EdgeDirection, IPotentialEdge] = null;
843
+
844
+ for (let potential of potentialSteps) {
845
+ if (potential[0] !== pano.direction) {
846
+ continue;
847
+ }
848
+
849
+ let motionChange: number = this._spatial.angleDifference(
850
+ stepAngle,
851
+ potential[1].motionChange,
852
+ );
853
+
854
+ if (Math.abs(motionChange) > maxRotationDifference) {
855
+ continue;
856
+ }
857
+
858
+ let minOccupiedDifference: number = Number.MAX_VALUE;
859
+ for (let occupiedAngle of allOccupiedAngles) {
860
+ let occupiedDifference: number = Math.abs(
861
+ this._spatial.angleDifference(
862
+ occupiedAngle,
863
+ potential[1].motionChange,
864
+ ),
865
+ );
866
+
867
+ if (occupiedDifference < minOccupiedDifference) {
868
+ minOccupiedDifference = occupiedDifference;
869
+ }
870
+ }
871
+
872
+ if (minOccupiedDifference <= maxRotationDifference) {
873
+ continue;
874
+ }
875
+
876
+ let score: number =
877
+ (this._coefficients.panoPreferredDistance *
878
+ Math.abs(
879
+ potential[1].distance -
880
+ this._settings.panoPreferredDistance,
881
+ )) /
882
+ this._settings.panoMaxDistance +
883
+ (this._coefficients.panoMotion *
884
+ Math.abs(motionChange)) /
885
+ maxRotationDifference +
886
+ this._coefficients.panoMergeCCPenalty *
887
+ (potential[1].sameMergeCC ? 0 : 1);
888
+
889
+ if (score < lowestScore) {
890
+ lowestScore = score;
891
+ edge = potential;
892
+ }
893
+ }
894
+
895
+ if (edge != null) {
896
+ occupations.push(edge);
897
+ panoEdges.push({
898
+ data: {
899
+ direction: edge[0],
900
+ worldMotionAzimuth: edge[1].worldMotionAzimuth,
901
+ },
902
+ from: node.key,
903
+ to: edge[1].key,
904
+ });
905
+ }
906
+ }
907
+
908
+ for (let occupation of occupations) {
909
+ occupiedStepAngles[occupation[0]].push(
910
+ occupation[1].motionChange,
911
+ );
912
+ }
913
+ }
914
+
915
+ return panoEdges;
916
+ }
917
+ }
918
+
919
+ export default EdgeCalculator;