@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,759 @@
1
+ import { GeometryTagError } from "../error/GeometryTagError";
2
+ import { VertexGeometry } from "./VertexGeometry";
3
+ import { Transform } from "../../../Geo";
4
+
5
+ /**
6
+ * @class RectGeometry
7
+ *
8
+ * @classdesc Represents a rectangle geometry in the 2D basic image coordinate system.
9
+ *
10
+ * @example
11
+ * ```
12
+ * var basicRect = [0.5, 0.3, 0.7, 0.4];
13
+ * var rectGeometry = new Beeview.TagComponent.RectGeometry(basicRect);
14
+ * ```
15
+ */
16
+ export class RectGeometry extends VertexGeometry {
17
+ private _anchorIndex: number;
18
+ private _inverted: boolean;
19
+ private _rect: number[];
20
+
21
+ /**
22
+ * Create a rectangle geometry.
23
+ *
24
+ * @constructor
25
+ * @param {Array<number>} rect - An array representing the top-left and bottom-right
26
+ * corners of the rectangle in basic coordinates. Ordered according to [x0, y0, x1, y1].
27
+ *
28
+ * @throws {GeometryTagError} Rectangle coordinates must be valid basic coordinates.
29
+ */
30
+ constructor(rect: number[]) {
31
+ super();
32
+
33
+ if (rect[1] > rect[3]) {
34
+ throw new GeometryTagError(
35
+ "Basic Y coordinates values can not be inverted.",
36
+ );
37
+ }
38
+
39
+ for (let coord of rect) {
40
+ if (coord < 0 || coord > 1) {
41
+ throw new GeometryTagError(
42
+ "Basic coordinates must be on the interval [0, 1].",
43
+ );
44
+ }
45
+ }
46
+
47
+ this._anchorIndex = undefined;
48
+ this._rect = rect.slice(0, 4);
49
+ this._inverted = this._rect[0] > this._rect[2];
50
+ }
51
+
52
+ /**
53
+ * Get anchor index property.
54
+ *
55
+ * @returns {number} Index representing the current anchor property if
56
+ * achoring indexing has been initialized. If anchor indexing has not been
57
+ * initialized or has been terminated undefined will be returned.
58
+ */
59
+ public get anchorIndex(): number {
60
+ return this._anchorIndex;
61
+ }
62
+
63
+ /**
64
+ * Get inverted property.
65
+ *
66
+ * @returns {boolean} Boolean determining whether the rect geometry is
67
+ * inverted. For panoramas the rect geometrye may be inverted.
68
+ */
69
+ public get inverted(): boolean {
70
+ return this._inverted;
71
+ }
72
+
73
+ /**
74
+ * Get rect property.
75
+ *
76
+ * @returns {Array<number>} Array representing the top-left and bottom-right
77
+ * corners of the rectangle in basic coordinates.
78
+ */
79
+ public get rect(): number[] {
80
+ return this._rect;
81
+ }
82
+
83
+ /**
84
+ * Initialize anchor indexing to enable setting opposite vertex.
85
+ *
86
+ * @param {number} [index] - The index of the vertex to use as anchor.
87
+ *
88
+ * @throws {Error} If anchor indexing has already been initialized.
89
+ * @throws {Error} If index is not valid (0 to 3).
90
+ */
91
+ public initializeAnchorIndexing(index?: number): void {
92
+ if (this._anchorIndex !== undefined) {
93
+ throw new Error("Anchor indexing is already initialized.");
94
+ }
95
+
96
+ if (index < 0 || index > 3) {
97
+ throw new Error(`Invalid anchor index: ${index}.`);
98
+ }
99
+
100
+ this._anchorIndex = index === undefined ? 0 : index;
101
+ }
102
+
103
+ /**
104
+ * Terminate anchor indexing to disable setting pposite vertex.
105
+ */
106
+ public terminateAnchorIndexing(): void {
107
+ this._anchorIndex = undefined;
108
+ }
109
+
110
+ /**
111
+ * Set the value of the vertex opposite to the anchor in the polygon
112
+ * representation of the rectangle.
113
+ *
114
+ * @description Setting the opposite vertex may change the anchor index.
115
+ *
116
+ * @param {Array<number>} opposite - The new value of the vertex opposite to the anchor.
117
+ * @param {Transform} transform - The transform of the node related to the rectangle.
118
+ *
119
+ * @throws {Error} When anchor indexing has not been initialized.
120
+ */
121
+ public setOppositeVertex2d(opposite: number[], transform: Transform): void {
122
+ if (this._anchorIndex === undefined) {
123
+ throw new Error("Anchor indexing needs to be initialized.");
124
+ }
125
+
126
+ const changed: number[] = [
127
+ Math.max(0, Math.min(1, opposite[0])),
128
+ Math.max(0, Math.min(1, opposite[1])),
129
+ ];
130
+
131
+ const original: number[] = this._rect.slice();
132
+ const anchor: number[] =
133
+ this._anchorIndex === 0
134
+ ? [original[0], original[3]]
135
+ : this._anchorIndex === 1
136
+ ? [original[0], original[1]]
137
+ : this._anchorIndex === 2
138
+ ? [original[2], original[1]]
139
+ : [original[2], original[3]];
140
+
141
+ if (transform.fullPano) {
142
+ const deltaX: number =
143
+ this._anchorIndex < 2
144
+ ? changed[0] - original[2]
145
+ : changed[0] - original[0];
146
+
147
+ if (
148
+ !this._inverted &&
149
+ this._anchorIndex < 2 &&
150
+ changed[0] < 0.25 &&
151
+ original[2] > 0.75 &&
152
+ deltaX < -0.5
153
+ ) {
154
+ // right side passes boundary rightward
155
+ this._inverted = true;
156
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
157
+ } else if (
158
+ !this._inverted &&
159
+ this._anchorIndex >= 2 &&
160
+ changed[0] < 0.25 &&
161
+ original[2] > 0.75 &&
162
+ deltaX < -0.5
163
+ ) {
164
+ // left side passes right side and boundary rightward
165
+ this._inverted = true;
166
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
167
+ } else if (
168
+ this._inverted &&
169
+ this._anchorIndex >= 2 &&
170
+ changed[0] < 0.25 &&
171
+ original[0] > 0.75 &&
172
+ deltaX < -0.5
173
+ ) {
174
+ this._inverted = false;
175
+ if (anchor[0] > changed[0]) {
176
+ // left side passes boundary rightward
177
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
178
+ } else {
179
+ // left side passes right side and boundary rightward
180
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
181
+ }
182
+ } else if (
183
+ !this._inverted &&
184
+ this._anchorIndex >= 2 &&
185
+ changed[0] > 0.75 &&
186
+ original[0] < 0.25 &&
187
+ deltaX > 0.5
188
+ ) {
189
+ // left side passes boundary leftward
190
+ this._inverted = true;
191
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
192
+ } else if (
193
+ !this._inverted &&
194
+ this._anchorIndex < 2 &&
195
+ changed[0] > 0.75 &&
196
+ original[0] < 0.25 &&
197
+ deltaX > 0.5
198
+ ) {
199
+ // right side passes left side and boundary leftward
200
+ this._inverted = true;
201
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
202
+ } else if (
203
+ this._inverted &&
204
+ this._anchorIndex < 2 &&
205
+ changed[0] > 0.75 &&
206
+ original[2] < 0.25 &&
207
+ deltaX > 0.5
208
+ ) {
209
+ this._inverted = false;
210
+ if (anchor[0] > changed[0]) {
211
+ // right side passes boundary leftward
212
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
213
+ } else {
214
+ // right side passes left side and boundary leftward
215
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
216
+ }
217
+ } else if (
218
+ this._inverted &&
219
+ this._anchorIndex < 2 &&
220
+ changed[0] > original[0]
221
+ ) {
222
+ // inverted and right side passes left side completing a loop
223
+ this._inverted = false;
224
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
225
+ } else if (
226
+ this._inverted &&
227
+ this._anchorIndex >= 2 &&
228
+ changed[0] < original[2]
229
+ ) {
230
+ // inverted and left side passes right side completing a loop
231
+ this._inverted = false;
232
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
233
+ } else if (this._inverted) {
234
+ // if still inverted only top and bottom can switch
235
+ if (this._anchorIndex < 2) {
236
+ this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;
237
+ } else {
238
+ this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;
239
+ }
240
+ } else {
241
+ // if still not inverted treat as non full pano
242
+ if (anchor[0] <= changed[0] && anchor[1] > changed[1]) {
243
+ this._anchorIndex = 0;
244
+ } else if (anchor[0] <= changed[0] && anchor[1] <= changed[1]) {
245
+ this._anchorIndex = 1;
246
+ } else if (anchor[0] > changed[0] && anchor[1] <= changed[1]) {
247
+ this._anchorIndex = 2;
248
+ } else {
249
+ this._anchorIndex = 3;
250
+ }
251
+ }
252
+
253
+ const rect: number[] = [];
254
+ if (this._anchorIndex === 0) {
255
+ rect[0] = anchor[0];
256
+ rect[1] = changed[1];
257
+ rect[2] = changed[0];
258
+ rect[3] = anchor[1];
259
+ } else if (this._anchorIndex === 1) {
260
+ rect[0] = anchor[0];
261
+ rect[1] = anchor[1];
262
+ rect[2] = changed[0];
263
+ rect[3] = changed[1];
264
+ } else if (this._anchorIndex === 2) {
265
+ rect[0] = changed[0];
266
+ rect[1] = anchor[1];
267
+ rect[2] = anchor[0];
268
+ rect[3] = changed[1];
269
+ } else {
270
+ rect[0] = changed[0];
271
+ rect[1] = changed[1];
272
+ rect[2] = anchor[0];
273
+ rect[3] = anchor[1];
274
+ }
275
+
276
+ if (
277
+ (!this._inverted && rect[0] > rect[2]) ||
278
+ (this._inverted && rect[0] < rect[2])
279
+ ) {
280
+ rect[0] = original[0];
281
+ rect[2] = original[2];
282
+ }
283
+
284
+ if (rect[1] > rect[3]) {
285
+ rect[1] = original[1];
286
+ rect[3] = original[3];
287
+ }
288
+
289
+ this._rect[0] = rect[0];
290
+ this._rect[1] = rect[1];
291
+ this._rect[2] = rect[2];
292
+ this._rect[3] = rect[3];
293
+ } else {
294
+ if (anchor[0] <= changed[0] && anchor[1] > changed[1]) {
295
+ this._anchorIndex = 0;
296
+ } else if (anchor[0] <= changed[0] && anchor[1] <= changed[1]) {
297
+ this._anchorIndex = 1;
298
+ } else if (anchor[0] > changed[0] && anchor[1] <= changed[1]) {
299
+ this._anchorIndex = 2;
300
+ } else {
301
+ this._anchorIndex = 3;
302
+ }
303
+
304
+ const rect: number[] = [];
305
+ if (this._anchorIndex === 0) {
306
+ rect[0] = anchor[0];
307
+ rect[1] = changed[1];
308
+ rect[2] = changed[0];
309
+ rect[3] = anchor[1];
310
+ } else if (this._anchorIndex === 1) {
311
+ rect[0] = anchor[0];
312
+ rect[1] = anchor[1];
313
+ rect[2] = changed[0];
314
+ rect[3] = changed[1];
315
+ } else if (this._anchorIndex === 2) {
316
+ rect[0] = changed[0];
317
+ rect[1] = anchor[1];
318
+ rect[2] = anchor[0];
319
+ rect[3] = changed[1];
320
+ } else {
321
+ rect[0] = changed[0];
322
+ rect[1] = changed[1];
323
+ rect[2] = anchor[0];
324
+ rect[3] = anchor[1];
325
+ }
326
+
327
+ if (rect[0] > rect[2]) {
328
+ rect[0] = original[0];
329
+ rect[2] = original[2];
330
+ }
331
+
332
+ if (rect[1] > rect[3]) {
333
+ rect[1] = original[1];
334
+ rect[3] = original[3];
335
+ }
336
+
337
+ this._rect[0] = rect[0];
338
+ this._rect[1] = rect[1];
339
+ this._rect[2] = rect[2];
340
+ this._rect[3] = rect[3];
341
+ }
342
+
343
+ this._notifyChanged$.next(this);
344
+ }
345
+
346
+ /**
347
+ * Set the value of a vertex in the polygon representation of the rectangle.
348
+ *
349
+ * @description The polygon is defined to have the first vertex at the
350
+ * bottom-left corner with the rest of the vertices following in clockwise order.
351
+ *
352
+ * @param {number} index - The index of the vertex to be set.
353
+ * @param {Array<number>} value - The new value of the vertex.
354
+ * @param {Transform} transform - The transform of the node related to the rectangle.
355
+ */
356
+ public setVertex2d(
357
+ index: number,
358
+ value: number[],
359
+ transform: Transform,
360
+ ): void {
361
+ let original: number[] = this._rect.slice();
362
+
363
+ let changed: number[] = [
364
+ Math.max(0, Math.min(1, value[0])),
365
+ Math.max(0, Math.min(1, value[1])),
366
+ ];
367
+
368
+ let rect: number[] = [];
369
+ if (index === 0) {
370
+ rect[0] = changed[0];
371
+ rect[1] = original[1];
372
+ rect[2] = original[2];
373
+ rect[3] = changed[1];
374
+ } else if (index === 1) {
375
+ rect[0] = changed[0];
376
+ rect[1] = changed[1];
377
+ rect[2] = original[2];
378
+ rect[3] = original[3];
379
+ } else if (index === 2) {
380
+ rect[0] = original[0];
381
+ rect[1] = changed[1];
382
+ rect[2] = changed[0];
383
+ rect[3] = original[3];
384
+ } else if (index === 3) {
385
+ rect[0] = original[0];
386
+ rect[1] = original[1];
387
+ rect[2] = changed[0];
388
+ rect[3] = changed[1];
389
+ }
390
+
391
+ if (transform.fullPano) {
392
+ let passingBoundaryLeftward: boolean =
393
+ (index < 2 && changed[0] > 0.75 && original[0] < 0.25) ||
394
+ (index >= 2 &&
395
+ this._inverted &&
396
+ changed[0] > 0.75 &&
397
+ original[2] < 0.25);
398
+
399
+ let passingBoundaryRightward: boolean =
400
+ (index < 2 &&
401
+ this._inverted &&
402
+ changed[0] < 0.25 &&
403
+ original[0] > 0.75) ||
404
+ (index >= 2 && changed[0] < 0.25 && original[2] > 0.75);
405
+
406
+ if (passingBoundaryLeftward || passingBoundaryRightward) {
407
+ this._inverted = !this._inverted;
408
+ } else {
409
+ if (rect[0] - original[0] < -0.25) {
410
+ rect[0] = original[0];
411
+ }
412
+
413
+ if (rect[2] - original[2] > 0.25) {
414
+ rect[2] = original[2];
415
+ }
416
+ }
417
+
418
+ if (
419
+ (!this._inverted && rect[0] > rect[2]) ||
420
+ (this._inverted && rect[0] < rect[2])
421
+ ) {
422
+ rect[0] = original[0];
423
+ rect[2] = original[2];
424
+ }
425
+ } else {
426
+ if (rect[0] > rect[2]) {
427
+ rect[0] = original[0];
428
+ rect[2] = original[2];
429
+ }
430
+ }
431
+
432
+ if (rect[1] > rect[3]) {
433
+ rect[1] = original[1];
434
+ rect[3] = original[3];
435
+ }
436
+
437
+ this._rect[0] = rect[0];
438
+ this._rect[1] = rect[1];
439
+ this._rect[2] = rect[2];
440
+ this._rect[3] = rect[3];
441
+
442
+ this._notifyChanged$.next(this);
443
+ }
444
+
445
+ /** @inheritdoc */
446
+ public setCentroid2d(value: number[], transform: Transform): void {
447
+ let original: number[] = this._rect.slice();
448
+
449
+ let x0: number = original[0];
450
+ let x1: number = this._inverted ? original[2] + 1 : original[2];
451
+
452
+ let y0: number = original[1];
453
+ let y1: number = original[3];
454
+
455
+ let centerX: number = x0 + (x1 - x0) / 2;
456
+ let centerY: number = y0 + (y1 - y0) / 2;
457
+
458
+ let translationX: number = 0;
459
+
460
+ if (
461
+ transform.gpano != null &&
462
+ transform.gpano.CroppedAreaImageWidthPixels ===
463
+ transform.gpano.FullPanoWidthPixels
464
+ ) {
465
+ translationX = this._inverted
466
+ ? value[0] + 1 - centerX
467
+ : value[0] - centerX;
468
+ } else {
469
+ let minTranslationX: number = -x0;
470
+ let maxTranslationX: number = 1 - x1;
471
+
472
+ translationX = Math.max(
473
+ minTranslationX,
474
+ Math.min(maxTranslationX, value[0] - centerX),
475
+ );
476
+ }
477
+
478
+ let minTranslationY: number = -y0;
479
+ let maxTranslationY: number = 1 - y1;
480
+
481
+ let translationY: number = Math.max(
482
+ minTranslationY,
483
+ Math.min(maxTranslationY, value[1] - centerY),
484
+ );
485
+
486
+ this._rect[0] = original[0] + translationX;
487
+ this._rect[1] = original[1] + translationY;
488
+ this._rect[2] = original[2] + translationX;
489
+ this._rect[3] = original[3] + translationY;
490
+
491
+ if (this._rect[0] < 0) {
492
+ this._rect[0] += 1;
493
+ this._inverted = !this._inverted;
494
+ } else if (this._rect[0] > 1) {
495
+ this._rect[0] -= 1;
496
+ this._inverted = !this._inverted;
497
+ }
498
+
499
+ if (this._rect[2] < 0) {
500
+ this._rect[2] += 1;
501
+ this._inverted = !this._inverted;
502
+ } else if (this._rect[2] > 1) {
503
+ this._rect[2] -= 1;
504
+ this._inverted = !this._inverted;
505
+ }
506
+
507
+ this._notifyChanged$.next(this);
508
+ }
509
+
510
+ /**
511
+ * Get the 3D coordinates for the vertices of the rectangle with
512
+ * interpolated points along the lines.
513
+ *
514
+ * @param {Transform} transform - The transform of the node related to
515
+ * the rectangle.
516
+ * @returns {Array<Array<number>>} Polygon array of 3D world coordinates
517
+ * representing the rectangle.
518
+ */
519
+ public getPoints3d(transform: Transform): number[][] {
520
+ return this._getPoints2d(transform).map((point: number[]) => {
521
+ return transform.unprojectBasic(point, 200);
522
+ });
523
+ }
524
+
525
+ /**
526
+ * Get the coordinates of a vertex from the polygon representation of the geometry.
527
+ *
528
+ * @description The first vertex represents the bottom-left corner with the rest of
529
+ * the vertices following in clockwise order. The method shifts the right side
530
+ * coordinates of the rectangle by one unit to ensure that the vertices are ordered
531
+ * clockwise.
532
+ *
533
+ * @param {number} index - Vertex index.
534
+ * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.
535
+ */
536
+ public getVertex2d(index: number): number[] {
537
+ return this._rectToVertices2d(this._rect)[index];
538
+ }
539
+
540
+ /**
541
+ * Get the coordinates of a vertex from the polygon representation of the geometry.
542
+ *
543
+ * @description The first vertex represents the bottom-left corner with the rest of
544
+ * the vertices following in clockwise order. The coordinates will not be shifted
545
+ * so they may not appear in clockwise order when layed out on the plane.
546
+ *
547
+ * @param {number} index - Vertex index.
548
+ * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.
549
+ */
550
+ public getNonAdjustedVertex2d(index: number): number[] {
551
+ return this._rectToNonAdjustedVertices2d(this._rect)[index];
552
+ }
553
+
554
+ /**
555
+ * Get a vertex from the polygon representation of the 3D coordinates for the
556
+ * vertices of the geometry.
557
+ *
558
+ * @description The first vertex represents the bottom-left corner with the rest of
559
+ * the vertices following in clockwise order.
560
+ *
561
+ * @param {number} index - Vertex index.
562
+ * @param {Transform} transform - The transform of the node related to the geometry.
563
+ * @returns {Array<Array<number>>} Polygon array of 3D world coordinates representing
564
+ * the vertices of the geometry.
565
+ */
566
+ public getVertex3d(index: number, transform: Transform): number[] {
567
+ return transform.unprojectBasic(
568
+ this._rectToVertices2d(this._rect)[index],
569
+ 200,
570
+ );
571
+ }
572
+
573
+ /**
574
+ * Get a polygon representation of the 2D basic coordinates for the vertices of the rectangle.
575
+ *
576
+ * @description The first vertex represents the bottom-left corner with the rest of
577
+ * the vertices following in clockwise order.
578
+ *
579
+ * @returns {Array<Array<number>>} Polygon array of 2D basic coordinates representing
580
+ * the rectangle vertices.
581
+ */
582
+ public getVertices2d(): number[][] {
583
+ return this._rectToVertices2d(this._rect);
584
+ }
585
+
586
+ /**
587
+ * Get a polygon representation of the 3D coordinates for the vertices of the rectangle.
588
+ *
589
+ * @description The first vertex represents the bottom-left corner with the rest of
590
+ * the vertices following in clockwise order.
591
+ *
592
+ * @param {Transform} transform - The transform of the node related to the rectangle.
593
+ * @returns {Array<Array<number>>} Polygon array of 3D world coordinates representing
594
+ * the rectangle vertices.
595
+ */
596
+ public getVertices3d(transform: Transform): number[][] {
597
+ return this._rectToVertices2d(this._rect).map((vertex: number[]) => {
598
+ return transform.unprojectBasic(vertex, 200);
599
+ });
600
+ }
601
+
602
+ /** @inheritdoc */
603
+ public getCentroid2d(): number[] {
604
+ const rect: number[] = this._rect;
605
+
606
+ const x0: number = rect[0];
607
+ const x1: number = this._inverted ? rect[2] + 1 : rect[2];
608
+
609
+ const y0: number = rect[1];
610
+ const y1: number = rect[3];
611
+
612
+ const centroidX: number = x0 + (x1 - x0) / 2;
613
+ const centroidY: number = y0 + (y1 - y0) / 2;
614
+
615
+ return [centroidX, centroidY];
616
+ }
617
+
618
+ /** @inheritdoc */
619
+ public getCentroid3d(transform: Transform): number[] {
620
+ const centroid2d: number[] = this.getCentroid2d();
621
+
622
+ return transform.unprojectBasic(centroid2d, 200);
623
+ }
624
+
625
+ /** @inheritdoc */
626
+ public getPoleOfAccessibility2d(): number[] {
627
+ return this._getPoleOfInaccessibility2d(
628
+ this._rectToVertices2d(this._rect),
629
+ );
630
+ }
631
+
632
+ /** @inheritdoc */
633
+ public getPoleOfAccessibility3d(transform: Transform): number[] {
634
+ let pole2d: number[] = this._getPoleOfInaccessibility2d(
635
+ this._rectToVertices2d(this._rect),
636
+ );
637
+
638
+ return transform.unprojectBasic(pole2d, 200);
639
+ }
640
+
641
+ /** @inheritdoc */
642
+ public getTriangles3d(transform: Transform): number[] {
643
+ return this._triangulate(
644
+ this._rectToVertices2d(this._rect),
645
+ this.getVertices3d(transform),
646
+ );
647
+ }
648
+
649
+ /**
650
+ * Check if a particular bottom-right value is valid according to the current
651
+ * rectangle coordinates.
652
+ *
653
+ * @param {Array<number>} bottomRight - The bottom-right coordinates to validate
654
+ * @returns {boolean} Value indicating whether the provided bottom-right coordinates
655
+ * are valid.
656
+ */
657
+ public validate(bottomRight: number[]): boolean {
658
+ let rect: number[] = this._rect;
659
+
660
+ if (
661
+ (!this._inverted && bottomRight[0] < rect[0]) ||
662
+ bottomRight[0] - rect[2] > 0.25 ||
663
+ bottomRight[1] < rect[1]
664
+ ) {
665
+ return false;
666
+ }
667
+
668
+ return true;
669
+ }
670
+
671
+ /**
672
+ * Get the 2D coordinates for the vertices of the rectangle with
673
+ * interpolated points along the lines.
674
+ *
675
+ * @param {Transform} transform - The transform of the node related to
676
+ * the rectangle.
677
+ * @returns {Array<Array<number>>} Polygon array of 2D basic coordinates
678
+ * representing the rectangle.
679
+ */
680
+ private _getPoints2d(transform: Transform): number[][] {
681
+ let vertices2d: number[][] = this._rectToVertices2d(this._rect);
682
+
683
+ let sides: number = vertices2d.length - 1;
684
+ let sections: number = 10;
685
+
686
+ let points2d: number[][] = [];
687
+
688
+ for (let i: number = 0; i < sides; ++i) {
689
+ let startX: number = vertices2d[i][0];
690
+ let startY: number = vertices2d[i][1];
691
+
692
+ let endX: number = vertices2d[i + 1][0];
693
+ let endY: number = vertices2d[i + 1][1];
694
+
695
+ let intervalX: number = (endX - startX) / (sections - 1);
696
+ let intervalY: number = (endY - startY) / (sections - 1);
697
+
698
+ for (let j: number = 0; j < sections; ++j) {
699
+ let point: number[] = [
700
+ startX + j * intervalX,
701
+ startY + j * intervalY,
702
+ ];
703
+
704
+ points2d.push(point);
705
+ }
706
+ }
707
+
708
+ return points2d;
709
+ }
710
+
711
+ /**
712
+ * Convert the top-left, bottom-right representation of a rectangle to a polygon
713
+ * representation of the vertices starting at the bottom-left corner going
714
+ * clockwise.
715
+ *
716
+ * @description The method shifts the right side coordinates of the rectangle
717
+ * by one unit to ensure that the vertices are ordered clockwise.
718
+ *
719
+ * @param {Array<number>} rect - Top-left, bottom-right representation of a
720
+ * rectangle.
721
+ * @returns {Array<Array<number>>} Polygon representation of the vertices of the
722
+ * rectangle.
723
+ */
724
+ private _rectToVertices2d(rect: number[]): number[][] {
725
+ return [
726
+ [rect[0], rect[3]],
727
+ [rect[0], rect[1]],
728
+ [this._inverted ? rect[2] + 1 : rect[2], rect[1]],
729
+ [this._inverted ? rect[2] + 1 : rect[2], rect[3]],
730
+ [rect[0], rect[3]],
731
+ ];
732
+ }
733
+
734
+ /**
735
+ * Convert the top-left, bottom-right representation of a rectangle to a polygon
736
+ * representation of the vertices starting at the bottom-left corner going
737
+ * clockwise.
738
+ *
739
+ * @description The first vertex represents the bottom-left corner with the rest of
740
+ * the vertices following in clockwise order. The coordinates will not be shifted
741
+ * to ensure that the vertices are ordered clockwise when layed out on the plane.
742
+ *
743
+ * @param {Array<number>} rect - Top-left, bottom-right representation of a
744
+ * rectangle.
745
+ * @returns {Array<Array<number>>} Polygon representation of the vertices of the
746
+ * rectangle.
747
+ */
748
+ private _rectToNonAdjustedVertices2d(rect: number[]): number[][] {
749
+ return [
750
+ [rect[0], rect[3]],
751
+ [rect[0], rect[1]],
752
+ [rect[2], rect[1]],
753
+ [rect[2], rect[3]],
754
+ [rect[0], rect[3]],
755
+ ];
756
+ }
757
+ }
758
+
759
+ export default RectGeometry;