@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.
- package/bitbucket-pipelines.yml +50 -0
- package/config/rollup.js +33 -0
- package/config/rollup.serve.config.js +3 -0
- package/debug/circlemarker.html +444 -0
- package/debug/create_tags.html +474 -0
- package/debug/distance.html +220 -0
- package/debug/index.html +92 -0
- package/debug/integration.html +1084 -0
- package/debug/leaflet.html +54 -0
- package/debug/markers.html +115 -0
- package/debug/multi_monitor_sync.html +377 -0
- package/debug/outdoor.html +1026 -0
- package/debug/rect_tags.html +147 -0
- package/debug/rotate.html +236 -0
- package/debug/sample.html +324 -0
- package/debug/sequence.html +75 -0
- package/debug/tags.html +218 -0
- package/package.json +34 -10
- package/rollup.config.js +39 -0
- package/server.js +35 -0
- package/spec/api/APIv3.spec.ts +86 -0
- package/spec/component/Component.spec.ts +68 -0
- package/spec/component/StatsComponent.spec.ts +33 -0
- package/spec/component/direction/DirectionComponent.spec.ts +163 -0
- package/spec/component/direction/DirectionDOMRenderer.spec.ts +233 -0
- package/spec/component/keyboard/KeyZoomHandler.spec.ts +236 -0
- package/spec/component/marker/Marker.spec.ts +104 -0
- package/spec/component/marker/MarkerComponent.spec.ts +88 -0
- package/spec/component/marker/MarkerScene.spec.ts +223 -0
- package/spec/component/marker/MarkerSet.spec.ts +453 -0
- package/spec/component/mouse/DoubleClickZoomHandler.spec.ts +211 -0
- package/spec/component/popup/Popup.spec.ts +479 -0
- package/spec/component/popup/PopupComponent.spec.ts +414 -0
- package/spec/component/tag/CreateHandlerBase.spec.ts +83 -0
- package/spec/component/tag/CreatePointHandler.spec.ts +190 -0
- package/spec/component/tag/OutlineRenderTag.spec.ts +91 -0
- package/spec/component/tag/PointGeometry.spec.ts +131 -0
- package/spec/component/tag/PolygonGeometry.spec.ts +497 -0
- package/spec/component/tag/RectGeometry.spec.ts +1157 -0
- package/spec/component/tag/TagComponent.spec.ts +513 -0
- package/spec/component/tag/TagScene.spec.ts +346 -0
- package/spec/component/tag/TagSet.spec.ts +241 -0
- package/spec/component/utils/HandlerBase.spec.ts +203 -0
- package/spec/geo/Camera.spec.ts +250 -0
- package/spec/geo/GeoCoords.spec.ts +364 -0
- package/spec/geo/Spatial.spec.ts +711 -0
- package/spec/geo/Transform.spec.ts +850 -0
- package/spec/geo/ViewportCoords.spec.ts +534 -0
- package/spec/graph/FilterCreator.spec.ts +892 -0
- package/spec/graph/Graph.spec.ts +2078 -0
- package/spec/graph/GraphCalculator.spec.ts +263 -0
- package/spec/graph/GraphService.spec.ts +663 -0
- package/spec/graph/Node.spec.ts +373 -0
- package/spec/graph/NodeCache.spec.ts +206 -0
- package/spec/graph/Sequence.spec.ts +37 -0
- package/spec/graph/edge/EdgeCalculator.Pano.spec.ts +963 -0
- package/spec/graph/edge/EdgeCalculator.Sequence.spec.ts +108 -0
- package/spec/graph/edge/EdgeCalculator.Similar.spec.ts +272 -0
- package/spec/graph/edge/EdgeCalculator.Step.spec.ts +383 -0
- package/spec/graph/edge/EdgeCalculator.Turn.spec.ts +278 -0
- package/spec/graph/edge/EdgeCalculator.spec.ts +747 -0
- package/spec/helper/ContainerMockCreator.spec.ts +33 -0
- package/spec/helper/DOMRendererMockCreator.spec.ts +22 -0
- package/spec/helper/EdgeCalculatorHelper.spec.ts +96 -0
- package/spec/helper/EventHelper.spec.ts +92 -0
- package/spec/helper/GLRendererMockCreator.spec.ts +23 -0
- package/spec/helper/GeoHelper.spec.ts +16 -0
- package/spec/helper/ImageLoadingServiceMockCreator.spec.ts +24 -0
- package/spec/helper/KeyboardServiceMockCreator.spec.ts +21 -0
- package/spec/helper/LoadingServiceMockCreator.spec.ts +21 -0
- package/spec/helper/MockCreator.spec.ts +18 -0
- package/spec/helper/MockCreatorBase.spec.ts +17 -0
- package/spec/helper/MouseServiceMockCreator.spec.ts +38 -0
- package/spec/helper/NavigatorMockCreator.spec.ts +28 -0
- package/spec/helper/NodeHelper.spec.ts +77 -0
- package/spec/helper/NodeMockCreator.spec.ts +19 -0
- package/spec/helper/RenderServiceMockCreator.spec.ts +25 -0
- package/spec/helper/SpriteServiceMockCreator.spec.ts +22 -0
- package/spec/helper/StateServiceMockCreator.spec.ts +33 -0
- package/spec/helper/TouchServiceMockCreator.spec.ts +29 -0
- package/spec/helper/TransformHelper.spec.ts +17 -0
- package/spec/render/DOMRenderer.spec.ts +112 -0
- package/spec/render/GLRenderer.spec.ts +453 -0
- package/spec/render/RenderCamera.spec.ts +535 -0
- package/spec/render/RenderService.spec.ts +531 -0
- package/spec/state/StateBase.spec.ts +369 -0
- package/spec/state/StateService.spec.ts +9 -0
- package/spec/state/TraversingState.spec.ts +262 -0
- package/spec/state/WaitingState.spec.ts +319 -0
- package/spec/tiles/TextureProvider.spec.ts +653 -0
- package/spec/utils/EventEmitter.spec.ts +71 -0
- package/spec/utils/Support.spec.ts +54 -0
- package/spec/viewer/CacheService.spec.ts +160 -0
- package/spec/viewer/ComponentController.spec.ts +310 -0
- package/spec/viewer/LoadingService.spec.ts +19 -0
- package/spec/viewer/MouseService.spec.ts +1344 -0
- package/spec/viewer/Navigator.spec.ts +970 -0
- package/spec/viewer/Observer.spec.ts +96 -0
- package/spec/viewer/SpriteService.spec.ts +224 -0
- package/src/API.ts +3 -0
- package/src/Component.ts +77 -0
- package/src/Edge.ts +6 -0
- package/src/Error.ts +3 -0
- package/src/FilterRender.ts +27 -0
- package/src/Geo.ts +7 -0
- package/src/Graph.ts +19 -0
- package/src/MapxusVisual.ts +66 -0
- package/src/Render.ts +7 -0
- package/src/State.ts +8 -0
- package/src/Support.ts +35 -0
- package/src/Tiles.ts +5 -0
- package/src/Utils.ts +6 -0
- package/src/Viewer.ts +16 -0
- package/src/api/API.ts +396 -0
- package/src/api/Auth.ts +76 -0
- package/src/api/AuthStore.ts +11 -0
- package/src/api/GraphQLCreator.ts +100 -0
- package/src/api/interfaces/IAuth.ts +7 -0
- package/src/api/interfaces/IBuildingBase.ts +7 -0
- package/src/api/interfaces/IBuildingInfo.ts +19 -0
- package/src/api/interfaces/ICoreNode.ts +28 -0
- package/src/api/interfaces/IFillNode.ts +96 -0
- package/src/api/interfaces/IFloorInfo.ts +10 -0
- package/src/api/interfaces/IFullNode.ts +10 -0
- package/src/api/interfaces/IGPano.ts +38 -0
- package/src/api/interfaces/IImageTagInfo.ts +14 -0
- package/src/api/interfaces/IKey.ts +13 -0
- package/src/api/interfaces/ILatLon.ts +19 -0
- package/src/api/interfaces/IOutdoor.ts +14 -0
- package/src/api/interfaces/IPathNode.ts +37 -0
- package/src/api/interfaces/IProject.ts +8 -0
- package/src/api/interfaces/IQueryBuilding.ts +37 -0
- package/src/api/interfaces/IResponse.ts +7 -0
- package/src/api/interfaces/ISequence.ts +16 -0
- package/src/api/interfaces/IUser.ts +13 -0
- package/src/api/interfaces/interfaces.ts +17 -0
- package/src/component/AttributionComponent.ts +48 -0
- package/src/component/BackgroundComponent.ts +39 -0
- package/src/component/BearingComponent.ts +282 -0
- package/src/component/CacheComponent.ts +295 -0
- package/src/component/Component.ts +130 -0
- package/src/component/ComponentService.ts +150 -0
- package/src/component/CoverComponent.ts +132 -0
- package/src/component/DebugComponent.ts +157 -0
- package/src/component/ImageComponent.ts +96 -0
- package/src/component/LoadingComponent.ts +85 -0
- package/src/component/NavigationComponent.ts +233 -0
- package/src/component/RouteComponent.ts +354 -0
- package/src/component/StatsComponent.ts +100 -0
- package/src/component/direction/DirectionComponent.ts +254 -0
- package/src/component/direction/DirectionDOMCalculator.ts +243 -0
- package/src/component/direction/DirectionDOMRenderer.ts +631 -0
- package/src/component/imageplane/ImagePlaneComponent.ts +497 -0
- package/src/component/imageplane/ImagePlaneFactory.ts +314 -0
- package/src/component/imageplane/ImagePlaneGLRenderer.ts +247 -0
- package/src/component/imageplane/ImagePlaneScene.ts +87 -0
- package/src/component/imageplane/ImagePlaneShaders.ts +16 -0
- package/src/component/imageplane/SliderComponent.ts +697 -0
- package/src/component/imageplane/interfaces/IBBoxShaderMaterial.ts +10 -0
- package/src/component/imageplane/interfaces/IShaderMaterial.ts +9 -0
- package/src/component/imageplane/interfaces/interfaces.ts +2 -0
- package/src/component/imageplane/shaders/equirectangular.fragment.glsl.ts +26 -0
- package/src/component/imageplane/shaders/equirectangular.vertex.glsl.ts +15 -0
- package/src/component/imageplane/shaders/perspective.fragment.glsl.ts +27 -0
- package/src/component/imageplane/shaders/perspective.vertex.glsl.ts +15 -0
- package/src/component/interfaces/ICacheConfiguration.ts +72 -0
- package/src/component/interfaces/IComponentConfiguration.ts +5 -0
- package/src/component/interfaces/ICoverConfiguration.ts +15 -0
- package/src/component/interfaces/IDirectionConfiguration.ts +63 -0
- package/src/component/interfaces/IImagePlaneConfiguration.ts +17 -0
- package/src/component/interfaces/IKeyboardConfiguration.ts +44 -0
- package/src/component/interfaces/IMarkerConfiguration.ts +31 -0
- package/src/component/interfaces/IMouseConfiguration.ts +52 -0
- package/src/component/interfaces/INavigationConfiguration.ts +35 -0
- package/src/component/interfaces/IRouteConfiguration.ts +20 -0
- package/src/component/interfaces/ISequenceConfiguration.ts +72 -0
- package/src/component/interfaces/IShader.ts +6 -0
- package/src/component/interfaces/ISliderConfiguration.ts +61 -0
- package/src/component/interfaces/ITagConfiguration.ts +40 -0
- package/src/component/interfaces/interfaces.ts +17 -0
- package/src/component/keyboard/KeySequenceNavigationHandler.ts +86 -0
- package/src/component/keyboard/KeySpatialNavigationHandler.ts +216 -0
- package/src/component/keyboard/KeyZoomHandler.ts +106 -0
- package/src/component/keyboard/KeyboardComponent.ts +125 -0
- package/src/component/marker/Marker.ts +5 -0
- package/src/component/marker/MarkerComponent.ts +856 -0
- package/src/component/marker/MarkerScene.ts +145 -0
- package/src/component/marker/MarkerSet.ts +142 -0
- package/src/component/marker/interfaces/IArrowMarkerOptions.ts +41 -0
- package/src/component/marker/interfaces/ICircleMarkerOptions.ts +30 -0
- package/src/component/marker/interfaces/IDotMarkerOptions.ts +18 -0
- package/src/component/marker/interfaces/IMarkerEvent.ts +28 -0
- package/src/component/marker/interfaces/ISimpleMarkerOptions.ts +54 -0
- package/src/component/marker/interfaces/interfaces.ts +5 -0
- package/src/component/marker/marker/ArrowMarker.ts +84 -0
- package/src/component/marker/marker/CircleMarker.ts +82 -0
- package/src/component/marker/marker/DotMarker.ts +68 -0
- package/src/component/marker/marker/ImageMarker.ts +45 -0
- package/src/component/marker/marker/Marker.ts +99 -0
- package/src/component/marker/marker/SimpleMarker.ts +187 -0
- package/src/component/mouse/BounceHandler.ts +148 -0
- package/src/component/mouse/DoubleClickZoomHandler.ts +106 -0
- package/src/component/mouse/DragPanHandler.ts +489 -0
- package/src/component/mouse/HandlerTypes.ts +13 -0
- package/src/component/mouse/MouseComponent.ts +170 -0
- package/src/component/mouse/ScrollZoomHandler.ts +137 -0
- package/src/component/mouse/TouchZoomHandler.ts +136 -0
- package/src/component/path/PathComponent.ts +75 -0
- package/src/component/path/PathEvent.ts +245 -0
- package/src/component/path/PathMarker.ts +42 -0
- package/src/component/path/PathRender.ts +163 -0
- package/src/component/popup/Popup.ts +2 -0
- package/src/component/popup/PopupComponent.ts +244 -0
- package/src/component/popup/interfaces/IPopupOffset.ts +37 -0
- package/src/component/popup/interfaces/IPopupOptions.ts +81 -0
- package/src/component/popup/popup/Popup.ts +594 -0
- package/src/component/popup/popup/PopupAlignment.ts +3 -0
- package/src/component/sequence/SequenceComponent.ts +500 -0
- package/src/component/sequence/SequenceDOMInteraction.ts +23 -0
- package/src/component/sequence/SequenceDOMRenderer.ts +179 -0
- package/src/component/tag/Tag.ts +9 -0
- package/src/component/tag/TagComponent.ts +787 -0
- package/src/component/tag/TagCreator.ts +138 -0
- package/src/component/tag/TagDOMRenderer.ts +35 -0
- package/src/component/tag/TagMode.ts +37 -0
- package/src/component/tag/TagOperation.ts +7 -0
- package/src/component/tag/TagScene.ts +216 -0
- package/src/component/tag/TagSet.ts +186 -0
- package/src/component/tag/error/GeometryTagError.ts +11 -0
- package/src/component/tag/geometry/Geometry.ts +62 -0
- package/src/component/tag/geometry/PointGeometry.ts +89 -0
- package/src/component/tag/geometry/PolygonGeometry.ts +349 -0
- package/src/component/tag/geometry/RectGeometry.ts +759 -0
- package/src/component/tag/geometry/VertexGeometry.ts +185 -0
- package/src/component/tag/handlers/CreateHandlerBase.ts +81 -0
- package/src/component/tag/handlers/CreatePointHandler.ts +35 -0
- package/src/component/tag/handlers/CreatePolygonHandler.ts +33 -0
- package/src/component/tag/handlers/CreateRectDragHandler.ts +199 -0
- package/src/component/tag/handlers/CreateRectHandler.ts +57 -0
- package/src/component/tag/handlers/CreateVertexHandler.ts +165 -0
- package/src/component/tag/handlers/EditVertexHandler.ts +275 -0
- package/src/component/tag/handlers/TagHandlerBase.ts +57 -0
- package/src/component/tag/interfaces/IInteraction.ts +14 -0
- package/src/component/tag/interfaces/IOutlineCreateTagOptions.ts +15 -0
- package/src/component/tag/interfaces/IOutlineTagOptions.ts +89 -0
- package/src/component/tag/interfaces/ISpotTagOptions.ts +37 -0
- package/src/component/tag/interfaces/interfaces.ts +4 -0
- package/src/component/tag/tag/OutlineCreateTag.ts +330 -0
- package/src/component/tag/tag/OutlineRenderTag.ts +569 -0
- package/src/component/tag/tag/OutlineTag.ts +380 -0
- package/src/component/tag/tag/RenderTag.ts +50 -0
- package/src/component/tag/tag/SpotRenderTag.ts +160 -0
- package/src/component/tag/tag/SpotTag.ts +170 -0
- package/src/component/tag/tag/Tag.ts +103 -0
- package/src/component/utils/HandlerBase.ts +71 -0
- package/src/error/ArgumentBeeviewError.ts +11 -0
- package/src/error/BeeviewError.ts +9 -0
- package/src/error/GraphBeeviewError.ts +11 -0
- package/src/geo/Camera.ts +149 -0
- package/src/geo/GeoCoords.ts +280 -0
- package/src/geo/GeoRBush.ts +25 -0
- package/src/geo/Spatial.ts +259 -0
- package/src/geo/Transform.ts +543 -0
- package/src/geo/ViewportCoords.ts +518 -0
- package/src/geo/interfaces/ILatLonAlt.ts +7 -0
- package/src/geo/interfaces/interfaces.ts +1 -0
- package/src/graph/FilterCreator.ts +106 -0
- package/src/graph/FilterExpression.ts +16 -0
- package/src/graph/Graph.ts +1516 -0
- package/src/graph/GraphCalculator.ts +197 -0
- package/src/graph/GraphService.ts +516 -0
- package/src/graph/ImageLoadingService.ts +44 -0
- package/src/graph/MeshReader.ts +19 -0
- package/src/graph/Node.ts +622 -0
- package/src/graph/NodeCache.ts +548 -0
- package/src/graph/Sequence.ts +117 -0
- package/src/graph/edge/EdgeCalculator.ts +919 -0
- package/src/graph/edge/EdgeCalculatorCoefficients.ts +43 -0
- package/src/graph/edge/EdgeCalculatorDirections.ts +80 -0
- package/src/graph/edge/EdgeCalculatorSettings.ts +61 -0
- package/src/graph/edge/EdgeDirection.ts +63 -0
- package/src/graph/edge/interfaces/IEdge.ts +26 -0
- package/src/graph/edge/interfaces/IEdgeData.ts +22 -0
- package/src/graph/edge/interfaces/IPano.ts +8 -0
- package/src/graph/edge/interfaces/IPotentialEdge.ts +106 -0
- package/src/graph/edge/interfaces/IStep.ts +7 -0
- package/src/graph/edge/interfaces/ITurn.ts +7 -0
- package/src/graph/edge/interfaces/interfaces.ts +6 -0
- package/src/graph/interfaces/IEdgeStatus.ts +25 -0
- package/src/graph/interfaces/IGraphConfiguration.ts +26 -0
- package/src/graph/interfaces/ILoadStatus.ts +18 -0
- package/src/graph/interfaces/ILoadStatusObject.ts +8 -0
- package/src/graph/interfaces/IMesh.ts +20 -0
- package/src/graph/interfaces/interfaces.ts +5 -0
- package/src/render/DOMRenderer.ts +288 -0
- package/src/render/GLRenderStage.ts +6 -0
- package/src/render/GLRenderer.ts +436 -0
- package/src/render/RenderCamera.ts +212 -0
- package/src/render/RenderMode.ts +34 -0
- package/src/render/RenderService.ts +264 -0
- package/src/render/interfaces/IGLRender.ts +10 -0
- package/src/render/interfaces/IGLRenderFunction.ts +10 -0
- package/src/render/interfaces/IGLRenderHash.ts +8 -0
- package/src/render/interfaces/ISize.ts +6 -0
- package/src/render/interfaces/IVNodeHash.ts +8 -0
- package/src/render/interfaces/interfaces.ts +5 -0
- package/src/state/FrameGenerator.ts +36 -0
- package/src/state/State.ts +6 -0
- package/src/state/StateContext.ts +180 -0
- package/src/state/StateService.ts +600 -0
- package/src/state/StateTransitionMatrix.ts +58 -0
- package/src/state/interfaces/ICurrentState.ts +21 -0
- package/src/state/interfaces/IFrame.ts +9 -0
- package/src/state/interfaces/IRotation.ts +6 -0
- package/src/state/interfaces/IState.ts +11 -0
- package/src/state/interfaces/IStateContext.ts +31 -0
- package/src/state/interfaces/interfaces.ts +5 -0
- package/src/state/states/StateBase.ts +425 -0
- package/src/state/states/TraversingState.ts +861 -0
- package/src/state/states/WaitingState.ts +109 -0
- package/src/tiles/ImageTileLoader.ts +121 -0
- package/src/tiles/ImageTileStore.ts +70 -0
- package/src/tiles/RegionOfInterestCalculator.ts +158 -0
- package/src/tiles/TextureProvider.ts +609 -0
- package/src/tiles/interfaces/IBoundingBox.ts +28 -0
- package/src/tiles/interfaces/IRegionOfInterest.ts +25 -0
- package/src/tiles/interfaces/interfaces.ts +2 -0
- package/src/utils/DOM.ts +28 -0
- package/src/utils/EventEmitter.ts +61 -0
- package/src/utils/Func.ts +3 -0
- package/src/utils/Settings.ts +39 -0
- package/src/utils/Support.ts +70 -0
- package/src/utils/Urls.ts +43 -0
- package/src/viewer/Alignment.ts +53 -0
- package/src/viewer/CacheService.ts +75 -0
- package/src/viewer/ComponentController.ts +237 -0
- package/src/viewer/Container.ts +100 -0
- package/src/viewer/EventNames.ts +192 -0
- package/src/viewer/ImageSize.ts +28 -0
- package/src/viewer/KeyboardService.ts +15 -0
- package/src/viewer/LoadingService.ts +66 -0
- package/src/viewer/MouseService.ts +541 -0
- package/src/viewer/Navigator.ts +362 -0
- package/src/viewer/Observer.ts +441 -0
- package/src/viewer/Projection.ts +162 -0
- package/src/viewer/SpriteService.ts +281 -0
- package/src/viewer/TouchService.ts +336 -0
- package/src/viewer/Viewer.ts +1132 -0
- package/src/viewer/interfaces/IComponentOptions.ts +176 -0
- package/src/viewer/interfaces/IMouseClaim.ts +6 -0
- package/src/viewer/interfaces/IMouseDeferPixels.ts +6 -0
- package/src/viewer/interfaces/IPinch.ts +81 -0
- package/src/viewer/interfaces/ISpriteAtlas.ts +12 -0
- package/src/viewer/interfaces/IUnprojection.ts +9 -0
- package/src/viewer/interfaces/IViewerMouseEvent.ts +56 -0
- package/src/viewer/interfaces/IViewerOptions.ts +88 -0
- package/src/viewer/interfaces/PointOfView.ts +19 -0
- package/src/viewer/interfaces/interfaces.ts +9 -0
- package/styles/AttributionComponent.css +26 -0
- package/styles/BackgroundComponent.css +21 -0
- package/styles/BearingComponent.css +48 -0
- package/styles/CoverComponent.css +169 -0
- package/styles/DebugComponent.css +28 -0
- package/styles/DirectionComponent.css +154 -0
- package/styles/LoadingComponent.css +14 -0
- package/styles/NavigationComponent.css +64 -0
- package/styles/NorthBg.png +0 -0
- package/styles/PopupComponent.css +188 -0
- package/styles/RouteComponent.css +21 -0
- package/styles/SequenceComponent.css +120 -0
- package/styles/SliderComponent.css +82 -0
- package/styles/TagComponent.css +105 -0
- package/styles/cover-logo.png +0 -0
- package/styles/mapillary-js.css +29 -0
- package/styles/pano-indicator.svg +3 -0
- package/styles/pano.svg +20 -0
- package/styles/pointer-wheat.svg +3 -0
- package/styles/pointer-white.svg +3 -0
- package/styles/spinner.svg +1 -0
- package/styles/stepper-left.svg +1 -0
- package/styles/stepper-play.svg +1 -0
- package/styles/stepper-right.svg +1 -0
- package/styles/stepper-stop.svg +1 -0
- package/styles/turn-around.svg +3 -0
- package/styles/turn.svg +3 -0
- package/tsconfig.json +28 -0
- package/tslint.json +81 -0
- package/types/graphql/index.d.ts +28 -0
- package/types/graphql/language/ast/index.d.ts +7 -0
- package/types/images/index.d.ts +7 -0
- package/types/pbf/index.d.ts +16 -0
- package/types/rbush/index.d.ts +28 -0
- package/version/beeview-0.1.0.css +2 -0
- package/version/beeview-0.1.0.js +1 -0
- package/version/beeview-0.1.1.css +2 -0
- package/version/beeview-0.1.1.js +1 -0
- package/version/beeview-0.1.2.css +2 -0
- package/version/beeview-0.1.2.js +1 -0
- package/version/beeview-0.2.0.css +2 -0
- package/version/beeview-0.2.0.js +1 -0
- package/version/beeview-0.2.1.css +2 -0
- package/version/beeview-0.2.1.js +1 -0
- package/version/beeview-0.3.0.css +2 -0
- package/version/beeview-0.3.0.js +1 -0
- package/version/beeview-0.4.0.css +2 -0
- package/version/beeview-0.4.0.js +1 -0
- package/version/beeview-0.4.1.css +2 -0
- package/version/beeview-0.4.1.js +1 -0
- package/version/mapxus-visual-1.0.0.css +2 -0
- package/version/mapxus-visual-1.0.0.js +1 -0
- package/version/mapxus-visual-1.1.0.css +2 -0
- package/version/mapxus-visual-1.1.0.js +1 -0
- package/version/mapxus-visual-1.1.1.css +2 -0
- package/version/mapxus-visual-1.1.1.js +1 -0
- package/version/mapxus-visual-1.1.2.css +2 -0
- package/version/mapxus-visual-1.1.2.js +1 -0
- package/version/mapxus-visual-1.2.0.css +2 -0
- package/version/mapxus-visual-1.2.0.js +1 -0
- package/version/mapxus-visual-1.3.0.css +2 -0
- package/version/mapxus-visual-1.3.0.js +1 -0
- package/LICENSE +0 -11
- package/README.md +0 -28
- package/index.css +0 -2
- package/index.d.ts +0 -163
- package/index.js +0 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as vd from "virtual-dom";
|
|
2
|
+
import { Observable, Subscription, combineLatest } from "rxjs";
|
|
3
|
+
import type { IComponentConfiguration } from "../component/interfaces/interfaces";
|
|
4
|
+
import { Component } from "../component/Component";
|
|
5
|
+
import { ComponentService } from "../component/ComponentService";
|
|
6
|
+
import { Spatial, Transform } from "../Geo";
|
|
7
|
+
import { Node } from "../Graph";
|
|
8
|
+
import type { IVNodeHash } from "../render/interfaces/interfaces";
|
|
9
|
+
import { RenderCamera } from "../render/RenderCamera";
|
|
10
|
+
import type { IFrame } from "../state/interfaces/interfaces";
|
|
11
|
+
import { Container, Navigator } from "../Viewer";
|
|
12
|
+
import { distinctUntilChanged, map } from "rxjs/operators";
|
|
13
|
+
|
|
14
|
+
export class BearingComponent extends Component<IComponentConfiguration> {
|
|
15
|
+
public static componentName: string = "bearing";
|
|
16
|
+
|
|
17
|
+
private _spatial: Spatial;
|
|
18
|
+
private _svgNamespace: string;
|
|
19
|
+
private _distinctThreshold: number;
|
|
20
|
+
|
|
21
|
+
private _renderSubscription: Subscription;
|
|
22
|
+
|
|
23
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
24
|
+
super(name, container, navigator);
|
|
25
|
+
|
|
26
|
+
this._spatial = new Spatial();
|
|
27
|
+
this._svgNamespace = "http://www.w3.org/2000/svg";
|
|
28
|
+
this._distinctThreshold = Math.PI / 90;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected _activate(): void {
|
|
32
|
+
let nodeBearingFov$: Observable<[number, number]> =
|
|
33
|
+
this._navigator.stateService.currentState$.pipe(
|
|
34
|
+
distinctUntilChanged(undefined, (frame: IFrame): string => {
|
|
35
|
+
return frame.state.currentNode.key;
|
|
36
|
+
}),
|
|
37
|
+
map((frame: IFrame): [number, number] => {
|
|
38
|
+
let hFov: number;
|
|
39
|
+
let node: Node = frame.state.currentNode;
|
|
40
|
+
let transform: Transform = frame.state.currentTransform;
|
|
41
|
+
|
|
42
|
+
if (node.pano) {
|
|
43
|
+
hFov =
|
|
44
|
+
(2 *
|
|
45
|
+
Math.PI *
|
|
46
|
+
node.gpano.CroppedAreaImageWidthPixels) /
|
|
47
|
+
node.gpano.FullPanoWidthPixels;
|
|
48
|
+
|
|
49
|
+
return [this._spatial.degToRad(node.ca), hFov];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let size: number = Math.max(
|
|
53
|
+
transform.basicWidth,
|
|
54
|
+
transform.basicHeight,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (size <= 0) {
|
|
58
|
+
console.warn(
|
|
59
|
+
`Original image size (${transform.basicWidth}, ${transform.basicHeight}) is invalid (${node.key}. ` +
|
|
60
|
+
"Not showing available fov.",
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
hFov =
|
|
65
|
+
size > 0
|
|
66
|
+
? 2 *
|
|
67
|
+
Math.atan(
|
|
68
|
+
(0.5 * transform.basicWidth) /
|
|
69
|
+
(size * transform.focal),
|
|
70
|
+
)
|
|
71
|
+
: 0;
|
|
72
|
+
|
|
73
|
+
return [this._spatial.degToRad(node.ca), hFov];
|
|
74
|
+
}),
|
|
75
|
+
distinctUntilChanged(
|
|
76
|
+
(a1: [number, number], a2: [number, number]): boolean => {
|
|
77
|
+
return (
|
|
78
|
+
Math.abs(a2[0] - a1[0]) < this._distinctThreshold &&
|
|
79
|
+
Math.abs(a2[1] - a1[1]) < this._distinctThreshold
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
let cameraBearingFov$: Observable<[number, number]> =
|
|
86
|
+
this._container.renderService.renderCamera$.pipe(
|
|
87
|
+
map((rc: RenderCamera): [number, number] => {
|
|
88
|
+
let vFov: number = this._spatial.degToRad(
|
|
89
|
+
rc.perspective.fov,
|
|
90
|
+
);
|
|
91
|
+
let hFov: number =
|
|
92
|
+
rc.perspective.aspect === Number.POSITIVE_INFINITY
|
|
93
|
+
? Math.PI
|
|
94
|
+
: Math.atan(
|
|
95
|
+
rc.perspective.aspect * Math.tan(0.5 * vFov),
|
|
96
|
+
) * 2;
|
|
97
|
+
|
|
98
|
+
return [
|
|
99
|
+
this._spatial.azimuthalToBearing(rc.rotation.phi),
|
|
100
|
+
hFov,
|
|
101
|
+
];
|
|
102
|
+
}),
|
|
103
|
+
distinctUntilChanged(
|
|
104
|
+
(a1: [number, number], a2: [number, number]): boolean => {
|
|
105
|
+
return (
|
|
106
|
+
Math.abs(a2[0] - a1[0]) < this._distinctThreshold &&
|
|
107
|
+
Math.abs(a2[1] - a1[1]) < this._distinctThreshold
|
|
108
|
+
);
|
|
109
|
+
},
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
this._renderSubscription = combineLatest(
|
|
114
|
+
nodeBearingFov$,
|
|
115
|
+
cameraBearingFov$,
|
|
116
|
+
)
|
|
117
|
+
.pipe(
|
|
118
|
+
map(
|
|
119
|
+
(
|
|
120
|
+
args: [[number, number], [number, number]],
|
|
121
|
+
): IVNodeHash => {
|
|
122
|
+
let background: vd.VNode = vd.h(
|
|
123
|
+
"div.BearingIndicatorBackground",
|
|
124
|
+
{
|
|
125
|
+
oncontextmenu: (event: MouseEvent): void => {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
[
|
|
130
|
+
vd.h(
|
|
131
|
+
"div.BearingIndicatorBackgroundRectangle",
|
|
132
|
+
{},
|
|
133
|
+
[],
|
|
134
|
+
),
|
|
135
|
+
vd.h(
|
|
136
|
+
"div.BearingIndicatorBackgroundCircle",
|
|
137
|
+
{},
|
|
138
|
+
[],
|
|
139
|
+
),
|
|
140
|
+
],
|
|
141
|
+
);
|
|
142
|
+
let north: vd.VNode = vd.h(
|
|
143
|
+
"div.BearingIndicatorNorth",
|
|
144
|
+
{},
|
|
145
|
+
[],
|
|
146
|
+
);
|
|
147
|
+
let nodeSector: vd.VNode = this._createCircleSector(
|
|
148
|
+
args[0][0],
|
|
149
|
+
args[0][1],
|
|
150
|
+
"#fff",
|
|
151
|
+
);
|
|
152
|
+
let cameraSector: vd.VNode = this._createCircleSector(
|
|
153
|
+
args[1][0],
|
|
154
|
+
args[1][1],
|
|
155
|
+
"#49b1d3",
|
|
156
|
+
);
|
|
157
|
+
// let tetragon: vd.VNode = this._createCircleSector(args[1][0], args[1][1], "#ff6600");
|
|
158
|
+
let compass: vd.VNode = this._createCircleSectorCompass(
|
|
159
|
+
nodeSector,
|
|
160
|
+
cameraSector,
|
|
161
|
+
);
|
|
162
|
+
let degArgs: number = args[1][0] * 60;
|
|
163
|
+
let deg: vd.VNode = vd.h(
|
|
164
|
+
"div.TransformDeg",
|
|
165
|
+
{
|
|
166
|
+
attributes: {
|
|
167
|
+
style: `transform:rotate(${degArgs}deg)`,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
[],
|
|
171
|
+
);
|
|
172
|
+
return {
|
|
173
|
+
name: this._name,
|
|
174
|
+
vnode: vd.h("div.BearingIndicator", {}, [
|
|
175
|
+
background,
|
|
176
|
+
north,
|
|
177
|
+
compass,
|
|
178
|
+
deg,
|
|
179
|
+
]),
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
),
|
|
183
|
+
)
|
|
184
|
+
.subscribe(this._container.domRenderer.render$);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
protected _deactivate(): void {
|
|
188
|
+
this._renderSubscription.unsubscribe();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
protected _getDefaultConfiguration(): IComponentConfiguration {
|
|
192
|
+
return {};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private _createCircleSectorCompass(
|
|
196
|
+
nodeSector: vd.VNode,
|
|
197
|
+
cameraSector: vd.VNode,
|
|
198
|
+
): vd.VNode {
|
|
199
|
+
let group: vd.VNode = vd.h(
|
|
200
|
+
"g",
|
|
201
|
+
{
|
|
202
|
+
attributes: { transform: "translate(1,1)" },
|
|
203
|
+
namespace: this._svgNamespace,
|
|
204
|
+
},
|
|
205
|
+
[nodeSector, cameraSector],
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
let centerCircle: vd.VNode = vd.h(
|
|
209
|
+
"circle",
|
|
210
|
+
{
|
|
211
|
+
attributes: {
|
|
212
|
+
cx: "1",
|
|
213
|
+
cy: "1",
|
|
214
|
+
fill: "#fff",
|
|
215
|
+
r: "0.291667",
|
|
216
|
+
stroke: "#fff",
|
|
217
|
+
"stroke-width": "0.0833333",
|
|
218
|
+
},
|
|
219
|
+
namespace: this._svgNamespace,
|
|
220
|
+
},
|
|
221
|
+
[],
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
let svg: vd.VNode = vd.h(
|
|
225
|
+
"svg",
|
|
226
|
+
{
|
|
227
|
+
attributes: { viewBox: "0 0 2 2" },
|
|
228
|
+
namespace: this._svgNamespace,
|
|
229
|
+
style: {
|
|
230
|
+
bottom: "4px",
|
|
231
|
+
height: "48px",
|
|
232
|
+
left: "4px",
|
|
233
|
+
position: "absolute",
|
|
234
|
+
width: "48px",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
[group, centerCircle],
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
return svg;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private _createCircleSector(
|
|
244
|
+
bearing: number,
|
|
245
|
+
fov: number,
|
|
246
|
+
fill: string,
|
|
247
|
+
): vd.VNode {
|
|
248
|
+
if (fov > 2 * Math.PI - Math.PI / 90) {
|
|
249
|
+
return vd.h(
|
|
250
|
+
"circle",
|
|
251
|
+
{
|
|
252
|
+
attributes: { cx: "0", cy: "0", fill: fill, r: "1" },
|
|
253
|
+
namespace: this._svgNamespace,
|
|
254
|
+
},
|
|
255
|
+
[],
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let arcStart: number = bearing - fov / 2 - Math.PI / 2;
|
|
260
|
+
let arcEnd: number = arcStart + fov;
|
|
261
|
+
|
|
262
|
+
let startX: number = Math.cos(arcStart);
|
|
263
|
+
let startY: number = Math.sin(arcStart);
|
|
264
|
+
|
|
265
|
+
let endX: number = Math.cos(arcEnd);
|
|
266
|
+
let endY: number = Math.sin(arcEnd);
|
|
267
|
+
|
|
268
|
+
let largeArc: number = fov >= Math.PI ? 1 : 0;
|
|
269
|
+
|
|
270
|
+
let description: string = `M 0 0 ${startX} ${startY} A 1 1 0 ${largeArc} 1 ${endX} ${endY}`;
|
|
271
|
+
return vd.h(
|
|
272
|
+
"path",
|
|
273
|
+
{
|
|
274
|
+
attributes: { d: description, fill: fill },
|
|
275
|
+
namespace: this._svgNamespace,
|
|
276
|
+
},
|
|
277
|
+
[],
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export default BearingComponent;
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Observable,
|
|
3
|
+
Subscription,
|
|
4
|
+
EMPTY,
|
|
5
|
+
merge as observableMerge,
|
|
6
|
+
combineLatest as observableCombineLatest,
|
|
7
|
+
zip as observableZip,
|
|
8
|
+
of,
|
|
9
|
+
from,
|
|
10
|
+
} from "rxjs";
|
|
11
|
+
import type { IEdge } from "../graph/edge/interfaces/interfaces";
|
|
12
|
+
import { EdgeDirection } from "../graph/edge/EdgeDirection";
|
|
13
|
+
import type { IEdgeStatus } from "../graph/interfaces/interfaces";
|
|
14
|
+
import { Node } from "../graph/Node";
|
|
15
|
+
import type { ICacheConfiguration, ICacheDepth } from "./interfaces/interfaces";
|
|
16
|
+
import { ComponentService } from "../component/ComponentService";
|
|
17
|
+
import { Component } from "../component/Component";
|
|
18
|
+
import { Container } from "../viewer/Container";
|
|
19
|
+
import { Navigator } from "../viewer/Navigator";
|
|
20
|
+
import {
|
|
21
|
+
switchMap,
|
|
22
|
+
filter,
|
|
23
|
+
catchError,
|
|
24
|
+
expand,
|
|
25
|
+
mergeAll,
|
|
26
|
+
skip,
|
|
27
|
+
first,
|
|
28
|
+
map,
|
|
29
|
+
combineLatest,
|
|
30
|
+
mergeMap,
|
|
31
|
+
} from "rxjs/operators";
|
|
32
|
+
|
|
33
|
+
type EdgesDepth = [IEdge[], number];
|
|
34
|
+
|
|
35
|
+
export class CacheComponent extends Component<ICacheConfiguration> {
|
|
36
|
+
public static componentName: string = "cache";
|
|
37
|
+
|
|
38
|
+
private _sequenceSubscription: Subscription;
|
|
39
|
+
private _spatialSubscription: Subscription;
|
|
40
|
+
|
|
41
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
42
|
+
super(name, container, navigator);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Set the cache depth.
|
|
47
|
+
*
|
|
48
|
+
* Configures the cache depth. The cache depth can be different for
|
|
49
|
+
* different edge direction types.
|
|
50
|
+
*
|
|
51
|
+
* @param {ICacheDepth} depth - Cache depth structure.
|
|
52
|
+
*/
|
|
53
|
+
public setDepth(depth: ICacheDepth): void {
|
|
54
|
+
this.configure({ depth: depth });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected _activate(): void {
|
|
58
|
+
this._sequenceSubscription = observableCombineLatest(
|
|
59
|
+
this._navigator.stateService.currentNode$.pipe(
|
|
60
|
+
switchMap((node: Node): Observable<IEdgeStatus> => {
|
|
61
|
+
return node.sequenceEdges$;
|
|
62
|
+
}),
|
|
63
|
+
filter((status: IEdgeStatus): boolean => {
|
|
64
|
+
return status.cached;
|
|
65
|
+
}),
|
|
66
|
+
),
|
|
67
|
+
this._configuration$,
|
|
68
|
+
)
|
|
69
|
+
.pipe(
|
|
70
|
+
switchMap(
|
|
71
|
+
(
|
|
72
|
+
nc: [IEdgeStatus, ICacheConfiguration],
|
|
73
|
+
): Observable<EdgesDepth> => {
|
|
74
|
+
let status: IEdgeStatus = nc[0];
|
|
75
|
+
let configuration: ICacheConfiguration = nc[1];
|
|
76
|
+
let sequenceDepth: number = Math.max(
|
|
77
|
+
0,
|
|
78
|
+
Math.min(4, configuration.depth.sequence),
|
|
79
|
+
);
|
|
80
|
+
let next$: Observable<EdgesDepth> = this._cache$(
|
|
81
|
+
status.edges,
|
|
82
|
+
EdgeDirection.Next,
|
|
83
|
+
sequenceDepth,
|
|
84
|
+
);
|
|
85
|
+
let prev$: Observable<EdgesDepth> = this._cache$(
|
|
86
|
+
status.edges,
|
|
87
|
+
EdgeDirection.Prev,
|
|
88
|
+
sequenceDepth,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return observableMerge<EdgesDepth>(next$, prev$).pipe(
|
|
92
|
+
catchError(
|
|
93
|
+
(
|
|
94
|
+
error: Error,
|
|
95
|
+
caught: Observable<EdgesDepth>,
|
|
96
|
+
): Observable<EdgesDepth> => {
|
|
97
|
+
console.error(
|
|
98
|
+
"Failed to cache sequence edges.",
|
|
99
|
+
error,
|
|
100
|
+
);
|
|
101
|
+
return EMPTY;
|
|
102
|
+
},
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
.subscribe(() => {
|
|
109
|
+
/*noop*/
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
this._spatialSubscription = this._navigator.stateService.currentNode$
|
|
113
|
+
.pipe(
|
|
114
|
+
switchMap((node: Node): Observable<[Node, IEdgeStatus]> => {
|
|
115
|
+
return observableCombineLatest(
|
|
116
|
+
of<Node>(node),
|
|
117
|
+
node.spatialEdges$.pipe(
|
|
118
|
+
filter((status: IEdgeStatus): boolean => {
|
|
119
|
+
return status.cached;
|
|
120
|
+
}),
|
|
121
|
+
),
|
|
122
|
+
);
|
|
123
|
+
}),
|
|
124
|
+
combineLatest(
|
|
125
|
+
this._configuration$,
|
|
126
|
+
(
|
|
127
|
+
ns: [Node, IEdgeStatus],
|
|
128
|
+
configuration: ICacheConfiguration,
|
|
129
|
+
): [Node, IEdgeStatus, ICacheConfiguration] => {
|
|
130
|
+
return [ns[0], ns[1], configuration];
|
|
131
|
+
},
|
|
132
|
+
),
|
|
133
|
+
switchMap(
|
|
134
|
+
(
|
|
135
|
+
args: [Node, IEdgeStatus, ICacheConfiguration],
|
|
136
|
+
): Observable<EdgesDepth> => {
|
|
137
|
+
let node: Node = args[0];
|
|
138
|
+
let edges: IEdge[] = args[1].edges;
|
|
139
|
+
let depth: ICacheDepth = args[2].depth;
|
|
140
|
+
|
|
141
|
+
let panoDepth: number = Math.max(
|
|
142
|
+
0,
|
|
143
|
+
Math.min(2, depth.pano),
|
|
144
|
+
);
|
|
145
|
+
let stepDepth: number = node.pano
|
|
146
|
+
? 0
|
|
147
|
+
: Math.max(0, Math.min(3, depth.step));
|
|
148
|
+
let turnDepth: number = node.pano
|
|
149
|
+
? 0
|
|
150
|
+
: Math.max(0, Math.min(1, depth.turn));
|
|
151
|
+
|
|
152
|
+
let pano$: Observable<EdgesDepth> = this._cache$(
|
|
153
|
+
edges,
|
|
154
|
+
EdgeDirection.Pano,
|
|
155
|
+
panoDepth,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
let forward$: Observable<EdgesDepth> = this._cache$(
|
|
159
|
+
edges,
|
|
160
|
+
EdgeDirection.StepForward,
|
|
161
|
+
stepDepth,
|
|
162
|
+
);
|
|
163
|
+
let backward$: Observable<EdgesDepth> = this._cache$(
|
|
164
|
+
edges,
|
|
165
|
+
EdgeDirection.StepBackward,
|
|
166
|
+
stepDepth,
|
|
167
|
+
);
|
|
168
|
+
let left$: Observable<EdgesDepth> = this._cache$(
|
|
169
|
+
edges,
|
|
170
|
+
EdgeDirection.StepLeft,
|
|
171
|
+
stepDepth,
|
|
172
|
+
);
|
|
173
|
+
let right$: Observable<EdgesDepth> = this._cache$(
|
|
174
|
+
edges,
|
|
175
|
+
EdgeDirection.StepRight,
|
|
176
|
+
stepDepth,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
let turnLeft$: Observable<EdgesDepth> = this._cache$(
|
|
180
|
+
edges,
|
|
181
|
+
EdgeDirection.TurnLeft,
|
|
182
|
+
turnDepth,
|
|
183
|
+
);
|
|
184
|
+
let turnRight$: Observable<EdgesDepth> = this._cache$(
|
|
185
|
+
edges,
|
|
186
|
+
EdgeDirection.TurnRight,
|
|
187
|
+
turnDepth,
|
|
188
|
+
);
|
|
189
|
+
let turnU$: Observable<EdgesDepth> = this._cache$(
|
|
190
|
+
edges,
|
|
191
|
+
EdgeDirection.TurnU,
|
|
192
|
+
turnDepth,
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
return observableMerge<EdgesDepth>(
|
|
196
|
+
forward$,
|
|
197
|
+
backward$,
|
|
198
|
+
left$,
|
|
199
|
+
right$,
|
|
200
|
+
pano$,
|
|
201
|
+
turnLeft$,
|
|
202
|
+
turnRight$,
|
|
203
|
+
turnU$,
|
|
204
|
+
).pipe(
|
|
205
|
+
catchError(
|
|
206
|
+
(
|
|
207
|
+
error: Error,
|
|
208
|
+
caught: Observable<EdgesDepth>,
|
|
209
|
+
): Observable<EdgesDepth> => {
|
|
210
|
+
console.error(
|
|
211
|
+
"Failed to cache spatial edges.",
|
|
212
|
+
error,
|
|
213
|
+
);
|
|
214
|
+
return EMPTY;
|
|
215
|
+
},
|
|
216
|
+
),
|
|
217
|
+
);
|
|
218
|
+
},
|
|
219
|
+
),
|
|
220
|
+
)
|
|
221
|
+
.subscribe(() => {
|
|
222
|
+
/*noop*/
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
protected _deactivate(): void {
|
|
227
|
+
this._sequenceSubscription.unsubscribe();
|
|
228
|
+
this._spatialSubscription.unsubscribe();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
protected _getDefaultConfiguration(): ICacheConfiguration {
|
|
232
|
+
return { depth: { pano: 1, sequence: 2, step: 1, turn: 0 } };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private _cache$(
|
|
236
|
+
edges: IEdge[],
|
|
237
|
+
direction: EdgeDirection,
|
|
238
|
+
depth: number,
|
|
239
|
+
): Observable<EdgesDepth> {
|
|
240
|
+
return observableZip(of<IEdge[]>(edges), of<number>(depth)).pipe(
|
|
241
|
+
expand((ed: EdgesDepth): Observable<EdgesDepth> => {
|
|
242
|
+
let es: IEdge[] = ed[0];
|
|
243
|
+
let d: number = ed[1];
|
|
244
|
+
let edgesDepths$: Observable<EdgesDepth>[] = [];
|
|
245
|
+
if (d > 0) {
|
|
246
|
+
for (let edge of es) {
|
|
247
|
+
if (edge.data.direction === direction) {
|
|
248
|
+
edgesDepths$.push(
|
|
249
|
+
observableZip(
|
|
250
|
+
this._navigator.graphService
|
|
251
|
+
.cacheNode$(edge.to)
|
|
252
|
+
.pipe(
|
|
253
|
+
mergeMap(
|
|
254
|
+
(
|
|
255
|
+
n: Node,
|
|
256
|
+
): Observable<IEdge[]> => {
|
|
257
|
+
return this._nodeToEdges$(
|
|
258
|
+
n,
|
|
259
|
+
direction,
|
|
260
|
+
);
|
|
261
|
+
},
|
|
262
|
+
),
|
|
263
|
+
),
|
|
264
|
+
of<number>(d - 1),
|
|
265
|
+
),
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return from(edgesDepths$).pipe(mergeAll());
|
|
271
|
+
}),
|
|
272
|
+
skip(1),
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private _nodeToEdges$(
|
|
277
|
+
node: Node,
|
|
278
|
+
direction: EdgeDirection,
|
|
279
|
+
): Observable<IEdge[]> {
|
|
280
|
+
return (
|
|
281
|
+
[EdgeDirection.Next, EdgeDirection.Prev].indexOf(direction) > -1
|
|
282
|
+
? node.sequenceEdges$
|
|
283
|
+
: node.spatialEdges$
|
|
284
|
+
).pipe(
|
|
285
|
+
first((status: IEdgeStatus): boolean => {
|
|
286
|
+
return status.cached;
|
|
287
|
+
}),
|
|
288
|
+
map((status: IEdgeStatus): IEdge[] => {
|
|
289
|
+
return status.edges;
|
|
290
|
+
}),
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export default CacheComponent;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { BehaviorSubject, Observable, Subject, ReplaySubject } from "rxjs";
|
|
2
|
+
import { IComponentConfiguration } from "./interfaces/interfaces";
|
|
3
|
+
import { Navigator } from "../viewer/Navigator";
|
|
4
|
+
import { Container } from "../viewer/Container";
|
|
5
|
+
import { EventEmitter } from "../utils/EventEmitter";
|
|
6
|
+
import { multicast, refCount, scan, startWith } from "rxjs/operators";
|
|
7
|
+
|
|
8
|
+
export abstract class Component<
|
|
9
|
+
TConfiguration extends IComponentConfiguration,
|
|
10
|
+
> extends EventEmitter {
|
|
11
|
+
/**
|
|
12
|
+
* Component name. Used when interacting with component through the Viewer's API.
|
|
13
|
+
*/
|
|
14
|
+
public static componentName: string = "not_worthy";
|
|
15
|
+
|
|
16
|
+
protected _activated: boolean;
|
|
17
|
+
protected _container: Container;
|
|
18
|
+
protected _name: string;
|
|
19
|
+
protected _navigator: Navigator;
|
|
20
|
+
|
|
21
|
+
protected _activated$: BehaviorSubject<boolean> =
|
|
22
|
+
new BehaviorSubject<boolean>(false);
|
|
23
|
+
protected _configuration$: Observable<TConfiguration>;
|
|
24
|
+
protected _configurationSubject$: Subject<TConfiguration> =
|
|
25
|
+
new Subject<TConfiguration>();
|
|
26
|
+
|
|
27
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
28
|
+
super();
|
|
29
|
+
|
|
30
|
+
this._activated = false;
|
|
31
|
+
this._container = container;
|
|
32
|
+
this._name = name;
|
|
33
|
+
this._navigator = navigator;
|
|
34
|
+
|
|
35
|
+
this._configuration$ = this._configurationSubject$.pipe(
|
|
36
|
+
startWith(this.defaultConfiguration),
|
|
37
|
+
scan(
|
|
38
|
+
(
|
|
39
|
+
conf: TConfiguration,
|
|
40
|
+
newConf: TConfiguration,
|
|
41
|
+
): TConfiguration => {
|
|
42
|
+
for (let key in newConf) {
|
|
43
|
+
if (newConf.hasOwnProperty(key)) {
|
|
44
|
+
conf[key] = newConf[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return conf;
|
|
49
|
+
},
|
|
50
|
+
),
|
|
51
|
+
multicast(new ReplaySubject(1)),
|
|
52
|
+
refCount(),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
this._configuration$.subscribe(() => {
|
|
56
|
+
/*noop*/
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public get activated(): boolean {
|
|
61
|
+
return this._activated;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public get activated$(): Observable<boolean> {
|
|
65
|
+
return this._activated$;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get default configuration.
|
|
70
|
+
*
|
|
71
|
+
* @returns {TConfiguration} Default configuration for component.
|
|
72
|
+
*/
|
|
73
|
+
public get defaultConfiguration(): TConfiguration {
|
|
74
|
+
return this._getDefaultConfiguration();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public get configuration$(): Observable<TConfiguration> {
|
|
78
|
+
return this._configuration$;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public get name(): string {
|
|
82
|
+
return this._name;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public activate(conf?: TConfiguration): void {
|
|
86
|
+
if (this._activated) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (conf !== undefined) {
|
|
91
|
+
this._configurationSubject$.next(conf);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this._activated = true;
|
|
95
|
+
this._activate();
|
|
96
|
+
this._activated$.next(true);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public configure(conf: TConfiguration): void {
|
|
100
|
+
this._configurationSubject$.next(conf);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public deactivate(): void {
|
|
104
|
+
if (!this._activated) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this._activated = false;
|
|
109
|
+
this._deactivate();
|
|
110
|
+
this._container.domRenderer.clear(this._name);
|
|
111
|
+
this._container.glRenderer.clear(this._name);
|
|
112
|
+
this._activated$.next(false);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Detect the viewer's new width and height and resize the component's
|
|
117
|
+
* rendered elements accordingly if applicable.
|
|
118
|
+
*/
|
|
119
|
+
public resize(): void {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
protected abstract _activate(): void;
|
|
124
|
+
|
|
125
|
+
protected abstract _deactivate(): void;
|
|
126
|
+
|
|
127
|
+
protected abstract _getDefaultConfiguration(): TConfiguration;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default Component;
|