@aibee/owlly 1.0.25 → 1.0.29
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/lib/external/lines/line-geometry.d.ts +9 -0
- package/lib/external/lines/line-geometry.js +51 -0
- package/lib/external/lines/line-material.d.ts +10 -0
- package/lib/external/lines/line-material.js +376 -0
- package/lib/external/lines/line-segments-2.d.ts +7 -0
- package/lib/external/lines/line-segments-2.js +143 -0
- package/lib/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/external/lines/line-segments-geometry.js +140 -0
- package/lib/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/external/loaders/gltf-loader.js +2318 -0
- package/lib/external/orbit-controls.d.ts +44 -0
- package/lib/external/orbit-controls.js +745 -0
- package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/external/renderers/css-2d-renderer.js +121 -0
- package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/external/renderers/css-3d-renderer.js +138 -0
- package/lib/external/transform-controls.d.ts +106 -0
- package/lib/external/transform-controls.js +1112 -0
- package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/owlly/controller/aerial-element-controller.js +235 -0
- package/lib/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/owlly/controller/basic-controller.js +1238 -0
- package/lib/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/owlly/controller/camera-controller.js +137 -0
- package/lib/owlly/controller/controller.d.ts +61 -0
- package/lib/owlly/controller/controller.js +23 -0
- package/lib/owlly/controller/index.d.ts +2 -0
- package/lib/owlly/controller/index.js +13 -0
- package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
- package/lib/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/owlly/controller/orbit-control.js +264 -0
- package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
- package/lib/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/owlly/controller/panorama-controller.js +1943 -0
- package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/owlly/controller/panorama-transform-controller.js +136 -0
- package/lib/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/owlly/controller/plane-controller.js +173 -0
- package/lib/owlly/controller/texture-controller.d.ts +181 -0
- package/lib/owlly/controller/texture-controller.js +875 -0
- package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
- package/lib/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/owlly/controller/transform-controller.js +545 -0
- package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/owlly/element/bottom-nav-element.js +257 -0
- package/lib/owlly/element/camera.d.ts +82 -0
- package/lib/owlly/element/camera.js +283 -0
- package/lib/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/owlly/element/dom-2d-element.js +48 -0
- package/lib/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/owlly/element/dom-3d-element.js +33 -0
- package/lib/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/owlly/element/dom-label-2d.js +382 -0
- package/lib/owlly/element/element.d.ts +53 -0
- package/lib/owlly/element/element.js +75 -0
- package/lib/owlly/element/floor-model.d.ts +83 -0
- package/lib/owlly/element/floor-model.js +227 -0
- package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/owlly/element/gif-kit/Gif.js +432 -0
- package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/owlly/element/gif-kit/GifColor.js +37 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
- package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
- package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/owlly/element/gif-kit/GifImage.js +7 -0
- package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/owlly/element/gif-kit/GifParser.js +196 -0
- package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
- package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
- package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/owlly/element/gltf-mesh-element.js +136 -0
- package/lib/owlly/element/index.d.ts +20 -0
- package/lib/owlly/element/index.js +24 -0
- package/lib/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/owlly/element/map-kit/shape.js +189 -0
- package/lib/owlly/element/mesh-element.d.ts +22 -0
- package/lib/owlly/element/mesh-element.js +63 -0
- package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/owlly/element/mesh-line-2d.js +887 -0
- package/lib/owlly/element/meshline-o.d.ts +64 -0
- package/lib/owlly/element/meshline-o.js +678 -0
- package/lib/owlly/element/panorama-group.d.ts +241 -0
- package/lib/owlly/element/panorama-group.js +966 -0
- package/lib/owlly/element/panorama.d.ts +132 -0
- package/lib/owlly/element/panorama.js +812 -0
- package/lib/owlly/element/path-group.d.ts +69 -0
- package/lib/owlly/element/path-group.js +171 -0
- package/lib/owlly/element/path.d.ts +99 -0
- package/lib/owlly/element/path.js +531 -0
- package/lib/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/owlly/element/placeable-2d.js +470 -0
- package/lib/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/owlly/element/polygon-mesh.js +307 -0
- package/lib/owlly/element/ring-element.d.ts +79 -0
- package/lib/owlly/element/ring-element.js +383 -0
- package/lib/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/owlly/element/sphere-mesh.js +69 -0
- package/lib/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/owlly/element/svg-floor-model.js +184 -0
- package/lib/owlly/element/svg-floors.d.ts +27 -0
- package/lib/owlly/element/svg-floors.js +109 -0
- package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/owlly/element/tile-panorama-group.js +1006 -0
- package/lib/owlly/element/tile-panorama.d.ts +161 -0
- package/lib/owlly/element/tile-panorama.js +509 -0
- package/lib/owlly/element/tile-plane.d.ts +105 -0
- package/lib/owlly/element/tile-plane.js +360 -0
- package/lib/owlly/element/video-element.d.ts +33 -0
- package/lib/owlly/element/video-element.js +159 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
- package/lib/owlly/index.d.ts +13 -0
- package/lib/owlly/index.js +16 -0
- package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/owlly/overlay/canvas-overlay.js +510 -0
- package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/owlly/overlay/css-2d-overlay.js +35 -0
- package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/owlly/overlay/css-3d-overlay.js +36 -0
- package/lib/owlly/overlay/index.d.ts +6 -0
- package/lib/owlly/overlay/index.js +11 -0
- package/lib/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/owlly/overlay/label-overlay.js +328 -0
- package/lib/owlly/overlay/overlay.d.ts +14 -0
- package/lib/owlly/overlay/overlay.js +4 -0
- package/lib/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/owlly/overlay/path-overlay.js +124 -0
- package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/owlly/overlay/path-overlay2.js +118 -0
- package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
- package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/owlly/overlay/poi-overlay.js +1411 -0
- package/lib/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/owlly/owlly-2d/index.js +92 -0
- package/lib/owlly/screen/index.d.ts +1 -0
- package/lib/owlly/screen/index.js +1 -0
- package/lib/owlly/screen/screen.d.ts +73 -0
- package/lib/owlly/screen/screen.js +236 -0
- package/lib/owlly/stage/externals.d.ts +19 -0
- package/lib/owlly/stage/externals.js +24 -0
- package/lib/owlly/stage/index.d.ts +4 -0
- package/lib/owlly/stage/index.js +6 -0
- package/lib/owlly/stage/owlly.d.ts +38 -0
- package/lib/owlly/stage/owlly.js +168 -0
- package/lib/owlly/stage/stage.d.ts +108 -0
- package/lib/owlly/stage/stage.js +234 -0
- package/lib/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/owlly/utils/alignment-utils.js +63 -0
- package/lib/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/owlly/utils/basic-calc.js +129 -0
- package/lib/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/owlly/utils/basic-tools.js +235 -0
- package/lib/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/owlly/utils/bvh-tree.js +539 -0
- package/lib/owlly/utils/camera.d.ts +37 -0
- package/lib/owlly/utils/camera.js +50 -0
- package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/owlly/utils/cube-texture-cache.js +143 -0
- package/lib/owlly/utils/device-utils.d.ts +18 -0
- package/lib/owlly/utils/device-utils.js +41 -0
- package/lib/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/owlly/utils/environment-utils.js +73 -0
- package/lib/owlly/utils/event-hub.d.ts +50 -0
- package/lib/owlly/utils/event-hub.js +106 -0
- package/lib/owlly/utils/events.d.ts +219 -0
- package/lib/owlly/utils/events.js +219 -0
- package/lib/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/owlly/utils/geometry-utils.js +622 -0
- package/lib/owlly/utils/helper.d.ts +6 -0
- package/lib/owlly/utils/helper.js +24 -0
- package/lib/owlly/utils/index.d.ts +14 -0
- package/lib/owlly/utils/index.js +17 -0
- package/lib/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/owlly/utils/lru-cache.js +109 -0
- package/lib/owlly/utils/map-utils.d.ts +7 -0
- package/lib/owlly/utils/map-utils.js +52 -0
- package/lib/owlly/utils/number-utils.d.ts +8 -0
- package/lib/owlly/utils/number-utils.js +72 -0
- package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/owlly/utils/panorama-model-util.js +245 -0
- package/lib/owlly/utils/path-utils.d.ts +80 -0
- package/lib/owlly/utils/path-utils.js +728 -0
- package/lib/owlly/utils/svgutils.d.ts +138 -0
- package/lib/owlly/utils/svgutils.js +561 -0
- package/lib/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/owlly/utils/texture-cache.js +115 -0
- package/lib/owlly/utils/tile-util.d.ts +187 -0
- package/lib/owlly/utils/tile-util.js +456 -0
- package/lib/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/owlly/utils/time-profiler.js +48 -0
- package/lib/owlly/view/camera-view.d.ts +35 -0
- package/lib/owlly/view/camera-view.js +101 -0
- package/lib/owlly/view/index.d.ts +3 -0
- package/lib/owlly/view/index.js +5 -0
- package/lib/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/owlly/view/orthographic-view.js +94 -0
- package/lib/owlly/view/perspective-view.d.ts +40 -0
- package/lib/owlly/view/perspective-view.js +95 -0
- package/lib/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/owlly/view/svg-map-view.js +144 -0
- package/lib/owlly/view/view.d.ts +146 -0
- package/lib/owlly/view/view.js +317 -0
- package/lib/prod/owlly.esm.js +93462 -0
- package/lib/prod/owlly.esm.js.map +1 -0
- package/lib/prod/owlly.esm.min.js +54 -0
- package/lib/prod/owlly.iife.js +93560 -0
- package/lib/prod/owlly.iife.js.map +1 -0
- package/lib/prod/owlly.iife.min.js +69 -0
- package/lib/prod/owlly.miniapp.js +73845 -0
- package/lib/prod/owlly.miniapp.js.map +1 -0
- package/lib/prod/owlly.miniapp.min.js +63 -0
- package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
- package/lib/prod/src/external/lines/line-material.d.ts +10 -0
- package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
- package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/prod/src/external/orbit-controls.d.ts +44 -0
- package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/prod/src/external/transform-controls.d.ts +106 -0
- package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
- package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
- package/lib/prod/src/owlly/controller/index.d.ts +2 -0
- package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
- package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/prod/src/owlly/element/camera.d.ts +82 -0
- package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/prod/src/owlly/element/element.d.ts +53 -0
- package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
- package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/prod/src/owlly/element/index.d.ts +6 -0
- package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
- package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
- package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
- package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
- package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
- package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
- package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
- package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
- package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
- package/lib/prod/src/owlly/element/path.d.ts +99 -0
- package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
- package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
- package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
- package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
- package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
- package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/prod/src/owlly/index.d.ts +13 -0
- package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
- package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/prod/src/owlly/screen/index.d.ts +1 -0
- package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
- package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
- package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
- package/lib/prod/src/owlly/stage/index.d.ts +3 -0
- package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
- package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
- package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
- package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
- package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
- package/lib/prod/src/owlly/utils/events.d.ts +219 -0
- package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
- package/lib/prod/src/owlly/utils/index.d.ts +13 -0
- package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
- package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
- package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
- package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
- package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
- package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
- package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
- package/lib/prod/src/owlly/view/index.d.ts +3 -0
- package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/prod/src/owlly/view/view.d.ts +146 -0
- package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
- package/lib/src/owlly/controller/texture-controller.js +16 -1
- package/lib/src/owlly/controller/texture-controller.js.map +1 -1
- package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
- package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
- package/lib/src/owlly/element/tile-panorama.js +16 -3
- package/lib/src/owlly/element/tile-panorama.js.map +1 -1
- package/lib/src/owlly/element/tile-plane.d.ts +9 -0
- package/lib/src/owlly/element/tile-plane.js +27 -0
- package/lib/src/owlly/element/tile-plane.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
- package/lib/src/owlly/stage/owlly.js +7 -1
- package/lib/src/owlly/stage/owlly.js.map +1 -1
- package/lib/src/owlly/stage/stage.js +2 -0
- package/lib/src/owlly/stage/stage.js.map +1 -1
- package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
- package/package.json +16 -7
- package/src/owlly/controller/texture-controller.ts +18 -1
- package/src/owlly/controller/tile-panorama-controller.ts +3 -1
- package/src/owlly/element/tile-panorama.ts +14 -0
- package/src/owlly/element/tile-plane.ts +26 -0
- package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
- package/src/owlly/overlay/poi-overlay.ts +0 -4
- package/src/owlly/stage/owlly.ts +6 -1
- package/src/owlly/stage/stage.ts +2 -0
- package/src/web/main.rpeng.mes.plane.ts +0 -6
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import Snap from '@aibee/snapsvg';
|
|
2
|
+
import { NS_THREE } from '../stage/externals';
|
|
3
|
+
import { Shape } from '../element/map-kit/shape';
|
|
4
|
+
interface ModelSvgMapping {
|
|
5
|
+
scale: number;
|
|
6
|
+
theta: number;
|
|
7
|
+
offsetRatioX: number;
|
|
8
|
+
offsetRatioY: number;
|
|
9
|
+
imageHeight?: number;
|
|
10
|
+
imageWidth?: number;
|
|
11
|
+
}
|
|
12
|
+
declare type ArrayFixed<T, L extends number> = [T, ...Array<T>] & {
|
|
13
|
+
length: L;
|
|
14
|
+
};
|
|
15
|
+
/** @ignore */
|
|
16
|
+
interface SvgNode {
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
value: string;
|
|
20
|
+
attributes: any;
|
|
21
|
+
children: SvgNode[];
|
|
22
|
+
}
|
|
23
|
+
/** @ignore */
|
|
24
|
+
interface Command {
|
|
25
|
+
command: CommandChar;
|
|
26
|
+
args: number[];
|
|
27
|
+
}
|
|
28
|
+
/** @ignore */
|
|
29
|
+
interface CanvasNode {
|
|
30
|
+
id?: string;
|
|
31
|
+
children: CanvasNode[];
|
|
32
|
+
commands: Command[];
|
|
33
|
+
fill?: string;
|
|
34
|
+
fillRule?: string;
|
|
35
|
+
tag?: string;
|
|
36
|
+
}
|
|
37
|
+
/** @ignore */
|
|
38
|
+
interface SvgTransComps {
|
|
39
|
+
position: NS_THREE.Vector3;
|
|
40
|
+
scale: NS_THREE.Vector3;
|
|
41
|
+
quaternion: NS_THREE.Quaternion;
|
|
42
|
+
}
|
|
43
|
+
/** @ignore */
|
|
44
|
+
declare type CommandChar = 'C' | 'M' | 'L' | 'Z';
|
|
45
|
+
declare class SvgUtils {
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated
|
|
48
|
+
* 将SVG文件解析为Owlly map-kit可用的格式
|
|
49
|
+
* @param url svg地址
|
|
50
|
+
* @param alignMatrix 对齐数组
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* // 将svg解析为Shape对象数组
|
|
54
|
+
* const shapes = await SvgUtils.parseSVG(
|
|
55
|
+
* <svg url>,
|
|
56
|
+
* [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
static parseSVG(url: string, alignMatrix: ArrayFixed<number, 16>): Promise<Shape[]>;
|
|
61
|
+
static parseSVGString(svgStr: string, alignMatrix: ArrayFixed<number, 16>): Promise<Shape[]>;
|
|
62
|
+
/** @ignore */
|
|
63
|
+
static getShapesFromCanvasNode(canvasNode: CanvasNode): Shape[];
|
|
64
|
+
/** @ignore */
|
|
65
|
+
static planCoordinateToWorldCoordinate(planX: number, planY: number, mapping: ModelSvgMapping): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
/** @ignore */
|
|
70
|
+
static getPathCommands(path: string, translate: number[], mapping: ModelSvgMapping): Command[];
|
|
71
|
+
/** @ignore */
|
|
72
|
+
static svgNode2Canvas(node: SvgNode, mapping: ModelSvgMapping, isRoot?: boolean, fill?: string | null, fillRule?: string | null, translate?: number[], tag?: string | null): CanvasNode | null;
|
|
73
|
+
/** @ignore */
|
|
74
|
+
static svg2canvas(svg: SvgNode, mapping: ModelSvgMapping): CanvasNode | null;
|
|
75
|
+
/** @ignore */
|
|
76
|
+
static getPathCommandsWithAlignment(path: string, translate: number[], alignMatrix: ArrayFixed<number, 16>): Command[];
|
|
77
|
+
static get3DPositionsFrom2D([x, y]: [number, number], m: ArrayFixed<number, 16>): {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* 获取对齐矩阵指向北方转动的弧度
|
|
83
|
+
* @param m 对齐矩阵
|
|
84
|
+
*/
|
|
85
|
+
static getRotateRadiusToNorth(m: ArrayFixed<number, 16>): number;
|
|
86
|
+
/** @ignore */
|
|
87
|
+
private static generateCanvasNodeFromSvg;
|
|
88
|
+
/** @ignore */
|
|
89
|
+
static getCanvasNodeFromSvg(svg: SvgNode, alignMatrix: ArrayFixed<number, 16>): CanvasNode | null;
|
|
90
|
+
/** @ignore */
|
|
91
|
+
static generateNewShape(path: string, id: string, options?: {
|
|
92
|
+
tag?: string;
|
|
93
|
+
fill?: string;
|
|
94
|
+
ownTag?: string;
|
|
95
|
+
}): Shape;
|
|
96
|
+
/** @ignore */
|
|
97
|
+
static parseRectElementToShape(node: Snap.Element, alignMatrix: ArrayFixed<number, 16>, { tag, fill, ownTag }: {
|
|
98
|
+
tag?: string;
|
|
99
|
+
fill?: string;
|
|
100
|
+
ownTag?: string;
|
|
101
|
+
}): Shape;
|
|
102
|
+
/** @ignore */
|
|
103
|
+
static parsePolygonElementToShape(node: Snap.Element, alignMatrix: ArrayFixed<number, 16>, { tag, fill, ownTag }: {
|
|
104
|
+
tag?: string;
|
|
105
|
+
fill?: string;
|
|
106
|
+
ownTag?: string;
|
|
107
|
+
}): Shape;
|
|
108
|
+
/** @ignore */
|
|
109
|
+
static parsePathElementToShape(node: Snap.Element, alignMatrix: ArrayFixed<number, 16>, { tag, fill, ownTag }: {
|
|
110
|
+
tag?: string;
|
|
111
|
+
fill?: string;
|
|
112
|
+
ownTag?: string;
|
|
113
|
+
}): Shape;
|
|
114
|
+
/** @ignore */
|
|
115
|
+
static parseSnapSvgToShapes(node: Snap.Element, alignMatrix: ArrayFixed<number, 16>, options?: {
|
|
116
|
+
tag?: string;
|
|
117
|
+
fill?: string;
|
|
118
|
+
}): Shape[];
|
|
119
|
+
/** @ignore */
|
|
120
|
+
static getCompsFromMat4(mat: ArrayFixed<number, 16>): SvgTransComps;
|
|
121
|
+
/**
|
|
122
|
+
* 将svg解析为Shape对象数组
|
|
123
|
+
* @param url SVG文件url
|
|
124
|
+
* @param alignMatrix 对齐矩阵数组
|
|
125
|
+
* @param coefficient shape高度调整系数
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* // 将svg解析为Shape对象数组
|
|
129
|
+
* const shapes = await SvgUtils.parseSvgToShapes(
|
|
130
|
+
* <svg url>,
|
|
131
|
+
* [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
static parseSvgToShapes(url: string, alignMatrix: ArrayFixed<number, 16>, coefficient?: number): Promise<Shape[]>;
|
|
136
|
+
static calcHeightFromMat(height: number, alignMatrix: ArrayFixed<number, 16>): number;
|
|
137
|
+
}
|
|
138
|
+
export { CanvasNode, SvgNode, SvgUtils, ModelSvgMapping, };
|
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
|
+
import { parse } from 'svgson';
|
|
12
|
+
import { vec4, mat4 } from 'gl-matrix';
|
|
13
|
+
import Snap from '@aibee/snapsvg';
|
|
14
|
+
import { Externals } from '../stage/externals';
|
|
15
|
+
import { Shape } from '../element/map-kit/shape';
|
|
16
|
+
/** 图形标记 */
|
|
17
|
+
class GraphicTag {
|
|
18
|
+
}
|
|
19
|
+
/** 地面 */
|
|
20
|
+
GraphicTag.Ground = 'ground';
|
|
21
|
+
/** 区域 */
|
|
22
|
+
GraphicTag.Area = 'area';
|
|
23
|
+
/** 店铺 */
|
|
24
|
+
GraphicTag.Store = 'store';
|
|
25
|
+
/** 不可逾越 */
|
|
26
|
+
GraphicTag.Impassable = 'impassable';
|
|
27
|
+
/** 停车位 */
|
|
28
|
+
GraphicTag.ParkingSpace = 'parking-space';
|
|
29
|
+
class SvgUtils {
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated
|
|
32
|
+
* 将SVG文件解析为Owlly map-kit可用的格式
|
|
33
|
+
* @param url svg地址
|
|
34
|
+
* @param alignMatrix 对齐数组
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // 将svg解析为Shape对象数组
|
|
38
|
+
* const shapes = await SvgUtils.parseSVG(
|
|
39
|
+
* <svg url>,
|
|
40
|
+
* [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
static parseSVG(url, alignMatrix) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const { THREE } = Externals.getInstance();
|
|
47
|
+
const svg = yield new Promise((resolve) => {
|
|
48
|
+
const fileLoader = new THREE.FileLoader();
|
|
49
|
+
fileLoader.load(url, (data) => {
|
|
50
|
+
resolve(data);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
// const svgNode = await parse(svg) as SvgNode;
|
|
54
|
+
// const canvasNode = this.getCanvasNodeFromSvg(svgNode, alignMatrix);
|
|
55
|
+
// if (!canvasNode) return [];
|
|
56
|
+
// return SvgUtils.getShapesFromCanvasNode(canvasNode);
|
|
57
|
+
return this.parseSVGString(svg, alignMatrix);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static parseSVGString(svgStr, alignMatrix) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const svgNode = yield parse(svgStr);
|
|
63
|
+
const canvasNode = this.getCanvasNodeFromSvg(svgNode, alignMatrix);
|
|
64
|
+
if (!canvasNode)
|
|
65
|
+
return [];
|
|
66
|
+
return SvgUtils.getShapesFromCanvasNode(canvasNode);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** @ignore */
|
|
70
|
+
static getShapesFromCanvasNode(canvasNode) {
|
|
71
|
+
const result = [];
|
|
72
|
+
if (canvasNode.children.length) {
|
|
73
|
+
const nodesList = canvasNode.children.map((child) => SvgUtils.getShapesFromCanvasNode(child));
|
|
74
|
+
nodesList.forEach((nodes) => {
|
|
75
|
+
nodes.forEach((n) => { result.push(n); });
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (canvasNode.commands.length) {
|
|
79
|
+
const pathSteps = [];
|
|
80
|
+
canvasNode.commands.forEach((command) => {
|
|
81
|
+
pathSteps.push(`${command.command.toLowerCase()}${command.args.join(',')}`);
|
|
82
|
+
});
|
|
83
|
+
let height = 2;
|
|
84
|
+
let zIndex = 0.01;
|
|
85
|
+
let fillOpacity = 0.9;
|
|
86
|
+
if (canvasNode.tag) {
|
|
87
|
+
if (canvasNode.tag.indexOf(GraphicTag.Ground) > -1) {
|
|
88
|
+
height = 0.00;
|
|
89
|
+
zIndex = 0;
|
|
90
|
+
fillOpacity = 1;
|
|
91
|
+
}
|
|
92
|
+
if (canvasNode.tag.indexOf(GraphicTag.Area) > -1) {
|
|
93
|
+
height = 0.00;
|
|
94
|
+
zIndex = 0.01;
|
|
95
|
+
fillOpacity = 1;
|
|
96
|
+
}
|
|
97
|
+
if (canvasNode.tag.indexOf(GraphicTag.ParkingSpace) > -1) {
|
|
98
|
+
height = 0.00;
|
|
99
|
+
zIndex = 0.02;
|
|
100
|
+
fillOpacity = 1;
|
|
101
|
+
}
|
|
102
|
+
if (canvasNode.tag.indexOf(GraphicTag.Store) > -1) {
|
|
103
|
+
height = 1.8;
|
|
104
|
+
zIndex = 0.03;
|
|
105
|
+
fillOpacity = 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const data = {
|
|
109
|
+
path: pathSteps.join(''),
|
|
110
|
+
shapeType: 'shape',
|
|
111
|
+
fill: canvasNode.fill,
|
|
112
|
+
fillOpacity,
|
|
113
|
+
strokeOpacity: 0.2,
|
|
114
|
+
height,
|
|
115
|
+
zIndex,
|
|
116
|
+
tag: canvasNode.tag,
|
|
117
|
+
parentName: canvasNode.tag,
|
|
118
|
+
};
|
|
119
|
+
if (canvasNode.id) {
|
|
120
|
+
data.tag = canvasNode.id;
|
|
121
|
+
data.id = canvasNode.id;
|
|
122
|
+
}
|
|
123
|
+
const shape = new Shape(data);
|
|
124
|
+
result.push(shape);
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
/** @ignore */
|
|
129
|
+
static planCoordinateToWorldCoordinate(planX, planY, mapping) {
|
|
130
|
+
const imageWidth = mapping.imageWidth || 4000;
|
|
131
|
+
const imageHeight = mapping.imageHeight || 4000;
|
|
132
|
+
const ratio = imageWidth / 4000;
|
|
133
|
+
const yOffset = (imageWidth - imageHeight) / 2;
|
|
134
|
+
const s = mapping.scale * (4000 / 1000);
|
|
135
|
+
const t = mapping.theta * (Math.PI / 180);
|
|
136
|
+
const w = 4000;
|
|
137
|
+
const h = 4000;
|
|
138
|
+
const x = (planX / ratio - w * mapping.offsetRatioX) / s;
|
|
139
|
+
const y = ((planY + yOffset) / ratio - h * mapping.offsetRatioY) / s;
|
|
140
|
+
const worldX = x * Math.cos(t) + y * Math.sin(t);
|
|
141
|
+
const worldY = x * Math.sin(t) - y * Math.cos(t);
|
|
142
|
+
return { x: worldX, y: worldY };
|
|
143
|
+
}
|
|
144
|
+
// TODO(jyfang): set scale, theta, etc. externally
|
|
145
|
+
/** @ignore */
|
|
146
|
+
static getPathCommands(path, translate, mapping) {
|
|
147
|
+
const commands = [];
|
|
148
|
+
// eslint-disable-next-line max-len
|
|
149
|
+
const regexp = /((?:(?:M|L)(?:(?:[0-9]|[.eE]|-)+,(?:[0-9]|[.-eE]|-)+))|(?:C(?:(?:[0-9]|[.-eE]|-)+,(?:[0-9]|[.-eE]|-)+\s){2}(?:(?:[0-9]|[.-eE]|-)+,(?:[0-9]|[.-eE]|-)+))|(?:Z|z))/gm;
|
|
150
|
+
const matches = path.match(regexp);
|
|
151
|
+
if (matches !== null) {
|
|
152
|
+
matches.forEach((step) => {
|
|
153
|
+
const positions = [];
|
|
154
|
+
const commandChar = step[0];
|
|
155
|
+
step.substring(1).split(' ').forEach((pos) => {
|
|
156
|
+
positions.push(pos.split(',').map((v) => parseFloat(v)));
|
|
157
|
+
});
|
|
158
|
+
const worldPositions = [];
|
|
159
|
+
positions.forEach((position) => {
|
|
160
|
+
if (position.length < 2)
|
|
161
|
+
return;
|
|
162
|
+
const [planX, planY] = position;
|
|
163
|
+
const { x, y } = SvgUtils.planCoordinateToWorldCoordinate(translate[0] + planX, translate[1] + planY, mapping);
|
|
164
|
+
worldPositions.push(x);
|
|
165
|
+
worldPositions.push(y);
|
|
166
|
+
});
|
|
167
|
+
if (commandChar !== 'Z') {
|
|
168
|
+
commands.push({
|
|
169
|
+
command: commandChar,
|
|
170
|
+
args: worldPositions,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return commands;
|
|
176
|
+
}
|
|
177
|
+
/** @ignore */
|
|
178
|
+
static svgNode2Canvas(node, mapping, isRoot = false, fill = null, fillRule = null, translate = [0, 0], tag = null) {
|
|
179
|
+
const nodeTag = node.name === 'g' ? node.attributes.name || node.attributes.id || tag : tag;
|
|
180
|
+
const canvasNode = { children: [], commands: [], tag: nodeTag };
|
|
181
|
+
if (node.children && node.children.length) {
|
|
182
|
+
const nodeFill = node.attributes.fill || fill;
|
|
183
|
+
const nodeFillRule = node.attributes['fill-rule'] || fillRule;
|
|
184
|
+
const nodeTranslate = translate.slice();
|
|
185
|
+
if (node.attributes.transform) {
|
|
186
|
+
const regexp = /(?:translate\(((?:[0-9]|[.-eE]|-)+),\s((?:[0-9]|[.-eE]|-)+)\))/g;
|
|
187
|
+
const matches = regexp.exec(node.attributes.transform);
|
|
188
|
+
if (matches && matches.length > 2) {
|
|
189
|
+
nodeTranslate[0] += parseFloat(matches[1]);
|
|
190
|
+
nodeTranslate[1] += parseFloat(matches[2]);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
node.children.forEach((c) => {
|
|
194
|
+
if (isRoot && c.name !== 'g')
|
|
195
|
+
return;
|
|
196
|
+
const childNode = SvgUtils.svgNode2Canvas(c, mapping, false, nodeFill, nodeFillRule, nodeTranslate, nodeTag);
|
|
197
|
+
if (childNode)
|
|
198
|
+
canvasNode.children.push(childNode);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (node.name === 'path') {
|
|
202
|
+
// generate path commands
|
|
203
|
+
const path = node.attributes.d;
|
|
204
|
+
canvasNode.commands = SvgUtils.getPathCommands(path, translate, mapping);
|
|
205
|
+
canvasNode.fill = node.attributes.fill || fill;
|
|
206
|
+
canvasNode.fillRule = node.attributes['fill-rule'] || fillRule || 'nonzero';
|
|
207
|
+
}
|
|
208
|
+
if (node.name === 'polygon') {
|
|
209
|
+
// generate polygon commands
|
|
210
|
+
const flatPoints = node.attributes.points.split(' ');
|
|
211
|
+
for (let i = 0; i < flatPoints.length; i += 2) {
|
|
212
|
+
const { x, y } = SvgUtils.planCoordinateToWorldCoordinate(translate[0] + parseFloat(flatPoints[i]), translate[1] + parseFloat(flatPoints[i + 1]), mapping);
|
|
213
|
+
if (i === 0) {
|
|
214
|
+
canvasNode.commands.push({
|
|
215
|
+
command: 'M',
|
|
216
|
+
args: [x, y],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
canvasNode.commands.push({
|
|
221
|
+
command: 'L',
|
|
222
|
+
args: [x, y],
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
canvasNode.fill = node.attributes.fill || fill;
|
|
227
|
+
canvasNode.fillRule = node.attributes['fill-rule'] || fillRule || 'nonzero';
|
|
228
|
+
}
|
|
229
|
+
return canvasNode;
|
|
230
|
+
}
|
|
231
|
+
/** @ignore */
|
|
232
|
+
static svg2canvas(svg, mapping) {
|
|
233
|
+
return SvgUtils.svgNode2Canvas(svg, mapping, true);
|
|
234
|
+
}
|
|
235
|
+
/** @ignore */
|
|
236
|
+
static getPathCommandsWithAlignment(path, translate, alignMatrix) {
|
|
237
|
+
const commands = [];
|
|
238
|
+
// eslint-disable-next-line max-len
|
|
239
|
+
// const regexp = /((?:(?:M|L)(?:(?:[0-9]|[.eE]|-)+,(?:[0-9]|[.-eE]|-)+))|(?:C(?:(?:[0-9]|[.-eE]|-)+,(?:[0-9]|[.-eE]|-)+\s){2}(?:(?:[0-9]|[.-eE]|-)+,(?:[0-9]|[.-eE]|-)+))|(?:Z|z))/gm;
|
|
240
|
+
const regexp = /[a-z]|[A-Z](\S*)/gm;
|
|
241
|
+
const matches = path.match(regexp);
|
|
242
|
+
if (matches !== null) {
|
|
243
|
+
matches.forEach((step) => {
|
|
244
|
+
const positions = [];
|
|
245
|
+
const commandChar = step[0];
|
|
246
|
+
step.substring(1).split(' ').forEach((pos) => {
|
|
247
|
+
positions.push(pos.split(',').map((v) => parseFloat(v)));
|
|
248
|
+
});
|
|
249
|
+
const worldPositions = [];
|
|
250
|
+
const list = [];
|
|
251
|
+
positions.forEach((position) => {
|
|
252
|
+
if (position.length < 2)
|
|
253
|
+
return;
|
|
254
|
+
for (let i = 0; i < position.length;) {
|
|
255
|
+
const a = position.slice(i, i += 2);
|
|
256
|
+
list.push(a);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
list.forEach((e) => {
|
|
260
|
+
const [planX, planY] = e;
|
|
261
|
+
const { x, y } = SvgUtils.get3DPositionsFrom2D([translate[0] + planX, translate[1] + planY], alignMatrix);
|
|
262
|
+
worldPositions.push(x);
|
|
263
|
+
worldPositions.push(y);
|
|
264
|
+
});
|
|
265
|
+
if (commandChar !== 'Z') {
|
|
266
|
+
commands.push({
|
|
267
|
+
command: commandChar,
|
|
268
|
+
args: worldPositions,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return commands;
|
|
274
|
+
}
|
|
275
|
+
static get3DPositionsFrom2D([x, y], m) {
|
|
276
|
+
const alignMat = mat4.fromValues(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]);
|
|
277
|
+
const v = vec4.create();
|
|
278
|
+
vec4.set(v, x, y, 0, 1);
|
|
279
|
+
const result = vec4.create();
|
|
280
|
+
vec4.transformMat4(result, v, alignMat);
|
|
281
|
+
return { x: result[0], y: result[1] };
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* 获取对齐矩阵指向北方转动的弧度
|
|
285
|
+
* @param m 对齐矩阵
|
|
286
|
+
*/
|
|
287
|
+
static getRotateRadiusToNorth(m) {
|
|
288
|
+
const { THREE } = Externals.getInstance();
|
|
289
|
+
const position = new THREE.Vector3();
|
|
290
|
+
const scale = new THREE.Vector3();
|
|
291
|
+
const quaternion = new THREE.Quaternion();
|
|
292
|
+
new THREE.Matrix4().fromArray(m).decompose(position, quaternion, scale);
|
|
293
|
+
const targetAngle = new THREE.Euler().setFromQuaternion(quaternion).z;
|
|
294
|
+
return -targetAngle;
|
|
295
|
+
}
|
|
296
|
+
/** @ignore */
|
|
297
|
+
static generateCanvasNodeFromSvg(node, alignMatrix, isRoot = false, fill = null, fillRule = null, translate = [0, 0], tag = null) {
|
|
298
|
+
const nodeTag = node.name === 'g' ? node.attributes.name || node.attributes.id || tag : tag;
|
|
299
|
+
const canvasNode = {
|
|
300
|
+
children: [], commands: [], tag: nodeTag, id: node.attributes.id,
|
|
301
|
+
};
|
|
302
|
+
if (node.children && node.children.length) {
|
|
303
|
+
const nodeFill = node.attributes.fill || fill;
|
|
304
|
+
const nodeFillRule = node.attributes['fill-rule'] || fillRule;
|
|
305
|
+
const nodeTranslate = translate.slice();
|
|
306
|
+
if (node.attributes.transform) {
|
|
307
|
+
const regexp = /(?:translate\(((?:[0-9]|[.-eE]|-)+),\s((?:[0-9]|[.-eE]|-)+)\))/g;
|
|
308
|
+
const matches = regexp.exec(node.attributes.transform);
|
|
309
|
+
if (matches && matches.length > 2) {
|
|
310
|
+
nodeTranslate[0] += parseFloat(matches[1]);
|
|
311
|
+
nodeTranslate[1] += parseFloat(matches[2]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
node.children.forEach((c) => {
|
|
315
|
+
if (isRoot && c.name !== 'g')
|
|
316
|
+
return;
|
|
317
|
+
const childNode = SvgUtils.generateCanvasNodeFromSvg(c, alignMatrix, false, nodeFill, nodeFillRule, nodeTranslate, nodeTag);
|
|
318
|
+
if (childNode)
|
|
319
|
+
canvasNode.children.push(childNode);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (node.name === 'path') {
|
|
323
|
+
// generate path commands
|
|
324
|
+
const path = node.attributes.d;
|
|
325
|
+
canvasNode.commands = SvgUtils.getPathCommandsWithAlignment(path, translate, alignMatrix);
|
|
326
|
+
canvasNode.fill = node.attributes.fill || fill;
|
|
327
|
+
canvasNode.fillRule = node.attributes['fill-rule'] || fillRule || 'nonzero';
|
|
328
|
+
}
|
|
329
|
+
if (node.name === 'polygon') {
|
|
330
|
+
// generate polygon commands
|
|
331
|
+
const flatPoints = node.attributes.points.split(' ');
|
|
332
|
+
for (let i = 0; i < flatPoints.length; i += 2) {
|
|
333
|
+
const { x, y } = SvgUtils.get3DPositionsFrom2D([
|
|
334
|
+
translate[0] + parseFloat(flatPoints[i]),
|
|
335
|
+
translate[1] + parseFloat(flatPoints[i + 1]),
|
|
336
|
+
], alignMatrix);
|
|
337
|
+
if (i === 0) {
|
|
338
|
+
canvasNode.commands.push({
|
|
339
|
+
command: 'M',
|
|
340
|
+
args: [x, y],
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
canvasNode.commands.push({
|
|
345
|
+
command: 'L',
|
|
346
|
+
args: [x, y],
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
canvasNode.fill = node.attributes.fill || fill;
|
|
351
|
+
canvasNode.fillRule = node.attributes['fill-rule'] || fillRule || 'nonzero';
|
|
352
|
+
}
|
|
353
|
+
return canvasNode;
|
|
354
|
+
}
|
|
355
|
+
/** @ignore */
|
|
356
|
+
static getCanvasNodeFromSvg(svg, alignMatrix) {
|
|
357
|
+
return SvgUtils.generateCanvasNodeFromSvg(svg, alignMatrix, true);
|
|
358
|
+
}
|
|
359
|
+
/** @ignore */
|
|
360
|
+
static generateNewShape(path, id, options) {
|
|
361
|
+
const { tag, fill, ownTag } = options || {};
|
|
362
|
+
let height = 2;
|
|
363
|
+
let zIndex = 0.01;
|
|
364
|
+
let fillOpacity = 0.9;
|
|
365
|
+
if (tag === GraphicTag.Ground) {
|
|
366
|
+
height = 0.00;
|
|
367
|
+
zIndex = 0;
|
|
368
|
+
fillOpacity = 1;
|
|
369
|
+
}
|
|
370
|
+
if (tag === GraphicTag.Area) {
|
|
371
|
+
height = 0.00;
|
|
372
|
+
zIndex = 0.01;
|
|
373
|
+
fillOpacity = 1;
|
|
374
|
+
}
|
|
375
|
+
if (tag === GraphicTag.ParkingSpace) {
|
|
376
|
+
height = 0.00;
|
|
377
|
+
zIndex = 0.02;
|
|
378
|
+
fillOpacity = 1;
|
|
379
|
+
}
|
|
380
|
+
if (tag === GraphicTag.Store) {
|
|
381
|
+
height = 1.8;
|
|
382
|
+
zIndex = 0.03;
|
|
383
|
+
fillOpacity = 1;
|
|
384
|
+
}
|
|
385
|
+
return new Shape({
|
|
386
|
+
id,
|
|
387
|
+
path,
|
|
388
|
+
shapeType: 'shape',
|
|
389
|
+
fill,
|
|
390
|
+
fillOpacity,
|
|
391
|
+
strokeOpacity: 0.2,
|
|
392
|
+
height,
|
|
393
|
+
zIndex,
|
|
394
|
+
tag: ownTag || tag,
|
|
395
|
+
parentName: tag,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/** @ignore */
|
|
399
|
+
static parseRectElementToShape(node, alignMatrix, { tag, fill, ownTag }) {
|
|
400
|
+
const { x: xString, y: yString, width: widthString, height: heightString, id, } = node.attr();
|
|
401
|
+
const [x, y, width, height] = [xString, yString, widthString, heightString].map(parseFloat);
|
|
402
|
+
const alignedPathCommands = [];
|
|
403
|
+
const matrix = node.transform().totalMatrix;
|
|
404
|
+
const pointList = [x, y, x + width, y, x + width, y + height, x, y + height, x, y];
|
|
405
|
+
for (let i = 0; i < pointList.length; i += 2) {
|
|
406
|
+
const step = [];
|
|
407
|
+
step.push(i > 0 ? 'L' : 'M');
|
|
408
|
+
const localX = pointList[i];
|
|
409
|
+
const localY = pointList[i + 1];
|
|
410
|
+
const worldX = matrix.x(localX, localY);
|
|
411
|
+
const worldY = matrix.y(localX, localY);
|
|
412
|
+
const { x: xPos, y: yPos } = this.get3DPositionsFrom2D([worldX, worldY], alignMatrix);
|
|
413
|
+
step.push(xPos, yPos);
|
|
414
|
+
alignedPathCommands.push(step);
|
|
415
|
+
}
|
|
416
|
+
return this.generateNewShape(alignedPathCommands.map(([command, ...coords]) => (`${command}${coords.join(',')}`)).join(''), id, { tag, fill, ownTag });
|
|
417
|
+
}
|
|
418
|
+
/** @ignore */
|
|
419
|
+
static parsePolygonElementToShape(node, alignMatrix, { tag, fill, ownTag }) {
|
|
420
|
+
const { points, id } = node.attr();
|
|
421
|
+
const pointList = points.split(' ').map(parseFloat);
|
|
422
|
+
const alignedPathCommands = [];
|
|
423
|
+
const matrix = node.transform().totalMatrix;
|
|
424
|
+
for (let i = 0; i < pointList.length; i += 2) {
|
|
425
|
+
const step = [];
|
|
426
|
+
step.push(i > 0 ? 'L' : 'M');
|
|
427
|
+
const localX = pointList[i];
|
|
428
|
+
const localY = pointList[i + 1];
|
|
429
|
+
const worldX = matrix.x(localX, localY);
|
|
430
|
+
const worldY = matrix.y(localX, localY);
|
|
431
|
+
const { x, y } = this.get3DPositionsFrom2D([worldX, worldY], alignMatrix);
|
|
432
|
+
step.push(x, y);
|
|
433
|
+
alignedPathCommands.push(step);
|
|
434
|
+
}
|
|
435
|
+
return this.generateNewShape(alignedPathCommands.map(([command, ...coords]) => (`${command}${coords.join(',')}`)).join(''), id, { tag, fill, ownTag });
|
|
436
|
+
}
|
|
437
|
+
/** @ignore */
|
|
438
|
+
static parsePathElementToShape(node, alignMatrix, { tag, fill, ownTag }) {
|
|
439
|
+
const { d, id } = node.attr();
|
|
440
|
+
const pathCommands = Snap.parsePathString(d);
|
|
441
|
+
const alignedPathCommands = [];
|
|
442
|
+
const matrix = node.transform().totalMatrix;
|
|
443
|
+
pathCommands.forEach(([commandChar, ...coords]) => {
|
|
444
|
+
if (commandChar === 'Z')
|
|
445
|
+
return;
|
|
446
|
+
const step = [];
|
|
447
|
+
step.push(commandChar.toLowerCase());
|
|
448
|
+
for (let i = 0; i < coords.length; i += 2) {
|
|
449
|
+
const localX = coords[i];
|
|
450
|
+
const localY = coords[i + 1];
|
|
451
|
+
const worldX = matrix.x(localX, localY);
|
|
452
|
+
const worldY = matrix.y(localX, localY);
|
|
453
|
+
const { x, y } = SvgUtils.get3DPositionsFrom2D([worldX, worldY], alignMatrix);
|
|
454
|
+
step.push(x, y);
|
|
455
|
+
}
|
|
456
|
+
alignedPathCommands.push(step);
|
|
457
|
+
});
|
|
458
|
+
return this.generateNewShape(alignedPathCommands.map(([command, ...coords]) => (`${command}${coords.join(',')}`)).join(''), id, { tag, fill, ownTag });
|
|
459
|
+
}
|
|
460
|
+
/** @ignore */
|
|
461
|
+
static parseSnapSvgToShapes(node, alignMatrix, options) {
|
|
462
|
+
try {
|
|
463
|
+
const { tag, fill } = options || {};
|
|
464
|
+
const { type } = node;
|
|
465
|
+
const result = [];
|
|
466
|
+
const attr = node.attr();
|
|
467
|
+
const nodeTag = type === 'g' ? attr.name || attr.id || tag : tag;
|
|
468
|
+
const nodeOwnTag = attr.name || attr.id;
|
|
469
|
+
const nodeFill = attr.fill || fill || '';
|
|
470
|
+
const children = node.children();
|
|
471
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
472
|
+
const childShapes = this.parseSnapSvgToShapes(children[i], alignMatrix, { tag: nodeTag, fill: nodeFill });
|
|
473
|
+
for (let j = 0; j < childShapes.length; j += 1) {
|
|
474
|
+
result.push(childShapes[j]);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (type === 'path') {
|
|
478
|
+
result.push(this.parsePathElementToShape(node, alignMatrix, {
|
|
479
|
+
tag: nodeTag,
|
|
480
|
+
fill: nodeFill,
|
|
481
|
+
ownTag: nodeOwnTag,
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
if (type === 'polygon') {
|
|
485
|
+
result.push(this.parsePolygonElementToShape(node, alignMatrix, {
|
|
486
|
+
tag: nodeTag,
|
|
487
|
+
fill: nodeFill,
|
|
488
|
+
ownTag: nodeOwnTag,
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
if (type === 'rect') {
|
|
492
|
+
result.push(this.parseRectElementToShape(node, alignMatrix, {
|
|
493
|
+
tag: nodeTag,
|
|
494
|
+
fill: nodeFill,
|
|
495
|
+
ownTag: nodeOwnTag,
|
|
496
|
+
}));
|
|
497
|
+
}
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
// ignore
|
|
502
|
+
// console.log(node.type, node.attr('id'), 'not supported skip');
|
|
503
|
+
}
|
|
504
|
+
return [];
|
|
505
|
+
}
|
|
506
|
+
/** @ignore */
|
|
507
|
+
static getCompsFromMat4(mat) {
|
|
508
|
+
const { THREE } = Externals.getInstance();
|
|
509
|
+
const position = new THREE.Vector3();
|
|
510
|
+
const scale = new THREE.Vector3();
|
|
511
|
+
const quaternion = new THREE.Quaternion();
|
|
512
|
+
new THREE.Matrix4().fromArray(mat).decompose(position, quaternion, scale);
|
|
513
|
+
return {
|
|
514
|
+
position,
|
|
515
|
+
scale,
|
|
516
|
+
quaternion,
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* 将svg解析为Shape对象数组
|
|
521
|
+
* @param url SVG文件url
|
|
522
|
+
* @param alignMatrix 对齐矩阵数组
|
|
523
|
+
* @param coefficient shape高度调整系数
|
|
524
|
+
* @example
|
|
525
|
+
* ```typescript
|
|
526
|
+
* // 将svg解析为Shape对象数组
|
|
527
|
+
* const shapes = await SvgUtils.parseSvgToShapes(
|
|
528
|
+
* <svg url>,
|
|
529
|
+
* [0.02, 0, 0, 0, 0, -0.02, 0, 0, 0, 0, 0, 0, -40, 40, 0, 1], // 对齐矩阵
|
|
530
|
+
* );
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
static parseSvgToShapes(url, alignMatrix, coefficient = 1) {
|
|
534
|
+
return new Promise((resolve) => {
|
|
535
|
+
// const tagsCounterMap: Map<string, number> = new Map();
|
|
536
|
+
Snap.load(url, (fragment) => {
|
|
537
|
+
let shapes = this.parseSnapSvgToShapes(fragment.select('svg'), alignMatrix);
|
|
538
|
+
shapes = shapes.map((s) => {
|
|
539
|
+
const { height } = s.getData();
|
|
540
|
+
// if (parentName && !tagsCounterMap.get(parentName)) {
|
|
541
|
+
// tagsCounterMap.set(parentName, 0);
|
|
542
|
+
// }
|
|
543
|
+
// const count = parentName ? tagsCounterMap.get(parentName) : 0;
|
|
544
|
+
// tagsCounterMap.set(parentName as string, count as number + 1);
|
|
545
|
+
const newH = SvgUtils.calcHeightFromMat(height, alignMatrix);
|
|
546
|
+
// const offset = count as number * 0.01;
|
|
547
|
+
const tHeight = newH * coefficient;
|
|
548
|
+
s.updateData({ height: tHeight });
|
|
549
|
+
return s;
|
|
550
|
+
});
|
|
551
|
+
resolve(shapes);
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
static calcHeightFromMat(height, alignMatrix) {
|
|
556
|
+
const { scale } = SvgUtils.getCompsFromMat4(alignMatrix);
|
|
557
|
+
const muliNum = 20 * scale.x;
|
|
558
|
+
return height * muliNum;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
export { SvgUtils, };
|