@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,548 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Subject,
|
|
3
|
+
Observable,
|
|
4
|
+
Subscriber,
|
|
5
|
+
Subscription,
|
|
6
|
+
combineLatest,
|
|
7
|
+
ReplaySubject,
|
|
8
|
+
of,
|
|
9
|
+
} from "rxjs";
|
|
10
|
+
import {
|
|
11
|
+
startWith,
|
|
12
|
+
multicast,
|
|
13
|
+
refCount,
|
|
14
|
+
finalize,
|
|
15
|
+
first,
|
|
16
|
+
tap,
|
|
17
|
+
map,
|
|
18
|
+
} from "rxjs/operators";
|
|
19
|
+
import type { IEdge } from "./edge/interfaces/interfaces";
|
|
20
|
+
import type {
|
|
21
|
+
IEdgeStatus,
|
|
22
|
+
IMesh,
|
|
23
|
+
ILoadStatus,
|
|
24
|
+
ILoadStatusObject,
|
|
25
|
+
} from "./interfaces/interfaces";
|
|
26
|
+
import { MeshReader } from "./MeshReader";
|
|
27
|
+
import { Urls } from "../utils/Urls";
|
|
28
|
+
import { ImageSize } from "../viewer/ImageSize";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @class NodeCache
|
|
32
|
+
*
|
|
33
|
+
* @classdesc Represents the cached properties of a node.
|
|
34
|
+
*/
|
|
35
|
+
export class NodeCache {
|
|
36
|
+
private _disposed: boolean;
|
|
37
|
+
|
|
38
|
+
private _image: HTMLImageElement;
|
|
39
|
+
private _loadStatus: ILoadStatus;
|
|
40
|
+
private _mesh: IMesh;
|
|
41
|
+
private _sequenceEdges: IEdgeStatus;
|
|
42
|
+
private _spatialEdges: IEdgeStatus;
|
|
43
|
+
|
|
44
|
+
private _imageRequest: XMLHttpRequest;
|
|
45
|
+
private _meshRequest: XMLHttpRequest;
|
|
46
|
+
|
|
47
|
+
private _sequenceEdgesChanged$: Subject<IEdgeStatus>;
|
|
48
|
+
private _sequenceEdges$: Observable<IEdgeStatus>;
|
|
49
|
+
private _spatialEdgesChanged$: Subject<IEdgeStatus>;
|
|
50
|
+
private _spatialEdges$: Observable<IEdgeStatus>;
|
|
51
|
+
|
|
52
|
+
private _cachingAssets$: Observable<NodeCache>;
|
|
53
|
+
|
|
54
|
+
private _sequenceEdgesSubscription: Subscription;
|
|
55
|
+
private _spatialEdgesSubscription: Subscription;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create a new node cache instance.
|
|
59
|
+
*/
|
|
60
|
+
constructor() {
|
|
61
|
+
this._disposed = false;
|
|
62
|
+
|
|
63
|
+
this._image = null;
|
|
64
|
+
this._loadStatus = { loaded: 0, total: 0 };
|
|
65
|
+
this._mesh = null;
|
|
66
|
+
this._sequenceEdges = { cached: false, edges: [] };
|
|
67
|
+
this._spatialEdges = { cached: false, edges: [] };
|
|
68
|
+
|
|
69
|
+
this._sequenceEdgesChanged$ = new Subject<IEdgeStatus>();
|
|
70
|
+
this._sequenceEdges$ = this._sequenceEdgesChanged$.pipe(
|
|
71
|
+
startWith(this._sequenceEdges),
|
|
72
|
+
multicast(new ReplaySubject(1)),
|
|
73
|
+
refCount(),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
this._sequenceEdgesSubscription = this._sequenceEdges$.subscribe(() => {
|
|
77
|
+
/*noop*/
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
this._spatialEdgesChanged$ = new Subject<IEdgeStatus>();
|
|
81
|
+
this._spatialEdges$ = this._spatialEdgesChanged$.pipe(
|
|
82
|
+
startWith(this._spatialEdges),
|
|
83
|
+
multicast(new ReplaySubject(1)),
|
|
84
|
+
refCount(),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
this._spatialEdgesSubscription = this._spatialEdges$.subscribe(() => {
|
|
88
|
+
/*noop*/
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
this._cachingAssets$ = null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get image.
|
|
96
|
+
*
|
|
97
|
+
* @description Will not be set when assets have not been cached
|
|
98
|
+
* or when the object has been disposed.
|
|
99
|
+
*
|
|
100
|
+
* @returns {HTMLImageElement} Cached image element of the node.
|
|
101
|
+
*/
|
|
102
|
+
public get image(): HTMLImageElement {
|
|
103
|
+
return this._image;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get loadStatus.
|
|
108
|
+
*
|
|
109
|
+
* @returns {ILoadStatus} Value indicating the load status
|
|
110
|
+
* of the mesh and image.
|
|
111
|
+
*/
|
|
112
|
+
public get loadStatus(): ILoadStatus {
|
|
113
|
+
return this._loadStatus;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get mesh.
|
|
118
|
+
*
|
|
119
|
+
* @description Will not be set when assets have not been cached
|
|
120
|
+
* or when the object has been disposed.
|
|
121
|
+
*
|
|
122
|
+
* @returns {IMesh} SfM triangulated mesh of reconstructed
|
|
123
|
+
* atomic 3D points.
|
|
124
|
+
*/
|
|
125
|
+
public get mesh(): IMesh {
|
|
126
|
+
return this._mesh;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get sequenceEdges.
|
|
131
|
+
*
|
|
132
|
+
* @returns {IEdgeStatus} Value describing the status of the
|
|
133
|
+
* sequence edges.
|
|
134
|
+
*/
|
|
135
|
+
public get sequenceEdges(): IEdgeStatus {
|
|
136
|
+
return this._sequenceEdges;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get sequenceEdges$.
|
|
141
|
+
*
|
|
142
|
+
* @returns {Observable<IEdgeStatus>} Observable emitting
|
|
143
|
+
* values describing the status of the sequence edges.
|
|
144
|
+
*/
|
|
145
|
+
public get sequenceEdges$(): Observable<IEdgeStatus> {
|
|
146
|
+
return this._sequenceEdges$;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get spatialEdges.
|
|
151
|
+
*
|
|
152
|
+
* @returns {IEdgeStatus} Value describing the status of the
|
|
153
|
+
* spatial edges.
|
|
154
|
+
*/
|
|
155
|
+
public get spatialEdges(): IEdgeStatus {
|
|
156
|
+
return this._spatialEdges;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get spatialEdges$.
|
|
161
|
+
*
|
|
162
|
+
* @returns {Observable<IEdgeStatus>} Observable emitting
|
|
163
|
+
* values describing the status of the spatial edges.
|
|
164
|
+
*/
|
|
165
|
+
public get spatialEdges$(): Observable<IEdgeStatus> {
|
|
166
|
+
return this._spatialEdges$;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Cache the image and mesh assets.
|
|
171
|
+
*
|
|
172
|
+
* @param {string} key - Key of the node to cache.
|
|
173
|
+
* @param {boolean} pano - Value indicating whether node is a panorama.
|
|
174
|
+
* @param {boolean} merged - Value indicating whether node is merged.
|
|
175
|
+
* @returns {Observable<NodeCache>} Observable emitting this node
|
|
176
|
+
* cache whenever the load status has changed and when the mesh or image
|
|
177
|
+
* has been fully loaded.
|
|
178
|
+
*/
|
|
179
|
+
public cacheAssets$(
|
|
180
|
+
key: string,
|
|
181
|
+
pano: boolean,
|
|
182
|
+
merged: boolean,
|
|
183
|
+
): Observable<NodeCache> {
|
|
184
|
+
if (this._cachingAssets$ != null) {
|
|
185
|
+
return this._cachingAssets$;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this._cachingAssets$ = combineLatest(
|
|
189
|
+
this._cacheImage$(key),
|
|
190
|
+
(imageStatus: ILoadStatusObject<HTMLImageElement>): NodeCache => {
|
|
191
|
+
this._loadStatus.loaded = 0;
|
|
192
|
+
this._loadStatus.total = 0;
|
|
193
|
+
this._mesh = { faces: [], vertices: [] };
|
|
194
|
+
if (imageStatus) {
|
|
195
|
+
this._image = imageStatus.object;
|
|
196
|
+
this._loadStatus.loaded += imageStatus.loaded.loaded;
|
|
197
|
+
this._loadStatus.total += imageStatus.loaded.total;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return this;
|
|
201
|
+
},
|
|
202
|
+
).pipe(
|
|
203
|
+
finalize((): void => {
|
|
204
|
+
this._cachingAssets$ = null;
|
|
205
|
+
}),
|
|
206
|
+
multicast(new ReplaySubject(1)),
|
|
207
|
+
refCount(),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
return this._cachingAssets$;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Cache an image with a higher resolution than the current one.
|
|
215
|
+
*
|
|
216
|
+
* @param {string} key - Key of the node to cache.
|
|
217
|
+
* @param {ImageSize} imageSize - The size to cache.
|
|
218
|
+
* @returns {Observable<NodeCache>} Observable emitting a single item,
|
|
219
|
+
* the node cache, when the image has been cached. If supplied image
|
|
220
|
+
* size is not larger than the current image size the node cache is
|
|
221
|
+
* returned immediately.
|
|
222
|
+
*/
|
|
223
|
+
public cacheImage$(
|
|
224
|
+
key: string,
|
|
225
|
+
imageSize: ImageSize,
|
|
226
|
+
): Observable<NodeCache> {
|
|
227
|
+
if (
|
|
228
|
+
this._image != null &&
|
|
229
|
+
imageSize <= Math.max(this._image.width, this._image.height)
|
|
230
|
+
) {
|
|
231
|
+
return of<NodeCache>(this);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return this._cacheImage$(key).pipe(
|
|
235
|
+
first((status: ILoadStatusObject<HTMLImageElement>): boolean => {
|
|
236
|
+
return status.object != null;
|
|
237
|
+
}),
|
|
238
|
+
tap((status: ILoadStatusObject<HTMLImageElement>): void => {
|
|
239
|
+
this._disposeImage();
|
|
240
|
+
this._image = status.object;
|
|
241
|
+
}),
|
|
242
|
+
map(
|
|
243
|
+
(
|
|
244
|
+
imageStatus: ILoadStatusObject<HTMLImageElement>,
|
|
245
|
+
): NodeCache => {
|
|
246
|
+
return this;
|
|
247
|
+
},
|
|
248
|
+
),
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Cache the sequence edges.
|
|
254
|
+
*
|
|
255
|
+
* @param {Array<IEdge>} edges - Sequence edges to cache.
|
|
256
|
+
*/
|
|
257
|
+
public cacheSequenceEdges(edges: IEdge[]): void {
|
|
258
|
+
this._sequenceEdges = { cached: true, edges: edges };
|
|
259
|
+
this._sequenceEdgesChanged$.next(this._sequenceEdges);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Cache the spatial edges.
|
|
264
|
+
*
|
|
265
|
+
* @param {Array<IEdge>} edges - Spatial edges to cache.
|
|
266
|
+
*/
|
|
267
|
+
public cacheSpatialEdges(edges: IEdge[]): void {
|
|
268
|
+
this._spatialEdges = { cached: true, edges: edges };
|
|
269
|
+
this._spatialEdgesChanged$.next(this._spatialEdges);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Dispose the node cache.
|
|
274
|
+
*
|
|
275
|
+
* @description Disposes all cached assets and unsubscribes to
|
|
276
|
+
* all streams.
|
|
277
|
+
*/
|
|
278
|
+
public dispose(): void {
|
|
279
|
+
this._sequenceEdgesSubscription.unsubscribe();
|
|
280
|
+
this._spatialEdgesSubscription.unsubscribe();
|
|
281
|
+
|
|
282
|
+
this._disposeImage();
|
|
283
|
+
|
|
284
|
+
this._mesh = null;
|
|
285
|
+
this._loadStatus.loaded = 0;
|
|
286
|
+
this._loadStatus.total = 0;
|
|
287
|
+
this._sequenceEdges = { cached: false, edges: [] };
|
|
288
|
+
this._spatialEdges = { cached: false, edges: [] };
|
|
289
|
+
|
|
290
|
+
this._sequenceEdgesChanged$.next(this._sequenceEdges);
|
|
291
|
+
this._spatialEdgesChanged$.next(this._spatialEdges);
|
|
292
|
+
|
|
293
|
+
this._disposed = true;
|
|
294
|
+
|
|
295
|
+
if (this._imageRequest != null) {
|
|
296
|
+
this._imageRequest.abort();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (this._meshRequest != null) {
|
|
300
|
+
this._meshRequest.abort();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Reset the sequence edges.
|
|
306
|
+
*/
|
|
307
|
+
public resetSequenceEdges(): void {
|
|
308
|
+
this._sequenceEdges = { cached: false, edges: [] };
|
|
309
|
+
this._sequenceEdgesChanged$.next(this._sequenceEdges);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Reset the spatial edges.
|
|
314
|
+
*/
|
|
315
|
+
public resetSpatialEdges(): void {
|
|
316
|
+
this._spatialEdges = { cached: false, edges: [] };
|
|
317
|
+
this._spatialEdgesChanged$.next(this._spatialEdges);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Cache the image.
|
|
322
|
+
*
|
|
323
|
+
* @param {string} key - Key of the node to cache.
|
|
324
|
+
* @param {boolean} pano - Value indicating whether node is a panorama.
|
|
325
|
+
* @returns {Observable<ILoadStatusObject<HTMLImageElement>>} Observable
|
|
326
|
+
* emitting a load status object every time the load status changes
|
|
327
|
+
* and completes when the image is fully loaded.
|
|
328
|
+
*/
|
|
329
|
+
private _cacheImage$(
|
|
330
|
+
key: string,
|
|
331
|
+
): Observable<ILoadStatusObject<HTMLImageElement>> {
|
|
332
|
+
return Observable.create(
|
|
333
|
+
(
|
|
334
|
+
subscriber: Subscriber<ILoadStatusObject<HTMLImageElement>>,
|
|
335
|
+
): void => {
|
|
336
|
+
let xmlHTTP: XMLHttpRequest = new XMLHttpRequest();
|
|
337
|
+
xmlHTTP.open("GET", Urls.thumbnail(key), true);
|
|
338
|
+
xmlHTTP.setRequestHeader("Accept", "image/jpeg");
|
|
339
|
+
// if XMLHttpRequest is rewritten by mockjs, need to get origin XMLHttpRequest instance
|
|
340
|
+
if ((<any>xmlHTTP).custom && (<any>xmlHTTP).custom.xhr) {
|
|
341
|
+
xmlHTTP = (<any>xmlHTTP).custom.xhr;
|
|
342
|
+
}
|
|
343
|
+
xmlHTTP.responseType = "arraybuffer";
|
|
344
|
+
xmlHTTP.timeout = 15000;
|
|
345
|
+
|
|
346
|
+
xmlHTTP.onload = (pe: ProgressEvent) => {
|
|
347
|
+
if (xmlHTTP.status !== 200) {
|
|
348
|
+
this._imageRequest = null;
|
|
349
|
+
|
|
350
|
+
subscriber.error(
|
|
351
|
+
new Error(
|
|
352
|
+
`Failed to fetch image (${key}). Status: ${xmlHTTP.status}, ${xmlHTTP.statusText}`,
|
|
353
|
+
),
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
let image: HTMLImageElement = new Image();
|
|
360
|
+
image.crossOrigin = "Anonymous";
|
|
361
|
+
|
|
362
|
+
image.onload = (e: Event) => {
|
|
363
|
+
this._imageRequest = null;
|
|
364
|
+
|
|
365
|
+
if (this._disposed) {
|
|
366
|
+
window.URL.revokeObjectURL(image.src);
|
|
367
|
+
subscriber.error(
|
|
368
|
+
new Error(`Image load was aborted (${key})`),
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
subscriber.next({
|
|
375
|
+
loaded: { loaded: pe.loaded, total: pe.total },
|
|
376
|
+
object: image,
|
|
377
|
+
});
|
|
378
|
+
subscriber.complete();
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
image.onerror = (error: ErrorEvent) => {
|
|
382
|
+
this._imageRequest = null;
|
|
383
|
+
|
|
384
|
+
subscriber.error(
|
|
385
|
+
new Error(`Failed to load image (${key})`),
|
|
386
|
+
);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
let blob: Blob = new Blob([xmlHTTP.response]);
|
|
390
|
+
image.src = window.URL.createObjectURL(blob);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
xmlHTTP.onprogress = (pe: ProgressEvent) => {
|
|
394
|
+
if (this._disposed) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
subscriber.next({
|
|
399
|
+
loaded: { loaded: pe.loaded, total: pe.total },
|
|
400
|
+
object: null,
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
xmlHTTP.onerror = (error: Event) => {
|
|
405
|
+
this._imageRequest = null;
|
|
406
|
+
|
|
407
|
+
subscriber.error(
|
|
408
|
+
new Error(`Failed to fetch image (${key})`),
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
xmlHTTP.ontimeout = (e: Event) => {
|
|
413
|
+
this._imageRequest = null;
|
|
414
|
+
|
|
415
|
+
subscriber.error(
|
|
416
|
+
new Error(`Image request timed out (${key})`),
|
|
417
|
+
);
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
xmlHTTP.onabort = (event: Event) => {
|
|
421
|
+
this._imageRequest = null;
|
|
422
|
+
|
|
423
|
+
subscriber.error(
|
|
424
|
+
new Error(`Image request was aborted (${key})`),
|
|
425
|
+
);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
this._imageRequest = xmlHTTP;
|
|
429
|
+
|
|
430
|
+
xmlHTTP.send(null);
|
|
431
|
+
},
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Cache the mesh.
|
|
437
|
+
*
|
|
438
|
+
* @param {string} key - Key of the node to cache.
|
|
439
|
+
* @param {boolean} merged - Value indicating whether node is merged.
|
|
440
|
+
* @returns {Observable<ILoadStatusObject<IMesh>>} Observable emitting
|
|
441
|
+
* a load status object every time the load status changes and completes
|
|
442
|
+
* when the mesh is fully loaded.
|
|
443
|
+
*/
|
|
444
|
+
private _cacheMesh$(
|
|
445
|
+
key: string,
|
|
446
|
+
merged: boolean,
|
|
447
|
+
): Observable<ILoadStatusObject<IMesh>> {
|
|
448
|
+
return Observable.create(
|
|
449
|
+
(subscriber: Subscriber<ILoadStatusObject<IMesh>>): void => {
|
|
450
|
+
if (!merged) {
|
|
451
|
+
subscriber.next(this._createEmptyMeshLoadStatus());
|
|
452
|
+
subscriber.complete();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
let xmlHTTP: XMLHttpRequest = new XMLHttpRequest();
|
|
457
|
+
xmlHTTP.open("GET", Urls.protoMesh(key), true);
|
|
458
|
+
xmlHTTP.setRequestHeader("Accept", "application/mesh");
|
|
459
|
+
// if XMLHttpRequest is rewritten by mockjs, need to get origin XMLHttpRequest instance
|
|
460
|
+
if ((<any>xmlHTTP).custom && (<any>xmlHTTP).custom.xhr) {
|
|
461
|
+
xmlHTTP = (<any>xmlHTTP).custom.xhr;
|
|
462
|
+
}
|
|
463
|
+
xmlHTTP.responseType = "arraybuffer";
|
|
464
|
+
xmlHTTP.timeout = 15000;
|
|
465
|
+
|
|
466
|
+
xmlHTTP.onload = (pe: ProgressEvent) => {
|
|
467
|
+
this._meshRequest = null;
|
|
468
|
+
|
|
469
|
+
if (this._disposed) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
let mesh: IMesh =
|
|
474
|
+
xmlHTTP.status === 200
|
|
475
|
+
? MeshReader.read(new Buffer(xmlHTTP.response))
|
|
476
|
+
: { faces: [], vertices: [] };
|
|
477
|
+
subscriber.next({
|
|
478
|
+
loaded: { loaded: pe.loaded, total: pe.total },
|
|
479
|
+
object: { faces: [], vertices: [] },
|
|
480
|
+
}); // mesh设置为空
|
|
481
|
+
subscriber.complete();
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
xmlHTTP.onprogress = (pe: ProgressEvent) => {
|
|
485
|
+
if (this._disposed) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
subscriber.next({
|
|
490
|
+
loaded: { loaded: pe.loaded, total: pe.total },
|
|
491
|
+
object: null,
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
xmlHTTP.onerror = (e: Event) => {
|
|
496
|
+
this._meshRequest = null;
|
|
497
|
+
|
|
498
|
+
// console.error(`Failed to cache mesh (${key})`);
|
|
499
|
+
|
|
500
|
+
subscriber.next(this._createEmptyMeshLoadStatus());
|
|
501
|
+
subscriber.complete();
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
xmlHTTP.ontimeout = (e: Event) => {
|
|
505
|
+
this._meshRequest = null;
|
|
506
|
+
|
|
507
|
+
// console.error(`Mesh request timed out (${key})`);
|
|
508
|
+
|
|
509
|
+
subscriber.next(this._createEmptyMeshLoadStatus());
|
|
510
|
+
subscriber.complete();
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
xmlHTTP.onabort = (e: Event) => {
|
|
514
|
+
this._meshRequest = null;
|
|
515
|
+
|
|
516
|
+
// subscriber.error(new Error(`Mesh request was aborted (${key})`));
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
this._meshRequest = xmlHTTP;
|
|
520
|
+
|
|
521
|
+
xmlHTTP.send(null);
|
|
522
|
+
},
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Create a load status object with an empty mesh.
|
|
528
|
+
*
|
|
529
|
+
* @returns {ILoadStatusObject<IMesh>} Load status object
|
|
530
|
+
* with empty mesh.
|
|
531
|
+
*/
|
|
532
|
+
private _createEmptyMeshLoadStatus(): ILoadStatusObject<IMesh> {
|
|
533
|
+
return {
|
|
534
|
+
loaded: { loaded: 0, total: 0 },
|
|
535
|
+
object: { faces: [], vertices: [] },
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
private _disposeImage(): void {
|
|
540
|
+
if (this._image != null) {
|
|
541
|
+
window.URL.revokeObjectURL(this._image.src);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
this._image = null;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export default NodeCache;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as _ from "underscore";
|
|
2
|
+
|
|
3
|
+
import {ISequence} from "../API";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @class Sequence
|
|
7
|
+
*
|
|
8
|
+
* @classdesc Represents a sequence of ordered nodes.
|
|
9
|
+
*/
|
|
10
|
+
export class Sequence {
|
|
11
|
+
private _key: string;
|
|
12
|
+
private _keys: string[];
|
|
13
|
+
private _country: string;
|
|
14
|
+
private _city: string;
|
|
15
|
+
private _building: object;
|
|
16
|
+
private _floor: object;
|
|
17
|
+
private _loopLine: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new sequene instance.
|
|
21
|
+
*
|
|
22
|
+
* @param {ISequence} sequence - Raw sequence data.
|
|
23
|
+
*/
|
|
24
|
+
constructor(sequence: ISequence) {
|
|
25
|
+
this._key = sequence.key;
|
|
26
|
+
this._keys = sequence.keys;
|
|
27
|
+
this._country = sequence.country;
|
|
28
|
+
this._city = sequence.city;
|
|
29
|
+
this._building = sequence.building;
|
|
30
|
+
this._floor = sequence.floor;
|
|
31
|
+
this._loopLine = sequence.loop_line;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get key.
|
|
36
|
+
*
|
|
37
|
+
* @returns {string} Unique sequence key.
|
|
38
|
+
*/
|
|
39
|
+
public get key(): string {
|
|
40
|
+
return this._key;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get keys.
|
|
45
|
+
*
|
|
46
|
+
* @returns {Array<string>} Array of ordered node keys in the sequence.
|
|
47
|
+
*/
|
|
48
|
+
public get keys(): string[] {
|
|
49
|
+
return this._keys;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public get country(): string {
|
|
53
|
+
return this._country;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public get city(): string {
|
|
57
|
+
return this._city;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public get building(): object {
|
|
61
|
+
return this._building;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public get floor(): object {
|
|
65
|
+
return this._floor;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public get floorVersion(): number {
|
|
69
|
+
return this._loopLine;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Dispose the sequence.
|
|
74
|
+
*
|
|
75
|
+
* @description Disposes all cached assets.
|
|
76
|
+
*/
|
|
77
|
+
public dispose(): void {
|
|
78
|
+
this._key = null;
|
|
79
|
+
this._keys = null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Find the next node key in the sequence with respect to
|
|
84
|
+
* the provided node key.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} key - Reference node key.
|
|
87
|
+
* @returns {string} Next key in sequence if it exists, null otherwise.
|
|
88
|
+
*/
|
|
89
|
+
public findNextKey(key: string): string {
|
|
90
|
+
let i: number = _.indexOf(this._keys, key);
|
|
91
|
+
|
|
92
|
+
if ((i + 1) >= this._keys.length || i === -1) {
|
|
93
|
+
return null;
|
|
94
|
+
} else {
|
|
95
|
+
return this._keys[i + 1];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Find the previous node key in the sequence with respect to
|
|
101
|
+
* the provided node key.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} key - Reference node key.
|
|
104
|
+
* @returns {string} Previous key in sequence if it exists, null otherwise.
|
|
105
|
+
*/
|
|
106
|
+
public findPrevKey(key: string): string {
|
|
107
|
+
let i: number = _.indexOf(this._keys, key);
|
|
108
|
+
|
|
109
|
+
if (i === 0 || i === -1) {
|
|
110
|
+
return null;
|
|
111
|
+
} else {
|
|
112
|
+
return this._keys[i - 1];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default Sequence;
|