@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,963 @@
1
+ /// <reference path="../../../typings/index.d.ts" />
2
+
3
+ import {
4
+ EdgeCalculator,
5
+ EdgeCalculatorSettings,
6
+ EdgeCalculatorDirections,
7
+ EdgeDirection,
8
+ IEdge,
9
+ IPotentialEdge,
10
+ } from "../../../src/Edge";
11
+ import {Node} from "../../../src/Graph";
12
+ import {Spatial} from "../../../src/Geo";
13
+ import {EdgeCalculatorHelper} from "../../helper/EdgeCalculatorHelper.spec";
14
+
15
+ describe("EdgeCalculator.computePanoEdges", () => {
16
+ let edgeCalculator: EdgeCalculator;
17
+ let settings: EdgeCalculatorSettings;
18
+ let directions: EdgeCalculatorDirections;
19
+
20
+ let helper: EdgeCalculatorHelper;
21
+
22
+ let spatial: Spatial;
23
+
24
+ let node: Node;
25
+ let potentialEdge1: IPotentialEdge;
26
+
27
+ beforeEach(() => {
28
+ settings = new EdgeCalculatorSettings();
29
+ settings.panoMinDistance = 0.1;
30
+ settings.panoMaxDistance = 20;
31
+ settings.panoPreferredDistance = 5;
32
+ settings.panoMaxItems = 4;
33
+ });
34
+
35
+ beforeEach(() => {
36
+ directions = new EdgeCalculatorDirections();
37
+ edgeCalculator = new EdgeCalculator(settings, directions);
38
+
39
+ helper = new EdgeCalculatorHelper();
40
+
41
+ spatial = new Spatial();
42
+ });
43
+
44
+ beforeEach(() => {
45
+ node = helper.createDefaultNode(true);
46
+
47
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
48
+ potentialEdge1.distance = settings.panoMaxDistance / 2;
49
+ potentialEdge1.fullPano = true;
50
+ });
51
+
52
+ it("should throw when node is not full", () => {
53
+ node = helper.createCoreNode("", { alt: 0, lat: 0, lon: 0 }, "");
54
+
55
+ expect(() => { edgeCalculator.computePanoEdges(node, []); }).toThrowError(Error);
56
+ });
57
+
58
+ it("should have a pano edge", () => {
59
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
60
+
61
+ expect(panoEdges.length).toBe(1);
62
+
63
+ let panoEdge: IEdge = panoEdges[0];
64
+
65
+ expect(panoEdge.to).toBe(potentialEdge1.key);
66
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
67
+ });
68
+
69
+ it("should not have a pano edge for potential cropped pano ", () => {
70
+ potentialEdge1.croppedPano = true;
71
+ potentialEdge1.fullPano = false;
72
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
73
+
74
+ expect(panoEdges.length).toBe(0);
75
+ });
76
+
77
+ it("should have a pano edge irrespective of rotation", () => {
78
+ potentialEdge1.directionChange = Math.PI;
79
+
80
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
81
+
82
+ expect(panoEdges.length).toBe(1);
83
+
84
+ let panoEdge: IEdge = panoEdges[0];
85
+
86
+ expect(panoEdge.to).toBe(potentialEdge1.key);
87
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
88
+ });
89
+
90
+ it("should not have a pano edge with to long distance", () => {
91
+ potentialEdge1.distance = settings.panoMaxDistance + 1;
92
+
93
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
94
+
95
+ expect(panoEdges.length).toBe(0);
96
+ });
97
+
98
+ it("should not have a pano edge with to short distance", () => {
99
+ potentialEdge1.distance = settings.panoMinDistance / 2;
100
+
101
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
102
+
103
+ expect(panoEdges.length).toBe(0);
104
+ });
105
+
106
+ it("should not have a pano edge for non full pano", () => {
107
+ potentialEdge1.fullPano = false;
108
+
109
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
110
+
111
+ for (let panoEdge of panoEdges) {
112
+ expect(panoEdge.data.direction === EdgeDirection.Pano).toBe(false);
113
+ }
114
+ });
115
+
116
+ it("should not have a pano edge when node is not full pano", () => {
117
+ node = helper.createDefaultNode(false);
118
+
119
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
120
+
121
+ expect(panoEdges.length).toBe(0);
122
+ });
123
+ });
124
+
125
+ describe("EdgeCalculator.computePanoEdges", () => {
126
+ let edgeCalculator: EdgeCalculator;
127
+ let settings: EdgeCalculatorSettings;
128
+ let directions: EdgeCalculatorDirections;
129
+
130
+ let helper: EdgeCalculatorHelper;
131
+
132
+ let spatial: Spatial;
133
+
134
+ let node: Node;
135
+ let potentialEdge1: IPotentialEdge;
136
+ let potentialEdge2: IPotentialEdge;
137
+
138
+ beforeEach(() => {
139
+ settings = new EdgeCalculatorSettings();
140
+ settings.panoMinDistance = 0.1;
141
+ settings.panoMaxDistance = 20;
142
+ settings.panoPreferredDistance = 5;
143
+ settings.panoMaxItems = 4;
144
+ });
145
+
146
+ beforeEach(() => {
147
+ directions = new EdgeCalculatorDirections();
148
+ edgeCalculator = new EdgeCalculator(settings, directions);
149
+
150
+ helper = new EdgeCalculatorHelper();
151
+
152
+ spatial = new Spatial();
153
+ });
154
+
155
+ beforeEach(() => {
156
+ node = helper.createDefaultNode(true);
157
+
158
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
159
+ potentialEdge1.distance = settings.panoPreferredDistance;
160
+ potentialEdge1.fullPano = true;
161
+
162
+ potentialEdge2 = helper.createPotentialEdge("pkey2");
163
+ potentialEdge2.distance = settings.panoPreferredDistance;
164
+ potentialEdge2.fullPano = true;
165
+ });
166
+
167
+ it("should have a pano edge closest to preferred distance", () => {
168
+ potentialEdge1.distance = settings.panoPreferredDistance + 1;
169
+ potentialEdge2.distance = settings.panoPreferredDistance;
170
+
171
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
172
+
173
+ expect(panoEdges.length).toBe(1);
174
+
175
+ let panoEdge: IEdge = panoEdges[0];
176
+
177
+ expect(panoEdge.to).toBe(potentialEdge2.key);
178
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
179
+ });
180
+
181
+ it("should have a pano edge closest to preferred distance", () => {
182
+ potentialEdge1.distance = settings.panoPreferredDistance - 1;
183
+ potentialEdge2.distance = settings.panoPreferredDistance;
184
+
185
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
186
+
187
+ expect(panoEdges.length).toBe(1);
188
+
189
+ let panoEdge: IEdge = panoEdges[0];
190
+
191
+ expect(panoEdge.to).toBe(potentialEdge2.key);
192
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
193
+ });
194
+
195
+ it("should have a pano edge with same sequence", () => {
196
+ potentialEdge1.sameSequence = false;
197
+ potentialEdge2.sameSequence = true;
198
+
199
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
200
+
201
+ expect(panoEdges.length).toBe(1);
202
+
203
+ let panoEdge: IEdge = panoEdges[0];
204
+
205
+ expect(panoEdge.to).toBe(potentialEdge2.key);
206
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
207
+ });
208
+
209
+ it("should have a pano edge with same sequence", () => {
210
+ potentialEdge1.sameMergeCC = false;
211
+ potentialEdge2.sameMergeCC = true;
212
+
213
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
214
+
215
+ expect(panoEdges.length).toBe(1);
216
+
217
+ let panoEdge: IEdge = panoEdges[0];
218
+
219
+ expect(panoEdge.to).toBe(potentialEdge2.key);
220
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
221
+ });
222
+
223
+ it("should have a pano edge with smallest motion change", () => {
224
+ potentialEdge1.motionChange = 0.2;
225
+ potentialEdge2.motionChange = 0.1;
226
+
227
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
228
+
229
+ expect(panoEdges.length).toBe(1);
230
+
231
+ let panoEdge: IEdge = panoEdges[0];
232
+
233
+ expect(panoEdge.to).toBe(potentialEdge2.key);
234
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
235
+ });
236
+ });
237
+
238
+ describe("EdgeCalculator.computePanoEdges", () => {
239
+ let edgeCalculator: EdgeCalculator;
240
+ let settings: EdgeCalculatorSettings;
241
+ let directions: EdgeCalculatorDirections;
242
+
243
+ let helper: EdgeCalculatorHelper;
244
+
245
+ let spatial: Spatial;
246
+
247
+ let node: Node;
248
+
249
+ let potentialEdge1: IPotentialEdge;
250
+ let potentialEdge2: IPotentialEdge;
251
+ let potentialEdge3: IPotentialEdge;
252
+ let potentialEdge4: IPotentialEdge;
253
+
254
+ beforeEach(() => {
255
+ settings = new EdgeCalculatorSettings();
256
+ settings.panoMinDistance = 0.1;
257
+ settings.panoMaxDistance = 20;
258
+ settings.panoPreferredDistance = 5;
259
+ settings.panoMaxItems = 4;
260
+ });
261
+
262
+ beforeEach(() => {
263
+ directions = new EdgeCalculatorDirections();
264
+ edgeCalculator = new EdgeCalculator(settings, directions);
265
+
266
+ helper = new EdgeCalculatorHelper();
267
+
268
+ spatial = new Spatial();
269
+ });
270
+
271
+ beforeEach(() => {
272
+ node = helper.createDefaultNode(true);
273
+
274
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
275
+ potentialEdge1.distance = settings.panoMaxDistance / 2;
276
+ potentialEdge1.fullPano = true;
277
+
278
+ potentialEdge2 = helper.createPotentialEdge("pkey2");
279
+ potentialEdge2.distance = settings.panoMaxDistance / 2;
280
+ potentialEdge2.fullPano = true;
281
+
282
+ potentialEdge3 = helper.createPotentialEdge("pkey3");
283
+ potentialEdge3.distance = settings.panoMaxDistance / 2;
284
+ potentialEdge3.fullPano = true;
285
+
286
+ potentialEdge4 = helper.createPotentialEdge("pkey4");
287
+ potentialEdge4.distance = settings.panoMaxDistance / 2;
288
+ potentialEdge4.fullPano = true;
289
+ });
290
+
291
+ it("should have only have one pano edge based on motion change", () => {
292
+ potentialEdge1.motionChange = Math.PI / 4;
293
+ potentialEdge2.motionChange = -Math.PI / 4;
294
+ potentialEdge3.motionChange = Math.PI / 8;
295
+ potentialEdge4.motionChange = 0;
296
+
297
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
298
+ node,
299
+ [potentialEdge1, potentialEdge2, potentialEdge3, potentialEdge4]);
300
+
301
+ expect(panoEdges.length).toBe(1);
302
+
303
+ let panoEdge: IEdge = panoEdges[0];
304
+
305
+ expect(panoEdge.to).toBe(potentialEdge4.key);
306
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
307
+ });
308
+
309
+ it("should have a pano edge in four directions", () => {
310
+ potentialEdge1.motionChange = 0;
311
+ potentialEdge2.motionChange = Math.PI / 2;
312
+ potentialEdge3.motionChange = Math.PI;
313
+ potentialEdge4.motionChange = -Math.PI / 2;
314
+
315
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
316
+ node,
317
+ [potentialEdge1, potentialEdge2, potentialEdge3, potentialEdge4]);
318
+
319
+ expect(panoEdges.length).toBe(4);
320
+
321
+ let keys: string[] = [
322
+ potentialEdge1.key,
323
+ potentialEdge2.key,
324
+ potentialEdge3.key,
325
+ potentialEdge4.key,
326
+ ];
327
+
328
+ for (let key of keys) {
329
+ let edge: IEdge = null;
330
+ for (let panoEdge of panoEdges) {
331
+ if (panoEdge.to === key) {
332
+ edge = panoEdge;
333
+ }
334
+ }
335
+
336
+ expect(edge.data.direction).toBe(EdgeDirection.Pano);
337
+ }
338
+ });
339
+
340
+ it("should not have multiple pano edges in same slice", () => {
341
+ potentialEdge1.motionChange = 0;
342
+ potentialEdge2.motionChange = Math.PI / 36;
343
+ potentialEdge3.motionChange = Math.PI;
344
+ potentialEdge4.motionChange = -35 * Math.PI / 36;
345
+
346
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
347
+ node,
348
+ [potentialEdge1, potentialEdge2, potentialEdge3, potentialEdge4]);
349
+
350
+ expect(panoEdges.length).toBe(2);
351
+
352
+ let keys: string[] = [
353
+ potentialEdge1.key,
354
+ potentialEdge3.key,
355
+ ];
356
+
357
+ for (let key of keys) {
358
+ let edge: IEdge = null;
359
+ for (let panoEdge of panoEdges) {
360
+ if (panoEdge.to === key) {
361
+ edge = panoEdge;
362
+ }
363
+ }
364
+
365
+ expect(edge.data.direction).toBe(EdgeDirection.Pano);
366
+ }
367
+ });
368
+
369
+ it("should not have pano edges too close to each other on different slices", () => {
370
+ potentialEdge1.motionChange = Math.PI / 6;
371
+ potentialEdge2.motionChange = 2 * Math.PI / 6;
372
+
373
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
374
+ node,
375
+ [potentialEdge1, potentialEdge2]);
376
+
377
+ expect(panoEdges.length).toBe(1);
378
+
379
+ let panoEdge: IEdge = panoEdges[0];
380
+
381
+ expect(panoEdge.to).toBe(potentialEdge1.key);
382
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
383
+ });
384
+ });
385
+
386
+ describe("EdgeCalculator.computePanoEdges", () => {
387
+ let edgeCalculator: EdgeCalculator;
388
+ let settings: EdgeCalculatorSettings;
389
+ let directions: EdgeCalculatorDirections;
390
+
391
+ let helper: EdgeCalculatorHelper;
392
+
393
+ let spatial: Spatial;
394
+
395
+ let node: Node;
396
+ let potentialEdge1: IPotentialEdge;
397
+
398
+ beforeEach(() => {
399
+ settings = new EdgeCalculatorSettings();
400
+ settings.panoMinDistance = 0.1;
401
+ settings.panoMaxDistance = 20;
402
+ settings.panoPreferredDistance = 5;
403
+ settings.panoMaxItems = 4;
404
+ settings.panoMaxStepTurnChange = Math.PI / 8;
405
+ });
406
+
407
+ beforeEach(() => {
408
+ directions = new EdgeCalculatorDirections();
409
+
410
+ edgeCalculator = new EdgeCalculator(settings, directions);
411
+
412
+ helper = new EdgeCalculatorHelper();
413
+
414
+ spatial = new Spatial();
415
+ });
416
+
417
+ beforeEach(() => {
418
+ node = helper.createDefaultNode(true);
419
+
420
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
421
+ potentialEdge1.distance = settings.panoPreferredDistance;
422
+ potentialEdge1.fullPano = false;
423
+ });
424
+
425
+ it("should have a step forward edge", () => {
426
+ potentialEdge1.motionChange = 0;
427
+ potentialEdge1.directionChange = 0;
428
+
429
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
430
+
431
+ expect(panoEdges.length).toBe(1);
432
+
433
+ let panoEdge: IEdge = panoEdges[0];
434
+
435
+ expect(panoEdge.to).toBe(potentialEdge1.key);
436
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
437
+ });
438
+
439
+ it("should not have a step forward edge for potential cropped pano", () => {
440
+ potentialEdge1.motionChange = 0;
441
+ potentialEdge1.directionChange = 0;
442
+ potentialEdge1.croppedPano = true;
443
+
444
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
445
+
446
+ expect(panoEdges.length).toBe(0);
447
+ });
448
+
449
+ it("should have a step left edge", () => {
450
+ potentialEdge1.motionChange = Math.PI / 2;
451
+ potentialEdge1.directionChange = 0;
452
+
453
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
454
+
455
+ expect(panoEdges.length).toBe(1);
456
+
457
+ let panoEdge: IEdge = panoEdges[0];
458
+
459
+ expect(panoEdge.to).toBe(potentialEdge1.key);
460
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepLeft);
461
+ });
462
+
463
+ it("should have a step left edge for direction change", () => {
464
+ potentialEdge1.motionChange = 0;
465
+ potentialEdge1.directionChange = -Math.PI / 2;
466
+
467
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
468
+
469
+ expect(panoEdges.length).toBe(1);
470
+
471
+ let panoEdge: IEdge = panoEdges[0];
472
+
473
+ expect(panoEdge.to).toBe(potentialEdge1.key);
474
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepLeft);
475
+ });
476
+
477
+ it("should have a step right edge", () => {
478
+ potentialEdge1.motionChange = -Math.PI / 2;
479
+ potentialEdge1.directionChange = 0;
480
+
481
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
482
+
483
+ expect(panoEdges.length).toBe(1);
484
+
485
+ let panoEdge: IEdge = panoEdges[0];
486
+
487
+ expect(panoEdge.to).toBe(potentialEdge1.key);
488
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepRight);
489
+ });
490
+
491
+ it("should have a step right edge for direction change", () => {
492
+ potentialEdge1.motionChange = 0;
493
+ potentialEdge1.directionChange = Math.PI / 2;
494
+
495
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
496
+
497
+ expect(panoEdges.length).toBe(1);
498
+
499
+ let panoEdge: IEdge = panoEdges[0];
500
+
501
+ expect(panoEdge.to).toBe(potentialEdge1.key);
502
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepRight);
503
+ });
504
+
505
+ it("should have a step backward edge", () => {
506
+ potentialEdge1.motionChange = Math.PI;
507
+ potentialEdge1.directionChange = 0;
508
+
509
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
510
+
511
+ expect(panoEdges.length).toBe(1);
512
+
513
+ let panoEdge: IEdge = panoEdges[0];
514
+
515
+ expect(panoEdge.to).toBe(potentialEdge1.key);
516
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepBackward);
517
+ });
518
+
519
+ it("should have a step backward edge for direction change", () => {
520
+ potentialEdge1.motionChange = 0;
521
+ potentialEdge1.directionChange = Math.PI;
522
+
523
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
524
+
525
+ expect(panoEdges.length).toBe(1);
526
+
527
+ let panoEdge: IEdge = panoEdges[0];
528
+
529
+ expect(panoEdge.to).toBe(potentialEdge1.key);
530
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepBackward);
531
+ });
532
+
533
+ it("should have a step forward edge in opposite motion direction", () => {
534
+ potentialEdge1.motionChange = Math.PI;
535
+ potentialEdge1.directionChange = Math.PI;
536
+
537
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
538
+
539
+ expect(panoEdges.length).toBe(1);
540
+
541
+ let panoEdge: IEdge = panoEdges[0];
542
+
543
+ expect(panoEdge.to).toBe(potentialEdge1.key);
544
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
545
+ });
546
+
547
+ it("should have a step forward edge in perpendicular motion direction", () => {
548
+ potentialEdge1.motionChange = Math.PI / 2;
549
+ potentialEdge1.directionChange = Math.PI / 2;
550
+
551
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
552
+
553
+ expect(panoEdges.length).toBe(1);
554
+
555
+ let panoEdge: IEdge = panoEdges[0];
556
+
557
+ expect(panoEdge.to).toBe(potentialEdge1.key);
558
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
559
+ });
560
+
561
+ it("should have a step forward edge in perpendicular motion direction", () => {
562
+ potentialEdge1.motionChange = -Math.PI / 2;
563
+ potentialEdge1.directionChange = -Math.PI / 2;
564
+
565
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
566
+
567
+ expect(panoEdges.length).toBe(1);
568
+
569
+ let panoEdge: IEdge = panoEdges[0];
570
+
571
+ expect(panoEdge.to).toBe(potentialEdge1.key);
572
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
573
+ });
574
+
575
+ it("should not have a step forward edge when turn is to large", () => {
576
+ potentialEdge1.motionChange = 0;
577
+ potentialEdge1.directionChange = settings.panoMaxStepTurnChange + Math.PI / 18;
578
+
579
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
580
+
581
+ expect(panoEdges.length).toBe(0);
582
+ });
583
+
584
+ it("should not have a step forward edge when turn is to large", () => {
585
+ potentialEdge1.motionChange = 0;
586
+ potentialEdge1.directionChange = -settings.panoMaxStepTurnChange - Math.PI / 18;
587
+
588
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
589
+
590
+ expect(panoEdges.length).toBe(0);
591
+ });
592
+
593
+ it("should not have a step left edge when turn is to large", () => {
594
+ potentialEdge1.motionChange = 0;
595
+ potentialEdge1.directionChange = Math.PI / 2 + settings.panoMaxStepTurnChange + Math.PI / 18;
596
+
597
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
598
+
599
+ expect(panoEdges.length).toBe(0);
600
+ });
601
+
602
+ it("should not have a step left edge when turn is to large", () => {
603
+ potentialEdge1.motionChange = 0;
604
+ potentialEdge1.directionChange = Math.PI / 2 - settings.panoMaxStepTurnChange - Math.PI / 18;
605
+
606
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1]);
607
+
608
+ expect(panoEdges.length).toBe(0);
609
+ });
610
+ });
611
+
612
+ describe("EdgeCalculator.computePanoEdges", () => {
613
+ let edgeCalculator: EdgeCalculator;
614
+ let settings: EdgeCalculatorSettings;
615
+ let directions: EdgeCalculatorDirections;
616
+
617
+ let helper: EdgeCalculatorHelper;
618
+
619
+ let spatial: Spatial;
620
+
621
+ let node: Node;
622
+ let potentialEdge1: IPotentialEdge;
623
+ let potentialEdge2: IPotentialEdge;
624
+
625
+ beforeEach(() => {
626
+ settings = new EdgeCalculatorSettings();
627
+ settings.panoMinDistance = 0.1;
628
+ settings.panoMaxDistance = 20;
629
+ settings.panoPreferredDistance = 5;
630
+ settings.panoMaxItems = 4;
631
+ settings.panoMaxStepTurnChange = Math.PI / 8;
632
+ });
633
+
634
+ beforeEach(() => {
635
+ directions = new EdgeCalculatorDirections();
636
+
637
+ edgeCalculator = new EdgeCalculator(settings, directions);
638
+
639
+ helper = new EdgeCalculatorHelper();
640
+
641
+ spatial = new Spatial();
642
+ });
643
+
644
+ beforeEach(() => {
645
+ node = helper.createDefaultNode(true);
646
+
647
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
648
+ potentialEdge1.distance = settings.panoPreferredDistance;
649
+ potentialEdge1.fullPano = false;
650
+
651
+ potentialEdge2 = helper.createPotentialEdge("pkey2");
652
+ potentialEdge2.distance = settings.panoPreferredDistance;
653
+ potentialEdge2.fullPano = false;
654
+ });
655
+
656
+ it("should prefer a step forward edge with preferred distance", () => {
657
+ potentialEdge1.distance = settings.panoPreferredDistance + 1;
658
+ potentialEdge2.distance = settings.panoPreferredDistance;
659
+
660
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
661
+
662
+ expect(panoEdges.length).toBe(1);
663
+
664
+ let panoEdge: IEdge = panoEdges[0];
665
+
666
+ expect(panoEdge.to).toBe(potentialEdge2.key);
667
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
668
+ });
669
+
670
+ it("should prefer a step forward edge with preferred distance", () => {
671
+ potentialEdge1.distance = settings.panoPreferredDistance - 1;
672
+ potentialEdge2.distance = settings.panoPreferredDistance;
673
+
674
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
675
+
676
+ expect(panoEdges.length).toBe(1);
677
+
678
+ let panoEdge: IEdge = panoEdges[0];
679
+
680
+ expect(panoEdge.to).toBe(potentialEdge2.key);
681
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
682
+ });
683
+
684
+ it("should prefer a step forward edge with smaller motion change", () => {
685
+ potentialEdge1.motionChange = Math.PI / 18;
686
+ potentialEdge2.motionChange = Math.PI / 36;
687
+
688
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
689
+
690
+ expect(panoEdges.length).toBe(1);
691
+
692
+ let panoEdge: IEdge = panoEdges[0];
693
+
694
+ expect(panoEdge.to).toBe(potentialEdge2.key);
695
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
696
+ });
697
+
698
+ it("should prefer a step forward edge with smaller motion change", () => {
699
+ potentialEdge1.motionChange = -Math.PI / 18;
700
+ potentialEdge2.motionChange = -Math.PI / 36;
701
+
702
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
703
+
704
+ expect(panoEdges.length).toBe(1);
705
+
706
+ let panoEdge: IEdge = panoEdges[0];
707
+
708
+ expect(panoEdge.to).toBe(potentialEdge2.key);
709
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
710
+ });
711
+
712
+ it("should prefer a step forward edge with same merge connected component", () => {
713
+ potentialEdge1.sameMergeCC = false;
714
+ potentialEdge2.sameMergeCC = true;
715
+
716
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(node, [potentialEdge1, potentialEdge2]);
717
+
718
+ expect(panoEdges.length).toBe(1);
719
+
720
+ let panoEdge: IEdge = panoEdges[0];
721
+
722
+ expect(panoEdge.to).toBe(potentialEdge2.key);
723
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
724
+ });
725
+ });
726
+
727
+ describe("EdgeCalculator.computePanoEdges", () => {
728
+ let edgeCalculator: EdgeCalculator;
729
+ let settings: EdgeCalculatorSettings;
730
+ let directions: EdgeCalculatorDirections;
731
+
732
+ let helper: EdgeCalculatorHelper;
733
+
734
+ let spatial: Spatial;
735
+
736
+ let node: Node;
737
+
738
+ let potentialEdge1: IPotentialEdge;
739
+ let potentialEdge2: IPotentialEdge;
740
+ let potentialEdge3: IPotentialEdge;
741
+ let potentialEdge4: IPotentialEdge;
742
+
743
+ beforeEach(() => {
744
+ settings = new EdgeCalculatorSettings();
745
+ settings.panoMinDistance = 0.1;
746
+ settings.panoMaxDistance = 20;
747
+ settings.panoPreferredDistance = 5;
748
+ settings.panoMaxItems = 4;
749
+ });
750
+
751
+ beforeEach(() => {
752
+ directions = new EdgeCalculatorDirections();
753
+ edgeCalculator = new EdgeCalculator(settings, directions);
754
+
755
+ helper = new EdgeCalculatorHelper();
756
+
757
+ spatial = new Spatial();
758
+ });
759
+
760
+ beforeEach(() => {
761
+ node = helper.createDefaultNode(true);
762
+
763
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
764
+ potentialEdge1.distance = settings.panoMaxDistance / 2;
765
+ potentialEdge1.fullPano = false;
766
+
767
+ potentialEdge2 = helper.createPotentialEdge("pkey2");
768
+ potentialEdge2.distance = settings.panoMaxDistance / 2;
769
+ potentialEdge2.fullPano = false;
770
+
771
+ potentialEdge3 = helper.createPotentialEdge("pkey3");
772
+ potentialEdge3.distance = settings.panoMaxDistance / 2;
773
+ potentialEdge3.fullPano = false;
774
+
775
+ potentialEdge4 = helper.createPotentialEdge("pkey4");
776
+ potentialEdge4.distance = settings.panoMaxDistance / 2;
777
+ potentialEdge4.fullPano = false;
778
+ });
779
+
780
+ it("should have a forward, left, backward and right pano edge at the same motion", () => {
781
+ potentialEdge1.directionChange = 0;
782
+ potentialEdge2.directionChange = -Math.PI / 2;
783
+ potentialEdge3.directionChange = Math.PI;
784
+ potentialEdge4.directionChange = Math.PI / 2;
785
+
786
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
787
+ node,
788
+ [potentialEdge1, potentialEdge2, potentialEdge3, potentialEdge4]);
789
+
790
+ expect(panoEdges.length).toBe(4);
791
+
792
+ for (let panoEdge of panoEdges) {
793
+ if (panoEdge.to === potentialEdge1.key) {
794
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
795
+ } else if (panoEdge.to === potentialEdge2.key) {
796
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepLeft);
797
+ } else if (panoEdge.to === potentialEdge3.key) {
798
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepBackward);
799
+ } else if (panoEdge.to === potentialEdge4.key) {
800
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepRight);
801
+ }
802
+ }
803
+ });
804
+
805
+ it("should not have any step edges in the pano edge direction", () => {
806
+ potentialEdge1.fullPano = true;
807
+
808
+ potentialEdge2.directionChange = 0;
809
+ potentialEdge3.directionChange = Math.PI / 2;
810
+ potentialEdge4.directionChange = Math.PI;
811
+
812
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
813
+ node,
814
+ [potentialEdge1, potentialEdge2, potentialEdge3, potentialEdge4]);
815
+
816
+ expect(panoEdges.length).toBe(1);
817
+
818
+ let panoEdge: IEdge = panoEdges[0];
819
+
820
+ expect(panoEdge.to).toBe(potentialEdge1.key);
821
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
822
+ });
823
+
824
+ it("should not have a step left or right edge based on step forward edges", () => {
825
+ potentialEdge1.directionChange = 0;
826
+ potentialEdge1.motionChange = Math.PI / 18;
827
+
828
+ potentialEdge2.directionChange = Math.PI / 4;
829
+ potentialEdge2.motionChange = Math.PI / 4 + Math.PI / 36;
830
+
831
+ potentialEdge3.directionChange = 3 * Math.PI / 4;
832
+ potentialEdge3.motionChange = Math.PI / 4 + Math.PI / 36;
833
+
834
+ let panoEdges: IEdge[] = edgeCalculator.computePanoEdges(
835
+ node,
836
+ [potentialEdge1, potentialEdge2, potentialEdge3]);
837
+
838
+ expect(panoEdges.length).toBe(1);
839
+
840
+ let panoEdge: IEdge = panoEdges[0];
841
+
842
+ expect(panoEdge.to).toBe(potentialEdge1.key);
843
+ expect(panoEdge.data.direction).toBe(EdgeDirection.StepForward);
844
+ });
845
+ });
846
+
847
+ describe("EdgeCalculator.computePerspectiveToPanoEdges", () => {
848
+ let calculator: EdgeCalculator;
849
+ let settings: EdgeCalculatorSettings;
850
+ let directions: EdgeCalculatorDirections;
851
+
852
+ let helper: EdgeCalculatorHelper;
853
+
854
+ let spatial: Spatial;
855
+
856
+ let node: Node;
857
+ let potentialEdge1: IPotentialEdge;
858
+ let potentialEdge2: IPotentialEdge;
859
+
860
+ beforeEach(() => {
861
+ settings = new EdgeCalculatorSettings();
862
+ settings.panoMinDistance = 0.1;
863
+ settings.panoMaxDistance = 20;
864
+ settings.panoPreferredDistance = 5;
865
+ settings.panoMaxItems = 4;
866
+ });
867
+
868
+ beforeEach(() => {
869
+ directions = new EdgeCalculatorDirections();
870
+ calculator = new EdgeCalculator(settings, directions);
871
+
872
+ helper = new EdgeCalculatorHelper();
873
+
874
+ spatial = new Spatial();
875
+ });
876
+
877
+ beforeEach(() => {
878
+ node = helper.createDefaultNode();
879
+
880
+ potentialEdge1 = helper.createPotentialEdge("pkey1");
881
+ potentialEdge1.distance = settings.panoMaxDistance / 2;
882
+ potentialEdge1.fullPano = true;
883
+
884
+ potentialEdge2 = helper.createPotentialEdge("pkey2");
885
+ potentialEdge2.distance = settings.panoMaxDistance / 2;
886
+ potentialEdge2.fullPano = true;
887
+ });
888
+
889
+ it("should return a pano edge", () => {
890
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1]);
891
+
892
+ expect(panoEdges.length).toBe(1);
893
+
894
+ let panoEdge: IEdge = panoEdges[0];
895
+
896
+ expect(panoEdge.to).toBe(potentialEdge1.key);
897
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
898
+ });
899
+
900
+ it("should not return a pano edge for potential cropped pano", () => {
901
+ potentialEdge1.croppedPano = true;
902
+ potentialEdge1.fullPano = false;
903
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1]);
904
+
905
+ expect(panoEdges.length).toBe(0);
906
+ });
907
+
908
+ it("should not return a pano edge when node is pano", () => {
909
+ node = helper.createDefaultNode(true);
910
+
911
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1]);
912
+
913
+ expect(panoEdges.length).toBe(0);
914
+ });
915
+
916
+ it("should return only one pano edge", () => {
917
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1, potentialEdge2]);
918
+
919
+ expect(panoEdges.length).toBe(1);
920
+ });
921
+
922
+ it("should return the pano edge closest to preferred distance", () => {
923
+ potentialEdge1.distance = settings.panoPreferredDistance - 1;
924
+ potentialEdge2.distance = settings.panoPreferredDistance;
925
+
926
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1, potentialEdge2]);
927
+
928
+ expect(panoEdges.length).toBe(1);
929
+
930
+ let panoEdge: IEdge = panoEdges[0];
931
+
932
+ expect(panoEdge.to).toBe(potentialEdge2.key);
933
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
934
+ });
935
+
936
+ it("should return the pano edge preferring forward motion", () => {
937
+ potentialEdge1.motionChange = -Math.PI / 9;
938
+ potentialEdge2.motionChange = Math.PI / 18;
939
+
940
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1, potentialEdge2]);
941
+
942
+ expect(panoEdges.length).toBe(1);
943
+
944
+ let panoEdge: IEdge = panoEdges[0];
945
+
946
+ expect(panoEdge.to).toBe(potentialEdge2.key);
947
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
948
+ });
949
+
950
+ it("should return the pano edge preferring same connected component", () => {
951
+ potentialEdge1.sameMergeCC = false;
952
+ potentialEdge2.sameMergeCC = true;
953
+
954
+ let panoEdges: IEdge[] = calculator.computePerspectiveToPanoEdges(node, [potentialEdge1, potentialEdge2]);
955
+
956
+ expect(panoEdges.length).toBe(1);
957
+
958
+ let panoEdge: IEdge = panoEdges[0];
959
+
960
+ expect(panoEdge.to).toBe(potentialEdge2.key);
961
+ expect(panoEdge.data.direction).toBe(EdgeDirection.Pano);
962
+ });
963
+ });