@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,138 @@
|
|
|
1
|
+
import { Observable, Subject } from "rxjs";
|
|
2
|
+
import { Component } from "../Component";
|
|
3
|
+
import type { ITagConfiguration } from "../interfaces/ITagConfiguration";
|
|
4
|
+
import { OutlineCreateTag } from "./tag/OutlineCreateTag";
|
|
5
|
+
import { PolygonGeometry } from "./geometry/PolygonGeometry";
|
|
6
|
+
import { RectGeometry } from "./geometry/RectGeometry";
|
|
7
|
+
import { Transform } from "../../Geo";
|
|
8
|
+
import { Navigator } from "../../Viewer";
|
|
9
|
+
import { scan, share, withLatestFrom, map } from "rxjs/operators";
|
|
10
|
+
|
|
11
|
+
interface ICreateTagOperation {
|
|
12
|
+
(tag: OutlineCreateTag): OutlineCreateTag;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class TagCreator {
|
|
16
|
+
private _component: Component<ITagConfiguration>;
|
|
17
|
+
private _navigator: Navigator;
|
|
18
|
+
|
|
19
|
+
private _tagOperation$: Subject<ICreateTagOperation>;
|
|
20
|
+
private _tag$: Observable<OutlineCreateTag>;
|
|
21
|
+
|
|
22
|
+
private _createPolygon$: Subject<number[]>;
|
|
23
|
+
private _createRect$: Subject<number[]>;
|
|
24
|
+
private _delete$: Subject<void>;
|
|
25
|
+
|
|
26
|
+
constructor(component: Component<ITagConfiguration>, navigator: Navigator) {
|
|
27
|
+
this._component = component;
|
|
28
|
+
this._navigator = navigator;
|
|
29
|
+
|
|
30
|
+
this._tagOperation$ = new Subject<ICreateTagOperation>();
|
|
31
|
+
this._createPolygon$ = new Subject<number[]>();
|
|
32
|
+
this._createRect$ = new Subject<number[]>();
|
|
33
|
+
this._delete$ = new Subject<void>();
|
|
34
|
+
|
|
35
|
+
this._tag$ = this._tagOperation$.pipe(
|
|
36
|
+
scan(
|
|
37
|
+
(
|
|
38
|
+
tag: OutlineCreateTag,
|
|
39
|
+
operation: ICreateTagOperation,
|
|
40
|
+
): OutlineCreateTag => {
|
|
41
|
+
return operation(tag);
|
|
42
|
+
},
|
|
43
|
+
null,
|
|
44
|
+
),
|
|
45
|
+
share(),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
this._createRect$
|
|
49
|
+
.pipe(
|
|
50
|
+
withLatestFrom(
|
|
51
|
+
this._component.configuration$,
|
|
52
|
+
this._navigator.stateService.currentTransform$,
|
|
53
|
+
),
|
|
54
|
+
map(
|
|
55
|
+
([coord, conf, transform]: [
|
|
56
|
+
number[],
|
|
57
|
+
ITagConfiguration,
|
|
58
|
+
Transform,
|
|
59
|
+
]): ICreateTagOperation => {
|
|
60
|
+
return (tag: OutlineCreateTag): OutlineCreateTag => {
|
|
61
|
+
const geometry: RectGeometry = new RectGeometry([
|
|
62
|
+
coord[0],
|
|
63
|
+
coord[1],
|
|
64
|
+
coord[0],
|
|
65
|
+
coord[1],
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
return new OutlineCreateTag(
|
|
69
|
+
geometry,
|
|
70
|
+
{ color: conf.createColor },
|
|
71
|
+
transform,
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
.subscribe(this._tagOperation$);
|
|
78
|
+
|
|
79
|
+
this._createPolygon$
|
|
80
|
+
.pipe(
|
|
81
|
+
withLatestFrom(
|
|
82
|
+
this._component.configuration$,
|
|
83
|
+
this._navigator.stateService.currentTransform$,
|
|
84
|
+
),
|
|
85
|
+
map(
|
|
86
|
+
([coord, conf, transform]: [
|
|
87
|
+
number[],
|
|
88
|
+
ITagConfiguration,
|
|
89
|
+
Transform,
|
|
90
|
+
]): ICreateTagOperation => {
|
|
91
|
+
return (tag: OutlineCreateTag): OutlineCreateTag => {
|
|
92
|
+
const geometry: PolygonGeometry =
|
|
93
|
+
new PolygonGeometry([
|
|
94
|
+
[coord[0], coord[1]],
|
|
95
|
+
[coord[0], coord[1]],
|
|
96
|
+
[coord[0], coord[1]],
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
return new OutlineCreateTag(
|
|
100
|
+
geometry,
|
|
101
|
+
{ color: conf.createColor },
|
|
102
|
+
transform,
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
.subscribe(this._tagOperation$);
|
|
109
|
+
|
|
110
|
+
this._delete$
|
|
111
|
+
.pipe(
|
|
112
|
+
map((): ICreateTagOperation => {
|
|
113
|
+
return (tag: OutlineCreateTag): OutlineCreateTag => {
|
|
114
|
+
return null;
|
|
115
|
+
};
|
|
116
|
+
}),
|
|
117
|
+
)
|
|
118
|
+
.subscribe(this._tagOperation$);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public get createRect$(): Subject<number[]> {
|
|
122
|
+
return this._createRect$;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public get createPolygon$(): Subject<number[]> {
|
|
126
|
+
return this._createPolygon$;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public get delete$(): Subject<void> {
|
|
130
|
+
return this._delete$;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public get tag$(): Observable<OutlineCreateTag> {
|
|
134
|
+
return this._tag$;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default TagCreator;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import * as vd from "virtual-dom";
|
|
3
|
+
import {
|
|
4
|
+
OutlineCreateTag,
|
|
5
|
+
RenderTag,
|
|
6
|
+
Tag,
|
|
7
|
+
} from "../../Component";
|
|
8
|
+
import {ISize} from "../../Render";
|
|
9
|
+
import {ISpriteAtlas} from "../../Viewer";
|
|
10
|
+
|
|
11
|
+
export class TagDOMRenderer {
|
|
12
|
+
public render(
|
|
13
|
+
tags: RenderTag<Tag>[],
|
|
14
|
+
createTag: OutlineCreateTag,
|
|
15
|
+
atlas: ISpriteAtlas,
|
|
16
|
+
camera: THREE.PerspectiveCamera,
|
|
17
|
+
size: ISize): vd.VNode {
|
|
18
|
+
|
|
19
|
+
let vNodes: vd.VNode[] = [];
|
|
20
|
+
|
|
21
|
+
for (const tag of tags) {
|
|
22
|
+
vNodes = vNodes.concat(tag.getDOMObjects(atlas, camera, size));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (createTag != null) {
|
|
26
|
+
vNodes = vNodes.concat(createTag.getDOMObjects(camera, size));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return vd.h("div.TagContainer", {}, vNodes);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public clear(): vd.VNode {
|
|
33
|
+
return vd.h("div", {}, []);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration for tag modes
|
|
3
|
+
* @enum {number}
|
|
4
|
+
* @readonly
|
|
5
|
+
* @description Modes for the interaction in the tag component.
|
|
6
|
+
*/
|
|
7
|
+
export enum TagMode {
|
|
8
|
+
/**
|
|
9
|
+
* Disables creating tags.
|
|
10
|
+
*/
|
|
11
|
+
Default,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a point geometry through a click.
|
|
15
|
+
*/
|
|
16
|
+
CreatePoint,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a polygon geometry through clicks.
|
|
20
|
+
*/
|
|
21
|
+
CreatePolygon,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a rect geometry through clicks.
|
|
25
|
+
*/
|
|
26
|
+
CreateRect,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a rect geometry through drag.
|
|
30
|
+
*
|
|
31
|
+
* @description Claims the mouse which results in mouse handlers like
|
|
32
|
+
* drag pan and scroll zoom becoming inactive.
|
|
33
|
+
*/
|
|
34
|
+
CreateRectDrag,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default TagMode;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import {OutlineCreateTag, RenderTag, Tag} from "../../Component";
|
|
3
|
+
|
|
4
|
+
type TagObjects = {
|
|
5
|
+
tag: RenderTag<Tag>;
|
|
6
|
+
objects: THREE.Object3D[];
|
|
7
|
+
retrievableObjects: THREE.Object3D[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type CreateTagObjects = {
|
|
11
|
+
tag: OutlineCreateTag;
|
|
12
|
+
objects: THREE.Object3D[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class TagScene {
|
|
16
|
+
private _createTag: CreateTagObjects;
|
|
17
|
+
private _needsRender: boolean;
|
|
18
|
+
private _objectTags: { [uuid: string]: string };
|
|
19
|
+
private _raycaster: THREE.Raycaster;
|
|
20
|
+
private _retrievableObjects: THREE.Object3D[];
|
|
21
|
+
private _scene: THREE.Scene;
|
|
22
|
+
private _tags: { [id: string]: TagObjects };
|
|
23
|
+
|
|
24
|
+
constructor(scene?: THREE.Scene, raycaster?: THREE.Raycaster) {
|
|
25
|
+
this._createTag = null;
|
|
26
|
+
this._needsRender = false;
|
|
27
|
+
this._raycaster = !!raycaster ? raycaster : new THREE.Raycaster();
|
|
28
|
+
this._scene = !!scene ? scene : new THREE.Scene();
|
|
29
|
+
|
|
30
|
+
this._objectTags = {};
|
|
31
|
+
this._retrievableObjects = [];
|
|
32
|
+
this._tags = {};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public get needsRender(): boolean {
|
|
36
|
+
return this._needsRender;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public add(tags: RenderTag<Tag>[]): void {
|
|
40
|
+
for (let tag of tags) {
|
|
41
|
+
if (tag.tag.id in this._tags) {
|
|
42
|
+
this._remove(tag.tag.id);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this._add(tag);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this._needsRender = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public addCreateTag(tag: OutlineCreateTag): void {
|
|
52
|
+
for (const object of tag.glObjects) {
|
|
53
|
+
this._scene.add(object);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this._createTag = { tag: tag, objects: tag.glObjects };
|
|
57
|
+
|
|
58
|
+
this._needsRender = true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public clear(): void {
|
|
62
|
+
for (const id of Object.keys(this._tags)) {
|
|
63
|
+
this._remove(id);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this._needsRender = false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public get(id: string): RenderTag<Tag> {
|
|
70
|
+
return this.has(id) ? this._tags[id].tag : undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public has(id: string): boolean {
|
|
74
|
+
return id in this._tags;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public hasCreateTag(): boolean {
|
|
78
|
+
return this._createTag != null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public intersectObjects([viewportX, viewportY]: number[], camera: THREE.Camera): string[] {
|
|
82
|
+
this._raycaster.setFromCamera(new THREE.Vector2(viewportX, viewportY), camera);
|
|
83
|
+
|
|
84
|
+
const intersects: THREE.Intersection[] = this._raycaster.intersectObjects(this._retrievableObjects);
|
|
85
|
+
const intersectedIds: string[] = [];
|
|
86
|
+
for (const intersect of intersects) {
|
|
87
|
+
if (intersect.object.uuid in this._objectTags) {
|
|
88
|
+
intersectedIds.push(this._objectTags[intersect.object.uuid]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return intersectedIds;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public remove(ids: string[]): void {
|
|
96
|
+
for (const id of ids) {
|
|
97
|
+
this._remove(id);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this._needsRender = true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public removeAll(): void {
|
|
104
|
+
for (const id of Object.keys(this._tags)) {
|
|
105
|
+
this._remove(id);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this._needsRender = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public removeCreateTag(): void {
|
|
112
|
+
if (this._createTag == null) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (const object of this._createTag.objects) {
|
|
117
|
+
this._scene.remove(object);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this._createTag.tag.dispose();
|
|
121
|
+
this._createTag = null;
|
|
122
|
+
|
|
123
|
+
this._needsRender = true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public render(
|
|
127
|
+
perspectiveCamera: THREE.PerspectiveCamera,
|
|
128
|
+
renderer: THREE.Renderer): void {
|
|
129
|
+
|
|
130
|
+
renderer.render(this._scene, perspectiveCamera);
|
|
131
|
+
|
|
132
|
+
this._needsRender = false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public update(): void {
|
|
136
|
+
this._needsRender = true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public updateCreateTagObjects(tag: OutlineCreateTag): void {
|
|
140
|
+
if (this._createTag.tag !== tag) {
|
|
141
|
+
throw new Error("Create tags do not have the same reference.");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
for (let object of this._createTag.objects) {
|
|
145
|
+
this._scene.remove(object);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
for (const object of tag.glObjects) {
|
|
149
|
+
this._scene.add(object);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this._createTag.objects = tag.glObjects;
|
|
153
|
+
|
|
154
|
+
this._needsRender = true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public updateObjects(tag: RenderTag<Tag>): void {
|
|
158
|
+
const id: string = tag.tag.id;
|
|
159
|
+
|
|
160
|
+
if (this._tags[id].tag !== tag) {
|
|
161
|
+
throw new Error("Tags do not have the same reference.");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const tagObjects: TagObjects = this._tags[id];
|
|
165
|
+
|
|
166
|
+
this._removeObjects(tagObjects);
|
|
167
|
+
|
|
168
|
+
delete this._tags[id];
|
|
169
|
+
|
|
170
|
+
this._add(tag);
|
|
171
|
+
this._needsRender = true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private _add(tag: RenderTag<Tag>): void {
|
|
175
|
+
const id: string = tag.tag.id;
|
|
176
|
+
const tagObjects: TagObjects = { tag: tag, objects: [], retrievableObjects: [] };
|
|
177
|
+
|
|
178
|
+
this._tags[id] = tagObjects;
|
|
179
|
+
|
|
180
|
+
for (const object of tag.getGLObjects()) {
|
|
181
|
+
tagObjects.objects.push(object);
|
|
182
|
+
this._scene.add(object);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
for (const retrievableObject of tag.getRetrievableObjects()) {
|
|
186
|
+
tagObjects.retrievableObjects.push(retrievableObject);
|
|
187
|
+
this._retrievableObjects.push(retrievableObject);
|
|
188
|
+
this._objectTags[retrievableObject.uuid] = tag.tag.id;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private _remove(id: string): void {
|
|
193
|
+
const tagObjects: TagObjects = this._tags[id];
|
|
194
|
+
|
|
195
|
+
this._removeObjects(tagObjects);
|
|
196
|
+
|
|
197
|
+
tagObjects.tag.dispose();
|
|
198
|
+
|
|
199
|
+
delete this._tags[id];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private _removeObjects(tagObjects: TagObjects): void {
|
|
203
|
+
for (const object of tagObjects.objects) {
|
|
204
|
+
this._scene.remove(object);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
for (const retrievableObject of tagObjects.retrievableObjects) {
|
|
208
|
+
const index: number = this._retrievableObjects.indexOf(retrievableObject);
|
|
209
|
+
if (index !== -1) {
|
|
210
|
+
this._retrievableObjects.splice(index, 1);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export default TagScene;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Observable, Subject } from "rxjs";
|
|
2
|
+
import { OutlineRenderTag } from "./tag/OutlineRenderTag";
|
|
3
|
+
import { OutlineTag } from "./tag/OutlineTag";
|
|
4
|
+
import { RenderTag } from "./tag/RenderTag";
|
|
5
|
+
import { SpotRenderTag } from "./tag/SpotRenderTag";
|
|
6
|
+
import { SpotTag } from "./tag/SpotTag";
|
|
7
|
+
import { Tag } from "./tag/Tag";
|
|
8
|
+
import { Transform } from "../../Geo";
|
|
9
|
+
|
|
10
|
+
export class TagSet {
|
|
11
|
+
private _active: boolean;
|
|
12
|
+
|
|
13
|
+
private _hash: { [id: string]: RenderTag<Tag> };
|
|
14
|
+
private _hashDeactivated: { [id: string]: Tag };
|
|
15
|
+
|
|
16
|
+
private _notifyChanged$: Subject<TagSet>;
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
this._active = false;
|
|
20
|
+
this._hash = {};
|
|
21
|
+
this._hashDeactivated = {};
|
|
22
|
+
this._notifyChanged$ = new Subject<TagSet>();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public get active(): boolean {
|
|
26
|
+
return this._active;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public get changed$(): Observable<TagSet> {
|
|
30
|
+
return this._notifyChanged$;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public activate(transform: Transform): void {
|
|
34
|
+
if (this._active) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const id in this._hashDeactivated) {
|
|
39
|
+
if (!this._hashDeactivated.hasOwnProperty(id)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const tag: Tag = this._hashDeactivated[id];
|
|
44
|
+
this._add(tag, transform);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this._hashDeactivated = {};
|
|
48
|
+
this._active = true;
|
|
49
|
+
|
|
50
|
+
this._notifyChanged$.next(this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public deactivate(): void {
|
|
54
|
+
if (!this._active) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const id in this._hash) {
|
|
59
|
+
if (!this._hash.hasOwnProperty(id)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this._hashDeactivated[id] = this._hash[id].tag;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this._hash = {};
|
|
67
|
+
this._active = false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public add(tags: Tag[], transform: Transform): void {
|
|
71
|
+
this._assertActivationState(true);
|
|
72
|
+
|
|
73
|
+
for (const tag of tags) {
|
|
74
|
+
this._add(tag, transform);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this._notifyChanged$.next(this);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public addDeactivated(tags: Tag[]): void {
|
|
81
|
+
this._assertActivationState(false);
|
|
82
|
+
|
|
83
|
+
for (const tag of tags) {
|
|
84
|
+
if (!(tag instanceof OutlineTag || tag instanceof SpotTag)) {
|
|
85
|
+
throw new Error("Tag type not supported");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this._hashDeactivated[tag.id] = tag;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public get(id: string): RenderTag<Tag> {
|
|
93
|
+
return this.has(id) ? this._hash[id] : undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public getAll(): RenderTag<Tag>[] {
|
|
97
|
+
const hash: { [id: string]: RenderTag<Tag> } = this._hash;
|
|
98
|
+
|
|
99
|
+
return Object.keys(hash).map((id: string): RenderTag<Tag> => {
|
|
100
|
+
return hash[id];
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public getAllDeactivated(): Tag[] {
|
|
105
|
+
const hashDeactivated: { [id: string]: Tag } = this._hashDeactivated;
|
|
106
|
+
|
|
107
|
+
return Object.keys(hashDeactivated).map((id: string): Tag => {
|
|
108
|
+
return hashDeactivated[id];
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public getDeactivated(id: string): Tag {
|
|
113
|
+
return this.hasDeactivated(id) ? this._hashDeactivated[id] : undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public has(id: string): boolean {
|
|
117
|
+
return id in this._hash;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public hasDeactivated(id: string): boolean {
|
|
121
|
+
return id in this._hashDeactivated;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public remove(ids: string[]): void {
|
|
125
|
+
this._assertActivationState(true);
|
|
126
|
+
|
|
127
|
+
const hash: { [id: string]: RenderTag<Tag> } = this._hash;
|
|
128
|
+
for (const id of ids) {
|
|
129
|
+
if (!(id in hash)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
delete hash[id];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
this._notifyChanged$.next(this);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public removeAll(): void {
|
|
140
|
+
this._assertActivationState(true);
|
|
141
|
+
|
|
142
|
+
this._hash = {};
|
|
143
|
+
|
|
144
|
+
this._notifyChanged$.next(this);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public removeAllDeactivated(): void {
|
|
148
|
+
this._assertActivationState(false);
|
|
149
|
+
|
|
150
|
+
this._hashDeactivated = {};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public removeDeactivated(ids: string[]): void {
|
|
154
|
+
this._assertActivationState(false);
|
|
155
|
+
|
|
156
|
+
const hashDeactivated: { [id: string]: Tag } = this._hashDeactivated;
|
|
157
|
+
for (const id of ids) {
|
|
158
|
+
if (!(id in hashDeactivated)) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
delete hashDeactivated[id];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private _add(tag: Tag, transform: Transform): void {
|
|
167
|
+
if (tag instanceof OutlineTag) {
|
|
168
|
+
this._hash[tag.id] = new OutlineRenderTag(
|
|
169
|
+
<OutlineTag>tag,
|
|
170
|
+
transform,
|
|
171
|
+
);
|
|
172
|
+
} else if (tag instanceof SpotTag) {
|
|
173
|
+
this._hash[tag.id] = new SpotRenderTag(<SpotTag>tag, transform);
|
|
174
|
+
} else {
|
|
175
|
+
throw new Error("Tag type not supported");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private _assertActivationState(should: boolean): void {
|
|
180
|
+
if (should !== this._active) {
|
|
181
|
+
throw new Error("Tag set not in correct state for operation.");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export default TagSet;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {BeeviewError} from "../../../Error";
|
|
2
|
+
|
|
3
|
+
export class GeometryTagError extends BeeviewError {
|
|
4
|
+
constructor (message?: string) {
|
|
5
|
+
super(message != null ? message : "The provided geometry value is incorrect");
|
|
6
|
+
|
|
7
|
+
this.name = "GeometryTagError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default BeeviewError;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {Observable, Subject} from "rxjs";
|
|
2
|
+
|
|
3
|
+
import {Transform} from "../../../Geo";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @class Geometry
|
|
7
|
+
* @abstract
|
|
8
|
+
* @classdesc Represents a geometry.
|
|
9
|
+
*/
|
|
10
|
+
export abstract class Geometry {
|
|
11
|
+
protected _notifyChanged$: Subject<Geometry>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a geometry.
|
|
15
|
+
*
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
this._notifyChanged$ = new Subject<Geometry>();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get changed observable.
|
|
24
|
+
*
|
|
25
|
+
* @description Emits the geometry itself every time the geometry
|
|
26
|
+
* has changed.
|
|
27
|
+
*
|
|
28
|
+
* @returns {Observable<Geometry>} Observable emitting the geometry instance.
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
public get changed$(): Observable<Geometry> {
|
|
32
|
+
return this._notifyChanged$;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the 2D basic coordinates for the centroid of the geometry.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Array<number>} 2D basic coordinates representing the centroid.
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
public abstract getCentroid2d(): number[];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the 3D world coordinates for the centroid of the geometry.
|
|
45
|
+
*
|
|
46
|
+
* @param {Transform} transform - The transform of the node related to the geometry.
|
|
47
|
+
* @returns {Array<number>} 3D world coordinates representing the centroid.
|
|
48
|
+
* @ignore
|
|
49
|
+
*/
|
|
50
|
+
public abstract getCentroid3d(transform: Transform): number[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Set the 2D centroid of the geometry.
|
|
54
|
+
*
|
|
55
|
+
* @param {Array<number>} value - The new value of the centroid in basic coordinates.
|
|
56
|
+
* @param {Transform} transform - The transform of the node related to the geometry.
|
|
57
|
+
* @ignore
|
|
58
|
+
*/
|
|
59
|
+
public abstract setCentroid2d(value: number[], transform: Transform): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default Geometry;
|