@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
package/src/api/API.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { Observable, defer, from } from "rxjs";
|
|
2
|
+
import * as _ from "underscore";
|
|
3
|
+
import { GraphQLCreator } from "./GraphQLCreator";
|
|
4
|
+
import { ApolloClient, gql } from "apollo-boost";
|
|
5
|
+
import { IFullNode } from "./interfaces/IFullNode";
|
|
6
|
+
import { IFillNode } from "./interfaces/IFillNode";
|
|
7
|
+
import { ICoreNode } from "./interfaces/ICoreNode";
|
|
8
|
+
import { ISequence } from "./interfaces/ISequence";
|
|
9
|
+
import { ILatLon } from "./interfaces/ILatLon";
|
|
10
|
+
import { IQueryBuilding } from "./interfaces/IQueryBuilding";
|
|
11
|
+
import IOutdoor from "./interfaces/IOutdoor";
|
|
12
|
+
import { map } from "rxjs/operators";
|
|
13
|
+
import IKey from "./interfaces/IKey";
|
|
14
|
+
|
|
15
|
+
type IGraphQLResponse<T> = {
|
|
16
|
+
data: T;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type IGraphQLResponseData<T> = {
|
|
20
|
+
[key: string]: T;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @class API
|
|
25
|
+
*
|
|
26
|
+
* @classdesc Provides methods for access of API.
|
|
27
|
+
*/
|
|
28
|
+
export class API {
|
|
29
|
+
|
|
30
|
+
private _model: ApolloClient<Object>;
|
|
31
|
+
private _modelCreator: GraphQLCreator;
|
|
32
|
+
|
|
33
|
+
private _minCount: number;
|
|
34
|
+
private _maxCount: number;
|
|
35
|
+
|
|
36
|
+
private _date: string;
|
|
37
|
+
private _sequence: string;
|
|
38
|
+
private _gpano: string;
|
|
39
|
+
private _building: string;
|
|
40
|
+
private _buildingName: string;
|
|
41
|
+
private _floor: string;
|
|
42
|
+
private _coordinate: string;
|
|
43
|
+
private _user: string;
|
|
44
|
+
private _image: string;
|
|
45
|
+
private _queryImages: string;
|
|
46
|
+
private _querySequences: string;
|
|
47
|
+
private _queryBuilding: string;
|
|
48
|
+
private _queryOutdoorImages: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create a new api v1 instance.
|
|
52
|
+
*
|
|
53
|
+
* @param {GraphQLCreator} [creator] - Optional model creator instance.
|
|
54
|
+
*/
|
|
55
|
+
constructor(creator?: GraphQLCreator) {
|
|
56
|
+
this._modelCreator = creator != null ? creator : new GraphQLCreator();
|
|
57
|
+
this._model = this._modelCreator.createGraphQL();
|
|
58
|
+
|
|
59
|
+
this._minCount = 0;
|
|
60
|
+
this._maxCount = 50;
|
|
61
|
+
|
|
62
|
+
this._date = `{
|
|
63
|
+
key
|
|
64
|
+
}`;
|
|
65
|
+
|
|
66
|
+
this._sequence = `{
|
|
67
|
+
key
|
|
68
|
+
}`;
|
|
69
|
+
|
|
70
|
+
this._gpano = `{
|
|
71
|
+
CroppedAreaImageHeightPixels
|
|
72
|
+
CroppedAreaImageWidthPixels
|
|
73
|
+
CroppedAreaLeftPixels
|
|
74
|
+
CroppedAreaTopPixels
|
|
75
|
+
FullPanoHeightPixels
|
|
76
|
+
FullPanoWidthPixels
|
|
77
|
+
ProjectionType
|
|
78
|
+
Software
|
|
79
|
+
valid
|
|
80
|
+
}`;
|
|
81
|
+
|
|
82
|
+
this._buildingName = `{
|
|
83
|
+
default
|
|
84
|
+
en
|
|
85
|
+
cn
|
|
86
|
+
zh
|
|
87
|
+
}`;
|
|
88
|
+
|
|
89
|
+
this._building = `{
|
|
90
|
+
id
|
|
91
|
+
name ${this._buildingName}
|
|
92
|
+
}`;
|
|
93
|
+
|
|
94
|
+
this._floor = `{
|
|
95
|
+
id
|
|
96
|
+
code
|
|
97
|
+
sequence
|
|
98
|
+
}`;
|
|
99
|
+
|
|
100
|
+
this._coordinate = `{
|
|
101
|
+
lat
|
|
102
|
+
lon
|
|
103
|
+
}`;
|
|
104
|
+
|
|
105
|
+
this._user = `{
|
|
106
|
+
username
|
|
107
|
+
}`;
|
|
108
|
+
|
|
109
|
+
this._image = `{
|
|
110
|
+
key
|
|
111
|
+
ca
|
|
112
|
+
floor ${this._floor}
|
|
113
|
+
cl ${this._coordinate}
|
|
114
|
+
l ${this._coordinate}
|
|
115
|
+
sequence ${this._sequence}
|
|
116
|
+
filename
|
|
117
|
+
}`;
|
|
118
|
+
|
|
119
|
+
this._queryImages = `{
|
|
120
|
+
key
|
|
121
|
+
sequence ${this._sequence}
|
|
122
|
+
c_rotation
|
|
123
|
+
c_translation
|
|
124
|
+
cl ${this._coordinate}
|
|
125
|
+
l ${this._coordinate}
|
|
126
|
+
building ${this._building}
|
|
127
|
+
floor ${this._floor}
|
|
128
|
+
loop_line
|
|
129
|
+
ca
|
|
130
|
+
captured_at
|
|
131
|
+
height
|
|
132
|
+
width
|
|
133
|
+
orientation
|
|
134
|
+
date
|
|
135
|
+
merge_version
|
|
136
|
+
gpano ${this._gpano}
|
|
137
|
+
merge_cc
|
|
138
|
+
user ${this._user}
|
|
139
|
+
}`;
|
|
140
|
+
|
|
141
|
+
this._querySequences = `{
|
|
142
|
+
key
|
|
143
|
+
keys
|
|
144
|
+
}`;
|
|
145
|
+
|
|
146
|
+
this._queryOutdoorImages = `{
|
|
147
|
+
key
|
|
148
|
+
outdoorImages ${this._image}
|
|
149
|
+
}`;
|
|
150
|
+
|
|
151
|
+
this._queryBuilding = `{
|
|
152
|
+
key
|
|
153
|
+
images ${this._image}
|
|
154
|
+
}`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public imageByKeyFullForOutdoor$(keys: string[]): Observable<{ [key: string]: IFullNode }> {
|
|
158
|
+
const query: string = `{
|
|
159
|
+
outdoorImages(keys: [${keys.map((key: string) => `"${key ? key.trim() : ""}"`)}])
|
|
160
|
+
${this._queryImages}
|
|
161
|
+
}`;
|
|
162
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>>
|
|
163
|
+
(this._model.query({
|
|
164
|
+
query: gql`${query}`,
|
|
165
|
+
})).pipe(
|
|
166
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>) => {
|
|
167
|
+
let result: { [key: string]: IFullNode } = {};
|
|
168
|
+
value.data.outdoorImages.forEach((res: IFullNode) => {
|
|
169
|
+
result[res.key] = res;
|
|
170
|
+
});
|
|
171
|
+
return result;
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public imageByKeyFull$(keys: string[]): Observable<{ [key: string]: IFullNode }> {
|
|
177
|
+
const query: string = `{
|
|
178
|
+
images(keys: [${keys.map((key: string) => `"${key ? key.trim() : ""}"`)}])
|
|
179
|
+
${this._queryImages}
|
|
180
|
+
}`;
|
|
181
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>>
|
|
182
|
+
(this._model.query({
|
|
183
|
+
query: gql`${query}`,
|
|
184
|
+
})).pipe(
|
|
185
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>) => {
|
|
186
|
+
let result: { [key: string]: IFullNode } = {};
|
|
187
|
+
value.data.images.forEach((res: IFullNode) => {
|
|
188
|
+
result[res.key] = res;
|
|
189
|
+
});
|
|
190
|
+
return result;
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public imageByKeyFill$(keys: string[]): Observable<{ [key: string]: IFillNode }> {
|
|
196
|
+
const query: string = `{
|
|
197
|
+
images(keys: [${keys.map((key: string) => `"${key ? key.trim() : ""}"`)}])
|
|
198
|
+
${this._queryImages}
|
|
199
|
+
}`;
|
|
200
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IFillNode[]>>>
|
|
201
|
+
(this._model.query({
|
|
202
|
+
query: gql`${query}`,
|
|
203
|
+
})).pipe(
|
|
204
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IFillNode[]>>) => {
|
|
205
|
+
let result: { [key: string]: IFillNode } = {};
|
|
206
|
+
value.data.images.forEach((res: IFullNode) => {
|
|
207
|
+
result[res.key] = res;
|
|
208
|
+
});
|
|
209
|
+
return result;
|
|
210
|
+
}),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public outdoorByBbox$(northEastLatLon: ILatLon, southWestLatLon: ILatLon): Observable<IOutdoor[]> {
|
|
215
|
+
const query: string = `{
|
|
216
|
+
outdoorByBbox(
|
|
217
|
+
ne_lat: ${northEastLatLon.lat},
|
|
218
|
+
ne_lon: ${northEastLatLon.lon},
|
|
219
|
+
sw_lat: ${southWestLatLon.lat},
|
|
220
|
+
sw_lon: ${southWestLatLon.lon}
|
|
221
|
+
)
|
|
222
|
+
${this._queryOutdoorImages}
|
|
223
|
+
}`;
|
|
224
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IOutdoor[]>>>
|
|
225
|
+
(this._model.query({
|
|
226
|
+
query: gql`${query}`,
|
|
227
|
+
})).pipe(
|
|
228
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IOutdoor[]>>) => {
|
|
229
|
+
return value.data.outdoorByBbox;
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public outdoorByLatLon$(l: ILatLon, distance: number = 5000, date?: number): Observable<IOutdoor[]> {
|
|
235
|
+
let content: string = `
|
|
236
|
+
from: ${this._minCount},
|
|
237
|
+
to: ${this._maxCount},
|
|
238
|
+
lat: ${l.lat},
|
|
239
|
+
lon: ${l.lon},
|
|
240
|
+
distance: ${distance}
|
|
241
|
+
`;
|
|
242
|
+
if (date) {
|
|
243
|
+
content += `, date: ${date}`;
|
|
244
|
+
}
|
|
245
|
+
const query: string = `{
|
|
246
|
+
outdoor(${content}) ${this._queryOutdoorImages}
|
|
247
|
+
}`;
|
|
248
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IOutdoor[]>>>
|
|
249
|
+
(this._model.query({
|
|
250
|
+
query: gql`${query}`,
|
|
251
|
+
})).pipe(
|
|
252
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IOutdoor[]>>) => {
|
|
253
|
+
return value.data.outdoor;
|
|
254
|
+
}),
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
public outdoorImagesByKeys$(keys: string[]): Observable<IFullNode> {
|
|
259
|
+
const query: string = `{
|
|
260
|
+
outdoorImages(keys: [${keys.map((key: string) => `"${key ? key.trim() : ""}"`)}])
|
|
261
|
+
${this._image}
|
|
262
|
+
}`;
|
|
263
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IFullNode>>>
|
|
264
|
+
(this._model.query({
|
|
265
|
+
query: gql`${query}`,
|
|
266
|
+
})).pipe(
|
|
267
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IFullNode>>) => {
|
|
268
|
+
return value.data.outdoorImages;
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
public imagesByH$(h: string, l: ILatLon): Observable<{ [h: string]: { [index: string]: ICoreNode } }> {
|
|
274
|
+
const query: string = `{
|
|
275
|
+
imagesByH(from: ${this._minCount}, to: ${this._maxCount}, lat: ${l.lat}, lon: ${l.lon})
|
|
276
|
+
${this._queryImages}
|
|
277
|
+
}`;
|
|
278
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<ICoreNode>>>
|
|
279
|
+
(this._model.query({
|
|
280
|
+
query: gql`${query}`,
|
|
281
|
+
})).pipe(
|
|
282
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<ICoreNode>>) => {
|
|
283
|
+
let result: any = {};
|
|
284
|
+
result[h] = value.data.imagesByH;
|
|
285
|
+
return result;
|
|
286
|
+
}),
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
public imageCloseTo$(l: ILatLon, floorCode: string, buildingId?: string, distance?: number, date?: number): Observable<IFullNode> {
|
|
291
|
+
let content: string = `
|
|
292
|
+
from: 0, to: 100,
|
|
293
|
+
lat: ${l.lat},
|
|
294
|
+
lon: ${l.lon},
|
|
295
|
+
floorCode: "${floorCode}"
|
|
296
|
+
`;
|
|
297
|
+
if (buildingId) {
|
|
298
|
+
content += `, buildingId: "${buildingId}"`;
|
|
299
|
+
}
|
|
300
|
+
if (distance) {
|
|
301
|
+
content += `, distance: ${distance}`;
|
|
302
|
+
}
|
|
303
|
+
if (date) {
|
|
304
|
+
content += `, date: ${date}`;
|
|
305
|
+
}
|
|
306
|
+
const query: string = `{
|
|
307
|
+
imagesByH(${content}) ${this._queryImages}
|
|
308
|
+
}`;
|
|
309
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>>
|
|
310
|
+
(this._model.query({
|
|
311
|
+
query: gql`${query}`,
|
|
312
|
+
})).pipe(
|
|
313
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IFullNode[]>>) => {
|
|
314
|
+
return _.last(value.data.imagesByH);
|
|
315
|
+
}),
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
public datesByKey(key: string): Observable<IKey[]> {
|
|
320
|
+
const query: string = `{
|
|
321
|
+
dates(key: "${key}")
|
|
322
|
+
${this._date}
|
|
323
|
+
}`;
|
|
324
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IKey[]>>>
|
|
325
|
+
(this._model.query({
|
|
326
|
+
query: gql`${query}`,
|
|
327
|
+
})).pipe(
|
|
328
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IKey[]>>) => {
|
|
329
|
+
return value.data.dates;
|
|
330
|
+
}),
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
public buildingByKey$(key: string, date?: number): Observable<IQueryBuilding> {
|
|
335
|
+
let params: string = `key: "${key}"`;
|
|
336
|
+
if (date) {
|
|
337
|
+
params += `, date: ${date}`;
|
|
338
|
+
}
|
|
339
|
+
const query: string = `{
|
|
340
|
+
building(${params})
|
|
341
|
+
${this._queryBuilding}
|
|
342
|
+
}`;
|
|
343
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<IQueryBuilding>>>
|
|
344
|
+
(this._model.query({
|
|
345
|
+
query: gql`${query}`,
|
|
346
|
+
})).pipe(
|
|
347
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<IQueryBuilding>>) => {
|
|
348
|
+
return value.data.building;
|
|
349
|
+
}),
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
public sequenceByKeyForOutdoor$(sequenceKeys: string[]): Observable<{ [sequenceKey: string]: ISequence }> {
|
|
354
|
+
const query: string = `{
|
|
355
|
+
outdoorSequences(keys: [${sequenceKeys.map((key: string) => `"${key.trim()}"`)}])
|
|
356
|
+
${this._querySequences}
|
|
357
|
+
}`;
|
|
358
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<ISequence[]>>>
|
|
359
|
+
(this._model.query({
|
|
360
|
+
query: gql`${query}`,
|
|
361
|
+
})).pipe(
|
|
362
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<ISequence[]>>) => {
|
|
363
|
+
let result: { [sequenceKey: string]: ISequence } = {};
|
|
364
|
+
value.data.outdoorSequences.forEach((res: ISequence) => {
|
|
365
|
+
result[res.key] = res;
|
|
366
|
+
});
|
|
367
|
+
return result;
|
|
368
|
+
}),
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
public sequenceByKey$(sequenceKeys: string[]): Observable<{ [sequenceKey: string]: ISequence }> {
|
|
373
|
+
const query: string = `{
|
|
374
|
+
sequences(keys: [${sequenceKeys.map((key: string) => `"${key.trim()}"`)}])
|
|
375
|
+
${this._querySequences}
|
|
376
|
+
}`;
|
|
377
|
+
return this._wrapPromise$<IGraphQLResponse<IGraphQLResponseData<ISequence[]>>>
|
|
378
|
+
(this._model.query({
|
|
379
|
+
query: gql`${query}`,
|
|
380
|
+
})).pipe(
|
|
381
|
+
map((value: IGraphQLResponse<IGraphQLResponseData<ISequence[]>>) => {
|
|
382
|
+
let result: { [sequenceKey: string]: ISequence } = {};
|
|
383
|
+
value.data.sequences.forEach((res: ISequence) => {
|
|
384
|
+
result[res.key] = res;
|
|
385
|
+
});
|
|
386
|
+
return result;
|
|
387
|
+
}),
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
private _wrapPromise$<T>(promise: Promise<T>): Observable<T> {
|
|
392
|
+
return defer(() => from(promise));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export default API;
|
package/src/api/Auth.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Urls from "../utils/Urls";
|
|
2
|
+
import { AuthStore } from "./AuthStore";
|
|
3
|
+
|
|
4
|
+
interface IAuthOption {
|
|
5
|
+
appId: string;
|
|
6
|
+
secret: string;
|
|
7
|
+
keyPlatform: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface IAuthWebOption extends IAuthOption {
|
|
11
|
+
origin: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IAuthIosOption extends IAuthOption {
|
|
15
|
+
bundleId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface IAuthAndroidOption extends IAuthOption {
|
|
19
|
+
packageName: string;
|
|
20
|
+
sha1: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type KeyPlatformEnum = "WEB" | "IOS" | "ANDROID";
|
|
24
|
+
|
|
25
|
+
export class Auth {
|
|
26
|
+
public applyToken(
|
|
27
|
+
appId: string,
|
|
28
|
+
secret: string,
|
|
29
|
+
keyPlatform: KeyPlatformEnum,
|
|
30
|
+
authOption?: any,
|
|
31
|
+
) {
|
|
32
|
+
let options: IAuthOption;
|
|
33
|
+
switch (keyPlatform) {
|
|
34
|
+
case "IOS": {
|
|
35
|
+
options = <IAuthIosOption>{
|
|
36
|
+
appId,
|
|
37
|
+
secret,
|
|
38
|
+
keyPlatform,
|
|
39
|
+
bundleId: authOption.bundleId,
|
|
40
|
+
};
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case "ANDROID": {
|
|
44
|
+
options = <IAuthAndroidOption>{
|
|
45
|
+
appId,
|
|
46
|
+
secret,
|
|
47
|
+
keyPlatform,
|
|
48
|
+
packageName: authOption.packageName,
|
|
49
|
+
sha1: authOption.sha1,
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
default: {
|
|
54
|
+
options = <IAuthWebOption>{
|
|
55
|
+
appId,
|
|
56
|
+
secret,
|
|
57
|
+
keyPlatform: keyPlatform || "WEB",
|
|
58
|
+
origin: window.location.hostname,
|
|
59
|
+
};
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
AuthStore.appId = appId;
|
|
64
|
+
AuthStore.secret = secret;
|
|
65
|
+
AuthStore.bundleId = authOption.bundleId;
|
|
66
|
+
AuthStore.packageName = authOption.packageName;
|
|
67
|
+
AuthStore.sha1 = authOption.sha1;
|
|
68
|
+
return fetch(Urls.authUrl, {
|
|
69
|
+
method: "post",
|
|
70
|
+
headers: {
|
|
71
|
+
"Content-Type": "application/json",
|
|
72
|
+
},
|
|
73
|
+
body: JSON.stringify(options),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KeyPlatformEnum } from "./Auth";
|
|
2
|
+
|
|
3
|
+
export class AuthStore {
|
|
4
|
+
|
|
5
|
+
public static appId: string;
|
|
6
|
+
public static secret: string;
|
|
7
|
+
public static keyPlatform: KeyPlatformEnum;
|
|
8
|
+
public static bundleId: string;
|
|
9
|
+
public static packageName: string;
|
|
10
|
+
public static sha1: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { HttpLink } from "apollo-link-http";
|
|
2
|
+
import { onError } from "apollo-link-error";
|
|
3
|
+
import ApolloClient from "apollo-client";
|
|
4
|
+
import { InMemoryCache } from "apollo-cache-inmemory";
|
|
5
|
+
import DefaultClient from "apollo-boost";
|
|
6
|
+
import { ApolloLink, Observable, Operation } from "apollo-link";
|
|
7
|
+
import { Urls } from "../Utils";
|
|
8
|
+
import { Auth } from "./Auth";
|
|
9
|
+
import { ServerError } from "apollo-link-http-common";
|
|
10
|
+
import { AuthStore } from "./AuthStore";
|
|
11
|
+
import IAuth from "./interfaces/IAuth";
|
|
12
|
+
import IResponse from "./interfaces/IResponse";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @class GraphQLCreator
|
|
16
|
+
*
|
|
17
|
+
* @classdesc Creates API models.
|
|
18
|
+
*/
|
|
19
|
+
export class GraphQLCreator {
|
|
20
|
+
private _token: string;
|
|
21
|
+
|
|
22
|
+
constructor(token?: string) {
|
|
23
|
+
this._token = token;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public get token(): string {
|
|
27
|
+
return this._token;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create a graphQL request model.
|
|
32
|
+
*
|
|
33
|
+
* @requires {DefaultClient} graphQL client for HTTP requests.
|
|
34
|
+
*/
|
|
35
|
+
public createGraphQL(): DefaultClient<Object> {
|
|
36
|
+
const httpLink: HttpLink = new HttpLink({
|
|
37
|
+
uri: Urls.graphqlModel(),
|
|
38
|
+
});
|
|
39
|
+
const errorLink: ApolloLink = onError(
|
|
40
|
+
({ networkError, operation, forward }) => {
|
|
41
|
+
if (
|
|
42
|
+
networkError &&
|
|
43
|
+
[401, 403].includes((<ServerError>networkError).statusCode)
|
|
44
|
+
) {
|
|
45
|
+
// refresh token operation
|
|
46
|
+
return new Observable((observer) => {
|
|
47
|
+
new Auth()
|
|
48
|
+
.applyToken(
|
|
49
|
+
AuthStore.appId,
|
|
50
|
+
AuthStore.secret,
|
|
51
|
+
AuthStore.keyPlatform,
|
|
52
|
+
{
|
|
53
|
+
bundleId: AuthStore.bundleId,
|
|
54
|
+
packageName: AuthStore.packageName,
|
|
55
|
+
sha1: AuthStore.sha1,
|
|
56
|
+
},
|
|
57
|
+
)
|
|
58
|
+
.then((res) => res.json())
|
|
59
|
+
.then((res) => {
|
|
60
|
+
this._token = res.result.idToken;
|
|
61
|
+
this._setTokenToHeader(operation);
|
|
62
|
+
})
|
|
63
|
+
.then(() => {
|
|
64
|
+
// Retry last failed request
|
|
65
|
+
forward(operation).subscribe({
|
|
66
|
+
next: observer.next.bind(observer),
|
|
67
|
+
error: observer.error.bind(observer),
|
|
68
|
+
complete: observer.complete.bind(observer),
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
const middlewareLink: ApolloLink = new ApolloLink(
|
|
76
|
+
(operation, forward) => {
|
|
77
|
+
this._setTokenToHeader(operation);
|
|
78
|
+
return forward(operation);
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
const link: ApolloLink = middlewareLink
|
|
82
|
+
.concat(errorLink)
|
|
83
|
+
.concat(httpLink);
|
|
84
|
+
|
|
85
|
+
return new ApolloClient({
|
|
86
|
+
link,
|
|
87
|
+
cache: new InMemoryCache(),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private _setTokenToHeader(operation: Operation): void {
|
|
92
|
+
operation.setContext({
|
|
93
|
+
headers: {
|
|
94
|
+
token: this._token,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default GraphQLCreator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import IImageTagInfo from "./IImageTagInfo";
|
|
2
|
+
import IFloorInfo from "./IFloorInfo";
|
|
3
|
+
import { IBuildingBase } from "./IBuildingBase";
|
|
4
|
+
|
|
5
|
+
export interface IBuildingInfo {
|
|
6
|
+
country?: string;
|
|
7
|
+
|
|
8
|
+
city?: string;
|
|
9
|
+
|
|
10
|
+
building?: IBuildingBase;
|
|
11
|
+
|
|
12
|
+
floor?: IFloorInfo;
|
|
13
|
+
|
|
14
|
+
loop_line?: number;
|
|
15
|
+
|
|
16
|
+
tags?: IImageTagInfo[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default IBuildingInfo;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IKey,
|
|
3
|
+
ILatLon,
|
|
4
|
+
} from "../../API";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Interface that describes the raw core node properties.
|
|
8
|
+
*
|
|
9
|
+
* @interface ICoreNode
|
|
10
|
+
*/
|
|
11
|
+
export interface ICoreNode extends IKey {
|
|
12
|
+
/**
|
|
13
|
+
* Original EXIF latitude longitude in WGS84 datum, measured in degrees.
|
|
14
|
+
*/
|
|
15
|
+
l: ILatLon;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* SfM computed latitude longitude in WGS84 datum, measured in degrees.
|
|
19
|
+
*/
|
|
20
|
+
cl?: ILatLon;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sequence that the node is part of.
|
|
24
|
+
*/
|
|
25
|
+
sequence: IKey;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default ICoreNode;
|