@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,1132 @@
|
|
|
1
|
+
import { Observable, AsyncSubject, of, throwError, combineLatest } from "rxjs";
|
|
2
|
+
import type { ILatLon } from "../api/interfaces/interfaces";
|
|
3
|
+
import { EdgeDirection } from "../graph/edge/EdgeDirection";
|
|
4
|
+
import { FilterExpression } from "../graph/FilterExpression";
|
|
5
|
+
import { Node } from "../graph/Node";
|
|
6
|
+
import { ComponentController } from "../viewer/ComponentController";
|
|
7
|
+
import { Container } from "../viewer/Container";
|
|
8
|
+
import { Navigator } from "../viewer/Navigator";
|
|
9
|
+
import { Observer } from "../viewer/Observer";
|
|
10
|
+
import type { IViewerOptions } from "../viewer/interfaces/interfaces";
|
|
11
|
+
import { Component } from "../component/Component";
|
|
12
|
+
import type { IComponentConfiguration } from "../component/interfaces/interfaces";
|
|
13
|
+
import { EventEmitter } from "../utils/EventEmitter";
|
|
14
|
+
import { Settings } from "../utils/Settings";
|
|
15
|
+
import { RenderMode } from "../render/RenderMode";
|
|
16
|
+
import { Auth } from "../api/Auth";
|
|
17
|
+
import API from "../api/API";
|
|
18
|
+
import GraphQLCreator from "../api/GraphQLCreator";
|
|
19
|
+
import { mergeMap, map, first } from "rxjs/operators";
|
|
20
|
+
import IOutdoor from "../api/interfaces/IOutdoor";
|
|
21
|
+
import IPathNode from "../api/interfaces/IPathNode";
|
|
22
|
+
import IQueryBuilding from "../api/interfaces/IQueryBuilding";
|
|
23
|
+
import IKey from "../api/interfaces/IKey";
|
|
24
|
+
import RenderCamera from "../render/RenderCamera";
|
|
25
|
+
import type { ILatLonAlt } from "../geo/interfaces/interfaces";
|
|
26
|
+
import type { PointOfView } from "./interfaces/PointOfView";
|
|
27
|
+
import { EventNames } from "./EventNames";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @class Viewer
|
|
31
|
+
*
|
|
32
|
+
* @classdesc The Viewer object represents the navigable photo viewer.
|
|
33
|
+
* Create a Viewer by specifying a container, client ID, photo key and
|
|
34
|
+
* other options. The viewer exposes methods and events for programmatic
|
|
35
|
+
* interaction.
|
|
36
|
+
*
|
|
37
|
+
* The viewer works with a few different coordinate systems.
|
|
38
|
+
*
|
|
39
|
+
* Container pixel coordinates
|
|
40
|
+
*
|
|
41
|
+
* Pixel coordinates are coordinates on the viewer container. The origin is
|
|
42
|
+
* in the top left corner of the container. The axes are
|
|
43
|
+
* directed according to the following for a viewer container with a width
|
|
44
|
+
* of 640 pixels and height of 480 pixels.
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
47
|
+
* (0,0) (640, 0)
|
|
48
|
+
* +------------------------>
|
|
49
|
+
* |
|
|
50
|
+
* |
|
|
51
|
+
* |
|
|
52
|
+
* v +
|
|
53
|
+
* (0, 480) (640, 480)
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* Basic image coordinates
|
|
57
|
+
*
|
|
58
|
+
* Basic image coordinates represents points in the original image adjusted for
|
|
59
|
+
* orientation. They range from 0 to 1 on both axes. The origin is in the top left
|
|
60
|
+
* corner of the image and the axes are directed
|
|
61
|
+
* according to the following for all image types.
|
|
62
|
+
*
|
|
63
|
+
* ```
|
|
64
|
+
* (0,0) (1, 0)
|
|
65
|
+
* +------------------------>
|
|
66
|
+
* |
|
|
67
|
+
* |
|
|
68
|
+
* |
|
|
69
|
+
* v +
|
|
70
|
+
* (0, 1) (1, 1)
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* For every camera viewing direction it is possible to convert between these
|
|
74
|
+
* two coordinate systems for the current node. The image can be panned and
|
|
75
|
+
* zoomed independently of the size of the viewer container resulting in
|
|
76
|
+
* different conversion results for different viewing directions.
|
|
77
|
+
*/
|
|
78
|
+
export class Viewer extends EventEmitter {
|
|
79
|
+
public static fov = EventNames.fov;
|
|
80
|
+
public static position = EventNames.position;
|
|
81
|
+
public static pov = EventNames.pov;
|
|
82
|
+
public static bearingchanged = EventNames.bearingchanged;
|
|
83
|
+
public static panwithoutinertiachanged = EventNames.panwithoutinertiachanged;
|
|
84
|
+
public static panchanged = EventNames.panchanged;
|
|
85
|
+
public static contextmenu = EventNames.contextmenu;
|
|
86
|
+
public static dblclick = EventNames.dblclick;
|
|
87
|
+
public static loadingchanged = EventNames.loadingchanged;
|
|
88
|
+
public static mousedown = EventNames.mousedown;
|
|
89
|
+
public static mousemove = EventNames.mousemove;
|
|
90
|
+
public static mouseout = EventNames.mouseout;
|
|
91
|
+
public static mouseover = EventNames.mouseover;
|
|
92
|
+
public static mouseup = EventNames.mouseup;
|
|
93
|
+
public static moveend = EventNames.moveend;
|
|
94
|
+
public static movestart = EventNames.movestart;
|
|
95
|
+
public static navigablechanged = EventNames.navigablechanged;
|
|
96
|
+
public static nodechanged = EventNames.nodechanged;
|
|
97
|
+
public static sequenceedgeschanged = EventNames.sequenceedgeschanged;
|
|
98
|
+
public static spatialedgeschanged = EventNames.spatialedgeschanged;
|
|
99
|
+
/**
|
|
100
|
+
* @ignore
|
|
101
|
+
* Private component controller object which manages component states.
|
|
102
|
+
*/
|
|
103
|
+
private _componentController: ComponentController;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @ignore
|
|
107
|
+
* Private container object which maintains the DOM Element,
|
|
108
|
+
* renderers and relevant services.
|
|
109
|
+
*/
|
|
110
|
+
private _container: Container;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @ignore
|
|
114
|
+
* Private observer object which observes the viewer state and
|
|
115
|
+
* fires events on behalf of the viewer.
|
|
116
|
+
*/
|
|
117
|
+
private _observer: Observer;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @ignore
|
|
121
|
+
* Private navigator object which controls navigation throught
|
|
122
|
+
* the vast seas of Beeview.
|
|
123
|
+
*/
|
|
124
|
+
private _navigator: Navigator;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @ignore
|
|
128
|
+
* Private api object which auth request
|
|
129
|
+
*/
|
|
130
|
+
private _api: API;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @ignore
|
|
134
|
+
* Private authComplete asyncSubject which auth complete callback
|
|
135
|
+
*/
|
|
136
|
+
private _authComplete$: AsyncSubject<string> = new AsyncSubject<string>();
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Create a new viewer instance.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} appId - Required auth username
|
|
142
|
+
* @param {string} secret - Required auth password
|
|
143
|
+
* @param {string} container - Required `id` of a DOM element which will
|
|
144
|
+
* be transformed into the viewer.
|
|
145
|
+
* @param {IViewerOptions} [options] - Optional configuration object
|
|
146
|
+
* specifing Viewer's initial setup.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```
|
|
150
|
+
* var viewer = new MapxusVisual.Viewer({
|
|
151
|
+
* appId: <user appId>,
|
|
152
|
+
* secret: <user secret>,
|
|
153
|
+
* container: <element-id>,
|
|
154
|
+
* imageId: <image-id>,
|
|
155
|
+
* component: {
|
|
156
|
+
* cover: false,
|
|
157
|
+
* }
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
constructor(options: IViewerOptions) {
|
|
162
|
+
super();
|
|
163
|
+
|
|
164
|
+
Settings.setOptions(options);
|
|
165
|
+
|
|
166
|
+
const auth: Auth = new Auth();
|
|
167
|
+
auth.applyToken(options.appId, options.secret, options.keyPlatform, {
|
|
168
|
+
bundleId: options.bundleId,
|
|
169
|
+
packageName: options.packageName,
|
|
170
|
+
sha1: options.sha1,
|
|
171
|
+
})
|
|
172
|
+
.then((res) => res.json())
|
|
173
|
+
.then((res) => {
|
|
174
|
+
const token: string = res.result.idToken;
|
|
175
|
+
const creator: GraphQLCreator = new GraphQLCreator(token);
|
|
176
|
+
this._api = new API(creator);
|
|
177
|
+
this._navigator = new Navigator(this._api);
|
|
178
|
+
this._container = new Container(
|
|
179
|
+
options.container,
|
|
180
|
+
this._navigator.stateService,
|
|
181
|
+
options,
|
|
182
|
+
);
|
|
183
|
+
this._observer = new Observer(
|
|
184
|
+
this,
|
|
185
|
+
this._navigator,
|
|
186
|
+
this._container,
|
|
187
|
+
);
|
|
188
|
+
this._componentController = new ComponentController(
|
|
189
|
+
this._container,
|
|
190
|
+
this._navigator,
|
|
191
|
+
this._observer,
|
|
192
|
+
options.imageId,
|
|
193
|
+
options.component,
|
|
194
|
+
);
|
|
195
|
+
this._authComplete$.next(options.imageId);
|
|
196
|
+
this._authComplete$.complete();
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Return a boolean indicating if the viewer is in a navigable state.
|
|
202
|
+
*
|
|
203
|
+
* @description The navigable state indicates if the viewer supports
|
|
204
|
+
* moving, i.e. calling the `moveToKey`, `moveDir` and `moveCloseTo`
|
|
205
|
+
* methods. The viewer will not be in a navigable state if the cover
|
|
206
|
+
* is activated and the viewer has been supplied a key. When the cover
|
|
207
|
+
* is deactivated or activated without being supplied a key it will
|
|
208
|
+
* be navigable.
|
|
209
|
+
*
|
|
210
|
+
* @returns {boolean} Boolean indicating whether the viewer is navigable.
|
|
211
|
+
*/
|
|
212
|
+
public get isNavigable(): boolean {
|
|
213
|
+
return this._componentController.navigable;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Preset already complete, in callback TODO
|
|
218
|
+
* @param {Function} callback
|
|
219
|
+
*/
|
|
220
|
+
public renderComplete(callback: Function): void {
|
|
221
|
+
this._authComplete$
|
|
222
|
+
.pipe(
|
|
223
|
+
mergeMap((key: string) => {
|
|
224
|
+
if (key) {
|
|
225
|
+
return this._observer.navigable$;
|
|
226
|
+
} else {
|
|
227
|
+
return of("complete");
|
|
228
|
+
}
|
|
229
|
+
}),
|
|
230
|
+
)
|
|
231
|
+
.subscribe(() => callback());
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Search outdoor image data by bbox range
|
|
236
|
+
* API request function
|
|
237
|
+
* @param {number} neLat north-east latitude
|
|
238
|
+
* @param {number} neLon north-east longitude
|
|
239
|
+
* @param {number} swLat south-west latitude
|
|
240
|
+
* @param {number} swLon south-west longitude
|
|
241
|
+
*/
|
|
242
|
+
public searchOutdoorImageByBbox(
|
|
243
|
+
neLat: number,
|
|
244
|
+
neLon: number,
|
|
245
|
+
swLat: number,
|
|
246
|
+
swLon: number,
|
|
247
|
+
): Promise<IPathNode[]> {
|
|
248
|
+
const northEastLatLon: ILatLon = {
|
|
249
|
+
lat: neLat,
|
|
250
|
+
lon: neLon,
|
|
251
|
+
};
|
|
252
|
+
const southWestLatLon: ILatLon = {
|
|
253
|
+
lat: swLat,
|
|
254
|
+
lon: swLon,
|
|
255
|
+
};
|
|
256
|
+
const outdoorImageByBbox$: Observable<IPathNode[]> = this._api
|
|
257
|
+
.outdoorByBbox$(northEastLatLon, southWestLatLon)
|
|
258
|
+
.pipe(
|
|
259
|
+
map((sequences: IOutdoor[]) => {
|
|
260
|
+
let list: IPathNode[] = [];
|
|
261
|
+
sequences.forEach(
|
|
262
|
+
(sequence: IOutdoor) =>
|
|
263
|
+
(list = list.concat(sequence.outdoorImages)),
|
|
264
|
+
);
|
|
265
|
+
return list;
|
|
266
|
+
}),
|
|
267
|
+
mergeMap((list: IPathNode[]) => {
|
|
268
|
+
return of(list);
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
return new Promise<IPathNode[]>(
|
|
273
|
+
(
|
|
274
|
+
resolve: (value: IPathNode[]) => void,
|
|
275
|
+
reject: (reason: Error) => void,
|
|
276
|
+
): void => {
|
|
277
|
+
outdoorImageByBbox$.subscribe(
|
|
278
|
+
(outdoorImage: IPathNode[]): void => {
|
|
279
|
+
resolve(outdoorImage);
|
|
280
|
+
},
|
|
281
|
+
(error: Error): void => {
|
|
282
|
+
reject(error);
|
|
283
|
+
},
|
|
284
|
+
);
|
|
285
|
+
},
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Search outdoor data by bbox range
|
|
291
|
+
* API request function
|
|
292
|
+
* @param {number} neLat north-east latitude
|
|
293
|
+
* @param {number} neLon north-east longitude
|
|
294
|
+
* @param {number} swLat south-west latitude
|
|
295
|
+
* @param {number} swLon south-west longitude
|
|
296
|
+
*/
|
|
297
|
+
public searchOutdoorByBbox(
|
|
298
|
+
neLat: number,
|
|
299
|
+
neLon: number,
|
|
300
|
+
swLat: number,
|
|
301
|
+
swLon: number,
|
|
302
|
+
): Promise<IOutdoor[]> {
|
|
303
|
+
const northEastLatLon: ILatLon = {
|
|
304
|
+
lat: neLat,
|
|
305
|
+
lon: neLon,
|
|
306
|
+
};
|
|
307
|
+
const southWestLatLon: ILatLon = {
|
|
308
|
+
lat: swLat,
|
|
309
|
+
lon: swLon,
|
|
310
|
+
};
|
|
311
|
+
const outdoorByBboxgByKey$: Observable<IOutdoor[]> =
|
|
312
|
+
this._api.outdoorByBbox$(northEastLatLon, southWestLatLon);
|
|
313
|
+
|
|
314
|
+
return new Promise<IOutdoor[]>(
|
|
315
|
+
(
|
|
316
|
+
resolve: (value: IOutdoor[]) => void,
|
|
317
|
+
reject: (reason: Error) => void,
|
|
318
|
+
): void => {
|
|
319
|
+
outdoorByBboxgByKey$.subscribe(
|
|
320
|
+
(outdoor: IOutdoor[]): void => {
|
|
321
|
+
resolve(outdoor);
|
|
322
|
+
},
|
|
323
|
+
(error: Error): void => {
|
|
324
|
+
reject(error);
|
|
325
|
+
},
|
|
326
|
+
);
|
|
327
|
+
},
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Search the images of building by id
|
|
333
|
+
* API request function
|
|
334
|
+
* @param {string} id building id
|
|
335
|
+
* @param {number} date date of date generation
|
|
336
|
+
*/
|
|
337
|
+
public searchBuildingsById(
|
|
338
|
+
id: string,
|
|
339
|
+
date?: number,
|
|
340
|
+
): Promise<IQueryBuilding> {
|
|
341
|
+
const buildingByKey$: Observable<IQueryBuilding> =
|
|
342
|
+
this._api.buildingByKey$(id, date);
|
|
343
|
+
|
|
344
|
+
return new Promise<IQueryBuilding>(
|
|
345
|
+
(
|
|
346
|
+
resolve: (value: IQueryBuilding) => void,
|
|
347
|
+
reject: (reason: Error) => void,
|
|
348
|
+
): void => {
|
|
349
|
+
buildingByKey$.subscribe(
|
|
350
|
+
(building: IQueryBuilding): void => {
|
|
351
|
+
resolve(building);
|
|
352
|
+
},
|
|
353
|
+
(error: Error): void => {
|
|
354
|
+
reject(error);
|
|
355
|
+
},
|
|
356
|
+
);
|
|
357
|
+
},
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Search the dates by building id
|
|
363
|
+
* API request function
|
|
364
|
+
* @param {string} buildingId
|
|
365
|
+
*/
|
|
366
|
+
public searchDatesByBuildingId(buildingId: string): Promise<IKey[]> {
|
|
367
|
+
const datesByKey$: Observable<IKey[]> =
|
|
368
|
+
this._api.datesByKey(buildingId);
|
|
369
|
+
|
|
370
|
+
return new Promise<IKey[]>(
|
|
371
|
+
(
|
|
372
|
+
resolve: (value: IKey[]) => void,
|
|
373
|
+
reject: (reason: Error) => void,
|
|
374
|
+
): void => {
|
|
375
|
+
datesByKey$.subscribe(
|
|
376
|
+
(dates: IKey[]): void => {
|
|
377
|
+
resolve(dates);
|
|
378
|
+
},
|
|
379
|
+
(error: Error): void => {
|
|
380
|
+
reject(error);
|
|
381
|
+
},
|
|
382
|
+
);
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Activate a component.
|
|
389
|
+
*
|
|
390
|
+
* @param {string} name - Name of the component which will become active.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```
|
|
394
|
+
* viewer.activateComponent("marker");
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
public activateComponent(name: string): void {
|
|
398
|
+
this._componentController.activate(name);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Activate the cover (deactivates all other components).
|
|
403
|
+
*/
|
|
404
|
+
public activateCover(): void {
|
|
405
|
+
this._componentController.activateCover();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Deactivate a component.
|
|
410
|
+
*
|
|
411
|
+
* @param {string} name - Name of component which become inactive.
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```
|
|
415
|
+
* viewer.deactivateComponent("mouse");
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
public deactivateComponent(name: string): void {
|
|
419
|
+
this._componentController.deactivate(name);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Deactivate the cover (activates all components marked as active).
|
|
424
|
+
*/
|
|
425
|
+
public deactivateCover(): void {
|
|
426
|
+
this._componentController.deactivateCover();
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Get the viewer's current vertical field of view.
|
|
431
|
+
*
|
|
432
|
+
* @description The vertical field of view rendered on the viewer canvas
|
|
433
|
+
* measured in degrees.
|
|
434
|
+
*
|
|
435
|
+
* @returns {Promise<number>} Promise to the current field of view
|
|
436
|
+
* of the viewer camera.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```js
|
|
440
|
+
* viewer.getFieldOfView().then(fov => { console.log(fov); });
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
public getFieldOfView(): Promise<number> {
|
|
444
|
+
return new Promise<number>(
|
|
445
|
+
(
|
|
446
|
+
resolve: (value: number) => void,
|
|
447
|
+
reject: (reason: Error) => void,
|
|
448
|
+
): void => {
|
|
449
|
+
this._container.renderService.renderCamera$
|
|
450
|
+
.pipe(first())
|
|
451
|
+
.subscribe(
|
|
452
|
+
(rc: RenderCamera): void => {
|
|
453
|
+
resolve(rc.perspective.fov);
|
|
454
|
+
},
|
|
455
|
+
(error: Error): void => {
|
|
456
|
+
reject(error);
|
|
457
|
+
},
|
|
458
|
+
);
|
|
459
|
+
},
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Get the viewer's current image.
|
|
465
|
+
*
|
|
466
|
+
* @returns {Promise<Image>} Promise to the current image.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```js
|
|
470
|
+
* viewer.getImage().then(image => { console.log(image.id); });
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
public getImage(): Promise<Node> {
|
|
474
|
+
return new Promise<Node>(
|
|
475
|
+
(
|
|
476
|
+
resolve: (image: Node) => void,
|
|
477
|
+
reject: (reason: Error) => void,
|
|
478
|
+
): void => {
|
|
479
|
+
this._navigator.stateService.currentNode$
|
|
480
|
+
.pipe(first())
|
|
481
|
+
.subscribe(
|
|
482
|
+
(image) => {
|
|
483
|
+
resolve(image);
|
|
484
|
+
},
|
|
485
|
+
(error) => {
|
|
486
|
+
reject(error);
|
|
487
|
+
},
|
|
488
|
+
);
|
|
489
|
+
},
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Get the viewer's current point of view.
|
|
495
|
+
*
|
|
496
|
+
* @returns {Promise<PointOfView>} Promise to the current point of view
|
|
497
|
+
* of the viewer camera.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```js
|
|
501
|
+
* viewer.getPointOfView().then(pov => { console.log(pov); });
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
public getPointOfView(): Promise<PointOfView> {
|
|
505
|
+
return new Promise<PointOfView>(
|
|
506
|
+
(
|
|
507
|
+
resolve: (value: PointOfView) => void,
|
|
508
|
+
reject: (reason: Error) => void,
|
|
509
|
+
): void => {
|
|
510
|
+
combineLatest([
|
|
511
|
+
this._container.renderService.renderCamera$,
|
|
512
|
+
this._container.renderService.bearing$,
|
|
513
|
+
])
|
|
514
|
+
.pipe(first())
|
|
515
|
+
.subscribe(
|
|
516
|
+
([rc, bearing]: [RenderCamera, number]): void => {
|
|
517
|
+
resolve({
|
|
518
|
+
bearing: bearing,
|
|
519
|
+
tilt: rc.getTilt(),
|
|
520
|
+
});
|
|
521
|
+
},
|
|
522
|
+
(error: Error): void => {
|
|
523
|
+
reject(error);
|
|
524
|
+
},
|
|
525
|
+
);
|
|
526
|
+
},
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Get the viewer's current position
|
|
532
|
+
*
|
|
533
|
+
* @returns {Promise<LngLat>} Promise to the viewers's current
|
|
534
|
+
* position.
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```js
|
|
538
|
+
* viewer.getPosition().then(pos => { console.log(pos); });
|
|
539
|
+
* ```
|
|
540
|
+
*/
|
|
541
|
+
public getPosition(): Promise<ILatLon> {
|
|
542
|
+
return new Promise<ILatLon>(
|
|
543
|
+
(
|
|
544
|
+
resolve: (value: ILatLon) => void,
|
|
545
|
+
reject: (reason: Error) => void,
|
|
546
|
+
): void => {
|
|
547
|
+
combineLatest([
|
|
548
|
+
this._container.renderService.renderCamera$,
|
|
549
|
+
this._navigator.stateService.reference$,
|
|
550
|
+
])
|
|
551
|
+
.pipe(first())
|
|
552
|
+
.subscribe(
|
|
553
|
+
([render, reference]: [
|
|
554
|
+
RenderCamera,
|
|
555
|
+
ILatLonAlt,
|
|
556
|
+
]): void => {
|
|
557
|
+
resolve(
|
|
558
|
+
this._observer.projection.cameraToLngLat(
|
|
559
|
+
render,
|
|
560
|
+
reference,
|
|
561
|
+
),
|
|
562
|
+
);
|
|
563
|
+
},
|
|
564
|
+
(error: Error): void => {
|
|
565
|
+
reject(error);
|
|
566
|
+
},
|
|
567
|
+
);
|
|
568
|
+
},
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Get the bearing of the current viewer camera.
|
|
574
|
+
*
|
|
575
|
+
* @description The bearing depends on how the camera
|
|
576
|
+
* is currently rotated and does not correspond
|
|
577
|
+
* to the compass angle of the current node if the view
|
|
578
|
+
* has been panned.
|
|
579
|
+
*
|
|
580
|
+
* Bearing is measured in degrees clockwise with respect to
|
|
581
|
+
* north.
|
|
582
|
+
*
|
|
583
|
+
* @returns {Promise<number>} Promise to the bearing
|
|
584
|
+
* of the current viewer camera.
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* ```
|
|
588
|
+
* viewer.getBearing().then((b) => { console.log(b); });
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
public getBearing(): Promise<number> {
|
|
592
|
+
return new Promise<number>(
|
|
593
|
+
(
|
|
594
|
+
resolve: (value: number) => void,
|
|
595
|
+
reject: (reason: Error) => void,
|
|
596
|
+
): void => {
|
|
597
|
+
this._container.renderService.bearing$.pipe(first()).subscribe(
|
|
598
|
+
(bearing: number): void => {
|
|
599
|
+
resolve(bearing);
|
|
600
|
+
},
|
|
601
|
+
(error: Error): void => {
|
|
602
|
+
reject(error);
|
|
603
|
+
},
|
|
604
|
+
);
|
|
605
|
+
},
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Get the basic coordinates of the current photo that is
|
|
611
|
+
* at the center of the viewport.
|
|
612
|
+
*
|
|
613
|
+
* @description Basic coordinates are 2D coordinates on the [0, 1] interval
|
|
614
|
+
* and have the origin point, (0, 0), at the top left corner and the
|
|
615
|
+
* maximum value, (1, 1), at the bottom right corner of the original
|
|
616
|
+
* photo.
|
|
617
|
+
*
|
|
618
|
+
* @returns {Promise<number[]>} Promise to the basic coordinates
|
|
619
|
+
* of the current photo at the center for the viewport.
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```
|
|
623
|
+
* viewer.getCenter().then((c) => { console.log(c); });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
public getCenter(): Promise<number[]> {
|
|
627
|
+
return new Promise<number[]>(
|
|
628
|
+
(
|
|
629
|
+
resolve: (value: number[]) => void,
|
|
630
|
+
reject: (reason: Error) => void,
|
|
631
|
+
): void => {
|
|
632
|
+
this._navigator.stateService.getCenter().subscribe(
|
|
633
|
+
(center: number[]): void => {
|
|
634
|
+
resolve(center);
|
|
635
|
+
},
|
|
636
|
+
(error: Error): void => {
|
|
637
|
+
reject(error);
|
|
638
|
+
},
|
|
639
|
+
);
|
|
640
|
+
},
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Get a component.
|
|
646
|
+
*
|
|
647
|
+
* @param {string} name - Name of component.
|
|
648
|
+
* @returns {Component} The requested component.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```
|
|
652
|
+
* var mouseComponent = viewer.getComponent("mouse");
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
public getComponent<TComponent extends Component<IComponentConfiguration>>(
|
|
656
|
+
name: string,
|
|
657
|
+
): TComponent {
|
|
658
|
+
return this._componentController.get<TComponent>(name);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Returns the viewer's containing HTML element.
|
|
662
|
+
*
|
|
663
|
+
* @returns {HTMLElement} The viewer's container.
|
|
664
|
+
*/
|
|
665
|
+
public getContainer(): HTMLElement {
|
|
666
|
+
return this._container.element;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Get the photo's current zoom level.
|
|
671
|
+
*
|
|
672
|
+
* @returns {Promise<number>} Promise to the viewers's current
|
|
673
|
+
* zoom level.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```
|
|
677
|
+
* viewer.getZoom().then((z) => { console.log(z); });
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
public getZoom(): Promise<number> {
|
|
681
|
+
return new Promise<number>(
|
|
682
|
+
(
|
|
683
|
+
resolve: (value: number) => void,
|
|
684
|
+
reject: (reason: Error) => void,
|
|
685
|
+
): void => {
|
|
686
|
+
this._navigator.stateService.getZoom().subscribe(
|
|
687
|
+
(zoom: number): void => {
|
|
688
|
+
resolve(zoom);
|
|
689
|
+
},
|
|
690
|
+
(error: Error): void => {
|
|
691
|
+
reject(error);
|
|
692
|
+
},
|
|
693
|
+
);
|
|
694
|
+
},
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Move close to given latitude and longitude.
|
|
700
|
+
*
|
|
701
|
+
* @description Because the method propagates IO errors, these potential errors
|
|
702
|
+
* need to be handled by the method caller (see example).
|
|
703
|
+
*
|
|
704
|
+
* @param {Number} lat - Latitude, in degrees.
|
|
705
|
+
* @param {Number} lon - Longitude, in degrees.
|
|
706
|
+
* @param {String} floorCode - Image belong floor code.
|
|
707
|
+
* @param {String} buildingId - Image belong building id.
|
|
708
|
+
* @param {Number} distance - Search position radius distance optional.
|
|
709
|
+
* @param {Number} date - Data belong date optional .
|
|
710
|
+
* @returns {Promise<Node>} Promise to the node that was navigated to.
|
|
711
|
+
* @throws {Error} If no nodes exist close to provided latitude
|
|
712
|
+
* longitude.
|
|
713
|
+
* @throws {Error} Propagates any IO errors to the caller.
|
|
714
|
+
* @throws {Error} When viewer is not navigable.
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```
|
|
718
|
+
* viewer.moveCloseTo(0, 0, "1", "k11_hk_59f074").then(
|
|
719
|
+
* (n) => { console.log(n); },
|
|
720
|
+
* (e) => { console.error(e); });
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
public moveCloseTo(
|
|
724
|
+
lat: number,
|
|
725
|
+
lon: number,
|
|
726
|
+
floorCode: string,
|
|
727
|
+
buildingId: string,
|
|
728
|
+
distance?: number,
|
|
729
|
+
date?: number,
|
|
730
|
+
): Promise<Node> {
|
|
731
|
+
const moveCloseTo$: Observable<Node> = this.isNavigable
|
|
732
|
+
? this._navigator.moveCloseTo$(
|
|
733
|
+
lat,
|
|
734
|
+
lon,
|
|
735
|
+
floorCode,
|
|
736
|
+
buildingId,
|
|
737
|
+
distance,
|
|
738
|
+
date,
|
|
739
|
+
)
|
|
740
|
+
: throwError(
|
|
741
|
+
new Error(
|
|
742
|
+
"Calling moveCloseTo is not supported when viewer is not navigable.",
|
|
743
|
+
),
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
return new Promise<Node>(
|
|
747
|
+
(
|
|
748
|
+
resolve: (value: Node) => void,
|
|
749
|
+
reject: (reason: Error) => void,
|
|
750
|
+
): void => {
|
|
751
|
+
moveCloseTo$.subscribe(
|
|
752
|
+
(node: Node): void => {
|
|
753
|
+
resolve(node);
|
|
754
|
+
},
|
|
755
|
+
(error: Error): void => {
|
|
756
|
+
reject(error);
|
|
757
|
+
},
|
|
758
|
+
);
|
|
759
|
+
},
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Navigate in a given direction.
|
|
765
|
+
*
|
|
766
|
+
* @description This method has to be called through EdgeDirection enumeration as in the example.
|
|
767
|
+
*
|
|
768
|
+
* @param {EdgeDirection} dir - Direction in which which to move.
|
|
769
|
+
* @returns {Promise<Node>} Promise to the node that was navigated to.
|
|
770
|
+
* @throws {Error} If the current node does not have the edge direction
|
|
771
|
+
* or the edges has not yet been cached.
|
|
772
|
+
* @throws {Error} Propagates any IO errors to the caller.
|
|
773
|
+
* @throws {Error} When viewer is not navigable.
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```
|
|
777
|
+
* viewer.moveDir(Beeview.EdgeDirection.Next).then(
|
|
778
|
+
* (n) => { console.log(n); },
|
|
779
|
+
* (e) => { console.error(e); });
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
public moveDir(dir: EdgeDirection): Promise<Node> {
|
|
783
|
+
const moveDir$: Observable<Node> = this.isNavigable
|
|
784
|
+
? this._navigator.moveDir$(dir)
|
|
785
|
+
: throwError(
|
|
786
|
+
new Error(
|
|
787
|
+
"Calling moveDir is not supported when viewer is not navigable.",
|
|
788
|
+
),
|
|
789
|
+
);
|
|
790
|
+
|
|
791
|
+
return new Promise<Node>(
|
|
792
|
+
(
|
|
793
|
+
resolve: (value: Node) => void,
|
|
794
|
+
reject: (reason: Error) => void,
|
|
795
|
+
): void => {
|
|
796
|
+
moveDir$.subscribe(
|
|
797
|
+
(node: Node): void => {
|
|
798
|
+
resolve(node);
|
|
799
|
+
},
|
|
800
|
+
(error: Error): void => {
|
|
801
|
+
reject(error);
|
|
802
|
+
},
|
|
803
|
+
);
|
|
804
|
+
},
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Navigate to a given photo key.
|
|
810
|
+
*
|
|
811
|
+
* @param {string} key - A valid Beeview photo key.
|
|
812
|
+
* @param {number} date - Data belong date optional.
|
|
813
|
+
* @returns {Promise<Node>} Promise to the node that was navigated to.
|
|
814
|
+
* @throws {Error} Propagates any IO errors to the caller.
|
|
815
|
+
* @throws {Error} When viewer is not navigable.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```
|
|
819
|
+
* viewer.moveToKey("<my key>").then(
|
|
820
|
+
* (n) => { console.log(n); },
|
|
821
|
+
* (e) => { console.error(e); });
|
|
822
|
+
* ```
|
|
823
|
+
*/
|
|
824
|
+
public moveToKey(key: string, date?: number): Promise<Node> {
|
|
825
|
+
const moveToKey$: Observable<Node> = this.isNavigable
|
|
826
|
+
? this._navigator.moveToKey$(key, date)
|
|
827
|
+
: throwError(
|
|
828
|
+
new Error(
|
|
829
|
+
"Calling moveToKey is not supported when viewer is not navigable.",
|
|
830
|
+
),
|
|
831
|
+
);
|
|
832
|
+
|
|
833
|
+
return new Promise<Node>(
|
|
834
|
+
(
|
|
835
|
+
resolve: (value: Node) => void,
|
|
836
|
+
reject: (reason: Error) => void,
|
|
837
|
+
): void => {
|
|
838
|
+
moveToKey$.subscribe(
|
|
839
|
+
(node: Node): void => {
|
|
840
|
+
resolve(node);
|
|
841
|
+
},
|
|
842
|
+
(error: Error): void => {
|
|
843
|
+
reject(error);
|
|
844
|
+
},
|
|
845
|
+
);
|
|
846
|
+
},
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Project basic image coordinates for the current node to canvas pixel
|
|
852
|
+
* coordinates.
|
|
853
|
+
*
|
|
854
|
+
* @description The basic image coordinates may not always correspond to a
|
|
855
|
+
* pixel point that lies in the visible area of the viewer container.
|
|
856
|
+
*
|
|
857
|
+
* @param {Array<number>} basicPoint - Basic images coordinates to project.
|
|
858
|
+
* @returns {Promise<ILatLon>} Promise to the pixel coordinates corresponding
|
|
859
|
+
* to the basic image point.
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```
|
|
863
|
+
* viewer.projectFromBasic([0.3, 0.7])
|
|
864
|
+
* .then((pixelPoint) => { console.log(pixelPoint); });
|
|
865
|
+
* ```
|
|
866
|
+
*/
|
|
867
|
+
public projectFromBasic(basicPoint: number[]): Promise<number[]> {
|
|
868
|
+
return new Promise<number[]>(
|
|
869
|
+
(
|
|
870
|
+
resolve: (value: number[]) => void,
|
|
871
|
+
reject: (reason: Error) => void,
|
|
872
|
+
): void => {
|
|
873
|
+
this._observer.projectBasic$(basicPoint).subscribe(
|
|
874
|
+
(pixelPoint: number[]): void => {
|
|
875
|
+
resolve(pixelPoint);
|
|
876
|
+
},
|
|
877
|
+
(error: Error): void => {
|
|
878
|
+
reject(error);
|
|
879
|
+
},
|
|
880
|
+
);
|
|
881
|
+
},
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Detect the viewer's new width and height and resize it.
|
|
887
|
+
*
|
|
888
|
+
* @description The components will also detect the viewer's
|
|
889
|
+
* new size and resize their rendered elements if needed.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```
|
|
893
|
+
* viewer.resize();
|
|
894
|
+
* ```
|
|
895
|
+
*/
|
|
896
|
+
public resize(): void {
|
|
897
|
+
this._container.renderService.resize$.next(null);
|
|
898
|
+
this._componentController.resize();
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Set the basic coordinates of the current photo to be in the
|
|
903
|
+
* center of the viewport.
|
|
904
|
+
*
|
|
905
|
+
* @description Basic coordinates are 2D coordinates on the [0, 1] interval
|
|
906
|
+
* and has the origin point, (0, 0), at the top left corner and the
|
|
907
|
+
* maximum value, (1, 1), at the bottom right corner of the original
|
|
908
|
+
* photo.
|
|
909
|
+
*
|
|
910
|
+
* @param {number[]} The basic coordinates of the current
|
|
911
|
+
* photo to be at the center for the viewport.
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* ```
|
|
915
|
+
* viewer.setCenter([0.5, 0.5]);
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
public setCenter(center: number[]): void {
|
|
919
|
+
this._navigator.stateService.setCenter(center);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Set the filter selecting nodes to use when calculating
|
|
924
|
+
* the spatial edges.
|
|
925
|
+
*
|
|
926
|
+
* @description The following filter types are supported:
|
|
927
|
+
*
|
|
928
|
+
* Comparison
|
|
929
|
+
*
|
|
930
|
+
* `["==", key, value]` equality: `node[key] = value`
|
|
931
|
+
*
|
|
932
|
+
* `["!=", key, value]` inequality: `node[key] ≠ value`
|
|
933
|
+
*
|
|
934
|
+
* `["<", key, value]` less than: `node[key] < value`
|
|
935
|
+
*
|
|
936
|
+
* `["<=", key, value]` less than or equal: `node[key] ≤ value`
|
|
937
|
+
*
|
|
938
|
+
* `[">", key, value]` greater than: `node[key] > value`
|
|
939
|
+
*
|
|
940
|
+
* `[">=", key, value]` greater than or equal: `node[key] ≥ value`
|
|
941
|
+
*
|
|
942
|
+
* Set membership
|
|
943
|
+
*
|
|
944
|
+
* `["in", key, v0, ..., vn]` set inclusion: `node[key] ∈ {v0, ..., vn}`
|
|
945
|
+
*
|
|
946
|
+
* `["!in", key, v0, ..., vn]` set exclusion: `node[key] ∉ {v0, ..., vn}`
|
|
947
|
+
*
|
|
948
|
+
* Combining
|
|
949
|
+
*
|
|
950
|
+
* `["all", f0, ..., fn]` logical `AND`: `f0 ∧ ... ∧ fn`
|
|
951
|
+
*
|
|
952
|
+
* A key must be a string that identifies a node property name. A value must be
|
|
953
|
+
* a string, number, or boolean. Strictly-typed comparisons are used. The values
|
|
954
|
+
* `f0, ..., fn` of the combining filter must be filter expressions.
|
|
955
|
+
*
|
|
956
|
+
* Clear the filter by setting it to null or empty array.
|
|
957
|
+
*
|
|
958
|
+
* @param {FilterExpression} filter - The filter expression.
|
|
959
|
+
* @returns {Promise<void>} Promise that resolves after filter is applied.
|
|
960
|
+
*
|
|
961
|
+
* @example
|
|
962
|
+
* ```
|
|
963
|
+
* viewer.setFilter(["==", "sequenceKey", "<my sequence key>"]);
|
|
964
|
+
* ```
|
|
965
|
+
*/
|
|
966
|
+
public setFilter(filter: FilterExpression): Promise<void> {
|
|
967
|
+
return new Promise<void>(
|
|
968
|
+
(
|
|
969
|
+
resolve: (value: void) => void,
|
|
970
|
+
reject: (reason: Error) => void,
|
|
971
|
+
): void => {
|
|
972
|
+
this._navigator.setFilter$(filter).subscribe(
|
|
973
|
+
(): void => {
|
|
974
|
+
resolve(undefined);
|
|
975
|
+
},
|
|
976
|
+
(error: Error): void => {
|
|
977
|
+
reject(error);
|
|
978
|
+
},
|
|
979
|
+
);
|
|
980
|
+
},
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Set the viewer's render mode.
|
|
986
|
+
*
|
|
987
|
+
* @param {RenderMode} renderMode - Render mode.
|
|
988
|
+
*
|
|
989
|
+
* @example
|
|
990
|
+
* ```
|
|
991
|
+
* viewer.setRenderMode(Beeview.RenderMode.Letterbox);
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
994
|
+
public setRenderMode(renderMode: RenderMode): void {
|
|
995
|
+
this._container.renderService.renderMode$.next(renderMode);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Set the photo's current zoom level.
|
|
1000
|
+
*
|
|
1001
|
+
* @description Possible zoom level values are on the [0, 3] interval.
|
|
1002
|
+
* Zero means zooming out to fit the photo to the view whereas three
|
|
1003
|
+
* shows the highest level of detail.
|
|
1004
|
+
*
|
|
1005
|
+
* @param {number} The photo's current zoom level.
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```
|
|
1009
|
+
* viewer.setZoom(2);
|
|
1010
|
+
* ```
|
|
1011
|
+
*/
|
|
1012
|
+
public setZoom(zoom: number): void {
|
|
1013
|
+
this._navigator.stateService.setZoom(zoom);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Set the photo's pan to bearing.
|
|
1018
|
+
*
|
|
1019
|
+
* @description Provide the angle (0 - 360), to pan rotation photo's bearing.
|
|
1020
|
+
*
|
|
1021
|
+
* @param {number} The photo's pan to bearing.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```
|
|
1025
|
+
* viewer.setBearing(90);
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
public setBearing(bearing: number): void {
|
|
1029
|
+
let timer: number | NodeJS.Timeout | any = setInterval(() => {
|
|
1030
|
+
this.getBearing().then((currentBearing: number) => {
|
|
1031
|
+
if (Math.floor(Math.abs(currentBearing - bearing)) < 15) {
|
|
1032
|
+
clearInterval(timer);
|
|
1033
|
+
} else {
|
|
1034
|
+
this._navigator.stateService.rotateBasicWithoutInertia([
|
|
1035
|
+
1, 0,
|
|
1036
|
+
]);
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Pan current image basic rotate position, without inertia
|
|
1044
|
+
* @description basicRotate source is panchanged event callback param
|
|
1045
|
+
* @param basicRotate [0, 0]
|
|
1046
|
+
* @example
|
|
1047
|
+
* ```
|
|
1048
|
+
* viewer.panToWithoutInertia([0.00001, 0.00005]);
|
|
1049
|
+
* ```
|
|
1050
|
+
*/
|
|
1051
|
+
public panToWithoutInertia(basicRotate: number[]): void {
|
|
1052
|
+
this._navigator.stateService.rotateBasicWithoutInertia(basicRotate);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Pan current image basic rotate position
|
|
1057
|
+
* @description basicRotate source is panchanged event callback param
|
|
1058
|
+
* @param basicRotate [0, 0]
|
|
1059
|
+
* @example
|
|
1060
|
+
* ```
|
|
1061
|
+
* viewer.panToWithoutInertia([0.00001, 0.00005]);
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
public panTo(basicRotate: number[]): void {
|
|
1065
|
+
this._navigator.stateService.rotateBasic(basicRotate);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Unproject canvas pixel coordinates to an ILatLon representing geographical
|
|
1070
|
+
* coordinates.
|
|
1071
|
+
* @description The pixel point may not always correspond to geographical
|
|
1072
|
+
* coordinates. In the case of no correspondence the returned value will
|
|
1073
|
+
* be `null`.
|
|
1074
|
+
* @param {Array<number>} pixelPoint - Pixel coordinates to unproject.
|
|
1075
|
+
* @returns {Promise<ILatLon>} Promise to the latLon corresponding to the pixel point.
|
|
1076
|
+
* @example
|
|
1077
|
+
* ```
|
|
1078
|
+
* viewer.unproject([100, 100])
|
|
1079
|
+
* .then((latLon) => { console.log(latLon); });
|
|
1080
|
+
* ```
|
|
1081
|
+
*/
|
|
1082
|
+
public unproject(pixelPoint: number[]): Promise<ILatLon> {
|
|
1083
|
+
return new Promise<ILatLon>(
|
|
1084
|
+
(
|
|
1085
|
+
resolve: (value: ILatLon) => void,
|
|
1086
|
+
reject: (reason: Error) => void,
|
|
1087
|
+
): void => {
|
|
1088
|
+
this._observer.unproject$(pixelPoint).subscribe(
|
|
1089
|
+
(latLon: ILatLon): void => {
|
|
1090
|
+
resolve(latLon);
|
|
1091
|
+
},
|
|
1092
|
+
(error: Error): void => {
|
|
1093
|
+
reject(error);
|
|
1094
|
+
},
|
|
1095
|
+
);
|
|
1096
|
+
},
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Unproject canvas pixel coordinates to basic image coordinates for the
|
|
1102
|
+
* current node.
|
|
1103
|
+
* @description The pixel point may not always correspond to basic image
|
|
1104
|
+
* coordinates. In the case of no correspondence the returned value will
|
|
1105
|
+
* be `null`.
|
|
1106
|
+
* @param {Array<number>} pixelPoint - Pixel coordinates to unproject.
|
|
1107
|
+
* @returns {Promise<ILatLon>} Promise to the basic coordinates corresponding
|
|
1108
|
+
* to the pixel point.
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```
|
|
1111
|
+
* viewer.unprojectToBasic([100, 100])
|
|
1112
|
+
* .then((basicPoint) => { console.log(basicPoint); });
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
public unprojectToBasic(pixelPoint: number[]): Promise<number[]> {
|
|
1116
|
+
return new Promise<number[]>(
|
|
1117
|
+
(
|
|
1118
|
+
resolve: (value: number[]) => void,
|
|
1119
|
+
reject: (reason: Error) => void,
|
|
1120
|
+
): void => {
|
|
1121
|
+
this._observer.unprojectBasic$(pixelPoint).subscribe(
|
|
1122
|
+
(basicPoint: number[]): void => {
|
|
1123
|
+
resolve(basicPoint);
|
|
1124
|
+
},
|
|
1125
|
+
(error: Error): void => {
|
|
1126
|
+
reject(error);
|
|
1127
|
+
},
|
|
1128
|
+
);
|
|
1129
|
+
},
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
}
|