@artstesh/maps 5.1.7 → 6.0.1
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/README.md +13 -13
- package/dist/README.md +24 -24
- package/dist/esm2022/map/common/destructible.component.mjs +18 -18
- package/dist/esm2022/map/common/id.generator.mjs +14 -14
- package/dist/esm2022/map/helpers/index.mjs +4 -4
- package/dist/esm2022/map/helpers/marker-style.helper.mjs +28 -28
- package/dist/esm2022/map/helpers/polygon-style.helper.mjs +32 -32
- package/dist/esm2022/map/helpers/stringify-feature.helper.mjs +58 -58
- package/dist/esm2022/map/helpers/text-style.helper.mjs +13 -13
- package/dist/esm2022/map/map-plate/controls/index.mjs +2 -2
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -52
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +12 -12
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +44 -44
- package/dist/esm2022/map/map-plate/features/index.mjs +2 -2
- package/dist/esm2022/map/map-plate/features/markers/markers.component.mjs +42 -42
- package/dist/esm2022/map/map-plate/features/polygons/polygons.component.mjs +42 -42
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -59
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +52 -52
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +38 -38
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +66 -66
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -52
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +28 -28
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +91 -91
- package/dist/esm2022/map/map-plate/layers/index.mjs +7 -7
- package/dist/esm2022/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -57
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +52 -52
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +50 -50
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +44 -44
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +102 -102
- package/dist/esm2022/map/map-plate/map-plate.factory.service.mjs +27 -27
- package/dist/esm2022/map/map-plate/tooltips/index.mjs +2 -2
- package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.component.mjs +81 -81
- package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +30 -30
- package/dist/esm2022/map/map.module.mjs +63 -63
- package/dist/esm2022/map/messages/commands/add-control.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/add-layer.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/add-tile.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/cancel-drawing.command.mjs +7 -7
- package/dist/esm2022/map/messages/commands/cancel-feature-modification.command.mjs +7 -7
- package/dist/esm2022/map/messages/commands/close-tooltip.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/draw-selection-area.command.mjs +16 -16
- package/dist/esm2022/map/messages/commands/fit-to-features.command.mjs +14 -14
- package/dist/esm2022/map/messages/commands/fit-to-polygons.command.mjs +14 -14
- package/dist/esm2022/map/messages/commands/modify-feature.command.mjs +17 -17
- package/dist/esm2022/map/messages/commands/place-layer-features.command.mjs +14 -14
- package/dist/esm2022/map/messages/commands/remove-control.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/remove-layer.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/remove-tile.command.mjs +12 -12
- package/dist/esm2022/map/messages/commands/set-map-center.command.mjs +25 -25
- package/dist/esm2022/map/messages/commands/start-drawing.command.mjs +17 -17
- package/dist/esm2022/map/messages/events/drawing-finished.event.mjs +10 -10
- package/dist/esm2022/map/messages/events/map-click.event.mjs +16 -16
- package/dist/esm2022/map/messages/events/map-move-end.event.mjs +14 -14
- package/dist/esm2022/map/messages/events/map-rendered.event.mjs +12 -12
- package/dist/esm2022/map/messages/executors/calculate-area.executor.mjs +12 -12
- package/dist/esm2022/map/messages/executors/filter-features-in-area.executor.mjs +14 -14
- package/dist/esm2022/map/messages/executors/generate-draw.executor.mjs +16 -16
- package/dist/esm2022/map/messages/executors/generate-zoom-control.executor.mjs +12 -12
- package/dist/esm2022/map/messages/index.mjs +14 -14
- package/dist/esm2022/map/messages/queries/get-features-in-area.query.mjs +14 -14
- package/dist/esm2022/map/messages/queries/get-layer.query.mjs +12 -12
- package/dist/esm2022/map/models/drawing-type.enum.mjs +7 -7
- package/dist/esm2022/map/models/feature-format.enum.mjs +5 -5
- package/dist/esm2022/map/models/i-identified.mjs +1 -1
- package/dist/esm2022/map/models/index.mjs +7 -7
- package/dist/esm2022/map/models/map-control.mjs +14 -14
- package/dist/esm2022/map/models/map-lyrs.enum.mjs +18 -18
- package/dist/esm2022/map/models/map-settings.mjs +50 -50
- package/dist/esm2022/map/models/map.constants.mjs +4 -4
- package/dist/esm2022/map/models/marker-model.mjs +28 -28
- package/dist/esm2022/map/models/polygon.model.mjs +32 -32
- package/dist/esm2022/map/public-api.mjs +15 -15
- package/dist/esm2022/map/services/controls/controls.service.mjs +39 -39
- package/dist/esm2022/map/services/drawing/drawing-generation.service.mjs +25 -25
- package/dist/esm2022/map/services/drawing/drawing.service.mjs +101 -101
- package/dist/esm2022/map/services/drawing/feature-modification.service.mjs +103 -103
- package/dist/esm2022/map/services/feature.service.mjs +21 -21
- package/dist/esm2022/map/services/map-click.service.mjs +55 -55
- package/dist/esm2022/map/services/map-feature.service.mjs +55 -55
- package/dist/esm2022/map/services/map-management.service.mjs +103 -103
- package/dist/esm2022/map/services/map-postboy.service.mjs +18 -18
- package/dist/esm2022/map/services/map-state.service.mjs +43 -43
- package/dist/esm2022/map/services/message-registrator.service.mjs +82 -82
- package/dist/esm2022/maps-components.mjs +4 -4
- package/dist/esm2022/public-api.mjs +4 -4
- package/dist/esm2022/src/map/common/destructible.component.mjs +18 -18
- package/dist/esm2022/src/map/common/id.generator.mjs +14 -14
- package/dist/esm2022/src/map/helpers/index.mjs +4 -4
- package/dist/esm2022/src/map/helpers/marker-style.helper.mjs +28 -28
- package/dist/esm2022/src/map/helpers/polygon-style.helper.mjs +32 -32
- package/dist/esm2022/src/map/helpers/stringify-feature.helper.mjs +58 -58
- package/dist/esm2022/src/map/helpers/text-style.helper.mjs +13 -13
- package/dist/esm2022/src/map/map-plate/controls/index.mjs +2 -2
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -52
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +12 -12
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +44 -44
- package/dist/esm2022/src/map/map-plate/features/index.mjs +2 -2
- package/dist/esm2022/src/map/map-plate/features/markers/markers.component.mjs +42 -42
- package/dist/esm2022/src/map/map-plate/features/polygons/polygons.component.mjs +42 -42
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -59
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +52 -52
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +38 -38
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +66 -66
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -52
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +28 -28
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +91 -91
- package/dist/esm2022/src/map/map-plate/layers/index.mjs +7 -7
- package/dist/esm2022/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -57
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +52 -52
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +50 -50
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +44 -44
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +102 -102
- package/dist/esm2022/src/map/map-plate/map-plate.factory.service.mjs +27 -27
- package/dist/esm2022/src/map/map-plate/tooltips/index.mjs +2 -2
- package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.component.mjs +81 -81
- package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +30 -30
- package/dist/esm2022/src/map/map.module.mjs +63 -63
- package/dist/esm2022/src/map/maps-components-src-map.mjs +4 -4
- package/dist/esm2022/src/map/messages/commands/add-control.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/add-layer.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/add-tile.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/cancel-drawing.command.mjs +7 -7
- package/dist/esm2022/src/map/messages/commands/cancel-feature-modification.command.mjs +7 -7
- package/dist/esm2022/src/map/messages/commands/close-tooltip.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/draw-selection-area.command.mjs +16 -16
- package/dist/esm2022/src/map/messages/commands/fit-to-features.command.mjs +14 -14
- package/dist/esm2022/src/map/messages/commands/fit-to-polygons.command.mjs +14 -14
- package/dist/esm2022/src/map/messages/commands/modify-feature.command.mjs +17 -17
- package/dist/esm2022/src/map/messages/commands/place-layer-features.command.mjs +14 -14
- package/dist/esm2022/src/map/messages/commands/remove-control.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/remove-layer.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/remove-tile.command.mjs +12 -12
- package/dist/esm2022/src/map/messages/commands/set-map-center.command.mjs +25 -25
- package/dist/esm2022/src/map/messages/commands/start-drawing.command.mjs +17 -17
- package/dist/esm2022/src/map/messages/events/drawing-finished.event.mjs +10 -10
- package/dist/esm2022/src/map/messages/events/map-click.event.mjs +16 -16
- package/dist/esm2022/src/map/messages/events/map-move-end.event.mjs +14 -14
- package/dist/esm2022/src/map/messages/events/map-rendered.event.mjs +12 -12
- package/dist/esm2022/src/map/messages/executors/calculate-area.executor.mjs +12 -12
- package/dist/esm2022/src/map/messages/executors/filter-features-in-area.executor.mjs +14 -14
- package/dist/esm2022/src/map/messages/executors/generate-draw.executor.mjs +16 -16
- package/dist/esm2022/src/map/messages/executors/generate-zoom-control.executor.mjs +12 -12
- package/dist/esm2022/src/map/messages/index.mjs +14 -14
- package/dist/esm2022/src/map/messages/queries/get-features-in-area.query.mjs +14 -14
- package/dist/esm2022/src/map/messages/queries/get-layer.query.mjs +12 -12
- package/dist/esm2022/src/map/models/drawing-type.enum.mjs +7 -7
- package/dist/esm2022/src/map/models/feature-format.enum.mjs +5 -5
- package/dist/esm2022/src/map/models/i-identified.mjs +1 -1
- package/dist/esm2022/src/map/models/index.mjs +7 -7
- package/dist/esm2022/src/map/models/map-control.mjs +14 -14
- package/dist/esm2022/src/map/models/map-lyrs.enum.mjs +18 -18
- package/dist/esm2022/src/map/models/map-settings.mjs +50 -50
- package/dist/esm2022/src/map/models/map.constants.mjs +4 -4
- package/dist/esm2022/src/map/models/marker-model.mjs +28 -28
- package/dist/esm2022/src/map/models/polygon.model.mjs +32 -32
- package/dist/esm2022/src/map/public-api.mjs +15 -15
- package/dist/esm2022/src/map/services/controls/controls.service.mjs +39 -39
- package/dist/esm2022/src/map/services/drawing/drawing-generation.service.mjs +25 -25
- package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +101 -101
- package/dist/esm2022/src/map/services/drawing/feature-modification.service.mjs +103 -103
- package/dist/esm2022/src/map/services/feature.service.mjs +21 -21
- package/dist/esm2022/src/map/services/map-click.service.mjs +55 -55
- package/dist/esm2022/src/map/services/map-feature.service.mjs +55 -55
- package/dist/esm2022/src/map/services/map-management.service.mjs +103 -103
- package/dist/esm2022/src/map/services/map-postboy.service.mjs +18 -18
- package/dist/esm2022/src/map/services/map-state.service.mjs +43 -43
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +82 -82
- package/dist/fesm2022/maps-components-src-map.mjs +2109 -2109
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +2111 -2111
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/map/common/destructible.component.d.ts +10 -10
- package/dist/map/common/id.generator.d.ts +4 -4
- package/dist/map/helpers/index.d.ts +4 -4
- package/dist/map/helpers/marker-style.helper.d.ts +7 -7
- package/dist/map/helpers/polygon-style.helper.d.ts +5 -5
- package/dist/map/helpers/stringify-feature.helper.d.ts +8 -8
- package/dist/map/helpers/text-style.helper.d.ts +4 -4
- package/dist/map/map-plate/controls/index.d.ts +2 -2
- package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -19
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -5
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -14
- package/dist/map/map-plate/features/index.d.ts +2 -2
- package/dist/map/map-plate/features/markers/markers.component.d.ts +16 -16
- package/dist/map/map-plate/features/polygons/polygons.component.d.ts +16 -16
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -11
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -21
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +13 -13
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +22 -22
- package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +22 -22
- package/dist/map/map-plate/layers/feature-layer/feature-layer.factory.d.ts +9 -9
- package/dist/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +61 -61
- package/dist/map/map-plate/layers/index.d.ts +7 -7
- package/dist/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +19 -19
- package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +21 -21
- package/dist/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -11
- package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +14 -14
- package/dist/map/map-plate/map-plate.component.d.ts +27 -27
- package/dist/map/map-plate/map-plate.factory.service.d.ts +8 -8
- package/dist/map/map-plate/tooltips/index.d.ts +2 -2
- package/dist/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -26
- package/dist/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -11
- package/dist/map/map.module.d.ts +17 -17
- package/dist/map/messages/commands/add-control.command.d.ts +8 -8
- package/dist/map/messages/commands/add-layer.command.d.ts +10 -10
- package/dist/map/messages/commands/add-tile.command.d.ts +9 -9
- package/dist/map/messages/commands/cancel-drawing.command.d.ts +5 -5
- package/dist/map/messages/commands/cancel-feature-modification.command.d.ts +5 -5
- package/dist/map/messages/commands/close-tooltip.command.d.ts +7 -7
- package/dist/map/messages/commands/draw-selection-area.command.d.ts +13 -13
- package/dist/map/messages/commands/fit-to-features.command.d.ts +10 -10
- package/dist/map/messages/commands/fit-to-polygons.command.d.ts +9 -9
- package/dist/map/messages/commands/modify-feature.command.d.ts +11 -11
- package/dist/map/messages/commands/place-layer-features.command.d.ts +10 -10
- package/dist/map/messages/commands/remove-control.command.d.ts +8 -8
- package/dist/map/messages/commands/remove-layer.command.d.ts +8 -8
- package/dist/map/messages/commands/remove-tile.command.d.ts +9 -9
- package/dist/map/messages/commands/set-map-center.command.d.ts +18 -18
- package/dist/map/messages/commands/start-drawing.command.d.ts +11 -11
- package/dist/map/messages/events/drawing-finished.event.d.ts +6 -6
- package/dist/map/messages/events/map-click.event.d.ts +20 -20
- package/dist/map/messages/events/map-move-end.event.d.ts +8 -8
- package/dist/map/messages/events/map-rendered.event.d.ts +8 -8
- package/dist/map/messages/executors/calculate-area.executor.d.ts +10 -10
- package/dist/map/messages/executors/filter-features-in-area.executor.d.ts +10 -10
- package/dist/map/messages/executors/generate-draw.executor.d.ts +14 -14
- package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -9
- package/dist/map/messages/index.d.ts +14 -14
- package/dist/map/messages/queries/get-features-in-area.query.d.ts +11 -11
- package/dist/map/messages/queries/get-layer.query.d.ts +10 -10
- package/dist/map/models/drawing-type.enum.d.ts +6 -6
- package/dist/map/models/feature-format.enum.d.ts +4 -4
- package/dist/map/models/i-identified.d.ts +3 -3
- package/dist/map/models/index.d.ts +7 -7
- package/dist/map/models/map-control.d.ts +13 -13
- package/dist/map/models/map-lyrs.enum.d.ts +10 -10
- package/dist/map/models/map-settings.d.ts +17 -17
- package/dist/map/models/map.constants.d.ts +4 -4
- package/dist/map/models/marker-model.d.ts +16 -16
- package/dist/map/models/polygon.model.d.ts +19 -19
- package/dist/map/public-api.d.ts +12 -12
- package/dist/map/services/controls/controls.service.d.ts +14 -14
- package/dist/map/services/drawing/drawing-generation.service.d.ts +6 -6
- package/dist/map/services/drawing/drawing.service.d.ts +19 -19
- package/dist/map/services/drawing/feature-modification.service.d.ts +22 -22
- package/dist/map/services/feature.service.d.ts +9 -9
- package/dist/map/services/map-click.service.d.ts +16 -16
- package/dist/map/services/map-feature.service.d.ts +16 -16
- package/dist/map/services/map-management.service.d.ts +20 -20
- package/dist/map/services/map-postboy.service.d.ts +7 -7
- package/dist/map/services/map-state.service.d.ts +13 -13
- package/dist/map/services/message-registrator.service.d.ts +17 -17
- package/dist/public-api.d.ts +1 -1
- package/dist/src/map/common/destructible.component.d.ts +10 -10
- package/dist/src/map/common/id.generator.d.ts +4 -4
- package/dist/src/map/helpers/index.d.ts +4 -4
- package/dist/src/map/helpers/marker-style.helper.d.ts +7 -7
- package/dist/src/map/helpers/polygon-style.helper.d.ts +5 -5
- package/dist/src/map/helpers/stringify-feature.helper.d.ts +8 -8
- package/dist/src/map/helpers/text-style.helper.d.ts +4 -4
- package/dist/src/map/index.d.ts +5 -5
- package/dist/src/map/map-plate/controls/index.d.ts +2 -2
- package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -19
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -5
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -14
- package/dist/src/map/map-plate/features/index.d.ts +2 -2
- package/dist/src/map/map-plate/features/markers/markers.component.d.ts +16 -16
- package/dist/src/map/map-plate/features/polygons/polygons.component.d.ts +16 -16
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -11
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -21
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +13 -13
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +22 -22
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +22 -22
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.factory.d.ts +9 -9
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +61 -61
- package/dist/src/map/map-plate/layers/index.d.ts +7 -7
- package/dist/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +19 -19
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +21 -21
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -11
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +14 -14
- package/dist/src/map/map-plate/map-plate.component.d.ts +27 -27
- package/dist/src/map/map-plate/map-plate.factory.service.d.ts +8 -8
- package/dist/src/map/map-plate/tooltips/index.d.ts +2 -2
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -26
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -11
- package/dist/src/map/map.module.d.ts +17 -17
- package/dist/src/map/messages/commands/add-control.command.d.ts +8 -8
- package/dist/src/map/messages/commands/add-layer.command.d.ts +10 -10
- package/dist/src/map/messages/commands/add-tile.command.d.ts +9 -9
- package/dist/src/map/messages/commands/cancel-drawing.command.d.ts +5 -5
- package/dist/src/map/messages/commands/cancel-feature-modification.command.d.ts +5 -5
- package/dist/src/map/messages/commands/close-tooltip.command.d.ts +7 -7
- package/dist/src/map/messages/commands/draw-selection-area.command.d.ts +13 -13
- package/dist/src/map/messages/commands/fit-to-features.command.d.ts +10 -10
- package/dist/src/map/messages/commands/fit-to-polygons.command.d.ts +9 -9
- package/dist/src/map/messages/commands/modify-feature.command.d.ts +11 -11
- package/dist/src/map/messages/commands/place-layer-features.command.d.ts +10 -10
- package/dist/src/map/messages/commands/remove-control.command.d.ts +8 -8
- package/dist/src/map/messages/commands/remove-layer.command.d.ts +8 -8
- package/dist/src/map/messages/commands/remove-tile.command.d.ts +9 -9
- package/dist/src/map/messages/commands/set-map-center.command.d.ts +18 -18
- package/dist/src/map/messages/commands/start-drawing.command.d.ts +11 -11
- package/dist/src/map/messages/events/drawing-finished.event.d.ts +6 -6
- package/dist/src/map/messages/events/map-click.event.d.ts +20 -20
- package/dist/src/map/messages/events/map-move-end.event.d.ts +8 -8
- package/dist/src/map/messages/events/map-rendered.event.d.ts +8 -8
- package/dist/src/map/messages/executors/calculate-area.executor.d.ts +10 -10
- package/dist/src/map/messages/executors/filter-features-in-area.executor.d.ts +10 -10
- package/dist/src/map/messages/executors/generate-draw.executor.d.ts +14 -14
- package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -9
- package/dist/src/map/messages/index.d.ts +14 -14
- package/dist/src/map/messages/queries/get-features-in-area.query.d.ts +11 -11
- package/dist/src/map/messages/queries/get-layer.query.d.ts +10 -10
- package/dist/src/map/models/drawing-type.enum.d.ts +6 -6
- package/dist/src/map/models/feature-format.enum.d.ts +4 -4
- package/dist/src/map/models/i-identified.d.ts +3 -3
- package/dist/src/map/models/index.d.ts +7 -7
- package/dist/src/map/models/map-control.d.ts +13 -13
- package/dist/src/map/models/map-lyrs.enum.d.ts +10 -10
- package/dist/src/map/models/map-settings.d.ts +17 -17
- package/dist/src/map/models/map.constants.d.ts +4 -4
- package/dist/src/map/models/marker-model.d.ts +16 -16
- package/dist/src/map/models/polygon.model.d.ts +19 -19
- package/dist/src/map/public-api.d.ts +12 -12
- package/dist/src/map/services/controls/controls.service.d.ts +14 -14
- package/dist/src/map/services/drawing/drawing-generation.service.d.ts +6 -6
- package/dist/src/map/services/drawing/drawing.service.d.ts +19 -19
- package/dist/src/map/services/drawing/feature-modification.service.d.ts +22 -22
- package/dist/src/map/services/feature.service.d.ts +9 -9
- package/dist/src/map/services/map-click.service.d.ts +16 -16
- package/dist/src/map/services/map-feature.service.d.ts +16 -16
- package/dist/src/map/services/map-management.service.d.ts +20 -20
- package/dist/src/map/services/map-postboy.service.d.ts +7 -7
- package/dist/src/map/services/map-state.service.d.ts +13 -13
- package/dist/src/map/services/message-registrator.service.d.ts +17 -17
- package/package.json +23 -24
- package/dist/package.json +0 -35
|
@@ -29,2155 +29,2155 @@ import Style from 'ol/style/Style';
|
|
|
29
29
|
import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
|
|
30
30
|
import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
|
|
31
31
|
|
|
32
|
-
class DestructibleComponent {
|
|
33
|
-
subs = [];
|
|
34
|
-
onDestroy;
|
|
35
|
-
ngOnDestroy() {
|
|
36
|
-
this.subs.forEach((s) => s.unsubscribe());
|
|
37
|
-
if (this.onDestroy)
|
|
38
|
-
this.onDestroy();
|
|
39
|
-
}
|
|
40
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
41
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
42
|
-
}
|
|
43
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
-
type: Component,
|
|
45
|
-
args: [{ template: '' }]
|
|
32
|
+
class DestructibleComponent {
|
|
33
|
+
subs = [];
|
|
34
|
+
onDestroy;
|
|
35
|
+
ngOnDestroy() {
|
|
36
|
+
this.subs.forEach((s) => s.unsubscribe());
|
|
37
|
+
if (this.onDestroy)
|
|
38
|
+
this.onDestroy();
|
|
39
|
+
}
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DestructibleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: DestructibleComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DestructibleComponent, decorators: [{
|
|
44
|
+
type: Component,
|
|
45
|
+
args: [{ template: '' }]
|
|
46
46
|
}] });
|
|
47
47
|
|
|
48
|
-
var MapLyrs;
|
|
49
|
-
(function (MapLyrs) {
|
|
50
|
-
MapLyrs[MapLyrs["Hybrid"] = 1] = "Hybrid";
|
|
51
|
-
MapLyrs[MapLyrs["Satellite"] = 2] = "Satellite";
|
|
52
|
-
MapLyrs[MapLyrs["Streets"] = 3] = "Streets";
|
|
53
|
-
MapLyrs[MapLyrs["Terrain"] = 4] = "Terrain";
|
|
54
|
-
})(MapLyrs || (MapLyrs = {}));
|
|
55
|
-
class MapLyrsLabel {
|
|
56
|
-
static lyrs = {
|
|
57
|
-
[MapLyrs.Hybrid]: 's,h',
|
|
58
|
-
[MapLyrs.Satellite]: 's',
|
|
59
|
-
[MapLyrs.Streets]: 'm',
|
|
60
|
-
[MapLyrs.Terrain]: 'p',
|
|
61
|
-
};
|
|
62
|
-
static get(lyrs) {
|
|
63
|
-
return MapLyrsLabel.lyrs[lyrs];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
class MapSettings {
|
|
68
|
-
center = [0, 0];
|
|
69
|
-
maxZoom = 19;
|
|
70
|
-
minZoom = 0;
|
|
71
|
-
zoom = 4;
|
|
72
|
-
lyrs = MapLyrs.Hybrid;
|
|
73
|
-
language = 'en';
|
|
74
|
-
static copy(model) {
|
|
75
|
-
const result = new MapSettings();
|
|
76
|
-
result.center = model.center;
|
|
77
|
-
result.maxZoom = model.maxZoom;
|
|
78
|
-
result.minZoom = model.minZoom;
|
|
79
|
-
result.zoom = model.zoom;
|
|
80
|
-
result.lyrs = model.lyrs;
|
|
81
|
-
result.language = model.language;
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
setCenter(center) {
|
|
85
|
-
return MapSettings.copy({ ...this, center });
|
|
86
|
-
}
|
|
87
|
-
setMaxZoom(maxZoom) {
|
|
88
|
-
return MapSettings.copy({ ...this, maxZoom });
|
|
89
|
-
}
|
|
90
|
-
setMinZoom(minZoom) {
|
|
91
|
-
return MapSettings.copy({ ...this, minZoom });
|
|
92
|
-
}
|
|
93
|
-
setZoom(zoom) {
|
|
94
|
-
return MapSettings.copy({ ...this, zoom });
|
|
95
|
-
}
|
|
96
|
-
setLyrs(lyrs) {
|
|
97
|
-
return MapSettings.copy({ ...this, lyrs });
|
|
98
|
-
}
|
|
99
|
-
setLanguage(language) {
|
|
100
|
-
return MapSettings.copy({ ...this, language });
|
|
101
|
-
}
|
|
102
|
-
isSame(model) {
|
|
103
|
-
if (this.maxZoom !== model.maxZoom)
|
|
104
|
-
return false;
|
|
105
|
-
if (this.minZoom !== model.minZoom)
|
|
106
|
-
return false;
|
|
107
|
-
if (this.zoom !== model.zoom)
|
|
108
|
-
return false;
|
|
109
|
-
if (this.lyrs !== model.lyrs)
|
|
110
|
-
return false;
|
|
111
|
-
if (this.language !== model.language)
|
|
112
|
-
return false;
|
|
113
|
-
return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
class IdGenerator {
|
|
118
|
-
static collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
119
|
-
static get() {
|
|
120
|
-
let result = [];
|
|
121
|
-
for (let i = 0; i < 7; i++) {
|
|
122
|
-
result.push(IdGenerator.collection
|
|
123
|
-
.sort(() => 0.5 - Math.random())
|
|
124
|
-
.slice(0, 5)
|
|
125
|
-
.join(''));
|
|
126
|
-
}
|
|
127
|
-
return result.join('-');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
class MapConstants {
|
|
132
|
-
static FeatureInfo = 'f-info';
|
|
133
|
-
static DrawingLayerId = '93a981756ec7';
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
class MarkerModel {
|
|
137
|
-
lat;
|
|
138
|
-
lng;
|
|
139
|
-
info;
|
|
140
|
-
id;
|
|
141
|
-
constructor(lat, lng, id, info) {
|
|
142
|
-
this.lat = lat;
|
|
143
|
-
this.lng = lng;
|
|
144
|
-
this.info = info;
|
|
145
|
-
this.id = id == null ? IdGenerator.get() : id;
|
|
146
|
-
this._feature = this.getFeature();
|
|
147
|
-
}
|
|
148
|
-
_feature;
|
|
149
|
-
get feature() {
|
|
150
|
-
return this._feature;
|
|
151
|
-
}
|
|
152
|
-
getFeature() {
|
|
153
|
-
const feature = new Feature(new Point([this.lng, this.lat]));
|
|
154
|
-
feature.setId(this.id);
|
|
155
|
-
if (this.info)
|
|
156
|
-
feature.set(MapConstants.FeatureInfo, this.info);
|
|
157
|
-
return feature;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
class PolygonModel {
|
|
162
|
-
info;
|
|
163
|
-
id;
|
|
164
|
-
lat;
|
|
165
|
-
lng;
|
|
166
|
-
_feature;
|
|
167
|
-
static fromGeoJson(id, json, info) {
|
|
168
|
-
let feature = new GeoJSON().readFeature(json);
|
|
169
|
-
feature.setId(id);
|
|
170
|
-
return new PolygonModel(feature, id, info);
|
|
171
|
-
}
|
|
172
|
-
static fromWKT(id, wkt, info) {
|
|
173
|
-
let feature = new WKT().readFeature(wkt);
|
|
174
|
-
feature.setId(id);
|
|
175
|
-
return new PolygonModel(feature, id, info);
|
|
176
|
-
}
|
|
177
|
-
constructor(feature, id, info) {
|
|
178
|
-
this.info = info;
|
|
179
|
-
this.id = id == null ? IdGenerator.get() : id;
|
|
180
|
-
this._feature = feature;
|
|
181
|
-
if (this.info)
|
|
182
|
-
this._feature?.set(MapConstants.FeatureInfo, this.info);
|
|
183
|
-
[this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
|
|
184
|
-
}
|
|
185
|
-
get feature() {
|
|
186
|
-
return this._feature;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
var DrawingType;
|
|
191
|
-
(function (DrawingType) {
|
|
192
|
-
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
193
|
-
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
194
|
-
DrawingType[DrawingType["Square"] = 3] = "Square";
|
|
195
|
-
DrawingType[DrawingType["Box"] = 4] = "Box";
|
|
48
|
+
var MapLyrs;
|
|
49
|
+
(function (MapLyrs) {
|
|
50
|
+
MapLyrs[MapLyrs["Hybrid"] = 1] = "Hybrid";
|
|
51
|
+
MapLyrs[MapLyrs["Satellite"] = 2] = "Satellite";
|
|
52
|
+
MapLyrs[MapLyrs["Streets"] = 3] = "Streets";
|
|
53
|
+
MapLyrs[MapLyrs["Terrain"] = 4] = "Terrain";
|
|
54
|
+
})(MapLyrs || (MapLyrs = {}));
|
|
55
|
+
class MapLyrsLabel {
|
|
56
|
+
static lyrs = {
|
|
57
|
+
[MapLyrs.Hybrid]: 's,h',
|
|
58
|
+
[MapLyrs.Satellite]: 's',
|
|
59
|
+
[MapLyrs.Streets]: 'm',
|
|
60
|
+
[MapLyrs.Terrain]: 'p',
|
|
61
|
+
};
|
|
62
|
+
static get(lyrs) {
|
|
63
|
+
return MapLyrsLabel.lyrs[lyrs];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class MapSettings {
|
|
68
|
+
center = [0, 0];
|
|
69
|
+
maxZoom = 19;
|
|
70
|
+
minZoom = 0;
|
|
71
|
+
zoom = 4;
|
|
72
|
+
lyrs = MapLyrs.Hybrid;
|
|
73
|
+
language = 'en';
|
|
74
|
+
static copy(model) {
|
|
75
|
+
const result = new MapSettings();
|
|
76
|
+
result.center = model.center;
|
|
77
|
+
result.maxZoom = model.maxZoom;
|
|
78
|
+
result.minZoom = model.minZoom;
|
|
79
|
+
result.zoom = model.zoom;
|
|
80
|
+
result.lyrs = model.lyrs;
|
|
81
|
+
result.language = model.language;
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
setCenter(center) {
|
|
85
|
+
return MapSettings.copy({ ...this, center });
|
|
86
|
+
}
|
|
87
|
+
setMaxZoom(maxZoom) {
|
|
88
|
+
return MapSettings.copy({ ...this, maxZoom });
|
|
89
|
+
}
|
|
90
|
+
setMinZoom(minZoom) {
|
|
91
|
+
return MapSettings.copy({ ...this, minZoom });
|
|
92
|
+
}
|
|
93
|
+
setZoom(zoom) {
|
|
94
|
+
return MapSettings.copy({ ...this, zoom });
|
|
95
|
+
}
|
|
96
|
+
setLyrs(lyrs) {
|
|
97
|
+
return MapSettings.copy({ ...this, lyrs });
|
|
98
|
+
}
|
|
99
|
+
setLanguage(language) {
|
|
100
|
+
return MapSettings.copy({ ...this, language });
|
|
101
|
+
}
|
|
102
|
+
isSame(model) {
|
|
103
|
+
if (this.maxZoom !== model.maxZoom)
|
|
104
|
+
return false;
|
|
105
|
+
if (this.minZoom !== model.minZoom)
|
|
106
|
+
return false;
|
|
107
|
+
if (this.zoom !== model.zoom)
|
|
108
|
+
return false;
|
|
109
|
+
if (this.lyrs !== model.lyrs)
|
|
110
|
+
return false;
|
|
111
|
+
if (this.language !== model.language)
|
|
112
|
+
return false;
|
|
113
|
+
return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class IdGenerator {
|
|
118
|
+
static collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
119
|
+
static get() {
|
|
120
|
+
let result = [];
|
|
121
|
+
for (let i = 0; i < 7; i++) {
|
|
122
|
+
result.push(IdGenerator.collection
|
|
123
|
+
.sort(() => 0.5 - Math.random())
|
|
124
|
+
.slice(0, 5)
|
|
125
|
+
.join(''));
|
|
126
|
+
}
|
|
127
|
+
return result.join('-');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
class MapConstants {
|
|
132
|
+
static FeatureInfo = 'f-info';
|
|
133
|
+
static DrawingLayerId = '93a981756ec7';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class MarkerModel {
|
|
137
|
+
lat;
|
|
138
|
+
lng;
|
|
139
|
+
info;
|
|
140
|
+
id;
|
|
141
|
+
constructor(lat, lng, id, info) {
|
|
142
|
+
this.lat = lat;
|
|
143
|
+
this.lng = lng;
|
|
144
|
+
this.info = info;
|
|
145
|
+
this.id = id == null ? IdGenerator.get() : id;
|
|
146
|
+
this._feature = this.getFeature();
|
|
147
|
+
}
|
|
148
|
+
_feature;
|
|
149
|
+
get feature() {
|
|
150
|
+
return this._feature;
|
|
151
|
+
}
|
|
152
|
+
getFeature() {
|
|
153
|
+
const feature = new Feature(new Point([this.lng, this.lat]));
|
|
154
|
+
feature.setId(this.id);
|
|
155
|
+
if (this.info)
|
|
156
|
+
feature.set(MapConstants.FeatureInfo, this.info);
|
|
157
|
+
return feature;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
class PolygonModel {
|
|
162
|
+
info;
|
|
163
|
+
id;
|
|
164
|
+
lat;
|
|
165
|
+
lng;
|
|
166
|
+
_feature;
|
|
167
|
+
static fromGeoJson(id, json, info) {
|
|
168
|
+
let feature = new GeoJSON().readFeature(json);
|
|
169
|
+
feature.setId(id);
|
|
170
|
+
return new PolygonModel(feature, id, info);
|
|
171
|
+
}
|
|
172
|
+
static fromWKT(id, wkt, info) {
|
|
173
|
+
let feature = new WKT().readFeature(wkt);
|
|
174
|
+
feature.setId(id);
|
|
175
|
+
return new PolygonModel(feature, id, info);
|
|
176
|
+
}
|
|
177
|
+
constructor(feature, id, info) {
|
|
178
|
+
this.info = info;
|
|
179
|
+
this.id = id == null ? IdGenerator.get() : id;
|
|
180
|
+
this._feature = feature;
|
|
181
|
+
if (this.info)
|
|
182
|
+
this._feature?.set(MapConstants.FeatureInfo, this.info);
|
|
183
|
+
[this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
|
|
184
|
+
}
|
|
185
|
+
get feature() {
|
|
186
|
+
return this._feature;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
var DrawingType;
|
|
191
|
+
(function (DrawingType) {
|
|
192
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
193
|
+
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
194
|
+
DrawingType[DrawingType["Square"] = 3] = "Square";
|
|
195
|
+
DrawingType[DrawingType["Box"] = 4] = "Box";
|
|
196
196
|
})(DrawingType || (DrawingType = {}));
|
|
197
197
|
|
|
198
|
-
var FeatureOutputFormat;
|
|
199
|
-
(function (FeatureOutputFormat) {
|
|
200
|
-
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
201
|
-
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
198
|
+
var FeatureOutputFormat;
|
|
199
|
+
(function (FeatureOutputFormat) {
|
|
200
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
201
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
202
202
|
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
203
203
|
|
|
204
|
-
/**
|
|
205
|
-
*
|
|
206
|
-
* A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
|
|
207
|
-
* This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
|
|
208
|
-
* var myControl = new Control({element: myElement}); and then adding this to the map.
|
|
209
|
-
* The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
|
|
210
|
-
* You can also extend this base for your own control class. See examples/custom-controls for an example of how to do this.
|
|
211
|
-
*/
|
|
212
|
-
class MapControl extends Control {
|
|
213
|
-
constructor(options) {
|
|
214
|
-
super(options);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
class MapRenderedEvent extends PostboyGenericMessage {
|
|
219
|
-
map;
|
|
220
|
-
static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
221
|
-
constructor(map) {
|
|
222
|
-
super();
|
|
223
|
-
this.map = map;
|
|
224
|
-
}
|
|
225
|
-
get id() {
|
|
226
|
-
return MapRenderedEvent.ID;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
class MapClickEvent extends PostboyGenericMessage {
|
|
231
|
-
coordinates;
|
|
232
|
-
entities;
|
|
233
|
-
features;
|
|
234
|
-
static ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
235
|
-
constructor(coordinates, entities, features) {
|
|
236
|
-
super();
|
|
237
|
-
this.coordinates = coordinates;
|
|
238
|
-
this.entities = entities;
|
|
239
|
-
this.features = features;
|
|
240
|
-
}
|
|
241
|
-
get id() {
|
|
242
|
-
return MapClickEvent.ID;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
247
|
-
zoom;
|
|
248
|
-
extent;
|
|
249
|
-
static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
250
|
-
constructor(zoom, extent) {
|
|
251
|
-
super();
|
|
252
|
-
this.zoom = zoom;
|
|
253
|
-
this.extent = extent;
|
|
254
|
-
}
|
|
255
|
-
get id() {
|
|
256
|
-
return MapMoveEndEvent.ID;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
261
|
-
tooltipId;
|
|
262
|
-
static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
263
|
-
constructor(tooltipId) {
|
|
264
|
-
super();
|
|
265
|
-
this.tooltipId = tooltipId;
|
|
266
|
-
}
|
|
267
|
-
get id() {
|
|
268
|
-
return CloseTooltipCommand.ID;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
273
|
-
type;
|
|
274
|
-
style;
|
|
275
|
-
format;
|
|
276
|
-
static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
277
|
-
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
278
|
-
super();
|
|
279
|
-
this.type = type;
|
|
280
|
-
this.style = style;
|
|
281
|
-
this.format = format;
|
|
282
|
-
}
|
|
283
|
-
get id() {
|
|
284
|
-
return StartDrawingCommand.ID;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
289
|
-
static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
290
|
-
get id() {
|
|
291
|
-
return CancelDrawingCommand.ID;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
class DrawSelectionAreaCommand extends PostboyCallbackMessage {
|
|
296
|
-
type;
|
|
297
|
-
style;
|
|
298
|
-
ignore;
|
|
299
|
-
static ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
|
|
300
|
-
constructor(type, style, ignore = new Set()) {
|
|
301
|
-
super();
|
|
302
|
-
this.type = type;
|
|
303
|
-
this.style = style;
|
|
304
|
-
this.ignore = ignore;
|
|
305
|
-
}
|
|
306
|
-
get id() {
|
|
307
|
-
return DrawSelectionAreaCommand.ID;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
class ModifyFeatureCommand extends PostboyCallbackMessage {
|
|
312
|
-
model;
|
|
313
|
-
style;
|
|
314
|
-
format;
|
|
315
|
-
static ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
|
|
316
|
-
constructor(model, style, format = FeatureOutputFormat.GeoJson) {
|
|
317
|
-
super();
|
|
318
|
-
this.model = model;
|
|
319
|
-
this.style = style;
|
|
320
|
-
this.format = format;
|
|
321
|
-
}
|
|
322
|
-
get id() {
|
|
323
|
-
return ModifyFeatureCommand.ID;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
class CancelFeatureModificationCommand extends PostboyGenericMessage {
|
|
328
|
-
static ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
|
|
329
|
-
get id() {
|
|
330
|
-
return CancelFeatureModificationCommand.ID;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
class AddControlCommand extends PostboyGenericMessage {
|
|
335
|
-
item;
|
|
336
|
-
static ID = '8e1c06eb-b395-4fe1-929c-ebf0805eeb49';
|
|
337
|
-
constructor(item) {
|
|
338
|
-
super();
|
|
339
|
-
this.item = item;
|
|
340
|
-
}
|
|
341
|
-
get id() {
|
|
342
|
-
return AddControlCommand.ID;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
class RemoveControlCommand extends PostboyGenericMessage {
|
|
347
|
-
item;
|
|
348
|
-
static ID = '361641e0-804a-4930-8c27-0cea6330dbfc';
|
|
349
|
-
constructor(item) {
|
|
350
|
-
super();
|
|
351
|
-
this.item = item;
|
|
352
|
-
}
|
|
353
|
-
get id() {
|
|
354
|
-
return RemoveControlCommand.ID;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Forces map to move to a specific point
|
|
360
|
-
*/
|
|
361
|
-
class SetMapCenterCommand extends PostboyGenericMessage {
|
|
362
|
-
lat;
|
|
363
|
-
lng;
|
|
364
|
-
zoom;
|
|
365
|
-
static ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
|
|
366
|
-
/**
|
|
367
|
-
*
|
|
368
|
-
* @param lat - the desired latitude
|
|
369
|
-
* @param lng - the desired longitude
|
|
370
|
-
* @param zoom - the desired zoom; doesn't change zoom if undefined
|
|
371
|
-
*/
|
|
372
|
-
constructor(lat, lng, zoom) {
|
|
373
|
-
super();
|
|
374
|
-
this.lat = lat;
|
|
375
|
-
this.lng = lng;
|
|
376
|
-
this.zoom = zoom;
|
|
377
|
-
}
|
|
378
|
-
get id() {
|
|
379
|
-
return SetMapCenterCommand.ID;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
class CalculateAreaExecutor extends PostboyExecutor {
|
|
384
|
-
polygon;
|
|
385
|
-
static ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
|
|
386
|
-
constructor(polygon) {
|
|
387
|
-
super();
|
|
388
|
-
this.polygon = polygon;
|
|
389
|
-
}
|
|
390
|
-
get id() {
|
|
391
|
-
return CalculateAreaExecutor.ID;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
class FitToPolygonsCommand extends PostboyGenericMessage {
|
|
396
|
-
features;
|
|
397
|
-
zoomAfter;
|
|
398
|
-
static ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
|
|
399
|
-
constructor(features, zoomAfter = 0) {
|
|
400
|
-
super();
|
|
401
|
-
this.features = features;
|
|
402
|
-
this.zoomAfter = zoomAfter;
|
|
403
|
-
}
|
|
404
|
-
get id() {
|
|
405
|
-
return FitToPolygonsCommand.ID;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
class AddLayerCommand extends PostboyGenericMessage {
|
|
410
|
-
layer;
|
|
411
|
-
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
412
|
-
constructor(layer) {
|
|
413
|
-
super();
|
|
414
|
-
this.layer = layer;
|
|
415
|
-
}
|
|
416
|
-
get id() {
|
|
417
|
-
return AddLayerCommand.ID;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
422
|
-
layer;
|
|
423
|
-
features;
|
|
424
|
-
static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
425
|
-
constructor(layer, features) {
|
|
426
|
-
super();
|
|
427
|
-
this.layer = layer;
|
|
428
|
-
this.features = features;
|
|
429
|
-
}
|
|
430
|
-
get id() {
|
|
431
|
-
return PlaceLayerFeaturesCommand.ID;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
436
|
-
layer;
|
|
437
|
-
static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
438
|
-
constructor(layer) {
|
|
439
|
-
super();
|
|
440
|
-
this.layer = layer;
|
|
441
|
-
}
|
|
442
|
-
get id() {
|
|
443
|
-
return RemoveLayerCommand.ID;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
class AddTileCommand extends PostboyGenericMessage {
|
|
448
|
-
layer;
|
|
449
|
-
static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
450
|
-
constructor(layer) {
|
|
451
|
-
super();
|
|
452
|
-
this.layer = layer;
|
|
453
|
-
}
|
|
454
|
-
get id() {
|
|
455
|
-
return AddTileCommand.ID;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
class RemoveTileCommand extends PostboyGenericMessage {
|
|
460
|
-
layer;
|
|
461
|
-
static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
462
|
-
constructor(layer) {
|
|
463
|
-
super();
|
|
464
|
-
this.layer = layer;
|
|
465
|
-
}
|
|
466
|
-
get id() {
|
|
467
|
-
return RemoveTileCommand.ID;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
472
|
-
features;
|
|
473
|
-
zoomAfter;
|
|
474
|
-
static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
475
|
-
constructor(features, zoomAfter = 0) {
|
|
476
|
-
super();
|
|
477
|
-
this.features = features;
|
|
478
|
-
this.zoomAfter = zoomAfter;
|
|
479
|
-
}
|
|
480
|
-
get id() {
|
|
481
|
-
return FitToFeaturesCommand.ID;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
class GetLayerQuery extends PostboyCallbackMessage {
|
|
486
|
-
name;
|
|
487
|
-
static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
488
|
-
constructor(name) {
|
|
489
|
-
super();
|
|
490
|
-
this.name = name;
|
|
491
|
-
}
|
|
492
|
-
get id() {
|
|
493
|
-
return GetLayerQuery.ID;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
498
|
-
static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
499
|
-
constructor() {
|
|
500
|
-
super();
|
|
501
|
-
}
|
|
502
|
-
get id() {
|
|
503
|
-
return DrawingFinishedEvent.ID;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
class DrawingGenerationService {
|
|
508
|
-
static getDraw(ev) {
|
|
509
|
-
return new Draw({
|
|
510
|
-
source: ev.layer.getSource(),
|
|
511
|
-
type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
|
|
512
|
-
style: ev.style,
|
|
513
|
-
geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
static geometryFunc(type) {
|
|
517
|
-
switch (type) {
|
|
518
|
-
case DrawingType.Circle:
|
|
519
|
-
return createRegularPolygon(32);
|
|
520
|
-
case DrawingType.Box:
|
|
521
|
-
return createBox();
|
|
522
|
-
case DrawingType.Square:
|
|
523
|
-
return createRegularPolygon(4);
|
|
524
|
-
}
|
|
525
|
-
return undefined;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
class FeatureService {
|
|
530
|
-
constructor() { }
|
|
531
|
-
static filterFeaturesInArea(query) {
|
|
532
|
-
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
533
|
-
}
|
|
534
|
-
static booleanIntersects(g1, g2) {
|
|
535
|
-
if (g2.getType() === 'Point')
|
|
536
|
-
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
537
|
-
if (g2.getType() === 'Circle')
|
|
538
|
-
return g1.intersectsCoordinate(g2.getCenter());
|
|
539
|
-
if (g2.getType() === 'Polygon')
|
|
540
|
-
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
static calculateArea(g) {
|
|
544
|
-
if (!g)
|
|
545
|
-
return 0;
|
|
546
|
-
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
551
|
-
area;
|
|
552
|
-
ignore;
|
|
553
|
-
static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
|
|
554
|
-
constructor(area, ignore = new Set()) {
|
|
555
|
-
super();
|
|
556
|
-
this.area = area;
|
|
557
|
-
this.ignore = ignore;
|
|
558
|
-
}
|
|
559
|
-
get id() {
|
|
560
|
-
return GetFeaturesInAreaQuery.ID;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
class FilterFeaturesInAreaExecutor extends PostboyExecutor {
|
|
565
|
-
area;
|
|
566
|
-
features;
|
|
567
|
-
static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
|
|
568
|
-
constructor(area, features) {
|
|
569
|
-
super();
|
|
570
|
-
this.area = area;
|
|
571
|
-
this.features = features;
|
|
572
|
-
}
|
|
573
|
-
get id() {
|
|
574
|
-
return FilterFeaturesInAreaExecutor.ID;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
class GenerateDrawExecutor extends PostboyExecutor {
|
|
579
|
-
layer;
|
|
580
|
-
style;
|
|
581
|
-
type;
|
|
582
|
-
static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
583
|
-
constructor(layer, style, type) {
|
|
584
|
-
super();
|
|
585
|
-
this.layer = layer;
|
|
586
|
-
this.style = style;
|
|
587
|
-
this.type = type;
|
|
588
|
-
}
|
|
589
|
-
get id() {
|
|
590
|
-
return GenerateDrawExecutor.ID;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
class GenerateZoomControlExecutor extends PostboyExecutor {
|
|
595
|
-
settings;
|
|
596
|
-
static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
|
|
597
|
-
constructor(settings) {
|
|
598
|
-
super();
|
|
599
|
-
this.settings = settings;
|
|
600
|
-
}
|
|
601
|
-
get id() {
|
|
602
|
-
return GenerateZoomControlExecutor.ID;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
class ZoomControlFactory {
|
|
607
|
-
static build(settings) {
|
|
608
|
-
return new Zoom({
|
|
609
|
-
zoomInTipLabel: settings.zoomInLabel,
|
|
610
|
-
zoomOutTipLabel: settings.zoomOutLabel,
|
|
611
|
-
zoomInClassName: settings.zoomInClass,
|
|
612
|
-
zoomOutClassName: settings.zoomOutClass,
|
|
613
|
-
className: settings.controlClass,
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
class MapPostboyService extends PostboyService {
|
|
619
|
-
constructor() {
|
|
620
|
-
super();
|
|
621
|
-
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
622
|
-
}
|
|
623
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
624
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
625
|
-
}
|
|
626
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
627
|
-
type: Injectable
|
|
628
|
-
}], ctorParameters:
|
|
629
|
-
|
|
630
|
-
class MapManagementService {
|
|
631
|
-
postboy;
|
|
632
|
-
map;
|
|
633
|
-
layers = new Dictionary();
|
|
634
|
-
constructor(postboy) {
|
|
635
|
-
this.postboy = postboy;
|
|
636
|
-
}
|
|
637
|
-
up() {
|
|
638
|
-
this.observeMapRender();
|
|
639
|
-
this.observeAddLayer();
|
|
640
|
-
this.observeRemoveLayer();
|
|
641
|
-
this.observePlaceFeatures();
|
|
642
|
-
this.observeAddTile();
|
|
643
|
-
this.observeRemoveTile();
|
|
644
|
-
this.observeLayerQuery();
|
|
645
|
-
this.observeFeaturesInArea();
|
|
646
|
-
}
|
|
647
|
-
observeRemoveTile() {
|
|
648
|
-
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
649
|
-
if (!this.map)
|
|
650
|
-
return;
|
|
651
|
-
this.map.removeLayer(c.layer);
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
observeLayerQuery() {
|
|
655
|
-
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
|
|
656
|
-
}
|
|
657
|
-
observeAddTile() {
|
|
658
|
-
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
659
|
-
if (!this.map)
|
|
660
|
-
return;
|
|
661
|
-
this.map.addLayer(c.layer);
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
observeMapRender() {
|
|
665
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
666
|
-
this.map = m.map;
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
observeAddLayer() {
|
|
670
|
-
this.postboy.subscribe(AddLayerCommand.ID).subscribe((c) => {
|
|
671
|
-
if (!this.map)
|
|
672
|
-
return;
|
|
673
|
-
this.layers.put(c.layer.get('name'), c.layer);
|
|
674
|
-
this.map.addLayer(c.layer);
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
observePlaceFeatures() {
|
|
678
|
-
this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
|
|
679
|
-
if (!this.layers.has(c.layer))
|
|
680
|
-
return;
|
|
681
|
-
let source = this.layers.take(c.layer).getSource();
|
|
682
|
-
if (!!source['getSource'])
|
|
683
|
-
source = source?.getSource();
|
|
684
|
-
source?.clear();
|
|
685
|
-
!!c.features?.length && source?.addFeatures(c.features);
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
observeRemoveLayer() {
|
|
689
|
-
this.postboy.subscribe(RemoveLayerCommand.ID).subscribe((c) => {
|
|
690
|
-
if (!this.map)
|
|
691
|
-
return;
|
|
692
|
-
this.layers.rmv(c.layer.get('name'));
|
|
693
|
-
this.map.removeLayer(c.layer);
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
observeFeaturesInArea() {
|
|
697
|
-
this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
|
|
698
|
-
let result = new Dictionary();
|
|
699
|
-
this.layers.forEach((l) => {
|
|
700
|
-
let layerName = l.get('name');
|
|
701
|
-
if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
|
|
702
|
-
return;
|
|
703
|
-
let source = l.getSource();
|
|
704
|
-
if (!!source['getSource'])
|
|
705
|
-
source = source?.getSource();
|
|
706
|
-
let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
|
|
707
|
-
result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
|
|
708
|
-
});
|
|
709
|
-
qr.finish(result);
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
713
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
714
|
-
}
|
|
715
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
716
|
-
type: Injectable
|
|
717
|
-
}], ctorParameters:
|
|
718
|
-
|
|
719
|
-
class MapStateService {
|
|
720
|
-
postboy;
|
|
721
|
-
map;
|
|
722
|
-
constructor(postboy) {
|
|
723
|
-
this.postboy = postboy;
|
|
724
|
-
}
|
|
725
|
-
up() {
|
|
726
|
-
this.observeMapRendering();
|
|
727
|
-
this.observeCenter();
|
|
728
|
-
}
|
|
729
|
-
observeMapRendering() {
|
|
730
|
-
this.postboy
|
|
731
|
-
.subscribe(MapRenderedEvent.ID)
|
|
732
|
-
.pipe(first())
|
|
733
|
-
.subscribe((ev) => {
|
|
734
|
-
this.map = ev.map;
|
|
735
|
-
this.map?.on('moveend', () => {
|
|
736
|
-
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
737
|
-
const extent = this.map?.getView().calculateExtent() || [];
|
|
738
|
-
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
739
|
-
});
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
observeCenter() {
|
|
743
|
-
this.postboy.subscribe(SetMapCenterCommand.ID).subscribe((c) => {
|
|
744
|
-
this.map?.getView().setCenter([c.lng, c.lat]);
|
|
745
|
-
if (c.zoom)
|
|
746
|
-
this.map?.getView().setZoom(c.zoom);
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
750
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
751
|
-
}
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
753
|
-
type: Injectable
|
|
754
|
-
}], ctorParameters:
|
|
755
|
-
|
|
756
|
-
class MapFeatureService {
|
|
757
|
-
postboy;
|
|
758
|
-
map;
|
|
759
|
-
fitPolygonsWaiting;
|
|
760
|
-
constructor(postboy) {
|
|
761
|
-
this.postboy = postboy;
|
|
762
|
-
}
|
|
763
|
-
up() {
|
|
764
|
-
this.observeMapRender();
|
|
765
|
-
this.observeFitToFeatures();
|
|
766
|
-
this.observeFitToPolygons();
|
|
767
|
-
}
|
|
768
|
-
observeMapRender() {
|
|
769
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
770
|
-
this.map = m.map;
|
|
771
|
-
if (this.fitPolygonsWaiting)
|
|
772
|
-
this.postboy.fire(this.fitPolygonsWaiting);
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
observeFitToFeatures() {
|
|
776
|
-
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
|
|
777
|
-
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
observeFitToPolygons() {
|
|
781
|
-
this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
|
|
782
|
-
if (!this.map) {
|
|
783
|
-
this.fitPolygonsWaiting = cmd;
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
this.fitPolygonsWaiting = undefined;
|
|
787
|
-
this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
fitToGeometries(geometries, zoomAfter) {
|
|
791
|
-
if (!geometries?.length || !this.map)
|
|
792
|
-
return;
|
|
793
|
-
const extent = createEmpty();
|
|
794
|
-
geometries.forEach((g) => extend(extent, g.getExtent()));
|
|
795
|
-
this.map.getView().fit(extent);
|
|
796
|
-
this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
|
|
797
|
-
}
|
|
798
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
799
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
800
|
-
}
|
|
801
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
802
|
-
type: Injectable
|
|
803
|
-
}], ctorParameters:
|
|
804
|
-
|
|
805
|
-
class MapClickService {
|
|
806
|
-
postboy;
|
|
807
|
-
map;
|
|
808
|
-
constructor(postboy) {
|
|
809
|
-
this.postboy = postboy;
|
|
810
|
-
}
|
|
811
|
-
up() {
|
|
812
|
-
this.observeMapRender();
|
|
813
|
-
}
|
|
814
|
-
observeMapRender() {
|
|
815
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
816
|
-
this.map = m.map;
|
|
817
|
-
this.map?.on('singleclick', (e) => {
|
|
818
|
-
this.postboy.fire(this.onClick(e));
|
|
819
|
-
});
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
onClick(ev) {
|
|
823
|
-
const model = new MapClickEvent(ev.coordinate, {}, {});
|
|
824
|
-
this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
|
|
825
|
-
this.getFeatureCollectionWithInner([f])
|
|
826
|
-
.filter((f) => f.getId() != null)
|
|
827
|
-
.forEach((fs) => {
|
|
828
|
-
let layerName = l.get('name');
|
|
829
|
-
if (!model.entities[layerName])
|
|
830
|
-
model.entities[layerName] = [];
|
|
831
|
-
if (!model.features[layerName])
|
|
832
|
-
model.features[layerName] = [];
|
|
833
|
-
model.entities[layerName].push({ id: fs.getId(), ...fs.get(MapConstants.FeatureInfo) });
|
|
834
|
-
model.features[layerName].push(fs);
|
|
835
|
-
});
|
|
836
|
-
});
|
|
837
|
-
return model;
|
|
838
|
-
}
|
|
839
|
-
getFeatureCollectionWithInner(features) {
|
|
840
|
-
const result = [];
|
|
841
|
-
features?.forEach((f) => {
|
|
842
|
-
const innerFeatures = f.get('features');
|
|
843
|
-
innerFeatures?.length ? result.push(...innerFeatures) : result.push(f);
|
|
844
|
-
});
|
|
845
|
-
return result;
|
|
846
|
-
}
|
|
847
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
848
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
849
|
-
}
|
|
850
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
851
|
-
type: Injectable
|
|
852
|
-
}], ctorParameters:
|
|
853
|
-
|
|
854
|
-
class DrawingService {
|
|
855
|
-
postboy;
|
|
856
|
-
drawInteraction;
|
|
857
|
-
map;
|
|
858
|
-
constructor(postboy) {
|
|
859
|
-
this.postboy = postboy;
|
|
860
|
-
}
|
|
861
|
-
up() {
|
|
862
|
-
this.observeDrawing();
|
|
863
|
-
this.observeSelectArea();
|
|
864
|
-
this.observeMapRender();
|
|
865
|
-
}
|
|
866
|
-
observeSelectArea() {
|
|
867
|
-
this.postboy.subscribe(DrawSelectionAreaCommand.ID).subscribe((ev) => {
|
|
868
|
-
const drawingCommand = new StartDrawingCommand(ev.type, ev.style);
|
|
869
|
-
drawingCommand.result.subscribe((r) => {
|
|
870
|
-
if (!r) {
|
|
871
|
-
ev.finish(new Dictionary());
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
const area = PolygonModel.fromGeoJson(1, r).feature.getGeometry();
|
|
875
|
-
const getFeaturesCommand = new GetFeaturesInAreaQuery(area, ev.ignore);
|
|
876
|
-
getFeaturesCommand.result.subscribe((result) => ev.finish(result));
|
|
877
|
-
this.postboy.fire(getFeaturesCommand);
|
|
878
|
-
});
|
|
879
|
-
this.postboy.fire(drawingCommand);
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
observeDrawing() {
|
|
883
|
-
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
884
|
-
this.draw((l) => {
|
|
885
|
-
if (!l || !this.map) {
|
|
886
|
-
this.clearInteraction(l);
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
const cancelSub = this.observeCancelation(ev, l);
|
|
890
|
-
this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
|
|
891
|
-
this.map?.addInteraction(this.drawInteraction);
|
|
892
|
-
this.drawInteraction.on('drawend', (evt) => {
|
|
893
|
-
cancelSub.unsubscribe();
|
|
894
|
-
this.onEnd(evt, ev, l);
|
|
895
|
-
});
|
|
896
|
-
});
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
onEnd(evt, command, layer) {
|
|
900
|
-
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
901
|
-
? new GeoJSON().writeFeature(evt.feature)
|
|
902
|
-
: new WKT().writeFeature(evt.feature));
|
|
903
|
-
this.clearInteraction(layer);
|
|
904
|
-
}
|
|
905
|
-
observeMapRender() {
|
|
906
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
907
|
-
this.map = m.map;
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
draw(action) {
|
|
911
|
-
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
912
|
-
query.result.subscribe((l) => action(l));
|
|
913
|
-
this.postboy.fire(query);
|
|
914
|
-
}
|
|
915
|
-
observeCancelation(ev, layer) {
|
|
916
|
-
return this.postboy
|
|
917
|
-
.subscribe(CancelDrawingCommand.ID)
|
|
918
|
-
.pipe(first())
|
|
919
|
-
.subscribe(() => {
|
|
920
|
-
ev.finish(null);
|
|
921
|
-
this.clearInteraction(layer);
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
clearInteraction(layer) {
|
|
925
|
-
if (!!this.drawInteraction) {
|
|
926
|
-
this.map?.removeInteraction(this.drawInteraction);
|
|
927
|
-
layer?.setSource(new Vector({}));
|
|
928
|
-
}
|
|
929
|
-
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
930
|
-
}
|
|
931
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
932
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
933
|
-
}
|
|
934
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
935
|
-
type: Injectable
|
|
936
|
-
}], ctorParameters:
|
|
937
|
-
|
|
938
|
-
class FeatureModificationService {
|
|
939
|
-
postboy;
|
|
940
|
-
modify;
|
|
941
|
-
translate;
|
|
942
|
-
map;
|
|
943
|
-
constructor(postboy) {
|
|
944
|
-
this.postboy = postboy;
|
|
945
|
-
}
|
|
946
|
-
up() {
|
|
947
|
-
this.observeModification();
|
|
948
|
-
this.observeMapRender();
|
|
949
|
-
}
|
|
950
|
-
observeModification() {
|
|
951
|
-
this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
|
|
952
|
-
this.defineLayer((l) => {
|
|
953
|
-
if (!l || !this.map) {
|
|
954
|
-
this.clearInteraction(l);
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
this.observeCancelation(ev, l);
|
|
958
|
-
this.initFeature(l, ev.model.feature);
|
|
959
|
-
this.addModify(ev);
|
|
960
|
-
this.addDragging(ev);
|
|
961
|
-
});
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
initFeature(layer, feature) {
|
|
965
|
-
layer.getSource()?.clear();
|
|
966
|
-
layer.getSource()?.addFeature(feature);
|
|
967
|
-
}
|
|
968
|
-
addModify(command) {
|
|
969
|
-
this.modify = new Modify({
|
|
970
|
-
features: new Collection([command.model.feature]),
|
|
971
|
-
style: command.style,
|
|
972
|
-
});
|
|
973
|
-
this.modify.on('modifyend', () => {
|
|
974
|
-
this.onModified(command);
|
|
975
|
-
command.model.feature.changed();
|
|
976
|
-
});
|
|
977
|
-
this.map?.addInteraction(this.modify);
|
|
978
|
-
}
|
|
979
|
-
addDragging(command) {
|
|
980
|
-
this.translate = new Translate({
|
|
981
|
-
features: new Collection([command.model.feature]),
|
|
982
|
-
condition: (ev) => {
|
|
983
|
-
const clone = command.model.feature.clone();
|
|
984
|
-
clone.getGeometry()?.scale(0.999);
|
|
985
|
-
return clone.getGeometry().intersectsCoordinate(ev.coordinate);
|
|
986
|
-
},
|
|
987
|
-
});
|
|
988
|
-
this.translate.on('translateend', () => this.onModified(command));
|
|
989
|
-
this.map?.addInteraction(this.translate);
|
|
990
|
-
}
|
|
991
|
-
onModified(command) {
|
|
992
|
-
command.next(command.format === FeatureOutputFormat.GeoJson
|
|
993
|
-
? new GeoJSON().writeFeature(command.model.feature)
|
|
994
|
-
: new WKT().writeFeature(command.model.feature));
|
|
995
|
-
}
|
|
996
|
-
observeMapRender() {
|
|
997
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
998
|
-
this.map = m.map;
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
defineLayer(action) {
|
|
1002
|
-
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
1003
|
-
query.result.subscribe((l) => action(l));
|
|
1004
|
-
this.postboy.fire(query);
|
|
1005
|
-
}
|
|
1006
|
-
observeCancelation(ev, layer) {
|
|
1007
|
-
return this.postboy
|
|
1008
|
-
.subscribe(CancelFeatureModificationCommand.ID)
|
|
1009
|
-
.pipe(first())
|
|
1010
|
-
.subscribe(() => {
|
|
1011
|
-
ev.finish(null);
|
|
1012
|
-
this.clearInteraction(layer);
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
clearInteraction(layer) {
|
|
1016
|
-
if (this.modify)
|
|
1017
|
-
this.map?.removeInteraction(this.modify);
|
|
1018
|
-
if (this.translate)
|
|
1019
|
-
this.map?.removeInteraction(this.translate);
|
|
1020
|
-
}
|
|
1021
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1022
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1023
|
-
}
|
|
1024
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1025
|
-
type: Injectable
|
|
1026
|
-
}], ctorParameters:
|
|
1027
|
-
|
|
1028
|
-
class ControlsService {
|
|
1029
|
-
postboy;
|
|
1030
|
-
map;
|
|
1031
|
-
constructor(postboy) {
|
|
1032
|
-
this.postboy = postboy;
|
|
1033
|
-
}
|
|
1034
|
-
up() {
|
|
1035
|
-
this.observeMapRender();
|
|
1036
|
-
}
|
|
1037
|
-
observeMapRender() {
|
|
1038
|
-
this.postboy
|
|
1039
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1040
|
-
.pipe(first())
|
|
1041
|
-
.subscribe((m) => {
|
|
1042
|
-
this.map = m.map;
|
|
1043
|
-
this.observeAdding();
|
|
1044
|
-
this.observeRemoving();
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
observeAdding() {
|
|
1048
|
-
this.postboy.subscribe(AddControlCommand.ID).subscribe((c) => this.map?.addControl(c.item));
|
|
1049
|
-
}
|
|
1050
|
-
observeRemoving() {
|
|
1051
|
-
this.postboy
|
|
1052
|
-
.subscribe(RemoveControlCommand.ID)
|
|
1053
|
-
.subscribe((c) => this.map?.removeControl(c.item));
|
|
1054
|
-
}
|
|
1055
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1056
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1057
|
-
}
|
|
1058
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1059
|
-
type: Injectable
|
|
1060
|
-
}], ctorParameters:
|
|
1061
|
-
|
|
1062
|
-
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
1063
|
-
constructor(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
|
|
1064
|
-
super(service);
|
|
1065
|
-
this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
|
|
1066
|
-
}
|
|
1067
|
-
_up() {
|
|
1068
|
-
this.registerReplay(MapRenderedEvent.ID);
|
|
1069
|
-
this.registerReplay(PlaceLayerFeaturesCommand.ID);
|
|
1070
|
-
this.registerReplay(RemoveControlCommand.ID);
|
|
1071
|
-
this.registerReplay(AddControlCommand.ID);
|
|
1072
|
-
this.registerReplay(SetMapCenterCommand.ID);
|
|
1073
|
-
this.registerSubject(AddLayerCommand.ID);
|
|
1074
|
-
this.registerSubject(RemoveLayerCommand.ID);
|
|
1075
|
-
this.registerSubject(AddTileCommand.ID);
|
|
1076
|
-
this.registerSubject(RemoveTileCommand.ID);
|
|
1077
|
-
this.registerSubject(MapClickEvent.ID);
|
|
1078
|
-
this.registerSubject(CloseTooltipCommand.ID);
|
|
1079
|
-
this.registerSubject(FitToFeaturesCommand.ID);
|
|
1080
|
-
this.registerSubject(FitToPolygonsCommand.ID);
|
|
1081
|
-
this.registerSubject(MapMoveEndEvent.ID);
|
|
1082
|
-
this.registerSubject(CancelDrawingCommand.ID);
|
|
1083
|
-
this.registerSubject(StartDrawingCommand.ID);
|
|
1084
|
-
this.registerSubject(GetLayerQuery.ID);
|
|
1085
|
-
this.registerSubject(DrawingFinishedEvent.ID);
|
|
1086
|
-
this.registerSubject(GetFeaturesInAreaQuery.ID);
|
|
1087
|
-
this.registerSubject(DrawSelectionAreaCommand.ID);
|
|
1088
|
-
this.registerSubject(CancelFeatureModificationCommand.ID);
|
|
1089
|
-
this.registerSubject(ModifyFeatureCommand.ID);
|
|
1090
|
-
this.setExecutors();
|
|
1091
|
-
}
|
|
1092
|
-
setExecutors() {
|
|
1093
|
-
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
1094
|
-
this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
|
|
1095
|
-
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
1096
|
-
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
1097
|
-
}
|
|
1098
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1099
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1100
|
-
}
|
|
1101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1102
|
-
type: Injectable
|
|
1103
|
-
}], ctorParameters:
|
|
1104
|
-
|
|
1105
|
-
class TileLayerSettings {
|
|
1106
|
-
maxZoom = 19;
|
|
1107
|
-
minZoom = 0;
|
|
1108
|
-
opacity = 0.6;
|
|
1109
|
-
url = '';
|
|
1110
|
-
projection = 'EPSG:3857';
|
|
1111
|
-
static copy(model) {
|
|
1112
|
-
const result = new TileLayerSettings();
|
|
1113
|
-
result.maxZoom = model.maxZoom;
|
|
1114
|
-
result.minZoom = model.minZoom;
|
|
1115
|
-
result.projection = model.projection;
|
|
1116
|
-
result.opacity = model.opacity;
|
|
1117
|
-
result.url = model.url;
|
|
1118
|
-
return result;
|
|
1119
|
-
}
|
|
1120
|
-
setUrl(url) {
|
|
1121
|
-
return TileLayerSettings.copy({ ...this, url });
|
|
1122
|
-
}
|
|
1123
|
-
setMaxZoom(maxZoom) {
|
|
1124
|
-
return TileLayerSettings.copy({ ...this, maxZoom });
|
|
1125
|
-
}
|
|
1126
|
-
setMinZoom(minZoom) {
|
|
1127
|
-
return TileLayerSettings.copy({ ...this, minZoom });
|
|
1128
|
-
}
|
|
1129
|
-
setOpacity(opacity) {
|
|
1130
|
-
return TileLayerSettings.copy({ ...this, opacity });
|
|
1131
|
-
}
|
|
1132
|
-
setProjection(projection) {
|
|
1133
|
-
return TileLayerSettings.copy({ ...this, projection });
|
|
1134
|
-
}
|
|
1135
|
-
isSame(model) {
|
|
1136
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1137
|
-
return false;
|
|
1138
|
-
if (this.minZoom !== model.minZoom)
|
|
1139
|
-
return false;
|
|
1140
|
-
if (this.url !== model.url)
|
|
1141
|
-
return false;
|
|
1142
|
-
if (this.projection !== model.projection)
|
|
1143
|
-
return false;
|
|
1144
|
-
if (this.opacity !== model.opacity)
|
|
1145
|
-
return false;
|
|
1146
|
-
return true;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
class TileLayerFactory {
|
|
1151
|
-
build(settings) {
|
|
1152
|
-
const source = new XYZ({
|
|
1153
|
-
tileSize: 256,
|
|
1154
|
-
maxZoom: settings.maxZoom || 14,
|
|
1155
|
-
minZoom: settings.minZoom || 1,
|
|
1156
|
-
projection: get(settings.projection),
|
|
1157
|
-
tileUrlFunction: this.getTileFunc(settings),
|
|
1158
|
-
crossOrigin: 'Anonymous',
|
|
1159
|
-
});
|
|
1160
|
-
return new TileLayer({ source, opacity: settings.opacity });
|
|
1161
|
-
}
|
|
1162
|
-
getTileFunc(settings) {
|
|
1163
|
-
return (tileCoord) => {
|
|
1164
|
-
const zoom = tileCoord[0];
|
|
1165
|
-
const x = tileCoord[1];
|
|
1166
|
-
const y = tileCoord[2];
|
|
1167
|
-
const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
1168
|
-
const bound = 1 << zoom;
|
|
1169
|
-
return settings.url
|
|
1170
|
-
.replace('{x}', String(normalizedCoord?.x || x))
|
|
1171
|
-
.replace('{z}', String(zoom))
|
|
1172
|
-
.replace('{y}', String(bound - (normalizedCoord?.y || y) - 1));
|
|
1173
|
-
};
|
|
1174
|
-
}
|
|
1175
|
-
getNormalizedCoord(coord, zoom) {
|
|
1176
|
-
const y = coord.y;
|
|
1177
|
-
let x = coord.x;
|
|
1178
|
-
const tileRange = 1 << zoom;
|
|
1179
|
-
if (y < 0 || y >= tileRange)
|
|
1180
|
-
return null;
|
|
1181
|
-
if (x < 0 || x >= tileRange)
|
|
1182
|
-
x = ((x % tileRange) + tileRange) % tileRange;
|
|
1183
|
-
return { x: x, y: y };
|
|
1184
|
-
}
|
|
1185
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1186
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1187
|
-
}
|
|
1188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1189
|
-
type: Injectable,
|
|
1190
|
-
args: [{
|
|
1191
|
-
providedIn: 'root',
|
|
1192
|
-
}]
|
|
204
|
+
/**
|
|
205
|
+
*
|
|
206
|
+
* A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
|
|
207
|
+
* This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
|
|
208
|
+
* var myControl = new Control({element: myElement}); and then adding this to the map.
|
|
209
|
+
* The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
|
|
210
|
+
* You can also extend this base for your own control class. See examples/custom-controls for an example of how to do this.
|
|
211
|
+
*/
|
|
212
|
+
class MapControl extends Control {
|
|
213
|
+
constructor(options) {
|
|
214
|
+
super(options);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
219
|
+
map;
|
|
220
|
+
static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
221
|
+
constructor(map) {
|
|
222
|
+
super();
|
|
223
|
+
this.map = map;
|
|
224
|
+
}
|
|
225
|
+
get id() {
|
|
226
|
+
return MapRenderedEvent.ID;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
231
|
+
coordinates;
|
|
232
|
+
entities;
|
|
233
|
+
features;
|
|
234
|
+
static ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
235
|
+
constructor(coordinates, entities, features) {
|
|
236
|
+
super();
|
|
237
|
+
this.coordinates = coordinates;
|
|
238
|
+
this.entities = entities;
|
|
239
|
+
this.features = features;
|
|
240
|
+
}
|
|
241
|
+
get id() {
|
|
242
|
+
return MapClickEvent.ID;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
247
|
+
zoom;
|
|
248
|
+
extent;
|
|
249
|
+
static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
250
|
+
constructor(zoom, extent) {
|
|
251
|
+
super();
|
|
252
|
+
this.zoom = zoom;
|
|
253
|
+
this.extent = extent;
|
|
254
|
+
}
|
|
255
|
+
get id() {
|
|
256
|
+
return MapMoveEndEvent.ID;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
261
|
+
tooltipId;
|
|
262
|
+
static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
263
|
+
constructor(tooltipId) {
|
|
264
|
+
super();
|
|
265
|
+
this.tooltipId = tooltipId;
|
|
266
|
+
}
|
|
267
|
+
get id() {
|
|
268
|
+
return CloseTooltipCommand.ID;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
273
|
+
type;
|
|
274
|
+
style;
|
|
275
|
+
format;
|
|
276
|
+
static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
277
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
278
|
+
super();
|
|
279
|
+
this.type = type;
|
|
280
|
+
this.style = style;
|
|
281
|
+
this.format = format;
|
|
282
|
+
}
|
|
283
|
+
get id() {
|
|
284
|
+
return StartDrawingCommand.ID;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
289
|
+
static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
290
|
+
get id() {
|
|
291
|
+
return CancelDrawingCommand.ID;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
class DrawSelectionAreaCommand extends PostboyCallbackMessage {
|
|
296
|
+
type;
|
|
297
|
+
style;
|
|
298
|
+
ignore;
|
|
299
|
+
static ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
|
|
300
|
+
constructor(type, style, ignore = new Set()) {
|
|
301
|
+
super();
|
|
302
|
+
this.type = type;
|
|
303
|
+
this.style = style;
|
|
304
|
+
this.ignore = ignore;
|
|
305
|
+
}
|
|
306
|
+
get id() {
|
|
307
|
+
return DrawSelectionAreaCommand.ID;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
class ModifyFeatureCommand extends PostboyCallbackMessage {
|
|
312
|
+
model;
|
|
313
|
+
style;
|
|
314
|
+
format;
|
|
315
|
+
static ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
|
|
316
|
+
constructor(model, style, format = FeatureOutputFormat.GeoJson) {
|
|
317
|
+
super();
|
|
318
|
+
this.model = model;
|
|
319
|
+
this.style = style;
|
|
320
|
+
this.format = format;
|
|
321
|
+
}
|
|
322
|
+
get id() {
|
|
323
|
+
return ModifyFeatureCommand.ID;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
class CancelFeatureModificationCommand extends PostboyGenericMessage {
|
|
328
|
+
static ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
|
|
329
|
+
get id() {
|
|
330
|
+
return CancelFeatureModificationCommand.ID;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
class AddControlCommand extends PostboyGenericMessage {
|
|
335
|
+
item;
|
|
336
|
+
static ID = '8e1c06eb-b395-4fe1-929c-ebf0805eeb49';
|
|
337
|
+
constructor(item) {
|
|
338
|
+
super();
|
|
339
|
+
this.item = item;
|
|
340
|
+
}
|
|
341
|
+
get id() {
|
|
342
|
+
return AddControlCommand.ID;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
class RemoveControlCommand extends PostboyGenericMessage {
|
|
347
|
+
item;
|
|
348
|
+
static ID = '361641e0-804a-4930-8c27-0cea6330dbfc';
|
|
349
|
+
constructor(item) {
|
|
350
|
+
super();
|
|
351
|
+
this.item = item;
|
|
352
|
+
}
|
|
353
|
+
get id() {
|
|
354
|
+
return RemoveControlCommand.ID;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Forces map to move to a specific point
|
|
360
|
+
*/
|
|
361
|
+
class SetMapCenterCommand extends PostboyGenericMessage {
|
|
362
|
+
lat;
|
|
363
|
+
lng;
|
|
364
|
+
zoom;
|
|
365
|
+
static ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
|
|
366
|
+
/**
|
|
367
|
+
*
|
|
368
|
+
* @param lat - the desired latitude
|
|
369
|
+
* @param lng - the desired longitude
|
|
370
|
+
* @param zoom - the desired zoom; doesn't change zoom if undefined
|
|
371
|
+
*/
|
|
372
|
+
constructor(lat, lng, zoom) {
|
|
373
|
+
super();
|
|
374
|
+
this.lat = lat;
|
|
375
|
+
this.lng = lng;
|
|
376
|
+
this.zoom = zoom;
|
|
377
|
+
}
|
|
378
|
+
get id() {
|
|
379
|
+
return SetMapCenterCommand.ID;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
class CalculateAreaExecutor extends PostboyExecutor {
|
|
384
|
+
polygon;
|
|
385
|
+
static ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
|
|
386
|
+
constructor(polygon) {
|
|
387
|
+
super();
|
|
388
|
+
this.polygon = polygon;
|
|
389
|
+
}
|
|
390
|
+
get id() {
|
|
391
|
+
return CalculateAreaExecutor.ID;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
class FitToPolygonsCommand extends PostboyGenericMessage {
|
|
396
|
+
features;
|
|
397
|
+
zoomAfter;
|
|
398
|
+
static ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
|
|
399
|
+
constructor(features, zoomAfter = 0) {
|
|
400
|
+
super();
|
|
401
|
+
this.features = features;
|
|
402
|
+
this.zoomAfter = zoomAfter;
|
|
403
|
+
}
|
|
404
|
+
get id() {
|
|
405
|
+
return FitToPolygonsCommand.ID;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
410
|
+
layer;
|
|
411
|
+
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
412
|
+
constructor(layer) {
|
|
413
|
+
super();
|
|
414
|
+
this.layer = layer;
|
|
415
|
+
}
|
|
416
|
+
get id() {
|
|
417
|
+
return AddLayerCommand.ID;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
422
|
+
layer;
|
|
423
|
+
features;
|
|
424
|
+
static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
425
|
+
constructor(layer, features) {
|
|
426
|
+
super();
|
|
427
|
+
this.layer = layer;
|
|
428
|
+
this.features = features;
|
|
429
|
+
}
|
|
430
|
+
get id() {
|
|
431
|
+
return PlaceLayerFeaturesCommand.ID;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
436
|
+
layer;
|
|
437
|
+
static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
438
|
+
constructor(layer) {
|
|
439
|
+
super();
|
|
440
|
+
this.layer = layer;
|
|
441
|
+
}
|
|
442
|
+
get id() {
|
|
443
|
+
return RemoveLayerCommand.ID;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
448
|
+
layer;
|
|
449
|
+
static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
450
|
+
constructor(layer) {
|
|
451
|
+
super();
|
|
452
|
+
this.layer = layer;
|
|
453
|
+
}
|
|
454
|
+
get id() {
|
|
455
|
+
return AddTileCommand.ID;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
460
|
+
layer;
|
|
461
|
+
static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
462
|
+
constructor(layer) {
|
|
463
|
+
super();
|
|
464
|
+
this.layer = layer;
|
|
465
|
+
}
|
|
466
|
+
get id() {
|
|
467
|
+
return RemoveTileCommand.ID;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
472
|
+
features;
|
|
473
|
+
zoomAfter;
|
|
474
|
+
static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
475
|
+
constructor(features, zoomAfter = 0) {
|
|
476
|
+
super();
|
|
477
|
+
this.features = features;
|
|
478
|
+
this.zoomAfter = zoomAfter;
|
|
479
|
+
}
|
|
480
|
+
get id() {
|
|
481
|
+
return FitToFeaturesCommand.ID;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
486
|
+
name;
|
|
487
|
+
static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
488
|
+
constructor(name) {
|
|
489
|
+
super();
|
|
490
|
+
this.name = name;
|
|
491
|
+
}
|
|
492
|
+
get id() {
|
|
493
|
+
return GetLayerQuery.ID;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
498
|
+
static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
499
|
+
constructor() {
|
|
500
|
+
super();
|
|
501
|
+
}
|
|
502
|
+
get id() {
|
|
503
|
+
return DrawingFinishedEvent.ID;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
class DrawingGenerationService {
|
|
508
|
+
static getDraw(ev) {
|
|
509
|
+
return new Draw({
|
|
510
|
+
source: ev.layer.getSource(),
|
|
511
|
+
type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
|
|
512
|
+
style: ev.style,
|
|
513
|
+
geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
static geometryFunc(type) {
|
|
517
|
+
switch (type) {
|
|
518
|
+
case DrawingType.Circle:
|
|
519
|
+
return createRegularPolygon(32);
|
|
520
|
+
case DrawingType.Box:
|
|
521
|
+
return createBox();
|
|
522
|
+
case DrawingType.Square:
|
|
523
|
+
return createRegularPolygon(4);
|
|
524
|
+
}
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
class FeatureService {
|
|
530
|
+
constructor() { }
|
|
531
|
+
static filterFeaturesInArea(query) {
|
|
532
|
+
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
533
|
+
}
|
|
534
|
+
static booleanIntersects(g1, g2) {
|
|
535
|
+
if (g2.getType() === 'Point')
|
|
536
|
+
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
537
|
+
if (g2.getType() === 'Circle')
|
|
538
|
+
return g1.intersectsCoordinate(g2.getCenter());
|
|
539
|
+
if (g2.getType() === 'Polygon')
|
|
540
|
+
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
static calculateArea(g) {
|
|
544
|
+
if (!g)
|
|
545
|
+
return 0;
|
|
546
|
+
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
551
|
+
area;
|
|
552
|
+
ignore;
|
|
553
|
+
static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
|
|
554
|
+
constructor(area, ignore = new Set()) {
|
|
555
|
+
super();
|
|
556
|
+
this.area = area;
|
|
557
|
+
this.ignore = ignore;
|
|
558
|
+
}
|
|
559
|
+
get id() {
|
|
560
|
+
return GetFeaturesInAreaQuery.ID;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
class FilterFeaturesInAreaExecutor extends PostboyExecutor {
|
|
565
|
+
area;
|
|
566
|
+
features;
|
|
567
|
+
static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
|
|
568
|
+
constructor(area, features) {
|
|
569
|
+
super();
|
|
570
|
+
this.area = area;
|
|
571
|
+
this.features = features;
|
|
572
|
+
}
|
|
573
|
+
get id() {
|
|
574
|
+
return FilterFeaturesInAreaExecutor.ID;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
class GenerateDrawExecutor extends PostboyExecutor {
|
|
579
|
+
layer;
|
|
580
|
+
style;
|
|
581
|
+
type;
|
|
582
|
+
static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
583
|
+
constructor(layer, style, type) {
|
|
584
|
+
super();
|
|
585
|
+
this.layer = layer;
|
|
586
|
+
this.style = style;
|
|
587
|
+
this.type = type;
|
|
588
|
+
}
|
|
589
|
+
get id() {
|
|
590
|
+
return GenerateDrawExecutor.ID;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
class GenerateZoomControlExecutor extends PostboyExecutor {
|
|
595
|
+
settings;
|
|
596
|
+
static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
|
|
597
|
+
constructor(settings) {
|
|
598
|
+
super();
|
|
599
|
+
this.settings = settings;
|
|
600
|
+
}
|
|
601
|
+
get id() {
|
|
602
|
+
return GenerateZoomControlExecutor.ID;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
class ZoomControlFactory {
|
|
607
|
+
static build(settings) {
|
|
608
|
+
return new Zoom({
|
|
609
|
+
zoomInTipLabel: settings.zoomInLabel,
|
|
610
|
+
zoomOutTipLabel: settings.zoomOutLabel,
|
|
611
|
+
zoomInClassName: settings.zoomInClass,
|
|
612
|
+
zoomOutClassName: settings.zoomOutClass,
|
|
613
|
+
className: settings.controlClass,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
class MapPostboyService extends PostboyService {
|
|
619
|
+
constructor() {
|
|
620
|
+
super();
|
|
621
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
622
|
+
}
|
|
623
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
624
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService });
|
|
625
|
+
}
|
|
626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
627
|
+
type: Injectable
|
|
628
|
+
}], ctorParameters: () => [] });
|
|
629
|
+
|
|
630
|
+
class MapManagementService {
|
|
631
|
+
postboy;
|
|
632
|
+
map;
|
|
633
|
+
layers = new Dictionary();
|
|
634
|
+
constructor(postboy) {
|
|
635
|
+
this.postboy = postboy;
|
|
636
|
+
}
|
|
637
|
+
up() {
|
|
638
|
+
this.observeMapRender();
|
|
639
|
+
this.observeAddLayer();
|
|
640
|
+
this.observeRemoveLayer();
|
|
641
|
+
this.observePlaceFeatures();
|
|
642
|
+
this.observeAddTile();
|
|
643
|
+
this.observeRemoveTile();
|
|
644
|
+
this.observeLayerQuery();
|
|
645
|
+
this.observeFeaturesInArea();
|
|
646
|
+
}
|
|
647
|
+
observeRemoveTile() {
|
|
648
|
+
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
649
|
+
if (!this.map)
|
|
650
|
+
return;
|
|
651
|
+
this.map.removeLayer(c.layer);
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
observeLayerQuery() {
|
|
655
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
|
|
656
|
+
}
|
|
657
|
+
observeAddTile() {
|
|
658
|
+
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
659
|
+
if (!this.map)
|
|
660
|
+
return;
|
|
661
|
+
this.map.addLayer(c.layer);
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
observeMapRender() {
|
|
665
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
666
|
+
this.map = m.map;
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
observeAddLayer() {
|
|
670
|
+
this.postboy.subscribe(AddLayerCommand.ID).subscribe((c) => {
|
|
671
|
+
if (!this.map)
|
|
672
|
+
return;
|
|
673
|
+
this.layers.put(c.layer.get('name'), c.layer);
|
|
674
|
+
this.map.addLayer(c.layer);
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
observePlaceFeatures() {
|
|
678
|
+
this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
|
|
679
|
+
if (!this.layers.has(c.layer))
|
|
680
|
+
return;
|
|
681
|
+
let source = this.layers.take(c.layer).getSource();
|
|
682
|
+
if (!!source['getSource'])
|
|
683
|
+
source = source?.getSource();
|
|
684
|
+
source?.clear();
|
|
685
|
+
!!c.features?.length && source?.addFeatures(c.features);
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
observeRemoveLayer() {
|
|
689
|
+
this.postboy.subscribe(RemoveLayerCommand.ID).subscribe((c) => {
|
|
690
|
+
if (!this.map)
|
|
691
|
+
return;
|
|
692
|
+
this.layers.rmv(c.layer.get('name'));
|
|
693
|
+
this.map.removeLayer(c.layer);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
observeFeaturesInArea() {
|
|
697
|
+
this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
|
|
698
|
+
let result = new Dictionary();
|
|
699
|
+
this.layers.forEach((l) => {
|
|
700
|
+
let layerName = l.get('name');
|
|
701
|
+
if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
|
|
702
|
+
return;
|
|
703
|
+
let source = l.getSource();
|
|
704
|
+
if (!!source['getSource'])
|
|
705
|
+
source = source?.getSource();
|
|
706
|
+
let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
|
|
707
|
+
result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
|
|
708
|
+
});
|
|
709
|
+
qr.finish(result);
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
713
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService });
|
|
714
|
+
}
|
|
715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService, decorators: [{
|
|
716
|
+
type: Injectable
|
|
717
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
718
|
+
|
|
719
|
+
class MapStateService {
|
|
720
|
+
postboy;
|
|
721
|
+
map;
|
|
722
|
+
constructor(postboy) {
|
|
723
|
+
this.postboy = postboy;
|
|
724
|
+
}
|
|
725
|
+
up() {
|
|
726
|
+
this.observeMapRendering();
|
|
727
|
+
this.observeCenter();
|
|
728
|
+
}
|
|
729
|
+
observeMapRendering() {
|
|
730
|
+
this.postboy
|
|
731
|
+
.subscribe(MapRenderedEvent.ID)
|
|
732
|
+
.pipe(first())
|
|
733
|
+
.subscribe((ev) => {
|
|
734
|
+
this.map = ev.map;
|
|
735
|
+
this.map?.on('moveend', () => {
|
|
736
|
+
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
737
|
+
const extent = this.map?.getView().calculateExtent() || [];
|
|
738
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
observeCenter() {
|
|
743
|
+
this.postboy.subscribe(SetMapCenterCommand.ID).subscribe((c) => {
|
|
744
|
+
this.map?.getView().setCenter([c.lng, c.lat]);
|
|
745
|
+
if (c.zoom)
|
|
746
|
+
this.map?.getView().setZoom(c.zoom);
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
750
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService });
|
|
751
|
+
}
|
|
752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService, decorators: [{
|
|
753
|
+
type: Injectable
|
|
754
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
755
|
+
|
|
756
|
+
class MapFeatureService {
|
|
757
|
+
postboy;
|
|
758
|
+
map;
|
|
759
|
+
fitPolygonsWaiting;
|
|
760
|
+
constructor(postboy) {
|
|
761
|
+
this.postboy = postboy;
|
|
762
|
+
}
|
|
763
|
+
up() {
|
|
764
|
+
this.observeMapRender();
|
|
765
|
+
this.observeFitToFeatures();
|
|
766
|
+
this.observeFitToPolygons();
|
|
767
|
+
}
|
|
768
|
+
observeMapRender() {
|
|
769
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
770
|
+
this.map = m.map;
|
|
771
|
+
if (this.fitPolygonsWaiting)
|
|
772
|
+
this.postboy.fire(this.fitPolygonsWaiting);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
observeFitToFeatures() {
|
|
776
|
+
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
|
|
777
|
+
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
observeFitToPolygons() {
|
|
781
|
+
this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
|
|
782
|
+
if (!this.map) {
|
|
783
|
+
this.fitPolygonsWaiting = cmd;
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
this.fitPolygonsWaiting = undefined;
|
|
787
|
+
this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
fitToGeometries(geometries, zoomAfter) {
|
|
791
|
+
if (!geometries?.length || !this.map)
|
|
792
|
+
return;
|
|
793
|
+
const extent = createEmpty();
|
|
794
|
+
geometries.forEach((g) => extend(extent, g.getExtent()));
|
|
795
|
+
this.map.getView().fit(extent);
|
|
796
|
+
this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
|
|
797
|
+
}
|
|
798
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
799
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService });
|
|
800
|
+
}
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService, decorators: [{
|
|
802
|
+
type: Injectable
|
|
803
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
804
|
+
|
|
805
|
+
class MapClickService {
|
|
806
|
+
postboy;
|
|
807
|
+
map;
|
|
808
|
+
constructor(postboy) {
|
|
809
|
+
this.postboy = postboy;
|
|
810
|
+
}
|
|
811
|
+
up() {
|
|
812
|
+
this.observeMapRender();
|
|
813
|
+
}
|
|
814
|
+
observeMapRender() {
|
|
815
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
816
|
+
this.map = m.map;
|
|
817
|
+
this.map?.on('singleclick', (e) => {
|
|
818
|
+
this.postboy.fire(this.onClick(e));
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
onClick(ev) {
|
|
823
|
+
const model = new MapClickEvent(ev.coordinate, {}, {});
|
|
824
|
+
this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
|
|
825
|
+
this.getFeatureCollectionWithInner([f])
|
|
826
|
+
.filter((f) => f.getId() != null)
|
|
827
|
+
.forEach((fs) => {
|
|
828
|
+
let layerName = l.get('name');
|
|
829
|
+
if (!model.entities[layerName])
|
|
830
|
+
model.entities[layerName] = [];
|
|
831
|
+
if (!model.features[layerName])
|
|
832
|
+
model.features[layerName] = [];
|
|
833
|
+
model.entities[layerName].push({ id: fs.getId(), ...fs.get(MapConstants.FeatureInfo) });
|
|
834
|
+
model.features[layerName].push(fs);
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
return model;
|
|
838
|
+
}
|
|
839
|
+
getFeatureCollectionWithInner(features) {
|
|
840
|
+
const result = [];
|
|
841
|
+
features?.forEach((f) => {
|
|
842
|
+
const innerFeatures = f.get('features');
|
|
843
|
+
innerFeatures?.length ? result.push(...innerFeatures) : result.push(f);
|
|
844
|
+
});
|
|
845
|
+
return result;
|
|
846
|
+
}
|
|
847
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
848
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService });
|
|
849
|
+
}
|
|
850
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService, decorators: [{
|
|
851
|
+
type: Injectable
|
|
852
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
853
|
+
|
|
854
|
+
class DrawingService {
|
|
855
|
+
postboy;
|
|
856
|
+
drawInteraction;
|
|
857
|
+
map;
|
|
858
|
+
constructor(postboy) {
|
|
859
|
+
this.postboy = postboy;
|
|
860
|
+
}
|
|
861
|
+
up() {
|
|
862
|
+
this.observeDrawing();
|
|
863
|
+
this.observeSelectArea();
|
|
864
|
+
this.observeMapRender();
|
|
865
|
+
}
|
|
866
|
+
observeSelectArea() {
|
|
867
|
+
this.postboy.subscribe(DrawSelectionAreaCommand.ID).subscribe((ev) => {
|
|
868
|
+
const drawingCommand = new StartDrawingCommand(ev.type, ev.style);
|
|
869
|
+
drawingCommand.result.subscribe((r) => {
|
|
870
|
+
if (!r) {
|
|
871
|
+
ev.finish(new Dictionary());
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
const area = PolygonModel.fromGeoJson(1, r).feature.getGeometry();
|
|
875
|
+
const getFeaturesCommand = new GetFeaturesInAreaQuery(area, ev.ignore);
|
|
876
|
+
getFeaturesCommand.result.subscribe((result) => ev.finish(result));
|
|
877
|
+
this.postboy.fire(getFeaturesCommand);
|
|
878
|
+
});
|
|
879
|
+
this.postboy.fire(drawingCommand);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
observeDrawing() {
|
|
883
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
884
|
+
this.draw((l) => {
|
|
885
|
+
if (!l || !this.map) {
|
|
886
|
+
this.clearInteraction(l);
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
890
|
+
this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
|
|
891
|
+
this.map?.addInteraction(this.drawInteraction);
|
|
892
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
893
|
+
cancelSub.unsubscribe();
|
|
894
|
+
this.onEnd(evt, ev, l);
|
|
895
|
+
});
|
|
896
|
+
});
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
onEnd(evt, command, layer) {
|
|
900
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
901
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
902
|
+
: new WKT().writeFeature(evt.feature));
|
|
903
|
+
this.clearInteraction(layer);
|
|
904
|
+
}
|
|
905
|
+
observeMapRender() {
|
|
906
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
907
|
+
this.map = m.map;
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
draw(action) {
|
|
911
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
912
|
+
query.result.subscribe((l) => action(l));
|
|
913
|
+
this.postboy.fire(query);
|
|
914
|
+
}
|
|
915
|
+
observeCancelation(ev, layer) {
|
|
916
|
+
return this.postboy
|
|
917
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
918
|
+
.pipe(first())
|
|
919
|
+
.subscribe(() => {
|
|
920
|
+
ev.finish(null);
|
|
921
|
+
this.clearInteraction(layer);
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
clearInteraction(layer) {
|
|
925
|
+
if (!!this.drawInteraction) {
|
|
926
|
+
this.map?.removeInteraction(this.drawInteraction);
|
|
927
|
+
layer?.setSource(new Vector({}));
|
|
928
|
+
}
|
|
929
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
930
|
+
}
|
|
931
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
932
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService });
|
|
933
|
+
}
|
|
934
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService, decorators: [{
|
|
935
|
+
type: Injectable
|
|
936
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
937
|
+
|
|
938
|
+
class FeatureModificationService {
|
|
939
|
+
postboy;
|
|
940
|
+
modify;
|
|
941
|
+
translate;
|
|
942
|
+
map;
|
|
943
|
+
constructor(postboy) {
|
|
944
|
+
this.postboy = postboy;
|
|
945
|
+
}
|
|
946
|
+
up() {
|
|
947
|
+
this.observeModification();
|
|
948
|
+
this.observeMapRender();
|
|
949
|
+
}
|
|
950
|
+
observeModification() {
|
|
951
|
+
this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
|
|
952
|
+
this.defineLayer((l) => {
|
|
953
|
+
if (!l || !this.map) {
|
|
954
|
+
this.clearInteraction(l);
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
this.observeCancelation(ev, l);
|
|
958
|
+
this.initFeature(l, ev.model.feature);
|
|
959
|
+
this.addModify(ev);
|
|
960
|
+
this.addDragging(ev);
|
|
961
|
+
});
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
initFeature(layer, feature) {
|
|
965
|
+
layer.getSource()?.clear();
|
|
966
|
+
layer.getSource()?.addFeature(feature);
|
|
967
|
+
}
|
|
968
|
+
addModify(command) {
|
|
969
|
+
this.modify = new Modify({
|
|
970
|
+
features: new Collection([command.model.feature]),
|
|
971
|
+
style: command.style,
|
|
972
|
+
});
|
|
973
|
+
this.modify.on('modifyend', () => {
|
|
974
|
+
this.onModified(command);
|
|
975
|
+
command.model.feature.changed();
|
|
976
|
+
});
|
|
977
|
+
this.map?.addInteraction(this.modify);
|
|
978
|
+
}
|
|
979
|
+
addDragging(command) {
|
|
980
|
+
this.translate = new Translate({
|
|
981
|
+
features: new Collection([command.model.feature]),
|
|
982
|
+
condition: (ev) => {
|
|
983
|
+
const clone = command.model.feature.clone();
|
|
984
|
+
clone.getGeometry()?.scale(0.999);
|
|
985
|
+
return clone.getGeometry().intersectsCoordinate(ev.coordinate);
|
|
986
|
+
},
|
|
987
|
+
});
|
|
988
|
+
this.translate.on('translateend', () => this.onModified(command));
|
|
989
|
+
this.map?.addInteraction(this.translate);
|
|
990
|
+
}
|
|
991
|
+
onModified(command) {
|
|
992
|
+
command.next(command.format === FeatureOutputFormat.GeoJson
|
|
993
|
+
? new GeoJSON().writeFeature(command.model.feature)
|
|
994
|
+
: new WKT().writeFeature(command.model.feature));
|
|
995
|
+
}
|
|
996
|
+
observeMapRender() {
|
|
997
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
998
|
+
this.map = m.map;
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
defineLayer(action) {
|
|
1002
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
1003
|
+
query.result.subscribe((l) => action(l));
|
|
1004
|
+
this.postboy.fire(query);
|
|
1005
|
+
}
|
|
1006
|
+
observeCancelation(ev, layer) {
|
|
1007
|
+
return this.postboy
|
|
1008
|
+
.subscribe(CancelFeatureModificationCommand.ID)
|
|
1009
|
+
.pipe(first())
|
|
1010
|
+
.subscribe(() => {
|
|
1011
|
+
ev.finish(null);
|
|
1012
|
+
this.clearInteraction(layer);
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
clearInteraction(layer) {
|
|
1016
|
+
if (this.modify)
|
|
1017
|
+
this.map?.removeInteraction(this.modify);
|
|
1018
|
+
if (this.translate)
|
|
1019
|
+
this.map?.removeInteraction(this.translate);
|
|
1020
|
+
}
|
|
1021
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1022
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService });
|
|
1023
|
+
}
|
|
1024
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService, decorators: [{
|
|
1025
|
+
type: Injectable
|
|
1026
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
1027
|
+
|
|
1028
|
+
class ControlsService {
|
|
1029
|
+
postboy;
|
|
1030
|
+
map;
|
|
1031
|
+
constructor(postboy) {
|
|
1032
|
+
this.postboy = postboy;
|
|
1033
|
+
}
|
|
1034
|
+
up() {
|
|
1035
|
+
this.observeMapRender();
|
|
1036
|
+
}
|
|
1037
|
+
observeMapRender() {
|
|
1038
|
+
this.postboy
|
|
1039
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1040
|
+
.pipe(first())
|
|
1041
|
+
.subscribe((m) => {
|
|
1042
|
+
this.map = m.map;
|
|
1043
|
+
this.observeAdding();
|
|
1044
|
+
this.observeRemoving();
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
observeAdding() {
|
|
1048
|
+
this.postboy.subscribe(AddControlCommand.ID).subscribe((c) => this.map?.addControl(c.item));
|
|
1049
|
+
}
|
|
1050
|
+
observeRemoving() {
|
|
1051
|
+
this.postboy
|
|
1052
|
+
.subscribe(RemoveControlCommand.ID)
|
|
1053
|
+
.subscribe((c) => this.map?.removeControl(c.item));
|
|
1054
|
+
}
|
|
1055
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1056
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService });
|
|
1057
|
+
}
|
|
1058
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService, decorators: [{
|
|
1059
|
+
type: Injectable
|
|
1060
|
+
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
1061
|
+
|
|
1062
|
+
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
1063
|
+
constructor(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
|
|
1064
|
+
super(service);
|
|
1065
|
+
this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
|
|
1066
|
+
}
|
|
1067
|
+
_up() {
|
|
1068
|
+
this.registerReplay(MapRenderedEvent.ID);
|
|
1069
|
+
this.registerReplay(PlaceLayerFeaturesCommand.ID);
|
|
1070
|
+
this.registerReplay(RemoveControlCommand.ID);
|
|
1071
|
+
this.registerReplay(AddControlCommand.ID);
|
|
1072
|
+
this.registerReplay(SetMapCenterCommand.ID);
|
|
1073
|
+
this.registerSubject(AddLayerCommand.ID);
|
|
1074
|
+
this.registerSubject(RemoveLayerCommand.ID);
|
|
1075
|
+
this.registerSubject(AddTileCommand.ID);
|
|
1076
|
+
this.registerSubject(RemoveTileCommand.ID);
|
|
1077
|
+
this.registerSubject(MapClickEvent.ID);
|
|
1078
|
+
this.registerSubject(CloseTooltipCommand.ID);
|
|
1079
|
+
this.registerSubject(FitToFeaturesCommand.ID);
|
|
1080
|
+
this.registerSubject(FitToPolygonsCommand.ID);
|
|
1081
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
1082
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
1083
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
1084
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
1085
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
1086
|
+
this.registerSubject(GetFeaturesInAreaQuery.ID);
|
|
1087
|
+
this.registerSubject(DrawSelectionAreaCommand.ID);
|
|
1088
|
+
this.registerSubject(CancelFeatureModificationCommand.ID);
|
|
1089
|
+
this.registerSubject(ModifyFeatureCommand.ID);
|
|
1090
|
+
this.setExecutors();
|
|
1091
|
+
}
|
|
1092
|
+
setExecutors() {
|
|
1093
|
+
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
1094
|
+
this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
|
|
1095
|
+
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
1096
|
+
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
1097
|
+
}
|
|
1098
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }, { token: ControlsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1099
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService });
|
|
1100
|
+
}
|
|
1101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
1102
|
+
type: Injectable
|
|
1103
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }] });
|
|
1104
|
+
|
|
1105
|
+
class TileLayerSettings {
|
|
1106
|
+
maxZoom = 19;
|
|
1107
|
+
minZoom = 0;
|
|
1108
|
+
opacity = 0.6;
|
|
1109
|
+
url = '';
|
|
1110
|
+
projection = 'EPSG:3857';
|
|
1111
|
+
static copy(model) {
|
|
1112
|
+
const result = new TileLayerSettings();
|
|
1113
|
+
result.maxZoom = model.maxZoom;
|
|
1114
|
+
result.minZoom = model.minZoom;
|
|
1115
|
+
result.projection = model.projection;
|
|
1116
|
+
result.opacity = model.opacity;
|
|
1117
|
+
result.url = model.url;
|
|
1118
|
+
return result;
|
|
1119
|
+
}
|
|
1120
|
+
setUrl(url) {
|
|
1121
|
+
return TileLayerSettings.copy({ ...this, url });
|
|
1122
|
+
}
|
|
1123
|
+
setMaxZoom(maxZoom) {
|
|
1124
|
+
return TileLayerSettings.copy({ ...this, maxZoom });
|
|
1125
|
+
}
|
|
1126
|
+
setMinZoom(minZoom) {
|
|
1127
|
+
return TileLayerSettings.copy({ ...this, minZoom });
|
|
1128
|
+
}
|
|
1129
|
+
setOpacity(opacity) {
|
|
1130
|
+
return TileLayerSettings.copy({ ...this, opacity });
|
|
1131
|
+
}
|
|
1132
|
+
setProjection(projection) {
|
|
1133
|
+
return TileLayerSettings.copy({ ...this, projection });
|
|
1134
|
+
}
|
|
1135
|
+
isSame(model) {
|
|
1136
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1137
|
+
return false;
|
|
1138
|
+
if (this.minZoom !== model.minZoom)
|
|
1139
|
+
return false;
|
|
1140
|
+
if (this.url !== model.url)
|
|
1141
|
+
return false;
|
|
1142
|
+
if (this.projection !== model.projection)
|
|
1143
|
+
return false;
|
|
1144
|
+
if (this.opacity !== model.opacity)
|
|
1145
|
+
return false;
|
|
1146
|
+
return true;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
class TileLayerFactory {
|
|
1151
|
+
build(settings) {
|
|
1152
|
+
const source = new XYZ({
|
|
1153
|
+
tileSize: 256,
|
|
1154
|
+
maxZoom: settings.maxZoom || 14,
|
|
1155
|
+
minZoom: settings.minZoom || 1,
|
|
1156
|
+
projection: get(settings.projection),
|
|
1157
|
+
tileUrlFunction: this.getTileFunc(settings),
|
|
1158
|
+
crossOrigin: 'Anonymous',
|
|
1159
|
+
});
|
|
1160
|
+
return new TileLayer({ source, opacity: settings.opacity });
|
|
1161
|
+
}
|
|
1162
|
+
getTileFunc(settings) {
|
|
1163
|
+
return (tileCoord) => {
|
|
1164
|
+
const zoom = tileCoord[0];
|
|
1165
|
+
const x = tileCoord[1];
|
|
1166
|
+
const y = tileCoord[2];
|
|
1167
|
+
const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
1168
|
+
const bound = 1 << zoom;
|
|
1169
|
+
return settings.url
|
|
1170
|
+
.replace('{x}', String(normalizedCoord?.x || x))
|
|
1171
|
+
.replace('{z}', String(zoom))
|
|
1172
|
+
.replace('{y}', String(bound - (normalizedCoord?.y || y) - 1));
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
getNormalizedCoord(coord, zoom) {
|
|
1176
|
+
const y = coord.y;
|
|
1177
|
+
let x = coord.x;
|
|
1178
|
+
const tileRange = 1 << zoom;
|
|
1179
|
+
if (y < 0 || y >= tileRange)
|
|
1180
|
+
return null;
|
|
1181
|
+
if (x < 0 || x >= tileRange)
|
|
1182
|
+
x = ((x % tileRange) + tileRange) % tileRange;
|
|
1183
|
+
return { x: x, y: y };
|
|
1184
|
+
}
|
|
1185
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1186
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, providedIn: 'root' });
|
|
1187
|
+
}
|
|
1188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, decorators: [{
|
|
1189
|
+
type: Injectable,
|
|
1190
|
+
args: [{
|
|
1191
|
+
providedIn: 'root',
|
|
1192
|
+
}]
|
|
1193
1193
|
}] });
|
|
1194
1194
|
|
|
1195
|
-
class TileLayerComponent extends DestructibleComponent {
|
|
1196
|
-
postboy;
|
|
1197
|
-
factory;
|
|
1198
|
-
layer;
|
|
1199
|
-
constructor(postboy, factory) {
|
|
1200
|
-
super();
|
|
1201
|
-
this.postboy = postboy;
|
|
1202
|
-
this.factory = factory;
|
|
1203
|
-
}
|
|
1204
|
-
ngOnInit() {
|
|
1205
|
-
this.postboy
|
|
1206
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1207
|
-
.pipe(filter((m) => !!m), first())
|
|
1208
|
-
.subscribe((m) => this.initLayer());
|
|
1209
|
-
}
|
|
1210
|
-
_settings = new TileLayerSettings();
|
|
1211
|
-
set settings(value) {
|
|
1212
|
-
if (!value || this._settings.isSame(value))
|
|
1213
|
-
return;
|
|
1214
|
-
this._settings = value;
|
|
1215
|
-
this.initLayer();
|
|
1216
|
-
}
|
|
1217
|
-
onDestroy = () => this.removeLayer();
|
|
1218
|
-
initLayer() {
|
|
1219
|
-
this.removeLayer();
|
|
1220
|
-
this.layer = this.factory.build(this._settings);
|
|
1221
|
-
this.postboy.fire(new AddTileCommand(this.layer));
|
|
1222
|
-
}
|
|
1223
|
-
removeLayer() {
|
|
1224
|
-
if (this.layer)
|
|
1225
|
-
this.postboy.fire(new RemoveTileCommand(this.layer));
|
|
1226
|
-
}
|
|
1227
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1228
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1229
|
-
}
|
|
1230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1231
|
-
type: Component,
|
|
1232
|
-
args: [{ selector: 'art-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1233
|
-
}], ctorParameters:
|
|
1234
|
-
type: Input
|
|
1195
|
+
class TileLayerComponent extends DestructibleComponent {
|
|
1196
|
+
postboy;
|
|
1197
|
+
factory;
|
|
1198
|
+
layer;
|
|
1199
|
+
constructor(postboy, factory) {
|
|
1200
|
+
super();
|
|
1201
|
+
this.postboy = postboy;
|
|
1202
|
+
this.factory = factory;
|
|
1203
|
+
}
|
|
1204
|
+
ngOnInit() {
|
|
1205
|
+
this.postboy
|
|
1206
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1207
|
+
.pipe(filter((m) => !!m), first())
|
|
1208
|
+
.subscribe((m) => this.initLayer());
|
|
1209
|
+
}
|
|
1210
|
+
_settings = new TileLayerSettings();
|
|
1211
|
+
set settings(value) {
|
|
1212
|
+
if (!value || this._settings.isSame(value))
|
|
1213
|
+
return;
|
|
1214
|
+
this._settings = value;
|
|
1215
|
+
this.initLayer();
|
|
1216
|
+
}
|
|
1217
|
+
onDestroy = () => this.removeLayer();
|
|
1218
|
+
initLayer() {
|
|
1219
|
+
this.removeLayer();
|
|
1220
|
+
this.layer = this.factory.build(this._settings);
|
|
1221
|
+
this.postboy.fire(new AddTileCommand(this.layer));
|
|
1222
|
+
}
|
|
1223
|
+
removeLayer() {
|
|
1224
|
+
if (this.layer)
|
|
1225
|
+
this.postboy.fire(new RemoveTileCommand(this.layer));
|
|
1226
|
+
}
|
|
1227
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerComponent, deps: [{ token: MapPostboyService }, { token: TileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1228
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: TileLayerComponent, selector: "art-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1229
|
+
}
|
|
1230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerComponent, decorators: [{
|
|
1231
|
+
type: Component,
|
|
1232
|
+
args: [{ selector: 'art-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1233
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: TileLayerFactory }], propDecorators: { settings: [{
|
|
1234
|
+
type: Input
|
|
1235
1235
|
}] } });
|
|
1236
1236
|
|
|
1237
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
1238
|
-
layer;
|
|
1239
|
-
constructor() {
|
|
1240
|
-
super();
|
|
1241
|
-
}
|
|
1242
|
-
_url = '';
|
|
1243
|
-
set url(value) {
|
|
1244
|
-
if (!value || this._url === value)
|
|
1245
|
-
return;
|
|
1246
|
-
this._url = value;
|
|
1247
|
-
this.initLayer();
|
|
1248
|
-
}
|
|
1249
|
-
_map;
|
|
1250
|
-
set map(value) {
|
|
1251
|
-
if (!value || this._map === value)
|
|
1252
|
-
return;
|
|
1253
|
-
this._map = value;
|
|
1254
|
-
this.initLayer();
|
|
1255
|
-
}
|
|
1256
|
-
ngOnInit() { }
|
|
1257
|
-
ngOnDestroy() {
|
|
1258
|
-
if (this.layer) {
|
|
1259
|
-
this._map?.removeLayer(this.layer);
|
|
1260
|
-
}
|
|
1261
|
-
// @ts-ignore
|
|
1262
|
-
this.layer?.setMap(null);
|
|
1263
|
-
}
|
|
1264
|
-
initLayer() {
|
|
1265
|
-
if (!this._url || !this._map)
|
|
1266
|
-
return;
|
|
1267
|
-
if (this.layer)
|
|
1268
|
-
this._map.removeLayer(this.layer);
|
|
1269
|
-
this.layer = new TileLayer({
|
|
1270
|
-
source: new OSM({
|
|
1271
|
-
url: this._url,
|
|
1272
|
-
}),
|
|
1273
|
-
});
|
|
1274
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
1275
|
-
this._map.addLayer(this.layer);
|
|
1276
|
-
}
|
|
1277
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1278
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1279
|
-
}
|
|
1280
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1281
|
-
type: Component,
|
|
1282
|
-
args: [{ selector: 'art-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1283
|
-
}], ctorParameters:
|
|
1284
|
-
type: Input
|
|
1285
|
-
}], map: [{
|
|
1286
|
-
type: Input
|
|
1237
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
1238
|
+
layer;
|
|
1239
|
+
constructor() {
|
|
1240
|
+
super();
|
|
1241
|
+
}
|
|
1242
|
+
_url = '';
|
|
1243
|
+
set url(value) {
|
|
1244
|
+
if (!value || this._url === value)
|
|
1245
|
+
return;
|
|
1246
|
+
this._url = value;
|
|
1247
|
+
this.initLayer();
|
|
1248
|
+
}
|
|
1249
|
+
_map;
|
|
1250
|
+
set map(value) {
|
|
1251
|
+
if (!value || this._map === value)
|
|
1252
|
+
return;
|
|
1253
|
+
this._map = value;
|
|
1254
|
+
this.initLayer();
|
|
1255
|
+
}
|
|
1256
|
+
ngOnInit() { }
|
|
1257
|
+
ngOnDestroy() {
|
|
1258
|
+
if (this.layer) {
|
|
1259
|
+
this._map?.removeLayer(this.layer);
|
|
1260
|
+
}
|
|
1261
|
+
// @ts-ignore
|
|
1262
|
+
this.layer?.setMap(null);
|
|
1263
|
+
}
|
|
1264
|
+
initLayer() {
|
|
1265
|
+
if (!this._url || !this._map)
|
|
1266
|
+
return;
|
|
1267
|
+
if (this.layer)
|
|
1268
|
+
this._map.removeLayer(this.layer);
|
|
1269
|
+
this.layer = new TileLayer({
|
|
1270
|
+
source: new OSM({
|
|
1271
|
+
url: this._url,
|
|
1272
|
+
}),
|
|
1273
|
+
});
|
|
1274
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
1275
|
+
this._map.addLayer(this.layer);
|
|
1276
|
+
}
|
|
1277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1278
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1279
|
+
}
|
|
1280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
1281
|
+
type: Component,
|
|
1282
|
+
args: [{ selector: 'art-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1283
|
+
}], ctorParameters: () => [], propDecorators: { url: [{
|
|
1284
|
+
type: Input
|
|
1285
|
+
}], map: [{
|
|
1286
|
+
type: Input
|
|
1287
1287
|
}] } });
|
|
1288
1288
|
|
|
1289
|
-
/**
|
|
1290
|
-
* A layer that is responsible for showing and styling main features on the map, such as markers and polygons
|
|
1291
|
-
*/
|
|
1292
|
-
class FeatureLayerSettings {
|
|
1293
|
-
/**
|
|
1294
|
-
* The identifier of the field, it is autogenerated by default, but can be set manually
|
|
1295
|
-
*/
|
|
1296
|
-
name = IdGenerator.get();
|
|
1297
|
-
/**
|
|
1298
|
-
* The priority of showing - layers with higher zIndex cover others in case of collisions
|
|
1299
|
-
*/
|
|
1300
|
-
zIndex = 1;
|
|
1301
|
-
/**
|
|
1302
|
-
* The maximum zoom at which the layer is visible. 19 by default
|
|
1303
|
-
*/
|
|
1304
|
-
maxZoom = 19;
|
|
1305
|
-
/**
|
|
1306
|
-
* The minimum zoom at which the layer is visible. 0 by default
|
|
1307
|
-
*/
|
|
1308
|
-
minZoom = 0;
|
|
1309
|
-
/**
|
|
1310
|
-
* The styling definition of layer's features. The easiest way is to use {@link PolygonStyleHelper},{@link MarkerStyleHelper}
|
|
1311
|
-
*/
|
|
1312
|
-
style;
|
|
1313
|
-
/**
|
|
1314
|
-
* Creates a clone of the existing settings
|
|
1315
|
-
* @param model
|
|
1316
|
-
*/
|
|
1317
|
-
static copy(model) {
|
|
1318
|
-
const result = new FeatureLayerSettings();
|
|
1319
|
-
result.name = model.name;
|
|
1320
|
-
result.maxZoom = model.maxZoom;
|
|
1321
|
-
result.minZoom = model.minZoom;
|
|
1322
|
-
result.zIndex = model.zIndex;
|
|
1323
|
-
result.style = model.style;
|
|
1324
|
-
return result;
|
|
1325
|
-
}
|
|
1326
|
-
/**
|
|
1327
|
-
Setter for {@link FeatureLayerSettings.zIndex}
|
|
1328
|
-
* @param zIndex
|
|
1329
|
-
*/
|
|
1330
|
-
setZIndex(zIndex) {
|
|
1331
|
-
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
1332
|
-
}
|
|
1333
|
-
/**
|
|
1334
|
-
* Setter for {@link FeatureLayerSettings.name}
|
|
1335
|
-
* @param name
|
|
1336
|
-
*/
|
|
1337
|
-
setName(name) {
|
|
1338
|
-
return FeatureLayerSettings.copy({ ...this, name });
|
|
1339
|
-
}
|
|
1340
|
-
/**
|
|
1341
|
-
* Setter for {@link FeatureLayerSettings.maxZoom}
|
|
1342
|
-
* @param maxZoom
|
|
1343
|
-
*/
|
|
1344
|
-
setMaxZoom(maxZoom) {
|
|
1345
|
-
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Setter for {@link FeatureLayerSettings.minZoom}
|
|
1349
|
-
* @param minZoom
|
|
1350
|
-
*/
|
|
1351
|
-
setMinZoom(minZoom) {
|
|
1352
|
-
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
1353
|
-
}
|
|
1354
|
-
/**
|
|
1355
|
-
* Setter for {@link FeatureLayerSettings.style}
|
|
1356
|
-
* @param style
|
|
1357
|
-
*/
|
|
1358
|
-
setStyle(style) {
|
|
1359
|
-
return FeatureLayerSettings.copy({ ...this, style });
|
|
1360
|
-
}
|
|
1361
|
-
/**
|
|
1362
|
-
* Checks if the model has the same content
|
|
1363
|
-
* @param model - the object to compare
|
|
1364
|
-
*/
|
|
1365
|
-
isSame(model) {
|
|
1366
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1367
|
-
return false;
|
|
1368
|
-
if (this.minZoom !== model.minZoom)
|
|
1369
|
-
return false;
|
|
1370
|
-
if (this.zIndex !== model.zIndex)
|
|
1371
|
-
return false;
|
|
1372
|
-
if (this.name !== model.name)
|
|
1373
|
-
return false;
|
|
1374
|
-
if (this.style !== model.style)
|
|
1375
|
-
return false;
|
|
1376
|
-
return true;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
class FeatureLayerFactory {
|
|
1381
|
-
build(settings) {
|
|
1382
|
-
const source = new Vector({});
|
|
1383
|
-
const layer = new Vector$1({
|
|
1384
|
-
source: source,
|
|
1385
|
-
maxZoom: settings.maxZoom,
|
|
1386
|
-
minZoom: settings.minZoom,
|
|
1387
|
-
zIndex: settings.zIndex,
|
|
1388
|
-
});
|
|
1389
|
-
if (settings.style)
|
|
1390
|
-
layer.setStyle(settings.style);
|
|
1391
|
-
layer.set('name', settings.name);
|
|
1392
|
-
return layer;
|
|
1393
|
-
}
|
|
1394
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1395
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1396
|
-
}
|
|
1397
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1398
|
-
type: Injectable,
|
|
1399
|
-
args: [{
|
|
1400
|
-
providedIn: 'root',
|
|
1401
|
-
}]
|
|
1289
|
+
/**
|
|
1290
|
+
* A layer that is responsible for showing and styling main features on the map, such as markers and polygons
|
|
1291
|
+
*/
|
|
1292
|
+
class FeatureLayerSettings {
|
|
1293
|
+
/**
|
|
1294
|
+
* The identifier of the field, it is autogenerated by default, but can be set manually
|
|
1295
|
+
*/
|
|
1296
|
+
name = IdGenerator.get();
|
|
1297
|
+
/**
|
|
1298
|
+
* The priority of showing - layers with higher zIndex cover others in case of collisions
|
|
1299
|
+
*/
|
|
1300
|
+
zIndex = 1;
|
|
1301
|
+
/**
|
|
1302
|
+
* The maximum zoom at which the layer is visible. 19 by default
|
|
1303
|
+
*/
|
|
1304
|
+
maxZoom = 19;
|
|
1305
|
+
/**
|
|
1306
|
+
* The minimum zoom at which the layer is visible. 0 by default
|
|
1307
|
+
*/
|
|
1308
|
+
minZoom = 0;
|
|
1309
|
+
/**
|
|
1310
|
+
* The styling definition of layer's features. The easiest way is to use {@link PolygonStyleHelper},{@link MarkerStyleHelper}
|
|
1311
|
+
*/
|
|
1312
|
+
style;
|
|
1313
|
+
/**
|
|
1314
|
+
* Creates a clone of the existing settings
|
|
1315
|
+
* @param model
|
|
1316
|
+
*/
|
|
1317
|
+
static copy(model) {
|
|
1318
|
+
const result = new FeatureLayerSettings();
|
|
1319
|
+
result.name = model.name;
|
|
1320
|
+
result.maxZoom = model.maxZoom;
|
|
1321
|
+
result.minZoom = model.minZoom;
|
|
1322
|
+
result.zIndex = model.zIndex;
|
|
1323
|
+
result.style = model.style;
|
|
1324
|
+
return result;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
Setter for {@link FeatureLayerSettings.zIndex}
|
|
1328
|
+
* @param zIndex
|
|
1329
|
+
*/
|
|
1330
|
+
setZIndex(zIndex) {
|
|
1331
|
+
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Setter for {@link FeatureLayerSettings.name}
|
|
1335
|
+
* @param name
|
|
1336
|
+
*/
|
|
1337
|
+
setName(name) {
|
|
1338
|
+
return FeatureLayerSettings.copy({ ...this, name });
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Setter for {@link FeatureLayerSettings.maxZoom}
|
|
1342
|
+
* @param maxZoom
|
|
1343
|
+
*/
|
|
1344
|
+
setMaxZoom(maxZoom) {
|
|
1345
|
+
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Setter for {@link FeatureLayerSettings.minZoom}
|
|
1349
|
+
* @param minZoom
|
|
1350
|
+
*/
|
|
1351
|
+
setMinZoom(minZoom) {
|
|
1352
|
+
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Setter for {@link FeatureLayerSettings.style}
|
|
1356
|
+
* @param style
|
|
1357
|
+
*/
|
|
1358
|
+
setStyle(style) {
|
|
1359
|
+
return FeatureLayerSettings.copy({ ...this, style });
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Checks if the model has the same content
|
|
1363
|
+
* @param model - the object to compare
|
|
1364
|
+
*/
|
|
1365
|
+
isSame(model) {
|
|
1366
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1367
|
+
return false;
|
|
1368
|
+
if (this.minZoom !== model.minZoom)
|
|
1369
|
+
return false;
|
|
1370
|
+
if (this.zIndex !== model.zIndex)
|
|
1371
|
+
return false;
|
|
1372
|
+
if (this.name !== model.name)
|
|
1373
|
+
return false;
|
|
1374
|
+
if (this.style !== model.style)
|
|
1375
|
+
return false;
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
class FeatureLayerFactory {
|
|
1381
|
+
build(settings) {
|
|
1382
|
+
const source = new Vector({});
|
|
1383
|
+
const layer = new Vector$1({
|
|
1384
|
+
source: source,
|
|
1385
|
+
maxZoom: settings.maxZoom,
|
|
1386
|
+
minZoom: settings.minZoom,
|
|
1387
|
+
zIndex: settings.zIndex,
|
|
1388
|
+
});
|
|
1389
|
+
if (settings.style)
|
|
1390
|
+
layer.setStyle(settings.style);
|
|
1391
|
+
layer.set('name', settings.name);
|
|
1392
|
+
return layer;
|
|
1393
|
+
}
|
|
1394
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1395
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, providedIn: 'root' });
|
|
1396
|
+
}
|
|
1397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, decorators: [{
|
|
1398
|
+
type: Injectable,
|
|
1399
|
+
args: [{
|
|
1400
|
+
providedIn: 'root',
|
|
1401
|
+
}]
|
|
1402
1402
|
}] });
|
|
1403
1403
|
|
|
1404
|
-
class FeatureLayerComponent extends DestructibleComponent {
|
|
1405
|
-
postboy;
|
|
1406
|
-
factory;
|
|
1407
|
-
layer = null;
|
|
1408
|
-
_settings = new FeatureLayerSettings();
|
|
1409
|
-
constructor(postboy, factory) {
|
|
1410
|
-
super();
|
|
1411
|
-
this.postboy = postboy;
|
|
1412
|
-
this.factory = factory;
|
|
1413
|
-
}
|
|
1414
|
-
ngOnInit() {
|
|
1415
|
-
this.postboy
|
|
1416
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1417
|
-
.pipe(filter((m) => !!m), first())
|
|
1418
|
-
.subscribe((m) => this.initLayer());
|
|
1419
|
-
}
|
|
1420
|
-
set settings(value) {
|
|
1421
|
-
if (!value || this._settings.isSame(value))
|
|
1422
|
-
return;
|
|
1423
|
-
this._settings = value;
|
|
1424
|
-
this.initLayer();
|
|
1425
|
-
}
|
|
1426
|
-
onDestroy = () => this.removeLayer();
|
|
1427
|
-
initLayer() {
|
|
1428
|
-
this.removeLayer();
|
|
1429
|
-
this.layer = this.factory.build(this._settings);
|
|
1430
|
-
this.postboy.fire(new AddLayerCommand(this.layer));
|
|
1431
|
-
}
|
|
1432
|
-
removeLayer() {
|
|
1433
|
-
if (this.layer)
|
|
1434
|
-
this.postboy.fire(new RemoveLayerCommand(this.layer));
|
|
1435
|
-
}
|
|
1436
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1437
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1438
|
-
}
|
|
1439
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1440
|
-
type: Component,
|
|
1441
|
-
args: [{ selector: 'art-feature-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1442
|
-
}], ctorParameters:
|
|
1443
|
-
type: Input
|
|
1404
|
+
class FeatureLayerComponent extends DestructibleComponent {
|
|
1405
|
+
postboy;
|
|
1406
|
+
factory;
|
|
1407
|
+
layer = null;
|
|
1408
|
+
_settings = new FeatureLayerSettings();
|
|
1409
|
+
constructor(postboy, factory) {
|
|
1410
|
+
super();
|
|
1411
|
+
this.postboy = postboy;
|
|
1412
|
+
this.factory = factory;
|
|
1413
|
+
}
|
|
1414
|
+
ngOnInit() {
|
|
1415
|
+
this.postboy
|
|
1416
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1417
|
+
.pipe(filter((m) => !!m), first())
|
|
1418
|
+
.subscribe((m) => this.initLayer());
|
|
1419
|
+
}
|
|
1420
|
+
set settings(value) {
|
|
1421
|
+
if (!value || this._settings.isSame(value))
|
|
1422
|
+
return;
|
|
1423
|
+
this._settings = value;
|
|
1424
|
+
this.initLayer();
|
|
1425
|
+
}
|
|
1426
|
+
onDestroy = () => this.removeLayer();
|
|
1427
|
+
initLayer() {
|
|
1428
|
+
this.removeLayer();
|
|
1429
|
+
this.layer = this.factory.build(this._settings);
|
|
1430
|
+
this.postboy.fire(new AddLayerCommand(this.layer));
|
|
1431
|
+
}
|
|
1432
|
+
removeLayer() {
|
|
1433
|
+
if (this.layer)
|
|
1434
|
+
this.postboy.fire(new RemoveLayerCommand(this.layer));
|
|
1435
|
+
}
|
|
1436
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1438
|
+
}
|
|
1439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerComponent, decorators: [{
|
|
1440
|
+
type: Component,
|
|
1441
|
+
args: [{ selector: 'art-feature-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1442
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: FeatureLayerFactory }], propDecorators: { settings: [{
|
|
1443
|
+
type: Input
|
|
1444
1444
|
}] } });
|
|
1445
1445
|
|
|
1446
|
-
class ClusterLayerSettings {
|
|
1447
|
-
name = IdGenerator.get();
|
|
1448
|
-
zIndex = 1;
|
|
1449
|
-
maxZoom = 19;
|
|
1450
|
-
minZoom = 0;
|
|
1451
|
-
distance = 20;
|
|
1452
|
-
bbox = false;
|
|
1453
|
-
clusterCancel = 14;
|
|
1454
|
-
style;
|
|
1455
|
-
static copy(model) {
|
|
1456
|
-
const result = new ClusterLayerSettings();
|
|
1457
|
-
result.name = model.name;
|
|
1458
|
-
result.maxZoom = model.maxZoom;
|
|
1459
|
-
result.minZoom = model.minZoom;
|
|
1460
|
-
result.zIndex = model.zIndex;
|
|
1461
|
-
result.bbox = model.bbox;
|
|
1462
|
-
result.clusterCancel = model.clusterCancel;
|
|
1463
|
-
result.distance = model.distance;
|
|
1464
|
-
result.style = model.style;
|
|
1465
|
-
return result;
|
|
1466
|
-
}
|
|
1467
|
-
setZIndex(zIndex) {
|
|
1468
|
-
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1469
|
-
}
|
|
1470
|
-
setDistance(distance) {
|
|
1471
|
-
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1472
|
-
}
|
|
1473
|
-
setName(name) {
|
|
1474
|
-
return ClusterLayerSettings.copy({ ...this, name });
|
|
1475
|
-
}
|
|
1476
|
-
setMaxZoom(maxZoom) {
|
|
1477
|
-
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1478
|
-
}
|
|
1479
|
-
setMinZoom(minZoom) {
|
|
1480
|
-
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1481
|
-
}
|
|
1482
|
-
setClusterCancel(clusterCancel) {
|
|
1483
|
-
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
1484
|
-
}
|
|
1485
|
-
setBbox(bbox) {
|
|
1486
|
-
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1487
|
-
}
|
|
1488
|
-
setStyle(style) {
|
|
1489
|
-
return ClusterLayerSettings.copy({ ...this, style });
|
|
1490
|
-
}
|
|
1491
|
-
isSame(model) {
|
|
1492
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1493
|
-
return false;
|
|
1494
|
-
if (this.minZoom !== model.minZoom)
|
|
1495
|
-
return false;
|
|
1496
|
-
if (this.zIndex !== model.zIndex)
|
|
1497
|
-
return false;
|
|
1498
|
-
if (this.name !== model.name)
|
|
1499
|
-
return false;
|
|
1500
|
-
if (this.distance !== model.distance)
|
|
1501
|
-
return false;
|
|
1502
|
-
if (this.clusterCancel !== model.clusterCancel)
|
|
1503
|
-
return false;
|
|
1504
|
-
if (this.bbox !== model.bbox)
|
|
1505
|
-
return false;
|
|
1506
|
-
if (this.style !== model.style)
|
|
1507
|
-
return false;
|
|
1508
|
-
return true;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
class ClusterLayerManager {
|
|
1513
|
-
settings;
|
|
1514
|
-
layer;
|
|
1515
|
-
postboy;
|
|
1516
|
-
constructor(settings, layer, postboy) {
|
|
1517
|
-
this.settings = settings;
|
|
1518
|
-
this.layer = layer;
|
|
1519
|
-
this.postboy = postboy;
|
|
1520
|
-
this.observeClick();
|
|
1521
|
-
this.observeMapMovement();
|
|
1522
|
-
}
|
|
1523
|
-
observeMapMovement() {
|
|
1524
|
-
combineLatest([
|
|
1525
|
-
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1526
|
-
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1527
|
-
]).subscribe(([movement, renderEvent]) => {
|
|
1528
|
-
this.checkClusterNecessity(renderEvent.map);
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
|
-
observeClick() {
|
|
1532
|
-
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1533
|
-
if ((m.features[this.settings.name]?.length ?? 0) > 1) {
|
|
1534
|
-
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1535
|
-
}
|
|
1536
|
-
});
|
|
1537
|
-
}
|
|
1538
|
-
checkClusterNecessity(map) {
|
|
1539
|
-
let zoom = map.getView().getZoom() ?? 0;
|
|
1540
|
-
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1541
|
-
this.layer?.getSource()?.setDistance(distance);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
class ClusterLayerFactory {
|
|
1546
|
-
build(settings, postboy) {
|
|
1547
|
-
const source = new Vector({
|
|
1548
|
-
strategy: settings.bbox ? bbox : undefined,
|
|
1549
|
-
});
|
|
1550
|
-
const cluster = new Cluster({
|
|
1551
|
-
distance: settings.distance,
|
|
1552
|
-
source: source,
|
|
1553
|
-
geometryFunction: (feature) => {
|
|
1554
|
-
const geom = feature.getGeometry();
|
|
1555
|
-
if (geom?.getType() == 'Point') {
|
|
1556
|
-
return geom;
|
|
1557
|
-
}
|
|
1558
|
-
else if (geom?.getType() == 'Polygon') {
|
|
1559
|
-
return geom?.getInteriorPoint();
|
|
1560
|
-
}
|
|
1561
|
-
else if (geom?.getType() == 'MultiPolygon') {
|
|
1562
|
-
return fromExtent(geom.getExtent())?.getInteriorPoint();
|
|
1563
|
-
}
|
|
1564
|
-
return undefined;
|
|
1565
|
-
},
|
|
1566
|
-
});
|
|
1567
|
-
const layer = new Vector$1({
|
|
1568
|
-
source: cluster,
|
|
1569
|
-
maxZoom: settings.maxZoom || undefined,
|
|
1570
|
-
minZoom: settings.minZoom || undefined,
|
|
1571
|
-
zIndex: settings.zIndex || 0,
|
|
1572
|
-
});
|
|
1573
|
-
layer.setStyle(this.styleFunc(settings));
|
|
1574
|
-
layer.set('name', settings.name);
|
|
1575
|
-
return new ClusterLayerManager(settings, layer, postboy);
|
|
1576
|
-
}
|
|
1577
|
-
styleFunc(settings) {
|
|
1578
|
-
return (feature) => {
|
|
1579
|
-
const features = feature.get('features');
|
|
1580
|
-
if (!settings.style)
|
|
1581
|
-
return undefined;
|
|
1582
|
-
return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1586
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1587
|
-
}
|
|
1588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1589
|
-
type: Injectable,
|
|
1590
|
-
args: [{
|
|
1591
|
-
providedIn: 'root',
|
|
1592
|
-
}]
|
|
1446
|
+
class ClusterLayerSettings {
|
|
1447
|
+
name = IdGenerator.get();
|
|
1448
|
+
zIndex = 1;
|
|
1449
|
+
maxZoom = 19;
|
|
1450
|
+
minZoom = 0;
|
|
1451
|
+
distance = 20;
|
|
1452
|
+
bbox = false;
|
|
1453
|
+
clusterCancel = 14;
|
|
1454
|
+
style;
|
|
1455
|
+
static copy(model) {
|
|
1456
|
+
const result = new ClusterLayerSettings();
|
|
1457
|
+
result.name = model.name;
|
|
1458
|
+
result.maxZoom = model.maxZoom;
|
|
1459
|
+
result.minZoom = model.minZoom;
|
|
1460
|
+
result.zIndex = model.zIndex;
|
|
1461
|
+
result.bbox = model.bbox;
|
|
1462
|
+
result.clusterCancel = model.clusterCancel;
|
|
1463
|
+
result.distance = model.distance;
|
|
1464
|
+
result.style = model.style;
|
|
1465
|
+
return result;
|
|
1466
|
+
}
|
|
1467
|
+
setZIndex(zIndex) {
|
|
1468
|
+
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1469
|
+
}
|
|
1470
|
+
setDistance(distance) {
|
|
1471
|
+
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1472
|
+
}
|
|
1473
|
+
setName(name) {
|
|
1474
|
+
return ClusterLayerSettings.copy({ ...this, name });
|
|
1475
|
+
}
|
|
1476
|
+
setMaxZoom(maxZoom) {
|
|
1477
|
+
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1478
|
+
}
|
|
1479
|
+
setMinZoom(minZoom) {
|
|
1480
|
+
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1481
|
+
}
|
|
1482
|
+
setClusterCancel(clusterCancel) {
|
|
1483
|
+
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
1484
|
+
}
|
|
1485
|
+
setBbox(bbox) {
|
|
1486
|
+
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1487
|
+
}
|
|
1488
|
+
setStyle(style) {
|
|
1489
|
+
return ClusterLayerSettings.copy({ ...this, style });
|
|
1490
|
+
}
|
|
1491
|
+
isSame(model) {
|
|
1492
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1493
|
+
return false;
|
|
1494
|
+
if (this.minZoom !== model.minZoom)
|
|
1495
|
+
return false;
|
|
1496
|
+
if (this.zIndex !== model.zIndex)
|
|
1497
|
+
return false;
|
|
1498
|
+
if (this.name !== model.name)
|
|
1499
|
+
return false;
|
|
1500
|
+
if (this.distance !== model.distance)
|
|
1501
|
+
return false;
|
|
1502
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1503
|
+
return false;
|
|
1504
|
+
if (this.bbox !== model.bbox)
|
|
1505
|
+
return false;
|
|
1506
|
+
if (this.style !== model.style)
|
|
1507
|
+
return false;
|
|
1508
|
+
return true;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
class ClusterLayerManager {
|
|
1513
|
+
settings;
|
|
1514
|
+
layer;
|
|
1515
|
+
postboy;
|
|
1516
|
+
constructor(settings, layer, postboy) {
|
|
1517
|
+
this.settings = settings;
|
|
1518
|
+
this.layer = layer;
|
|
1519
|
+
this.postboy = postboy;
|
|
1520
|
+
this.observeClick();
|
|
1521
|
+
this.observeMapMovement();
|
|
1522
|
+
}
|
|
1523
|
+
observeMapMovement() {
|
|
1524
|
+
combineLatest([
|
|
1525
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1526
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1527
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1528
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
observeClick() {
|
|
1532
|
+
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1533
|
+
if ((m.features[this.settings.name]?.length ?? 0) > 1) {
|
|
1534
|
+
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
checkClusterNecessity(map) {
|
|
1539
|
+
let zoom = map.getView().getZoom() ?? 0;
|
|
1540
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1541
|
+
this.layer?.getSource()?.setDistance(distance);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
class ClusterLayerFactory {
|
|
1546
|
+
build(settings, postboy) {
|
|
1547
|
+
const source = new Vector({
|
|
1548
|
+
strategy: settings.bbox ? bbox : undefined,
|
|
1549
|
+
});
|
|
1550
|
+
const cluster = new Cluster({
|
|
1551
|
+
distance: settings.distance,
|
|
1552
|
+
source: source,
|
|
1553
|
+
geometryFunction: (feature) => {
|
|
1554
|
+
const geom = feature.getGeometry();
|
|
1555
|
+
if (geom?.getType() == 'Point') {
|
|
1556
|
+
return geom;
|
|
1557
|
+
}
|
|
1558
|
+
else if (geom?.getType() == 'Polygon') {
|
|
1559
|
+
return geom?.getInteriorPoint();
|
|
1560
|
+
}
|
|
1561
|
+
else if (geom?.getType() == 'MultiPolygon') {
|
|
1562
|
+
return fromExtent(geom.getExtent())?.getInteriorPoint();
|
|
1563
|
+
}
|
|
1564
|
+
return undefined;
|
|
1565
|
+
},
|
|
1566
|
+
});
|
|
1567
|
+
const layer = new Vector$1({
|
|
1568
|
+
source: cluster,
|
|
1569
|
+
maxZoom: settings.maxZoom || undefined,
|
|
1570
|
+
minZoom: settings.minZoom || undefined,
|
|
1571
|
+
zIndex: settings.zIndex || 0,
|
|
1572
|
+
});
|
|
1573
|
+
layer.setStyle(this.styleFunc(settings));
|
|
1574
|
+
layer.set('name', settings.name);
|
|
1575
|
+
return new ClusterLayerManager(settings, layer, postboy);
|
|
1576
|
+
}
|
|
1577
|
+
styleFunc(settings) {
|
|
1578
|
+
return (feature) => {
|
|
1579
|
+
const features = feature.get('features');
|
|
1580
|
+
if (!settings.style)
|
|
1581
|
+
return undefined;
|
|
1582
|
+
return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1586
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1587
|
+
}
|
|
1588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1589
|
+
type: Injectable,
|
|
1590
|
+
args: [{
|
|
1591
|
+
providedIn: 'root',
|
|
1592
|
+
}]
|
|
1593
1593
|
}] });
|
|
1594
1594
|
|
|
1595
|
-
class ClusterLayerComponent extends DestructibleComponent {
|
|
1596
|
-
postboy;
|
|
1597
|
-
factory;
|
|
1598
|
-
manager = null;
|
|
1599
|
-
_settings = new ClusterLayerSettings();
|
|
1600
|
-
constructor(postboy, factory) {
|
|
1601
|
-
super();
|
|
1602
|
-
this.postboy = postboy;
|
|
1603
|
-
this.factory = factory;
|
|
1604
|
-
}
|
|
1605
|
-
ngOnInit() {
|
|
1606
|
-
this.postboy
|
|
1607
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1608
|
-
.pipe(filter((m) => !!m), first())
|
|
1609
|
-
.subscribe((m) => this.initLayer());
|
|
1610
|
-
}
|
|
1611
|
-
set settings(value) {
|
|
1612
|
-
if (!value || this._settings.isSame(value))
|
|
1613
|
-
return;
|
|
1614
|
-
this._settings = value;
|
|
1615
|
-
this.initLayer();
|
|
1616
|
-
}
|
|
1617
|
-
onDestroy = () => this.removeLayer();
|
|
1618
|
-
initLayer() {
|
|
1619
|
-
this.removeLayer();
|
|
1620
|
-
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1621
|
-
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1622
|
-
}
|
|
1623
|
-
removeLayer() {
|
|
1624
|
-
if (this.manager?.layer)
|
|
1625
|
-
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1626
|
-
}
|
|
1627
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1628
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1629
|
-
}
|
|
1630
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1631
|
-
type: Component,
|
|
1632
|
-
args: [{ selector: 'art-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1633
|
-
}], ctorParameters:
|
|
1634
|
-
type: Input
|
|
1595
|
+
class ClusterLayerComponent extends DestructibleComponent {
|
|
1596
|
+
postboy;
|
|
1597
|
+
factory;
|
|
1598
|
+
manager = null;
|
|
1599
|
+
_settings = new ClusterLayerSettings();
|
|
1600
|
+
constructor(postboy, factory) {
|
|
1601
|
+
super();
|
|
1602
|
+
this.postboy = postboy;
|
|
1603
|
+
this.factory = factory;
|
|
1604
|
+
}
|
|
1605
|
+
ngOnInit() {
|
|
1606
|
+
this.postboy
|
|
1607
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1608
|
+
.pipe(filter((m) => !!m), first())
|
|
1609
|
+
.subscribe((m) => this.initLayer());
|
|
1610
|
+
}
|
|
1611
|
+
set settings(value) {
|
|
1612
|
+
if (!value || this._settings.isSame(value))
|
|
1613
|
+
return;
|
|
1614
|
+
this._settings = value;
|
|
1615
|
+
this.initLayer();
|
|
1616
|
+
}
|
|
1617
|
+
onDestroy = () => this.removeLayer();
|
|
1618
|
+
initLayer() {
|
|
1619
|
+
this.removeLayer();
|
|
1620
|
+
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1621
|
+
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1622
|
+
}
|
|
1623
|
+
removeLayer() {
|
|
1624
|
+
if (this.manager?.layer)
|
|
1625
|
+
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1626
|
+
}
|
|
1627
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1628
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: ClusterLayerComponent, selector: "art-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1629
|
+
}
|
|
1630
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1631
|
+
type: Component,
|
|
1632
|
+
args: [{ selector: 'art-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1633
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: ClusterLayerFactory }], propDecorators: { settings: [{
|
|
1634
|
+
type: Input
|
|
1635
1635
|
}] } });
|
|
1636
1636
|
|
|
1637
|
-
class MapPlateFactory {
|
|
1638
|
-
build(settings) {
|
|
1639
|
-
return new Map({
|
|
1640
|
-
controls: [],
|
|
1641
|
-
view: new View({
|
|
1642
|
-
center: settings?.center || [0, 0],
|
|
1643
|
-
zoom: settings?.zoom || 4,
|
|
1644
|
-
minZoom: settings?.minZoom || 0,
|
|
1645
|
-
maxZoom: settings?.maxZoom || 19,
|
|
1646
|
-
}),
|
|
1647
|
-
layers: [],
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1651
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1652
|
-
}
|
|
1653
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1654
|
-
type: Injectable,
|
|
1655
|
-
args: [{
|
|
1656
|
-
providedIn: 'root',
|
|
1657
|
-
}]
|
|
1637
|
+
class MapPlateFactory {
|
|
1638
|
+
build(settings) {
|
|
1639
|
+
return new Map({
|
|
1640
|
+
controls: [],
|
|
1641
|
+
view: new View({
|
|
1642
|
+
center: settings?.center || [0, 0],
|
|
1643
|
+
zoom: settings?.zoom || 4,
|
|
1644
|
+
minZoom: settings?.minZoom || 0,
|
|
1645
|
+
maxZoom: settings?.maxZoom || 19,
|
|
1646
|
+
}),
|
|
1647
|
+
layers: [],
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1651
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1652
|
+
}
|
|
1653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1654
|
+
type: Injectable,
|
|
1655
|
+
args: [{
|
|
1656
|
+
providedIn: 'root',
|
|
1657
|
+
}]
|
|
1658
1658
|
}] });
|
|
1659
1659
|
|
|
1660
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
1661
|
-
elementRef;
|
|
1662
|
-
postboy;
|
|
1663
|
-
mapFactory;
|
|
1664
|
-
registrator;
|
|
1665
|
-
detector;
|
|
1666
|
-
map;
|
|
1667
|
-
osmUrl = '';
|
|
1668
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1669
|
-
super();
|
|
1670
|
-
this.elementRef = elementRef;
|
|
1671
|
-
this.postboy = postboy;
|
|
1672
|
-
this.mapFactory = mapFactory;
|
|
1673
|
-
this.registrator = registrator;
|
|
1674
|
-
this.detector = detector;
|
|
1675
|
-
registrator.up();
|
|
1676
|
-
}
|
|
1677
|
-
_settings = new MapSettings();
|
|
1678
|
-
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1679
|
-
set settings(value) {
|
|
1680
|
-
if (!value || this._settings.isSame(value))
|
|
1681
|
-
return;
|
|
1682
|
-
this._settings = value;
|
|
1683
|
-
this.setOsm();
|
|
1684
|
-
}
|
|
1685
|
-
ngOnInit() {
|
|
1686
|
-
useGeographic();
|
|
1687
|
-
this.map = this.mapFactory.build(this._settings);
|
|
1688
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
1689
|
-
this.detector.detectChanges();
|
|
1690
|
-
this.map.once('postrender', () => {
|
|
1691
|
-
this.map.updateSize();
|
|
1692
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1693
|
-
});
|
|
1694
|
-
this.setOsm();
|
|
1695
|
-
}
|
|
1696
|
-
setOsm() {
|
|
1697
|
-
if (!this.map)
|
|
1698
|
-
return;
|
|
1699
|
-
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
1700
|
-
this.detector.detectChanges();
|
|
1701
|
-
this.map.updateSize();
|
|
1702
|
-
}
|
|
1703
|
-
onDestroy = () => {
|
|
1704
|
-
this.registrator.down();
|
|
1705
|
-
};
|
|
1706
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1707
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1708
|
-
MessageRegistratorService,
|
|
1709
|
-
MapStateService,
|
|
1710
|
-
MapManagementService,
|
|
1711
|
-
MapClickService,
|
|
1712
|
-
MapFeatureService,
|
|
1713
|
-
DrawingService,
|
|
1714
|
-
DrawingGenerationService,
|
|
1715
|
-
FeatureService,
|
|
1716
|
-
FeatureModificationService,
|
|
1717
|
-
ControlsService,
|
|
1718
|
-
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1719
|
-
}
|
|
1720
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1721
|
-
type: Component,
|
|
1722
|
-
args: [{ selector: 'art-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1723
|
-
MessageRegistratorService,
|
|
1724
|
-
MapStateService,
|
|
1725
|
-
MapManagementService,
|
|
1726
|
-
MapClickService,
|
|
1727
|
-
MapFeatureService,
|
|
1728
|
-
DrawingService,
|
|
1729
|
-
DrawingGenerationService,
|
|
1730
|
-
FeatureService,
|
|
1731
|
-
FeatureModificationService,
|
|
1732
|
-
ControlsService,
|
|
1733
|
-
], template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
|
|
1734
|
-
}], ctorParameters:
|
|
1735
|
-
type: Input
|
|
1660
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1661
|
+
elementRef;
|
|
1662
|
+
postboy;
|
|
1663
|
+
mapFactory;
|
|
1664
|
+
registrator;
|
|
1665
|
+
detector;
|
|
1666
|
+
map;
|
|
1667
|
+
osmUrl = '';
|
|
1668
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1669
|
+
super();
|
|
1670
|
+
this.elementRef = elementRef;
|
|
1671
|
+
this.postboy = postboy;
|
|
1672
|
+
this.mapFactory = mapFactory;
|
|
1673
|
+
this.registrator = registrator;
|
|
1674
|
+
this.detector = detector;
|
|
1675
|
+
registrator.up();
|
|
1676
|
+
}
|
|
1677
|
+
_settings = new MapSettings();
|
|
1678
|
+
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1679
|
+
set settings(value) {
|
|
1680
|
+
if (!value || this._settings.isSame(value))
|
|
1681
|
+
return;
|
|
1682
|
+
this._settings = value;
|
|
1683
|
+
this.setOsm();
|
|
1684
|
+
}
|
|
1685
|
+
ngOnInit() {
|
|
1686
|
+
useGeographic();
|
|
1687
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1688
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1689
|
+
this.detector.detectChanges();
|
|
1690
|
+
this.map.once('postrender', () => {
|
|
1691
|
+
this.map.updateSize();
|
|
1692
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1693
|
+
});
|
|
1694
|
+
this.setOsm();
|
|
1695
|
+
}
|
|
1696
|
+
setOsm() {
|
|
1697
|
+
if (!this.map)
|
|
1698
|
+
return;
|
|
1699
|
+
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
1700
|
+
this.detector.detectChanges();
|
|
1701
|
+
this.map.updateSize();
|
|
1702
|
+
}
|
|
1703
|
+
onDestroy = () => {
|
|
1704
|
+
this.registrator.down();
|
|
1705
|
+
};
|
|
1706
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1707
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapPlateComponent, selector: "art-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1708
|
+
MessageRegistratorService,
|
|
1709
|
+
MapStateService,
|
|
1710
|
+
MapManagementService,
|
|
1711
|
+
MapClickService,
|
|
1712
|
+
MapFeatureService,
|
|
1713
|
+
DrawingService,
|
|
1714
|
+
DrawingGenerationService,
|
|
1715
|
+
FeatureService,
|
|
1716
|
+
FeatureModificationService,
|
|
1717
|
+
ControlsService,
|
|
1718
|
+
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1719
|
+
}
|
|
1720
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1721
|
+
type: Component,
|
|
1722
|
+
args: [{ selector: 'art-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1723
|
+
MessageRegistratorService,
|
|
1724
|
+
MapStateService,
|
|
1725
|
+
MapManagementService,
|
|
1726
|
+
MapClickService,
|
|
1727
|
+
MapFeatureService,
|
|
1728
|
+
DrawingService,
|
|
1729
|
+
DrawingGenerationService,
|
|
1730
|
+
FeatureService,
|
|
1731
|
+
FeatureModificationService,
|
|
1732
|
+
ControlsService,
|
|
1733
|
+
], template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
|
|
1734
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }], propDecorators: { settings: [{
|
|
1735
|
+
type: Input
|
|
1736
1736
|
}] } });
|
|
1737
1737
|
|
|
1738
|
-
class MarkersComponent extends DestructibleComponent {
|
|
1739
|
-
postboy;
|
|
1740
|
-
layerName = '';
|
|
1741
|
-
constructor(postboy) {
|
|
1742
|
-
super();
|
|
1743
|
-
this.postboy = postboy;
|
|
1744
|
-
}
|
|
1745
|
-
_markers = [];
|
|
1746
|
-
set markers(value) {
|
|
1747
|
-
this._markers = value ?? [];
|
|
1748
|
-
this.putMarkers();
|
|
1749
|
-
}
|
|
1750
|
-
ngOnInit() {
|
|
1751
|
-
this.postboy
|
|
1752
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1753
|
-
.pipe(filter((m) => !!m), first())
|
|
1754
|
-
.subscribe(() => this.putMarkers());
|
|
1755
|
-
}
|
|
1756
|
-
putMarkers() {
|
|
1757
|
-
if (!this._markers)
|
|
1758
|
-
return;
|
|
1759
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1760
|
-
}
|
|
1761
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1762
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1763
|
-
}
|
|
1764
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1765
|
-
type: Component,
|
|
1766
|
-
args: [{ selector: 'art-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1767
|
-
}], ctorParameters:
|
|
1768
|
-
type: Input
|
|
1769
|
-
}], markers: [{
|
|
1770
|
-
type: Input
|
|
1738
|
+
class MarkersComponent extends DestructibleComponent {
|
|
1739
|
+
postboy;
|
|
1740
|
+
layerName = '';
|
|
1741
|
+
constructor(postboy) {
|
|
1742
|
+
super();
|
|
1743
|
+
this.postboy = postboy;
|
|
1744
|
+
}
|
|
1745
|
+
_markers = [];
|
|
1746
|
+
set markers(value) {
|
|
1747
|
+
this._markers = value ?? [];
|
|
1748
|
+
this.putMarkers();
|
|
1749
|
+
}
|
|
1750
|
+
ngOnInit() {
|
|
1751
|
+
this.postboy
|
|
1752
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1753
|
+
.pipe(filter((m) => !!m), first())
|
|
1754
|
+
.subscribe(() => this.putMarkers());
|
|
1755
|
+
}
|
|
1756
|
+
putMarkers() {
|
|
1757
|
+
if (!this._markers)
|
|
1758
|
+
return;
|
|
1759
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1760
|
+
}
|
|
1761
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1762
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MarkersComponent, selector: "art-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1763
|
+
}
|
|
1764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
1765
|
+
type: Component,
|
|
1766
|
+
args: [{ selector: 'art-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1767
|
+
}], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { layerName: [{
|
|
1768
|
+
type: Input
|
|
1769
|
+
}], markers: [{
|
|
1770
|
+
type: Input
|
|
1771
1771
|
}] } });
|
|
1772
1772
|
|
|
1773
|
-
class TooltipSettings {
|
|
1774
|
-
id;
|
|
1775
|
-
containerClass = 'custom-tooltip-class';
|
|
1776
|
-
show = (e) => true;
|
|
1777
|
-
constructor(id) {
|
|
1778
|
-
this.id = id ?? IdGenerator.get();
|
|
1779
|
-
}
|
|
1780
|
-
static copy(model) {
|
|
1781
|
-
const result = new TooltipSettings(model.id);
|
|
1782
|
-
result.show = model.show;
|
|
1783
|
-
result.containerClass = model.containerClass;
|
|
1784
|
-
return result;
|
|
1785
|
-
}
|
|
1786
|
-
setShow(show) {
|
|
1787
|
-
return TooltipSettings.copy({ ...this, show });
|
|
1788
|
-
}
|
|
1789
|
-
setClass(containerClass) {
|
|
1790
|
-
return TooltipSettings.copy({ ...this, containerClass });
|
|
1791
|
-
}
|
|
1792
|
-
isSame(model) {
|
|
1793
|
-
if (this.show !== model.show)
|
|
1794
|
-
return false;
|
|
1795
|
-
if (this.containerClass !== model.containerClass)
|
|
1796
|
-
return false;
|
|
1797
|
-
if (this.id !== model.id)
|
|
1798
|
-
return false;
|
|
1799
|
-
return true;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
class TooltipComponent extends DestructibleComponent {
|
|
1804
|
-
postboy;
|
|
1805
|
-
detector;
|
|
1806
|
-
container;
|
|
1807
|
-
_settings = new TooltipSettings();
|
|
1808
|
-
map;
|
|
1809
|
-
overlay;
|
|
1810
|
-
show = false;
|
|
1811
|
-
set settings(value) {
|
|
1812
|
-
if (!value || this._settings.isSame(value))
|
|
1813
|
-
return;
|
|
1814
|
-
this._settings = value;
|
|
1815
|
-
this.detector.detectChanges();
|
|
1816
|
-
}
|
|
1817
|
-
constructor(postboy, detector) {
|
|
1818
|
-
super();
|
|
1819
|
-
this.postboy = postboy;
|
|
1820
|
-
this.detector = detector;
|
|
1821
|
-
}
|
|
1822
|
-
ngOnInit() {
|
|
1823
|
-
this.subs.push(this.observeMapRender());
|
|
1824
|
-
this.subs.push(this.observeMapClick());
|
|
1825
|
-
this.subs.push(this.observeClose());
|
|
1826
|
-
}
|
|
1827
|
-
observeMapClick() {
|
|
1828
|
-
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1829
|
-
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1830
|
-
});
|
|
1831
|
-
}
|
|
1832
|
-
observeClose() {
|
|
1833
|
-
return this.postboy
|
|
1834
|
-
.subscribe(CloseTooltipCommand.ID)
|
|
1835
|
-
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1836
|
-
.subscribe(() => this.removeOverlay());
|
|
1837
|
-
}
|
|
1838
|
-
observeMapRender() {
|
|
1839
|
-
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1840
|
-
this.map = m.map;
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
removeOverlay = () => {
|
|
1844
|
-
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1845
|
-
this.show = false;
|
|
1846
|
-
};
|
|
1847
|
-
addOverlay(coordinates) {
|
|
1848
|
-
this.removeOverlay();
|
|
1849
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
1850
|
-
this.map?.addOverlay(this.overlay);
|
|
1851
|
-
this.show = true;
|
|
1852
|
-
this.detector.detectChanges();
|
|
1853
|
-
}
|
|
1854
|
-
options = (coordinates) => {
|
|
1855
|
-
return {
|
|
1856
|
-
element: this.container?.nativeElement,
|
|
1857
|
-
autoPan: false,
|
|
1858
|
-
autoPanAnimation: { duration: 0 },
|
|
1859
|
-
position: coordinates,
|
|
1860
|
-
};
|
|
1861
|
-
};
|
|
1862
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1863
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1864
|
-
}
|
|
1865
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1866
|
-
type: Component,
|
|
1867
|
-
args: [{ selector: 'art-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
1868
|
-
}], ctorParameters:
|
|
1869
|
-
type: ViewChild,
|
|
1870
|
-
args: ['tip']
|
|
1871
|
-
}], settings: [{
|
|
1872
|
-
type: Input
|
|
1773
|
+
class TooltipSettings {
|
|
1774
|
+
id;
|
|
1775
|
+
containerClass = 'custom-tooltip-class';
|
|
1776
|
+
show = (e) => true;
|
|
1777
|
+
constructor(id) {
|
|
1778
|
+
this.id = id ?? IdGenerator.get();
|
|
1779
|
+
}
|
|
1780
|
+
static copy(model) {
|
|
1781
|
+
const result = new TooltipSettings(model.id);
|
|
1782
|
+
result.show = model.show;
|
|
1783
|
+
result.containerClass = model.containerClass;
|
|
1784
|
+
return result;
|
|
1785
|
+
}
|
|
1786
|
+
setShow(show) {
|
|
1787
|
+
return TooltipSettings.copy({ ...this, show });
|
|
1788
|
+
}
|
|
1789
|
+
setClass(containerClass) {
|
|
1790
|
+
return TooltipSettings.copy({ ...this, containerClass });
|
|
1791
|
+
}
|
|
1792
|
+
isSame(model) {
|
|
1793
|
+
if (this.show !== model.show)
|
|
1794
|
+
return false;
|
|
1795
|
+
if (this.containerClass !== model.containerClass)
|
|
1796
|
+
return false;
|
|
1797
|
+
if (this.id !== model.id)
|
|
1798
|
+
return false;
|
|
1799
|
+
return true;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
class TooltipComponent extends DestructibleComponent {
|
|
1804
|
+
postboy;
|
|
1805
|
+
detector;
|
|
1806
|
+
container;
|
|
1807
|
+
_settings = new TooltipSettings();
|
|
1808
|
+
map;
|
|
1809
|
+
overlay;
|
|
1810
|
+
show = false;
|
|
1811
|
+
set settings(value) {
|
|
1812
|
+
if (!value || this._settings.isSame(value))
|
|
1813
|
+
return;
|
|
1814
|
+
this._settings = value;
|
|
1815
|
+
this.detector.detectChanges();
|
|
1816
|
+
}
|
|
1817
|
+
constructor(postboy, detector) {
|
|
1818
|
+
super();
|
|
1819
|
+
this.postboy = postboy;
|
|
1820
|
+
this.detector = detector;
|
|
1821
|
+
}
|
|
1822
|
+
ngOnInit() {
|
|
1823
|
+
this.subs.push(this.observeMapRender());
|
|
1824
|
+
this.subs.push(this.observeMapClick());
|
|
1825
|
+
this.subs.push(this.observeClose());
|
|
1826
|
+
}
|
|
1827
|
+
observeMapClick() {
|
|
1828
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1829
|
+
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
observeClose() {
|
|
1833
|
+
return this.postboy
|
|
1834
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1835
|
+
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1836
|
+
.subscribe(() => this.removeOverlay());
|
|
1837
|
+
}
|
|
1838
|
+
observeMapRender() {
|
|
1839
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1840
|
+
this.map = m.map;
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
removeOverlay = () => {
|
|
1844
|
+
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1845
|
+
this.show = false;
|
|
1846
|
+
};
|
|
1847
|
+
addOverlay(coordinates) {
|
|
1848
|
+
this.removeOverlay();
|
|
1849
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
1850
|
+
this.map?.addOverlay(this.overlay);
|
|
1851
|
+
this.show = true;
|
|
1852
|
+
this.detector.detectChanges();
|
|
1853
|
+
}
|
|
1854
|
+
options = (coordinates) => {
|
|
1855
|
+
return {
|
|
1856
|
+
element: this.container?.nativeElement,
|
|
1857
|
+
autoPan: false,
|
|
1858
|
+
autoPanAnimation: { duration: 0 },
|
|
1859
|
+
position: coordinates,
|
|
1860
|
+
};
|
|
1861
|
+
};
|
|
1862
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1863
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: TooltipComponent, selector: "art-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1864
|
+
}
|
|
1865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1866
|
+
type: Component,
|
|
1867
|
+
args: [{ selector: 'art-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
1868
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }], propDecorators: { container: [{
|
|
1869
|
+
type: ViewChild,
|
|
1870
|
+
args: ['tip']
|
|
1871
|
+
}], settings: [{
|
|
1872
|
+
type: Input
|
|
1873
1873
|
}] } });
|
|
1874
1874
|
|
|
1875
|
-
class PolygonsComponent extends DestructibleComponent {
|
|
1876
|
-
postboy;
|
|
1877
|
-
layerName = '';
|
|
1878
|
-
constructor(postboy) {
|
|
1879
|
-
super();
|
|
1880
|
-
this.postboy = postboy;
|
|
1881
|
-
}
|
|
1882
|
-
_polygons = [];
|
|
1883
|
-
set polygons(value) {
|
|
1884
|
-
this._polygons = value ?? [];
|
|
1885
|
-
this.putPolygons();
|
|
1886
|
-
}
|
|
1887
|
-
ngOnInit() {
|
|
1888
|
-
this.postboy
|
|
1889
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1890
|
-
.pipe(filter((m) => !!m), first())
|
|
1891
|
-
.subscribe(() => this.putPolygons());
|
|
1892
|
-
}
|
|
1893
|
-
putPolygons() {
|
|
1894
|
-
if (!this._polygons)
|
|
1895
|
-
return;
|
|
1896
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1897
|
-
}
|
|
1898
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1899
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1900
|
-
}
|
|
1901
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1902
|
-
type: Component,
|
|
1903
|
-
args: [{ selector: 'art-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1904
|
-
}], ctorParameters:
|
|
1905
|
-
type: Input
|
|
1906
|
-
}], polygons: [{
|
|
1907
|
-
type: Input
|
|
1875
|
+
class PolygonsComponent extends DestructibleComponent {
|
|
1876
|
+
postboy;
|
|
1877
|
+
layerName = '';
|
|
1878
|
+
constructor(postboy) {
|
|
1879
|
+
super();
|
|
1880
|
+
this.postboy = postboy;
|
|
1881
|
+
}
|
|
1882
|
+
_polygons = [];
|
|
1883
|
+
set polygons(value) {
|
|
1884
|
+
this._polygons = value ?? [];
|
|
1885
|
+
this.putPolygons();
|
|
1886
|
+
}
|
|
1887
|
+
ngOnInit() {
|
|
1888
|
+
this.postboy
|
|
1889
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1890
|
+
.pipe(filter((m) => !!m), first())
|
|
1891
|
+
.subscribe(() => this.putPolygons());
|
|
1892
|
+
}
|
|
1893
|
+
putPolygons() {
|
|
1894
|
+
if (!this._polygons)
|
|
1895
|
+
return;
|
|
1896
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1897
|
+
}
|
|
1898
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1899
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: PolygonsComponent, selector: "art-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1900
|
+
}
|
|
1901
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1902
|
+
type: Component,
|
|
1903
|
+
args: [{ selector: 'art-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1904
|
+
}], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { layerName: [{
|
|
1905
|
+
type: Input
|
|
1906
|
+
}], polygons: [{
|
|
1907
|
+
type: Input
|
|
1908
1908
|
}] } });
|
|
1909
1909
|
|
|
1910
|
-
class ZoomControlSettings {
|
|
1911
|
-
controlClass = 'ol-zoom';
|
|
1912
|
-
zoomInClass = 'ol-zoom-in';
|
|
1913
|
-
zoomOutClass = 'ol-zoom-out';
|
|
1914
|
-
zoomInLabel = 'Zoom In';
|
|
1915
|
-
zoomOutLabel = 'Zoom Out';
|
|
1916
|
-
static copy(model) {
|
|
1917
|
-
const result = new ZoomControlSettings();
|
|
1918
|
-
result.controlClass = model.controlClass;
|
|
1919
|
-
result.zoomInClass = model.zoomInClass;
|
|
1920
|
-
result.zoomOutClass = model.zoomOutClass;
|
|
1921
|
-
result.zoomInLabel = model.zoomInLabel;
|
|
1922
|
-
result.zoomOutLabel = model.zoomOutLabel;
|
|
1923
|
-
return result;
|
|
1924
|
-
}
|
|
1925
|
-
isSame(model) {
|
|
1926
|
-
if (this.zoomInClass !== model.zoomInClass)
|
|
1927
|
-
return false;
|
|
1928
|
-
if (this.zoomOutClass !== model.zoomOutClass)
|
|
1929
|
-
return false;
|
|
1930
|
-
if (this.zoomInLabel !== model.zoomInLabel)
|
|
1931
|
-
return false;
|
|
1932
|
-
if (this.controlClass !== model.controlClass)
|
|
1933
|
-
return false;
|
|
1934
|
-
if (this.zoomOutLabel !== model.zoomOutLabel)
|
|
1935
|
-
return false;
|
|
1936
|
-
return true;
|
|
1937
|
-
}
|
|
1938
|
-
setZoomInLabel(zoomInLabel) {
|
|
1939
|
-
return ZoomControlSettings.copy({ ...this, zoomInLabel });
|
|
1940
|
-
}
|
|
1941
|
-
setZoomOutClass(zoomOutClass) {
|
|
1942
|
-
return ZoomControlSettings.copy({ ...this, zoomOutClass });
|
|
1943
|
-
}
|
|
1944
|
-
setZoomInClass(zoomInClass) {
|
|
1945
|
-
return ZoomControlSettings.copy({ ...this, zoomInClass });
|
|
1946
|
-
}
|
|
1947
|
-
setZoomOutLabel(zoomOutLabel) {
|
|
1948
|
-
return ZoomControlSettings.copy({ ...this, zoomOutLabel });
|
|
1949
|
-
}
|
|
1950
|
-
setControlClass(controlClass) {
|
|
1951
|
-
return ZoomControlSettings.copy({ ...this, controlClass });
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
class MapControlZoomComponent extends DestructibleComponent {
|
|
1956
|
-
postboy;
|
|
1957
|
-
_settings = new ZoomControlSettings();
|
|
1958
|
-
map;
|
|
1959
|
-
control;
|
|
1960
|
-
set settings(value) {
|
|
1961
|
-
if (!value || this._settings.isSame(value))
|
|
1962
|
-
return;
|
|
1963
|
-
this._settings = value;
|
|
1964
|
-
this.setControl();
|
|
1965
|
-
}
|
|
1966
|
-
constructor(postboy) {
|
|
1967
|
-
super();
|
|
1968
|
-
this.postboy = postboy;
|
|
1969
|
-
}
|
|
1970
|
-
ngOnInit() {
|
|
1971
|
-
this.postboy
|
|
1972
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1973
|
-
.pipe(filter((m) => !!m), first())
|
|
1974
|
-
.subscribe((m) => {
|
|
1975
|
-
this.map = m.map;
|
|
1976
|
-
this.setControl();
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1979
|
-
setControl() {
|
|
1980
|
-
if (!this.map)
|
|
1981
|
-
return;
|
|
1982
|
-
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
1983
|
-
this.map.addControl(this.control);
|
|
1984
|
-
}
|
|
1985
|
-
onDestroy = () => {
|
|
1986
|
-
this.eliminate();
|
|
1987
|
-
};
|
|
1988
|
-
eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
1989
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1990
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1991
|
-
}
|
|
1992
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1993
|
-
type: Component,
|
|
1994
|
-
args: [{ selector: 'art-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1995
|
-
}], ctorParameters:
|
|
1996
|
-
type: Input
|
|
1910
|
+
class ZoomControlSettings {
|
|
1911
|
+
controlClass = 'ol-zoom';
|
|
1912
|
+
zoomInClass = 'ol-zoom-in';
|
|
1913
|
+
zoomOutClass = 'ol-zoom-out';
|
|
1914
|
+
zoomInLabel = 'Zoom In';
|
|
1915
|
+
zoomOutLabel = 'Zoom Out';
|
|
1916
|
+
static copy(model) {
|
|
1917
|
+
const result = new ZoomControlSettings();
|
|
1918
|
+
result.controlClass = model.controlClass;
|
|
1919
|
+
result.zoomInClass = model.zoomInClass;
|
|
1920
|
+
result.zoomOutClass = model.zoomOutClass;
|
|
1921
|
+
result.zoomInLabel = model.zoomInLabel;
|
|
1922
|
+
result.zoomOutLabel = model.zoomOutLabel;
|
|
1923
|
+
return result;
|
|
1924
|
+
}
|
|
1925
|
+
isSame(model) {
|
|
1926
|
+
if (this.zoomInClass !== model.zoomInClass)
|
|
1927
|
+
return false;
|
|
1928
|
+
if (this.zoomOutClass !== model.zoomOutClass)
|
|
1929
|
+
return false;
|
|
1930
|
+
if (this.zoomInLabel !== model.zoomInLabel)
|
|
1931
|
+
return false;
|
|
1932
|
+
if (this.controlClass !== model.controlClass)
|
|
1933
|
+
return false;
|
|
1934
|
+
if (this.zoomOutLabel !== model.zoomOutLabel)
|
|
1935
|
+
return false;
|
|
1936
|
+
return true;
|
|
1937
|
+
}
|
|
1938
|
+
setZoomInLabel(zoomInLabel) {
|
|
1939
|
+
return ZoomControlSettings.copy({ ...this, zoomInLabel });
|
|
1940
|
+
}
|
|
1941
|
+
setZoomOutClass(zoomOutClass) {
|
|
1942
|
+
return ZoomControlSettings.copy({ ...this, zoomOutClass });
|
|
1943
|
+
}
|
|
1944
|
+
setZoomInClass(zoomInClass) {
|
|
1945
|
+
return ZoomControlSettings.copy({ ...this, zoomInClass });
|
|
1946
|
+
}
|
|
1947
|
+
setZoomOutLabel(zoomOutLabel) {
|
|
1948
|
+
return ZoomControlSettings.copy({ ...this, zoomOutLabel });
|
|
1949
|
+
}
|
|
1950
|
+
setControlClass(controlClass) {
|
|
1951
|
+
return ZoomControlSettings.copy({ ...this, controlClass });
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
class MapControlZoomComponent extends DestructibleComponent {
|
|
1956
|
+
postboy;
|
|
1957
|
+
_settings = new ZoomControlSettings();
|
|
1958
|
+
map;
|
|
1959
|
+
control;
|
|
1960
|
+
set settings(value) {
|
|
1961
|
+
if (!value || this._settings.isSame(value))
|
|
1962
|
+
return;
|
|
1963
|
+
this._settings = value;
|
|
1964
|
+
this.setControl();
|
|
1965
|
+
}
|
|
1966
|
+
constructor(postboy) {
|
|
1967
|
+
super();
|
|
1968
|
+
this.postboy = postboy;
|
|
1969
|
+
}
|
|
1970
|
+
ngOnInit() {
|
|
1971
|
+
this.postboy
|
|
1972
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1973
|
+
.pipe(filter((m) => !!m), first())
|
|
1974
|
+
.subscribe((m) => {
|
|
1975
|
+
this.map = m.map;
|
|
1976
|
+
this.setControl();
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
setControl() {
|
|
1980
|
+
if (!this.map)
|
|
1981
|
+
return;
|
|
1982
|
+
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
1983
|
+
this.map.addControl(this.control);
|
|
1984
|
+
}
|
|
1985
|
+
onDestroy = () => {
|
|
1986
|
+
this.eliminate();
|
|
1987
|
+
};
|
|
1988
|
+
eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
1989
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1990
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapControlZoomComponent, selector: "art-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1991
|
+
}
|
|
1992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapControlZoomComponent, decorators: [{
|
|
1993
|
+
type: Component,
|
|
1994
|
+
args: [{ selector: 'art-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1995
|
+
}], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { settings: [{
|
|
1996
|
+
type: Input
|
|
1997
1997
|
}] } });
|
|
1998
1998
|
|
|
1999
|
-
class MapModule {
|
|
2000
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2001
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2002
|
-
MapPlateComponent,
|
|
2003
|
-
TileLayerComponent,
|
|
2004
|
-
OsmTileLayerComponent,
|
|
2005
|
-
FeatureLayerComponent,
|
|
2006
|
-
MarkersComponent,
|
|
2007
|
-
TooltipComponent,
|
|
2008
|
-
PolygonsComponent,
|
|
2009
|
-
ClusterLayerComponent,
|
|
2010
|
-
MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
2011
|
-
FeatureLayerComponent,
|
|
2012
|
-
MarkersComponent,
|
|
2013
|
-
TileLayerComponent,
|
|
2014
|
-
TooltipComponent,
|
|
2015
|
-
PolygonsComponent,
|
|
2016
|
-
ClusterLayerComponent,
|
|
2017
|
-
MapControlZoomComponent] });
|
|
2018
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2019
|
-
}
|
|
2020
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2021
|
-
type: NgModule,
|
|
2022
|
-
args: [{
|
|
2023
|
-
imports: [CommonModule],
|
|
2024
|
-
declarations: [
|
|
2025
|
-
DestructibleComponent,
|
|
2026
|
-
MapPlateComponent,
|
|
2027
|
-
TileLayerComponent,
|
|
2028
|
-
OsmTileLayerComponent,
|
|
2029
|
-
FeatureLayerComponent,
|
|
2030
|
-
MarkersComponent,
|
|
2031
|
-
TooltipComponent,
|
|
2032
|
-
PolygonsComponent,
|
|
2033
|
-
ClusterLayerComponent,
|
|
2034
|
-
MapControlZoomComponent,
|
|
2035
|
-
],
|
|
2036
|
-
exports: [
|
|
2037
|
-
MapPlateComponent,
|
|
2038
|
-
FeatureLayerComponent,
|
|
2039
|
-
MarkersComponent,
|
|
2040
|
-
TileLayerComponent,
|
|
2041
|
-
TooltipComponent,
|
|
2042
|
-
PolygonsComponent,
|
|
2043
|
-
ClusterLayerComponent,
|
|
2044
|
-
MapControlZoomComponent,
|
|
2045
|
-
],
|
|
2046
|
-
}]
|
|
1999
|
+
class MapModule {
|
|
2000
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2001
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
|
|
2002
|
+
MapPlateComponent,
|
|
2003
|
+
TileLayerComponent,
|
|
2004
|
+
OsmTileLayerComponent,
|
|
2005
|
+
FeatureLayerComponent,
|
|
2006
|
+
MarkersComponent,
|
|
2007
|
+
TooltipComponent,
|
|
2008
|
+
PolygonsComponent,
|
|
2009
|
+
ClusterLayerComponent,
|
|
2010
|
+
MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
2011
|
+
FeatureLayerComponent,
|
|
2012
|
+
MarkersComponent,
|
|
2013
|
+
TileLayerComponent,
|
|
2014
|
+
TooltipComponent,
|
|
2015
|
+
PolygonsComponent,
|
|
2016
|
+
ClusterLayerComponent,
|
|
2017
|
+
MapControlZoomComponent] });
|
|
2018
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
2019
|
+
}
|
|
2020
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, decorators: [{
|
|
2021
|
+
type: NgModule,
|
|
2022
|
+
args: [{
|
|
2023
|
+
imports: [CommonModule],
|
|
2024
|
+
declarations: [
|
|
2025
|
+
DestructibleComponent,
|
|
2026
|
+
MapPlateComponent,
|
|
2027
|
+
TileLayerComponent,
|
|
2028
|
+
OsmTileLayerComponent,
|
|
2029
|
+
FeatureLayerComponent,
|
|
2030
|
+
MarkersComponent,
|
|
2031
|
+
TooltipComponent,
|
|
2032
|
+
PolygonsComponent,
|
|
2033
|
+
ClusterLayerComponent,
|
|
2034
|
+
MapControlZoomComponent,
|
|
2035
|
+
],
|
|
2036
|
+
exports: [
|
|
2037
|
+
MapPlateComponent,
|
|
2038
|
+
FeatureLayerComponent,
|
|
2039
|
+
MarkersComponent,
|
|
2040
|
+
TileLayerComponent,
|
|
2041
|
+
TooltipComponent,
|
|
2042
|
+
PolygonsComponent,
|
|
2043
|
+
ClusterLayerComponent,
|
|
2044
|
+
MapControlZoomComponent,
|
|
2045
|
+
],
|
|
2046
|
+
}]
|
|
2047
2047
|
}] });
|
|
2048
2048
|
|
|
2049
|
-
class MarkerStyleHelper {
|
|
2050
|
-
static fromSvg(svg, size = [30, 30], zIndex = 400) {
|
|
2051
|
-
let image = new Image();
|
|
2052
|
-
image.src = 'data:image/svg+xml,' + escape(svg);
|
|
2053
|
-
return new Style({
|
|
2054
|
-
image: new Icon({
|
|
2055
|
-
img: image,
|
|
2056
|
-
imgSize: size,
|
|
2057
|
-
}),
|
|
2058
|
-
zIndex,
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
|
-
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
2062
|
-
return new Style({
|
|
2063
|
-
image: new Circle({
|
|
2064
|
-
radius,
|
|
2065
|
-
fill: new Fill({ color: fill }),
|
|
2066
|
-
stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
|
|
2067
|
-
}),
|
|
2068
|
-
});
|
|
2069
|
-
}
|
|
2070
|
-
static withText(style, text) {
|
|
2071
|
-
style.setText(text);
|
|
2072
|
-
return style;
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
class PolygonStyleHelper {
|
|
2077
|
-
static simple(fill, stroke, strokeWidth = 1) {
|
|
2078
|
-
return new Style({
|
|
2079
|
-
fill: new Fill({
|
|
2080
|
-
color: fill,
|
|
2081
|
-
}),
|
|
2082
|
-
stroke: new Stroke({
|
|
2083
|
-
color: stroke,
|
|
2084
|
-
width: strokeWidth,
|
|
2085
|
-
}),
|
|
2086
|
-
});
|
|
2087
|
-
}
|
|
2088
|
-
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
2089
|
-
return new Style({
|
|
2090
|
-
image: new Circle({
|
|
2091
|
-
fill: new Fill({
|
|
2092
|
-
color: stroke,
|
|
2093
|
-
}),
|
|
2094
|
-
radius: pinRadius,
|
|
2095
|
-
}),
|
|
2096
|
-
fill: new Fill({
|
|
2097
|
-
color: fill,
|
|
2098
|
-
}),
|
|
2099
|
-
stroke: new Stroke({
|
|
2100
|
-
color: stroke,
|
|
2101
|
-
width: strokeWidth,
|
|
2102
|
-
}),
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
class TextStyleHelper {
|
|
2108
|
-
static get(text, font, color) {
|
|
2109
|
-
return new Text({
|
|
2110
|
-
text: text,
|
|
2111
|
-
font: font,
|
|
2112
|
-
textAlign: 'center',
|
|
2113
|
-
fill: new Fill({
|
|
2114
|
-
color: color,
|
|
2115
|
-
}),
|
|
2116
|
-
});
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
class StringifyFeatureHelper {
|
|
2121
|
-
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2122
|
-
return format === FeatureOutputFormat.GeoJson
|
|
2123
|
-
? new GeoJSON().writeFeature(feature)
|
|
2124
|
-
: new WKT().writeFeature(feature);
|
|
2125
|
-
}
|
|
2126
|
-
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2127
|
-
// const clone = feature.clone();
|
|
2128
|
-
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
2129
|
-
const tetemp = feature.getGeometryName();
|
|
2130
|
-
const circle = feature.getGeometry();
|
|
2131
|
-
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
2132
|
-
const ttt = feature.getGeometry().getExtent();
|
|
2133
|
-
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
2134
|
-
const aaa = [
|
|
2135
|
-
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2136
|
-
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2137
|
-
];
|
|
2138
|
-
const radius = (aaa[2] - aaa[0]) / 2;
|
|
2139
|
-
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
2140
|
-
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
2141
|
-
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
2142
|
-
// var wgs84Sphere = new Sphere(6378137);
|
|
2143
|
-
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
2144
|
-
// const rad = circle.getRadius();
|
|
2145
|
-
// const degrees = 180 / Math.PI; // radians to degrees
|
|
2146
|
-
// const radians = Math.PI / 180; // degrees to radians
|
|
2147
|
-
// const rlat = rad * degrees * 1000;
|
|
2148
|
-
// const rlng = rad * radians;
|
|
2149
|
-
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
2150
|
-
}
|
|
2151
|
-
static drawCircle(point, radius) {
|
|
2152
|
-
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
2153
|
-
// const tetetemp = point;
|
|
2154
|
-
const radians = Math.PI / 180; // degrees to radians
|
|
2155
|
-
const degrees = 180 / Math.PI; // radians to degrees
|
|
2156
|
-
const earthsradius = 6378137.0;
|
|
2157
|
-
const rlat = (radius / earthsradius) * degrees;
|
|
2158
|
-
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
2159
|
-
const extp = [];
|
|
2160
|
-
for (let i = 0; i <= 32; i++) {
|
|
2161
|
-
const theta = Math.PI * (i / 16);
|
|
2162
|
-
extp.push([
|
|
2163
|
-
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
2164
|
-
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
2165
|
-
]);
|
|
2166
|
-
}
|
|
2167
|
-
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
/*
|
|
2172
|
-
* Public API Surface of maps
|
|
2049
|
+
class MarkerStyleHelper {
|
|
2050
|
+
static fromSvg(svg, size = [30, 30], zIndex = 400) {
|
|
2051
|
+
let image = new Image();
|
|
2052
|
+
image.src = 'data:image/svg+xml,' + escape(svg);
|
|
2053
|
+
return new Style({
|
|
2054
|
+
image: new Icon({
|
|
2055
|
+
img: image,
|
|
2056
|
+
imgSize: size,
|
|
2057
|
+
}),
|
|
2058
|
+
zIndex,
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
2062
|
+
return new Style({
|
|
2063
|
+
image: new Circle({
|
|
2064
|
+
radius,
|
|
2065
|
+
fill: new Fill({ color: fill }),
|
|
2066
|
+
stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
|
|
2067
|
+
}),
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
static withText(style, text) {
|
|
2071
|
+
style.setText(text);
|
|
2072
|
+
return style;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
class PolygonStyleHelper {
|
|
2077
|
+
static simple(fill, stroke, strokeWidth = 1) {
|
|
2078
|
+
return new Style({
|
|
2079
|
+
fill: new Fill({
|
|
2080
|
+
color: fill,
|
|
2081
|
+
}),
|
|
2082
|
+
stroke: new Stroke({
|
|
2083
|
+
color: stroke,
|
|
2084
|
+
width: strokeWidth,
|
|
2085
|
+
}),
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
2089
|
+
return new Style({
|
|
2090
|
+
image: new Circle({
|
|
2091
|
+
fill: new Fill({
|
|
2092
|
+
color: stroke,
|
|
2093
|
+
}),
|
|
2094
|
+
radius: pinRadius,
|
|
2095
|
+
}),
|
|
2096
|
+
fill: new Fill({
|
|
2097
|
+
color: fill,
|
|
2098
|
+
}),
|
|
2099
|
+
stroke: new Stroke({
|
|
2100
|
+
color: stroke,
|
|
2101
|
+
width: strokeWidth,
|
|
2102
|
+
}),
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
class TextStyleHelper {
|
|
2108
|
+
static get(text, font, color) {
|
|
2109
|
+
return new Text({
|
|
2110
|
+
text: text,
|
|
2111
|
+
font: font,
|
|
2112
|
+
textAlign: 'center',
|
|
2113
|
+
fill: new Fill({
|
|
2114
|
+
color: color,
|
|
2115
|
+
}),
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
class StringifyFeatureHelper {
|
|
2121
|
+
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2122
|
+
return format === FeatureOutputFormat.GeoJson
|
|
2123
|
+
? new GeoJSON().writeFeature(feature)
|
|
2124
|
+
: new WKT().writeFeature(feature);
|
|
2125
|
+
}
|
|
2126
|
+
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2127
|
+
// const clone = feature.clone();
|
|
2128
|
+
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
2129
|
+
const tetemp = feature.getGeometryName();
|
|
2130
|
+
const circle = feature.getGeometry();
|
|
2131
|
+
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
2132
|
+
const ttt = feature.getGeometry().getExtent();
|
|
2133
|
+
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
2134
|
+
const aaa = [
|
|
2135
|
+
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2136
|
+
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2137
|
+
];
|
|
2138
|
+
const radius = (aaa[2] - aaa[0]) / 2;
|
|
2139
|
+
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
2140
|
+
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
2141
|
+
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
2142
|
+
// var wgs84Sphere = new Sphere(6378137);
|
|
2143
|
+
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
2144
|
+
// const rad = circle.getRadius();
|
|
2145
|
+
// const degrees = 180 / Math.PI; // radians to degrees
|
|
2146
|
+
// const radians = Math.PI / 180; // degrees to radians
|
|
2147
|
+
// const rlat = rad * degrees * 1000;
|
|
2148
|
+
// const rlng = rad * radians;
|
|
2149
|
+
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
2150
|
+
}
|
|
2151
|
+
static drawCircle(point, radius) {
|
|
2152
|
+
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
2153
|
+
// const tetetemp = point;
|
|
2154
|
+
const radians = Math.PI / 180; // degrees to radians
|
|
2155
|
+
const degrees = 180 / Math.PI; // radians to degrees
|
|
2156
|
+
const earthsradius = 6378137.0;
|
|
2157
|
+
const rlat = (radius / earthsradius) * degrees;
|
|
2158
|
+
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
2159
|
+
const extp = [];
|
|
2160
|
+
for (let i = 0; i <= 32; i++) {
|
|
2161
|
+
const theta = Math.PI * (i / 16);
|
|
2162
|
+
extp.push([
|
|
2163
|
+
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
2164
|
+
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
2165
|
+
]);
|
|
2166
|
+
}
|
|
2167
|
+
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/*
|
|
2172
|
+
* Public API Surface of maps
|
|
2173
2173
|
*/
|
|
2174
2174
|
|
|
2175
|
-
/*
|
|
2176
|
-
* Public API Surface of maps-components
|
|
2175
|
+
/*
|
|
2176
|
+
* Public API Surface of maps-components
|
|
2177
2177
|
*/
|
|
2178
2178
|
|
|
2179
|
-
/**
|
|
2180
|
-
* Generated bundle index. Do not edit.
|
|
2179
|
+
/**
|
|
2180
|
+
* Generated bundle index. Do not edit.
|
|
2181
2181
|
*/
|
|
2182
2182
|
|
|
2183
2183
|
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FitToPolygonsCommand, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|