@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.31
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/LICENSE.md +1 -1
- package/README.md +12 -5
- package/build/postinstall.js +14 -3
- package/index.d.ts +3480 -2008
- package/index.js +169 -131
- package/package.json +25 -27
- package/src/category/category.js +483 -0
- package/src/category/categoryCollection.js +153 -0
- package/src/cesium/cesium3DTileFeature.js +2 -2
- package/src/cesium/cesium3DTilePointFeature.js +1 -1
- package/src/cesium/cesiumVcsCameraPrimitive.js +16 -8
- package/src/cesium/entity.js +29 -0
- package/src/cesium/wallpaperMaterial.js +5 -3
- package/src/classRegistry.js +169 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +49 -46
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +13 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +56 -26
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +33 -21
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +40 -21
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +131 -26
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +108 -53
- package/src/interaction/featureProviderInteraction.js +58 -0
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +40 -41
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +24 -31
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +83 -70
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +33 -8
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +24 -13
- package/src/layer/cesium/openStreetMapCesiumImpl.js +32 -0
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +12 -9
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +19 -9
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +8 -9
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +21 -10
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +93 -35
- package/src/layer/cesium/vectorContext.js +363 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +21 -13
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +58 -21
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +20 -9
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +24 -13
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +6 -3
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +71 -112
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +23 -20
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +55 -90
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +89 -74
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +197 -150
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +150 -92
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +114 -82
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +84 -69
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +30 -27
- package/src/{vcs/vcm/layer → layer}/globalHider.js +25 -39
- package/src/{vcs/vcm/layer → layer}/layer.js +171 -96
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +13 -6
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +2 -1
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +7 -5
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +76 -31
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +198 -80
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +59 -40
- package/src/layer/openlayers/layerOpenlayersImpl.js +165 -0
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +28 -0
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +44 -0
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +8 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +7 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +12 -10
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +21 -12
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +18 -12
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +9 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +19 -12
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +42 -39
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +86 -37
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +25 -22
- package/src/layer/terrainHelpers.js +95 -0
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +28 -21
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +13 -8
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +51 -8
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +87 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +200 -89
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +54 -13
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +22 -22
- package/src/layer/vectorHelpers.js +129 -0
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +124 -94
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +419 -107
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +11 -1
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +181 -116
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +33 -23
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +14 -7
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +53 -32
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +56 -42
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +83 -35
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +64 -37
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +431 -277
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +132 -97
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +69 -45
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +118 -46
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +221 -78
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +151 -55
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +77 -46
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +58 -26
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +9 -9
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +85 -35
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +45 -5
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +3 -5
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +62 -28
- package/src/ol/feature.js +34 -1
- package/src/ol/geom/circle.js +14 -5
- package/src/ol/geom/geometryCollection.js +14 -8
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -10
- package/src/overrideClassRegistry.js +214 -0
- package/src/style/arcStyle.js +453 -0
- package/src/style/arrowStyle.js +304 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +147 -82
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +8 -8
- package/src/style/styleFactory.js +32 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +24 -26
- package/src/style/styleItem.js +174 -0
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +230 -156
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +7 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +79 -49
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +56 -23
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +149 -88
- package/src/{vcs/vcm/util → util}/collection.js +28 -10
- package/src/util/editor/createFeatureSession.js +195 -0
- package/src/util/editor/editFeaturesSession.js +325 -0
- package/src/util/editor/editGeometrySession.js +452 -0
- package/src/util/editor/editorHelpers.js +300 -0
- package/src/util/editor/editorSessionHelpers.js +132 -0
- package/src/util/editor/editorSymbols.js +21 -0
- package/src/util/editor/interactions/createBBoxInteraction.js +154 -0
- package/src/util/editor/interactions/createCircleInteraction.js +119 -0
- package/src/util/editor/interactions/createLineStringInteraction.js +119 -0
- package/src/util/editor/interactions/createPointInteraction.js +73 -0
- package/src/util/editor/interactions/createPolygonInteraction.js +136 -0
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +88 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +119 -0
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +50 -0
- package/src/util/editor/interactions/insertVertexInteraction.js +103 -0
- package/src/util/editor/interactions/mapInteractionController.js +119 -0
- package/src/util/editor/interactions/removeVertexInteraction.js +42 -0
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +152 -0
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +165 -0
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +120 -0
- package/src/util/editor/interactions/translateVertexInteraction.js +60 -0
- package/src/util/editor/selectFeaturesSession.js +303 -0
- package/src/util/editor/transformation/create2DHandlers.js +339 -0
- package/src/util/editor/transformation/create3DHandlers.js +678 -0
- package/src/util/editor/transformation/extrudeInteraction.js +106 -0
- package/src/util/editor/transformation/rotateInteraction.js +201 -0
- package/src/util/editor/transformation/scaleInteraction.js +201 -0
- package/src/util/editor/transformation/transformationHandler.js +178 -0
- package/src/util/editor/transformation/transformationTypes.js +88 -0
- package/src/util/editor/transformation/translateInteraction.js +263 -0
- package/src/util/editor/validateGeoemetry.js +24 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +6 -3
- package/src/{vcs/vcm/util → util}/extent.js +26 -20
- package/src/util/featureconverter/arcToCesium.js +121 -0
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +70 -37
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +94 -16
- package/src/util/featureconverter/extent3D.js +284 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +253 -94
- package/src/util/featureconverter/lineStringToCesium.js +343 -0
- package/src/util/featureconverter/pointHelpers.js +413 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +157 -107
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +57 -24
- package/src/util/fetch.js +34 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +25 -17
- package/src/{vcs/vcm/util → util}/indexedCollection.js +27 -8
- package/src/{vcs/vcm/util → util}/isMobile.js +8 -2
- package/src/{vcs/vcm/util → util}/layerCollection.js +109 -19
- package/src/util/locale.js +12 -0
- package/src/{vcs/vcm/util → util}/mapCollection.js +170 -63
- package/src/util/math.js +193 -0
- package/src/util/overrideCollection.js +261 -0
- package/src/{vcs/vcm/util → util}/projection.js +23 -31
- package/src/{vcs/vcm/util → util}/urlHelpers.js +5 -3
- package/src/{vcs/vcm/util → util}/viewpoint.js +83 -57
- package/src/vcsApp.js +657 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/vcsModule.js +130 -0
- package/src/vcsModuleHelpers.js +136 -0
- package/src/{vcs/vcm/object.js → vcsObject.js} +3 -10
- package/tests/data/dynamicPointCzml.json +53 -0
- package/tests/data/oblique/imageData/imagev34.json +136 -0
- package/tests/data/oblique/imageData/imagev35.json +307 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +333 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -0
- package/tests/data/oblique/tiledImageData/image.json +70 -0
- package/tests/data/terrain/13/8800/6485.terrain +0 -0
- package/tests/data/terrain/13/8800/6486.terrain +0 -0
- package/tests/data/terrain/13/8801/6485.terrain +0 -0
- package/tests/data/terrain/13/8801/6486.terrain +0 -0
- package/tests/data/terrain/layer.json +127 -0
- package/tests/data/testGeoJSON.json +149 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +326 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +32 -0
- package/tests/unit/helpers/imageHelpers.js +24 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +102 -0
- package/tests/unit/helpers/obliqueHelpers.js +115 -0
- package/tests/unit/helpers/openlayersHelpers.js +25 -0
- package/tests/unit/helpers/terrain/terrainData.js +45 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/interaction/featureProviderInteraction.js +0 -54
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +0 -29
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/cesium/vectorContext.js +0 -167
- package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +0 -79
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +0 -121
- package/src/vcs/vcm/layer/terrainHelpers.js +0 -119
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/layer/vectorHelpers.js +0 -206
- package/src/vcs/vcm/util/dateTime.js +0 -60
- package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +0 -51
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +0 -171
- package/src/vcs/vcm/util/locale.js +0 -53
- package/src/vcs/vcm/util/math.js +0 -71
- package/src/vcs/vcm/util/splitScreen.js +0 -233
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
- package/src/vcs/vcm/util/style/styleItem.js +0 -243
- /package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-template-curly-in-string */
|
|
2
2
|
import Stroke from 'ol/style/Stroke.js';
|
|
3
|
-
import { Color, VerticalOrigin } from '@vcmap/
|
|
3
|
+
import { Color, VerticalOrigin } from '@vcmap-cesium/engine';
|
|
4
4
|
import Icon from 'ol/style/Icon.js';
|
|
5
5
|
import Style from 'ol/style/Style.js';
|
|
6
6
|
import OLText from 'ol/style/Text.js';
|
|
@@ -10,7 +10,7 @@ import Circle from 'ol/style/Circle.js';
|
|
|
10
10
|
import RegularShape from 'ol/style/RegularShape.js';
|
|
11
11
|
|
|
12
12
|
import { check, checkMaybe } from '@vcsuite/check';
|
|
13
|
-
import StyleItem
|
|
13
|
+
import StyleItem from './styleItem.js';
|
|
14
14
|
import {
|
|
15
15
|
parseColor,
|
|
16
16
|
PatternType,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
getDefaultVectorStyleItemOptions,
|
|
25
25
|
} from './styleHelpers.js';
|
|
26
26
|
import { getShapeFromOptions } from './shapesCategory.js';
|
|
27
|
+
import { styleClassRegistry } from '../classRegistry.js';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* @typedef {Object} VectorStyleItemPattern
|
|
@@ -96,7 +97,7 @@ import { getShapeFromOptions } from './shapesCategory.js';
|
|
|
96
97
|
* @property {number} POLYLINE
|
|
97
98
|
* @property {number} POINT
|
|
98
99
|
*/
|
|
99
|
-
export const
|
|
100
|
+
export const OlcsGeometryType = {
|
|
100
101
|
POLYGON: 1,
|
|
101
102
|
POLYLINE: 2,
|
|
102
103
|
POINT: 3,
|
|
@@ -114,21 +115,21 @@ export const olcsGeometryType = {
|
|
|
114
115
|
|
|
115
116
|
/**
|
|
116
117
|
* Is set on a feature and is used to signal that the feature has a specific vectorStyleItem.
|
|
117
|
-
* Is set by the Editor if the layerStyle is overwritten. The
|
|
118
|
+
* Is set by the Editor if the layerStyle is overwritten. The VectorLayer layer assures this style is set, if
|
|
118
119
|
* the style on the layer is not a DeclarativeStyle
|
|
119
120
|
* @type {symbol}
|
|
120
|
-
* @export
|
|
121
121
|
*/
|
|
122
122
|
export const vectorStyleSymbol = Symbol('VcsVectorStyleItem');
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* @class
|
|
126
126
|
* @extends {StyleItem}
|
|
127
|
-
* @export
|
|
128
127
|
* @api
|
|
129
128
|
*/
|
|
130
129
|
class VectorStyleItem extends StyleItem {
|
|
131
|
-
static get className() {
|
|
130
|
+
static get className() {
|
|
131
|
+
return 'VectorStyleItem';
|
|
132
|
+
}
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* @param {VectorStyleItemOptions} options
|
|
@@ -180,7 +181,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
180
181
|
this.label = this._label;
|
|
181
182
|
|
|
182
183
|
/**
|
|
183
|
-
* @type {import("@vcmap/
|
|
184
|
+
* @type {import("@vcmap-cesium/engine").Color}
|
|
184
185
|
* @private
|
|
185
186
|
*/
|
|
186
187
|
this._cesiumColor = new Color();
|
|
@@ -191,9 +192,11 @@ class VectorStyleItem extends StyleItem {
|
|
|
191
192
|
*/
|
|
192
193
|
this._image = undefined;
|
|
193
194
|
if (options.image) {
|
|
194
|
-
this._image = options.image.radius
|
|
195
|
-
getShapeFromOptions({ ...options.image })
|
|
196
|
-
new Icon(
|
|
195
|
+
this._image = options.image.radius
|
|
196
|
+
? getShapeFromOptions({ ...options.image })
|
|
197
|
+
: new Icon(
|
|
198
|
+
/** @type {import("ol/style/Icon").Options} */ (options.image),
|
|
199
|
+
);
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
/**
|
|
@@ -224,7 +227,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
224
227
|
check(option.color.length, [3, 4]);
|
|
225
228
|
} catch (e) {
|
|
226
229
|
this.getLogger().error(e.message);
|
|
227
|
-
option.color = /** @type {import("ol/color").Color} */ ([
|
|
230
|
+
option.color = /** @type {import("ol/color").Color} */ ([
|
|
231
|
+
255, 255, 255, 0.4,
|
|
232
|
+
]);
|
|
228
233
|
}
|
|
229
234
|
};
|
|
230
235
|
|
|
@@ -240,8 +245,15 @@ class VectorStyleItem extends StyleItem {
|
|
|
240
245
|
checkColor(options.fill);
|
|
241
246
|
if (options.fill.pattern) {
|
|
242
247
|
checkStroke(options.fill.pattern);
|
|
243
|
-
if (
|
|
244
|
-
|
|
248
|
+
if (
|
|
249
|
+
!(
|
|
250
|
+
options.fill.pattern.type &&
|
|
251
|
+
Object.values(PatternType).includes(options.fill.pattern.type)
|
|
252
|
+
)
|
|
253
|
+
) {
|
|
254
|
+
this.getLogger().error(
|
|
255
|
+
`Cannot find pattern ${options.fill.pattern.type}`,
|
|
256
|
+
);
|
|
245
257
|
options.fill.pattern.type = PatternType.NWSE;
|
|
246
258
|
}
|
|
247
259
|
}
|
|
@@ -260,7 +272,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
260
272
|
}
|
|
261
273
|
|
|
262
274
|
if (!(options.image.src || options.image.radius)) {
|
|
263
|
-
this.getLogger().error(
|
|
275
|
+
this.getLogger().error(
|
|
276
|
+
'missing source or label in style, setting default circle',
|
|
277
|
+
);
|
|
264
278
|
options.image = {
|
|
265
279
|
fill: {
|
|
266
280
|
color: 'rgba(255,255,255,0.4)',
|
|
@@ -296,24 +310,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
296
310
|
* @api
|
|
297
311
|
*/
|
|
298
312
|
get fillColor() {
|
|
299
|
-
return this._fillOptions
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* the current fill color as a cesium color
|
|
304
|
-
* @readonly
|
|
305
|
-
* @type {import("@vcmap/cesium").Color}
|
|
306
|
-
* @api
|
|
307
|
-
*/
|
|
308
|
-
get cesiumFillColor() {
|
|
309
|
-
const fillColor = this.fillColor ? this.fillColor.slice() : null;
|
|
310
|
-
if (fillColor) {
|
|
311
|
-
fillColor[3] = fillColor[3] || 1;
|
|
312
|
-
fillColor[3] *= 255; // cesium alpha range between 0 and 255
|
|
313
|
-
// @ts-ignore
|
|
314
|
-
return Color.fromBytes(...fillColor, this._cesiumColor);
|
|
315
|
-
}
|
|
316
|
-
return Color.RED.clone(this._cesiumColor); // TODO should not be red - transparent?
|
|
313
|
+
return this._fillOptions
|
|
314
|
+
? /** @type {import("ol/color").Color} */ (this._fillOptions.color)
|
|
315
|
+
: null;
|
|
317
316
|
}
|
|
318
317
|
|
|
319
318
|
/**
|
|
@@ -340,12 +339,31 @@ class VectorStyleItem extends StyleItem {
|
|
|
340
339
|
}
|
|
341
340
|
}
|
|
342
341
|
|
|
342
|
+
/**
|
|
343
|
+
* the current fill color as a cesium color
|
|
344
|
+
* @readonly
|
|
345
|
+
* @type {import("@vcmap-cesium/engine").Color}
|
|
346
|
+
* @api
|
|
347
|
+
*/
|
|
348
|
+
get cesiumFillColor() {
|
|
349
|
+
const fillColor = this.fillColor ? this.fillColor.slice() : null;
|
|
350
|
+
if (fillColor) {
|
|
351
|
+
fillColor[3] = fillColor[3] || 1;
|
|
352
|
+
fillColor[3] *= 255; // cesium alpha range between 0 and 255
|
|
353
|
+
// @ts-ignore
|
|
354
|
+
return Color.fromBytes(...fillColor, this._cesiumColor);
|
|
355
|
+
}
|
|
356
|
+
return Color.RED.clone(this._cesiumColor); // TODO should not be red - transparent?
|
|
357
|
+
}
|
|
358
|
+
|
|
343
359
|
/**
|
|
344
360
|
* @type {VectorStyleItemPattern}
|
|
345
361
|
* @api
|
|
346
362
|
*/
|
|
347
363
|
get pattern() {
|
|
348
|
-
return this._fillOptions && this._fillOptions.pattern
|
|
364
|
+
return this._fillOptions && this._fillOptions.pattern
|
|
365
|
+
? this._fillOptions.pattern
|
|
366
|
+
: null;
|
|
349
367
|
}
|
|
350
368
|
|
|
351
369
|
/**
|
|
@@ -357,12 +375,16 @@ class VectorStyleItem extends StyleItem {
|
|
|
357
375
|
return;
|
|
358
376
|
}
|
|
359
377
|
if (patternOptions) {
|
|
360
|
-
checkMaybe(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
378
|
+
checkMaybe(
|
|
379
|
+
patternOptions,
|
|
380
|
+
{
|
|
381
|
+
color: [String, [Number]],
|
|
382
|
+
width: Number,
|
|
383
|
+
type: Number,
|
|
384
|
+
size: [Number, undefined, null],
|
|
385
|
+
},
|
|
386
|
+
true,
|
|
387
|
+
);
|
|
366
388
|
this._fillOptions.pattern = patternOptions;
|
|
367
389
|
} else {
|
|
368
390
|
this._fillOptions.pattern = undefined;
|
|
@@ -374,7 +396,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
374
396
|
* @type {import("ol/style/Stroke").default}
|
|
375
397
|
* @api
|
|
376
398
|
*/
|
|
377
|
-
get stroke() {
|
|
399
|
+
get stroke() {
|
|
400
|
+
return this._stroke;
|
|
401
|
+
}
|
|
378
402
|
|
|
379
403
|
/**
|
|
380
404
|
* @param {import("ol/style/Stroke").default=} stroke
|
|
@@ -395,7 +419,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
395
419
|
* @type {string}
|
|
396
420
|
* @api
|
|
397
421
|
*/
|
|
398
|
-
get label() {
|
|
422
|
+
get label() {
|
|
423
|
+
return this._label;
|
|
424
|
+
}
|
|
399
425
|
|
|
400
426
|
/**
|
|
401
427
|
* @param {string} label
|
|
@@ -416,7 +442,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
416
442
|
* @type {import("ol/style/Text").default}
|
|
417
443
|
* @api
|
|
418
444
|
*/
|
|
419
|
-
get text() {
|
|
445
|
+
get text() {
|
|
446
|
+
return this._text;
|
|
447
|
+
}
|
|
420
448
|
|
|
421
449
|
/**
|
|
422
450
|
* @param {import("ol/style/Text").default=} text
|
|
@@ -436,7 +464,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
436
464
|
* @type {(import("ol/style/Icon").default|import("ol/style/RegularShape").default)}
|
|
437
465
|
* @api
|
|
438
466
|
*/
|
|
439
|
-
get image() {
|
|
467
|
+
get image() {
|
|
468
|
+
return this._image;
|
|
469
|
+
}
|
|
440
470
|
|
|
441
471
|
/**
|
|
442
472
|
* @param {(import("ol/style/Icon").default|import("ol/style/RegularShape").default)=} image
|
|
@@ -457,7 +487,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
457
487
|
* @type {import("ol/style/Style").default|import("ol/style/Style").StyleFunction}
|
|
458
488
|
* @api
|
|
459
489
|
*/
|
|
460
|
-
get style() {
|
|
490
|
+
get style() {
|
|
491
|
+
return this._style;
|
|
492
|
+
}
|
|
461
493
|
|
|
462
494
|
/**
|
|
463
495
|
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction} style
|
|
@@ -468,7 +500,10 @@ class VectorStyleItem extends StyleItem {
|
|
|
468
500
|
this._stroke = style.getStroke();
|
|
469
501
|
this._fill = style.getFill();
|
|
470
502
|
this._text = style.getText();
|
|
471
|
-
this._image =
|
|
503
|
+
this._image =
|
|
504
|
+
/** @type {import("ol/style/Icon").default|import("ol/style/Circle").default} */ (
|
|
505
|
+
style.getImage()
|
|
506
|
+
);
|
|
472
507
|
} else {
|
|
473
508
|
this._stroke = undefined;
|
|
474
509
|
this._fill = undefined;
|
|
@@ -490,9 +525,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
490
525
|
*/
|
|
491
526
|
_setFill() {
|
|
492
527
|
if (this._style instanceof Style) {
|
|
493
|
-
const color = this._fillOptions.pattern
|
|
494
|
-
createPattern(this._fillOptions)
|
|
495
|
-
this._fillOptions.color;
|
|
528
|
+
const color = this._fillOptions.pattern
|
|
529
|
+
? createPattern(this._fillOptions)
|
|
530
|
+
: this._fillOptions.color;
|
|
496
531
|
if (this._fill) {
|
|
497
532
|
this._fill.setColor(color);
|
|
498
533
|
} else {
|
|
@@ -521,13 +556,16 @@ class VectorStyleItem extends StyleItem {
|
|
|
521
556
|
updateCesiumStyleColor(silent) {
|
|
522
557
|
const colorConditions = getDefaultCondition('olcs_color', true);
|
|
523
558
|
if (this.stroke && this.stroke.getColor()) {
|
|
524
|
-
colorConditions.splice(1, 0, [
|
|
559
|
+
colorConditions.splice(1, 0, [
|
|
560
|
+
`\${olcs_geometryType}===${OlcsGeometryType.POLYLINE}`,
|
|
561
|
+
getStringColor(this.stroke.getColor()),
|
|
562
|
+
]);
|
|
525
563
|
}
|
|
526
564
|
if (this._image instanceof Circle && this._image.getFill()) {
|
|
527
|
-
colorConditions.splice(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
);
|
|
565
|
+
colorConditions.splice(1, 0, [
|
|
566
|
+
`\${olcs_geometryType}===${OlcsGeometryType.POINT}`,
|
|
567
|
+
getStringColor(this._image.getFill().getColor()),
|
|
568
|
+
]);
|
|
531
569
|
}
|
|
532
570
|
if (this.fillColor) {
|
|
533
571
|
colorConditions.splice(-1, 1, ['true', getStringColor(this.fillColor)]);
|
|
@@ -548,8 +586,12 @@ class VectorStyleItem extends StyleItem {
|
|
|
548
586
|
],
|
|
549
587
|
} */
|
|
550
588
|
const scaleConditions = getDefaultCondition('olcs_scale');
|
|
551
|
-
const pointOutlineWidthConditions =
|
|
552
|
-
|
|
589
|
+
const pointOutlineWidthConditions =
|
|
590
|
+
getDefaultCondition('olcs_outlineWidth');
|
|
591
|
+
const pointOutlineColorConditions = getDefaultCondition(
|
|
592
|
+
'olcs_outlineColor',
|
|
593
|
+
true,
|
|
594
|
+
);
|
|
553
595
|
const pointSizeConditions = getDefaultCondition('olcs_pointSize');
|
|
554
596
|
const imageConditions = getDefaultCondition('olcs_image');
|
|
555
597
|
/* commented out, because we simulate the anchorline via a line in the tileset, TODO Evaluate again
|
|
@@ -572,7 +614,10 @@ class VectorStyleItem extends StyleItem {
|
|
|
572
614
|
let size = this._image.getRadius() * 2;
|
|
573
615
|
if (stroke) {
|
|
574
616
|
if (this._image.getStroke().getColor()) {
|
|
575
|
-
pointOutlineColorConditions.splice(1, 1, [
|
|
617
|
+
pointOutlineColorConditions.splice(1, 1, [
|
|
618
|
+
'true',
|
|
619
|
+
getStringColor(this._image.getStroke().getColor()),
|
|
620
|
+
]);
|
|
576
621
|
}
|
|
577
622
|
const width = this._image.getStroke().getWidth();
|
|
578
623
|
pointOutlineWidthConditions.splice(1, 1, ['true', `${width}`]);
|
|
@@ -580,7 +625,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
580
625
|
}
|
|
581
626
|
pointSizeConditions.splice(1, 1, ['true', `${size}`]);
|
|
582
627
|
} else if (this._image instanceof RegularShape) {
|
|
583
|
-
const dataUrl = /** @type {HTMLCanvasElement} */ (
|
|
628
|
+
const dataUrl = /** @type {HTMLCanvasElement} */ (
|
|
629
|
+
this._image.getImage(1)
|
|
630
|
+
).toDataURL();
|
|
584
631
|
imageConditions.splice(1, 1, ['true', `"${dataUrl}"`]);
|
|
585
632
|
} else if (this._image instanceof Icon) {
|
|
586
633
|
imageConditions.splice(1, 1, ['true', `"${this._image.getSrc()}"`]);
|
|
@@ -593,10 +640,14 @@ class VectorStyleItem extends StyleItem {
|
|
|
593
640
|
*/
|
|
594
641
|
// @ts-ignore
|
|
595
642
|
this.cesiumStyle.scale = { conditions: scaleConditions };
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
643
|
+
this.cesiumStyle.pointOutlineWidth = {
|
|
644
|
+
// @ts-ignore
|
|
645
|
+
conditions: pointOutlineWidthConditions,
|
|
646
|
+
};
|
|
647
|
+
this.cesiumStyle.pointOutlineColor = {
|
|
648
|
+
// @ts-ignore
|
|
649
|
+
conditions: pointOutlineColorConditions,
|
|
650
|
+
};
|
|
600
651
|
// @ts-ignore
|
|
601
652
|
this.cesiumStyle.pointSize = { conditions: pointSizeConditions };
|
|
602
653
|
// @ts-ignore
|
|
@@ -622,8 +673,13 @@ class VectorStyleItem extends StyleItem {
|
|
|
622
673
|
const fontConditions = getDefaultCondition('olcs_font');
|
|
623
674
|
const labelTextConditions = getDefaultCondition('olcs_labelText');
|
|
624
675
|
const labelColorConditions = getDefaultCondition('olcs_fontColor', true);
|
|
625
|
-
const labelOutlineWidthConditions = getDefaultCondition(
|
|
626
|
-
|
|
676
|
+
const labelOutlineWidthConditions = getDefaultCondition(
|
|
677
|
+
'olcs_fontOutlineWidth',
|
|
678
|
+
);
|
|
679
|
+
const labelOutlineColorConditions = getDefaultCondition(
|
|
680
|
+
'olcs_fontOutlineColor',
|
|
681
|
+
true,
|
|
682
|
+
);
|
|
627
683
|
|
|
628
684
|
if (this._text) {
|
|
629
685
|
if (this._text.getFont()) {
|
|
@@ -633,12 +689,21 @@ class VectorStyleItem extends StyleItem {
|
|
|
633
689
|
labelTextConditions.splice(1, 1, ['true', `'${this._text.getText()}'`]);
|
|
634
690
|
}
|
|
635
691
|
if (this._text.getFill() && this._text.getFill().getColor()) {
|
|
636
|
-
labelColorConditions.splice(1, 1, [
|
|
692
|
+
labelColorConditions.splice(1, 1, [
|
|
693
|
+
'true',
|
|
694
|
+
getStringColor(this._text.getFill().getColor()),
|
|
695
|
+
]);
|
|
637
696
|
}
|
|
638
697
|
|
|
639
698
|
if (this._text.getStroke() && this._text.getStroke().getColor()) {
|
|
640
|
-
labelOutlineColorConditions.splice(1, 1, [
|
|
641
|
-
|
|
699
|
+
labelOutlineColorConditions.splice(1, 1, [
|
|
700
|
+
'true',
|
|
701
|
+
getStringColor(this._text.getStroke().getColor()),
|
|
702
|
+
]);
|
|
703
|
+
labelOutlineWidthConditions.splice(1, 1, [
|
|
704
|
+
'true',
|
|
705
|
+
`${this._text.getStroke().getWidth() || 1.25}`,
|
|
706
|
+
]);
|
|
642
707
|
}
|
|
643
708
|
}
|
|
644
709
|
|
|
@@ -649,12 +714,17 @@ class VectorStyleItem extends StyleItem {
|
|
|
649
714
|
// @ts-ignore
|
|
650
715
|
this.cesiumStyle.labelColor = { conditions: labelColorConditions };
|
|
651
716
|
|
|
717
|
+
this.cesiumStyle.labelOutlineWidth = {
|
|
718
|
+
// @ts-ignore
|
|
719
|
+
conditions: labelOutlineWidthConditions,
|
|
720
|
+
};
|
|
721
|
+
this.cesiumStyle.labelOutlineColor = {
|
|
722
|
+
// @ts-ignore
|
|
723
|
+
conditions: labelOutlineColorConditions,
|
|
724
|
+
};
|
|
652
725
|
// @ts-ignore
|
|
653
|
-
this.cesiumStyle.
|
|
654
|
-
|
|
655
|
-
this.cesiumStyle.labelOutlineColor = { conditions: labelOutlineColorConditions };
|
|
656
|
-
// @ts-ignore
|
|
657
|
-
this.cesiumStyle.labelStyle = 'Boolean(${olcs_fontOutlineWidth}) === true ? 2 : 0';
|
|
726
|
+
this.cesiumStyle.labelStyle =
|
|
727
|
+
'Boolean(${olcs_fontOutlineWidth}) === true ? 2 : 0';
|
|
658
728
|
// @ts-ignore
|
|
659
729
|
this.cesiumStyle.labelHorizontalOrigin = '0';
|
|
660
730
|
|
|
@@ -695,9 +765,12 @@ class VectorStyleItem extends StyleItem {
|
|
|
695
765
|
*/
|
|
696
766
|
clone(result) {
|
|
697
767
|
if (result) {
|
|
698
|
-
result.style =
|
|
768
|
+
result.style =
|
|
769
|
+
this._style instanceof Style ? this._style.clone() : this._style;
|
|
699
770
|
if (this._fillOptions && this._fillOptions.color) {
|
|
700
|
-
result.fillColor = /** @type {import("ol/color").Color} */ (
|
|
771
|
+
result.fillColor = /** @type {import("ol/color").Color} */ (
|
|
772
|
+
this._fillOptions.color
|
|
773
|
+
).slice();
|
|
701
774
|
if (this._fillOptions.pattern) {
|
|
702
775
|
result.pattern = { ...this._fillOptions.pattern };
|
|
703
776
|
}
|
|
@@ -710,7 +783,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
710
783
|
});
|
|
711
784
|
return result;
|
|
712
785
|
}
|
|
713
|
-
|
|
786
|
+
const config = this.toJSON();
|
|
787
|
+
delete config.name;
|
|
788
|
+
return new VectorStyleItem(config);
|
|
714
789
|
}
|
|
715
790
|
|
|
716
791
|
/**
|
|
@@ -719,6 +794,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
719
794
|
* @api
|
|
720
795
|
*/
|
|
721
796
|
assign(result) {
|
|
797
|
+
super.assign(result);
|
|
722
798
|
if (result.fillColor) {
|
|
723
799
|
this.fillColor = result.fillColor.slice();
|
|
724
800
|
}
|
|
@@ -755,79 +831,67 @@ class VectorStyleItem extends StyleItem {
|
|
|
755
831
|
}
|
|
756
832
|
|
|
757
833
|
/**
|
|
758
|
-
* @param {VectorStyleItemSections=} sections
|
|
759
834
|
* @returns {VectorStyleItemOptions}
|
|
760
835
|
* @api
|
|
761
836
|
*/
|
|
762
|
-
|
|
837
|
+
toJSON() {
|
|
763
838
|
// TODO clean default, only copy relevant keys
|
|
764
|
-
const options = /** @type {VectorStyleItemOptions} */ (super.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
if (usedSections.fill) {
|
|
775
|
-
if (this._fillOptions) {
|
|
776
|
-
options.fill = {
|
|
777
|
-
color: /** @type {import("ol/color").Color} */ (parseColor(this._fillOptions.color).slice()),
|
|
778
|
-
};
|
|
779
|
-
if (this._fillOptions.pattern) {
|
|
780
|
-
options.fill.pattern = { ...this._fillOptions.pattern };
|
|
781
|
-
}
|
|
782
|
-
} else if (this.exclude.fill) {
|
|
783
|
-
options.fill = false;
|
|
839
|
+
const options = /** @type {VectorStyleItemOptions} */ (super.toJSON());
|
|
840
|
+
if (this._fillOptions) {
|
|
841
|
+
options.fill = {
|
|
842
|
+
color: /** @type {import("ol/color").Color} */ (
|
|
843
|
+
parseColor(this._fillOptions.color).slice()
|
|
844
|
+
),
|
|
845
|
+
};
|
|
846
|
+
if (this._fillOptions.pattern) {
|
|
847
|
+
options.fill.pattern = { ...this._fillOptions.pattern };
|
|
784
848
|
}
|
|
849
|
+
} else if (this.exclude.fill) {
|
|
850
|
+
options.fill = false;
|
|
785
851
|
}
|
|
786
852
|
|
|
787
|
-
if (
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
options.stroke = false;
|
|
792
|
-
}
|
|
853
|
+
if (this._stroke) {
|
|
854
|
+
options.stroke = getStrokeOptions(this._stroke);
|
|
855
|
+
} else if (this.exclude.stroke) {
|
|
856
|
+
options.stroke = false;
|
|
793
857
|
}
|
|
794
858
|
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
options.text = getTextOptions(this._text);
|
|
798
|
-
}
|
|
859
|
+
if (this._text) {
|
|
860
|
+
options.text = getTextOptions(this._text);
|
|
799
861
|
}
|
|
800
862
|
|
|
801
|
-
if (
|
|
863
|
+
if (this._label) {
|
|
802
864
|
options.label = this._label;
|
|
803
865
|
}
|
|
804
866
|
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
867
|
+
if (this._image instanceof Icon) {
|
|
868
|
+
options.image = {
|
|
869
|
+
src: this._image.getSrc(), // XXX this is an issue... we dont want a data URI in the geoJSON
|
|
870
|
+
scale: this._image.getScale(),
|
|
871
|
+
opacity: this._image.getOpacity(),
|
|
872
|
+
};
|
|
873
|
+
} else if (this._image instanceof Circle) {
|
|
874
|
+
options.image = {
|
|
875
|
+
scale: this._image.getScale(),
|
|
876
|
+
fill: getFillOptions(this._image),
|
|
877
|
+
radius: this._image.getRadius(),
|
|
878
|
+
stroke: this._image.getStroke()
|
|
879
|
+
? getStrokeOptions(this._image.getStroke())
|
|
880
|
+
: undefined,
|
|
881
|
+
};
|
|
882
|
+
} else if (this._image instanceof RegularShape) {
|
|
883
|
+
options.image = {
|
|
884
|
+
scale: this._image.getScale(),
|
|
885
|
+
fill: getFillOptions(this._image),
|
|
886
|
+
points: this._image.getPoints(),
|
|
887
|
+
angle: this._image.getAngle(),
|
|
888
|
+
radius: this._image.getRadius(),
|
|
889
|
+
stroke: this._image.getStroke()
|
|
890
|
+
? getStrokeOptions(this._image.getStroke())
|
|
891
|
+
: undefined,
|
|
892
|
+
};
|
|
893
|
+
} else if (this.exclude.image) {
|
|
894
|
+
options.image = false;
|
|
831
895
|
}
|
|
832
896
|
|
|
833
897
|
return options;
|
|
@@ -839,35 +903,45 @@ class VectorStyleItem extends StyleItem {
|
|
|
839
903
|
*/
|
|
840
904
|
getOptionsForFeature(feature) {
|
|
841
905
|
const type = feature.getGeometry().getType();
|
|
842
|
-
const extrusion =
|
|
906
|
+
const extrusion =
|
|
907
|
+
feature.get('olcs_extrudedHeight') ||
|
|
843
908
|
(feature.get('olcs_storeyHeight') && feature.get('olcs_storeyNumber'));
|
|
844
|
-
const sections =
|
|
909
|
+
const sections = new Set();
|
|
845
910
|
|
|
846
911
|
if (type === 'Point' || type === 'MultiPoint') {
|
|
847
912
|
if (feature[vectorStyleSymbol].label != null) {
|
|
848
|
-
sections.text
|
|
849
|
-
sections.label
|
|
913
|
+
sections.add('text');
|
|
914
|
+
sections.add('label');
|
|
850
915
|
}
|
|
851
|
-
sections.image
|
|
916
|
+
sections.add('image');
|
|
852
917
|
|
|
853
918
|
if (extrusion) {
|
|
854
|
-
sections.stroke
|
|
919
|
+
sections.add('stroke');
|
|
855
920
|
}
|
|
856
921
|
} else if (type === 'LineString' || type === 'MultiLineString') {
|
|
857
|
-
sections.stroke
|
|
922
|
+
sections.add('stroke');
|
|
858
923
|
if (extrusion) {
|
|
859
|
-
sections.fill
|
|
924
|
+
sections.add('fill');
|
|
860
925
|
}
|
|
861
|
-
} else if (
|
|
862
|
-
|
|
863
|
-
|
|
926
|
+
} else if (
|
|
927
|
+
type === 'Polygon' ||
|
|
928
|
+
type === 'MultiPolygon' ||
|
|
929
|
+
type === 'Circle'
|
|
930
|
+
) {
|
|
931
|
+
sections.add('stroke');
|
|
932
|
+
sections.add('fill');
|
|
864
933
|
} else if (type === 'GeometryCollection') {
|
|
865
|
-
sections.stroke
|
|
866
|
-
sections.fill
|
|
867
|
-
sections.image
|
|
868
|
-
sections.text
|
|
869
|
-
}
|
|
870
|
-
|
|
934
|
+
sections.add('stroke');
|
|
935
|
+
sections.add('fill');
|
|
936
|
+
sections.add('image');
|
|
937
|
+
sections.add('text');
|
|
938
|
+
}
|
|
939
|
+
const config = this.toJSON();
|
|
940
|
+
const options = {};
|
|
941
|
+
sections.forEach((key) => {
|
|
942
|
+
options[key] = config[key];
|
|
943
|
+
});
|
|
944
|
+
return options;
|
|
871
945
|
}
|
|
872
946
|
|
|
873
947
|
/**
|
|
@@ -904,14 +978,15 @@ export default VectorStyleItem;
|
|
|
904
978
|
|
|
905
979
|
/**
|
|
906
980
|
* @type {VectorStyleItem}
|
|
907
|
-
* @export
|
|
908
981
|
*/
|
|
909
|
-
export const defaultVectorStyle = new VectorStyleItem(
|
|
982
|
+
export const defaultVectorStyle = new VectorStyleItem(
|
|
983
|
+
getDefaultVectorStyleItemOptions(),
|
|
984
|
+
);
|
|
985
|
+
styleClassRegistry.registerClass(VectorStyleItem.className, VectorStyleItem);
|
|
910
986
|
|
|
911
987
|
/**
|
|
912
|
-
* @param {import("@vcmap/
|
|
988
|
+
* @param {import("@vcmap-cesium/engine").Color} cesiumColor
|
|
913
989
|
* @returns {VectorStyleItem}
|
|
914
|
-
* @export
|
|
915
990
|
*/
|
|
916
991
|
export function fromCesiumColor(cesiumColor) {
|
|
917
992
|
const color = /** @type {import("ol/color").Color} */ (cesiumColor.toBytes());
|
|
@@ -924,4 +999,3 @@ export function fromCesiumColor(cesiumColor) {
|
|
|
924
999
|
},
|
|
925
1000
|
});
|
|
926
1001
|
}
|
|
927
|
-
|