@vcmap/core 5.0.0-rc.1 → 5.0.0-rc.12
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 +3 -2
- package/index.d.ts +2085 -1969
- package/index.js +137 -131
- package/package.json +14 -22
- package/src/category/appBackedCategory.js +76 -0
- package/src/category/category.js +417 -0
- package/src/category/categoryCollection.js +145 -0
- package/src/cesium/cesium3DTileFeature.js +1 -1
- package/src/classRegistry.js +162 -0
- package/src/context.js +72 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -9
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +25 -18
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -18
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +6 -9
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +6 -19
- package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +2 -13
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +10 -13
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
- package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -37
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -17
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +38 -29
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +27 -31
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +54 -54
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +9 -6
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -22
- package/src/{vcs/vcm/layer → layer}/globalHider.js +8 -32
- package/src/{vcs/vcm/layer → layer}/layer.js +63 -20
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +7 -9
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -33
- package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
- package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +8 -9
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -34
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -20
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -20
- package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -14
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -5
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -8
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -6
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -20
- package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -48
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +55 -54
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -20
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -23
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -21
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -17
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -34
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -57
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -15
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +41 -22
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
- package/src/ol/geom/circle.js +1 -1
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
- package/src/style/styleFactory.js +29 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
- package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -86
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
- package/src/{vcs/vcm/util → util}/collection.js +16 -4
- package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
- package/src/{vcs/vcm/util → util}/extent.js +18 -12
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
- package/src/util/featureconverter/extent3D.js +181 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
- package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +3 -3
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
- package/src/util/fetch.js +32 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -2
- package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
- package/src/{vcs/vcm/util → util}/layerCollection.js +49 -12
- package/src/{vcs/vcm/util → util}/locale.js +1 -1
- package/src/{vcs/vcm/util → util}/mapCollection.js +91 -34
- package/src/{vcs/vcm/util → util}/math.js +0 -0
- package/src/util/overrideCollection.js +223 -0
- package/src/{vcs/vcm/util → util}/projection.js +39 -29
- package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
- package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/viewpoint.js +5 -9
- package/src/vcsApp.js +471 -0
- package/src/vcsAppContextHelpers.js +121 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
- package/tests/data/buildings/tileset.json +428 -0
- package/tests/data/dynamicPointCzml.json +64 -0
- package/tests/data/oblique/imageData/imagev34.json +352 -0
- package/tests/data/oblique/imageData/imagev35.json +54 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/image.json +1 -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 +136 -0
- package/tests/data/testGeoJSON.json +161 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +272 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +11 -0
- package/tests/unit/helpers/imageHelpers.js +20 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +76 -0
- package/tests/unit/helpers/obliqueHelpers.js +112 -0
- package/tests/unit/helpers/openlayersHelpers.js +22 -0
- package/tests/unit/helpers/terrain/terrainData.js +46 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
|
@@ -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,19 @@ 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() { return '
|
|
130
|
+
static get className() { return 'VectorStyleItem'; }
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
133
|
* @param {VectorStyleItemOptions} options
|
|
@@ -521,12 +520,12 @@ class VectorStyleItem extends StyleItem {
|
|
|
521
520
|
updateCesiumStyleColor(silent) {
|
|
522
521
|
const colorConditions = getDefaultCondition('olcs_color', true);
|
|
523
522
|
if (this.stroke && this.stroke.getColor()) {
|
|
524
|
-
colorConditions.splice(1, 0, [`\${olcs_geometryType}===${
|
|
523
|
+
colorConditions.splice(1, 0, [`\${olcs_geometryType}===${OlcsGeometryType.POLYLINE}`, getStringColor(this.stroke.getColor())]);
|
|
525
524
|
}
|
|
526
525
|
if (this._image instanceof Circle && this._image.getFill()) {
|
|
527
526
|
colorConditions.splice(
|
|
528
527
|
1, 0,
|
|
529
|
-
[`\${olcs_geometryType}===${
|
|
528
|
+
[`\${olcs_geometryType}===${OlcsGeometryType.POINT}`, getStringColor(this._image.getFill().getColor())],
|
|
530
529
|
);
|
|
531
530
|
}
|
|
532
531
|
if (this.fillColor) {
|
|
@@ -710,7 +709,9 @@ class VectorStyleItem extends StyleItem {
|
|
|
710
709
|
});
|
|
711
710
|
return result;
|
|
712
711
|
}
|
|
713
|
-
|
|
712
|
+
const config = this.toJSON();
|
|
713
|
+
delete config.name;
|
|
714
|
+
return new VectorStyleItem(config);
|
|
714
715
|
}
|
|
715
716
|
|
|
716
717
|
/**
|
|
@@ -719,6 +720,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
719
720
|
* @api
|
|
720
721
|
*/
|
|
721
722
|
assign(result) {
|
|
723
|
+
super.assign(result);
|
|
722
724
|
if (result.fillColor) {
|
|
723
725
|
this.fillColor = result.fillColor.slice();
|
|
724
726
|
}
|
|
@@ -755,79 +757,61 @@ class VectorStyleItem extends StyleItem {
|
|
|
755
757
|
}
|
|
756
758
|
|
|
757
759
|
/**
|
|
758
|
-
* @param {VectorStyleItemSections=} sections
|
|
759
760
|
* @returns {VectorStyleItemOptions}
|
|
760
761
|
* @api
|
|
761
762
|
*/
|
|
762
|
-
|
|
763
|
+
toJSON() {
|
|
763
764
|
// TODO clean default, only copy relevant keys
|
|
764
|
-
const options = /** @type {VectorStyleItemOptions} */ (super.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
image: true,
|
|
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;
|
|
765
|
+
const options = /** @type {VectorStyleItemOptions} */ (super.toJSON());
|
|
766
|
+
if (this._fillOptions) {
|
|
767
|
+
options.fill = {
|
|
768
|
+
color: /** @type {import("ol/color").Color} */ (parseColor(this._fillOptions.color).slice()),
|
|
769
|
+
};
|
|
770
|
+
if (this._fillOptions.pattern) {
|
|
771
|
+
options.fill.pattern = { ...this._fillOptions.pattern };
|
|
784
772
|
}
|
|
773
|
+
} else if (this.exclude.fill) {
|
|
774
|
+
options.fill = false;
|
|
785
775
|
}
|
|
786
776
|
|
|
787
|
-
if (
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
options.stroke = false;
|
|
792
|
-
}
|
|
777
|
+
if (this._stroke) {
|
|
778
|
+
options.stroke = getStrokeOptions(this._stroke);
|
|
779
|
+
} else if (this.exclude.stroke) {
|
|
780
|
+
options.stroke = false;
|
|
793
781
|
}
|
|
794
782
|
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
options.text = getTextOptions(this._text);
|
|
798
|
-
}
|
|
783
|
+
if (this._text) {
|
|
784
|
+
options.text = getTextOptions(this._text);
|
|
799
785
|
}
|
|
800
786
|
|
|
801
|
-
if (
|
|
787
|
+
if (this._label) {
|
|
802
788
|
options.label = this._label;
|
|
803
789
|
}
|
|
804
790
|
|
|
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
|
-
options.image = false;
|
|
830
|
-
}
|
|
791
|
+
if (this._image instanceof Icon) {
|
|
792
|
+
options.image = {
|
|
793
|
+
src: this._image.getSrc(), // XXX this is an issue... we dont want a data URI in the geoJSON
|
|
794
|
+
scale: this._image.getScale(),
|
|
795
|
+
opacity: this._image.getOpacity(),
|
|
796
|
+
};
|
|
797
|
+
} else if (this._image instanceof Circle) {
|
|
798
|
+
options.image = {
|
|
799
|
+
scale: this._image.getScale(),
|
|
800
|
+
fill: getFillOptions(this._image),
|
|
801
|
+
radius: this._image.getRadius(),
|
|
802
|
+
stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
|
|
803
|
+
};
|
|
804
|
+
} else if (this._image instanceof RegularShape) {
|
|
805
|
+
options.image = {
|
|
806
|
+
scale: this._image.getScale(),
|
|
807
|
+
fill: getFillOptions(this._image),
|
|
808
|
+
points: this._image.getPoints(),
|
|
809
|
+
angle: this._image.getAngle(),
|
|
810
|
+
radius: this._image.getRadius(),
|
|
811
|
+
stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
|
|
812
|
+
};
|
|
813
|
+
} else if (this.exclude.image) {
|
|
814
|
+
options.image = false;
|
|
831
815
|
}
|
|
832
816
|
|
|
833
817
|
return options;
|
|
@@ -841,33 +825,38 @@ class VectorStyleItem extends StyleItem {
|
|
|
841
825
|
const type = feature.getGeometry().getType();
|
|
842
826
|
const extrusion = feature.get('olcs_extrudedHeight') ||
|
|
843
827
|
(feature.get('olcs_storeyHeight') && feature.get('olcs_storeyNumber'));
|
|
844
|
-
const sections =
|
|
828
|
+
const sections = new Set();
|
|
845
829
|
|
|
846
830
|
if (type === 'Point' || type === 'MultiPoint') {
|
|
847
831
|
if (feature[vectorStyleSymbol].label != null) {
|
|
848
|
-
sections.text
|
|
849
|
-
sections.label
|
|
832
|
+
sections.add('text');
|
|
833
|
+
sections.add('label');
|
|
850
834
|
}
|
|
851
|
-
sections.image
|
|
835
|
+
sections.add('image');
|
|
852
836
|
|
|
853
837
|
if (extrusion) {
|
|
854
|
-
sections.stroke
|
|
838
|
+
sections.add('stroke');
|
|
855
839
|
}
|
|
856
840
|
} else if (type === 'LineString' || type === 'MultiLineString') {
|
|
857
|
-
sections.stroke
|
|
841
|
+
sections.add('stroke');
|
|
858
842
|
if (extrusion) {
|
|
859
|
-
sections.fill
|
|
843
|
+
sections.add('fill');
|
|
860
844
|
}
|
|
861
845
|
} else if (type === 'Polygon' || type === 'MultiPolygon' || type === 'Circle') {
|
|
862
|
-
sections.stroke
|
|
863
|
-
sections.fill
|
|
846
|
+
sections.add('stroke');
|
|
847
|
+
sections.add('fill');
|
|
864
848
|
} else if (type === 'GeometryCollection') {
|
|
865
|
-
sections.stroke
|
|
866
|
-
sections.fill
|
|
867
|
-
sections.image
|
|
868
|
-
sections.text
|
|
869
|
-
}
|
|
870
|
-
|
|
849
|
+
sections.add('stroke');
|
|
850
|
+
sections.add('fill');
|
|
851
|
+
sections.add('image');
|
|
852
|
+
sections.add('text');
|
|
853
|
+
}
|
|
854
|
+
const config = this.toJSON();
|
|
855
|
+
const options = {};
|
|
856
|
+
sections.forEach((key) => {
|
|
857
|
+
options[key] = config[key];
|
|
858
|
+
});
|
|
859
|
+
return options;
|
|
871
860
|
}
|
|
872
861
|
|
|
873
862
|
/**
|
|
@@ -904,14 +893,13 @@ export default VectorStyleItem;
|
|
|
904
893
|
|
|
905
894
|
/**
|
|
906
895
|
* @type {VectorStyleItem}
|
|
907
|
-
* @export
|
|
908
896
|
*/
|
|
909
897
|
export const defaultVectorStyle = new VectorStyleItem(getDefaultVectorStyleItemOptions());
|
|
898
|
+
styleClassRegistry.registerClass(VectorStyleItem.className, VectorStyleItem);
|
|
910
899
|
|
|
911
900
|
/**
|
|
912
901
|
* @param {import("@vcmap/cesium").Color} cesiumColor
|
|
913
902
|
* @returns {VectorStyleItem}
|
|
914
|
-
* @export
|
|
915
903
|
*/
|
|
916
904
|
export function fromCesiumColor(cesiumColor) {
|
|
917
905
|
const color = /** @type {import("ol/color").Color} */ (cesiumColor.toBytes());
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import VectorStyleItem from './vectorStyleItem.js';
|
|
2
2
|
import DeclarativeStyleItem from './declarativeStyleItem.js';
|
|
3
|
-
import { referenceableStyleSymbol } from './styleItem.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* @param {VectorStyleItemOptions} obj
|
|
@@ -34,13 +33,11 @@ export function embedIconsInStyle(obj, embeddedIcons) {
|
|
|
34
33
|
* @param {VcsMeta=} vcsMeta
|
|
35
34
|
* @returns {VcsMeta}
|
|
36
35
|
*/
|
|
37
|
-
function writeStyle(style, vcsMeta = {}) {
|
|
38
|
-
if (style
|
|
39
|
-
vcsMeta.style = style.
|
|
40
|
-
} else if (style instanceof VectorStyleItem) {
|
|
41
|
-
vcsMeta.style = embedIconsInStyle(style.getOptions(), vcsMeta.embeddedIcons);
|
|
36
|
+
function writeStyle(style, vcsMeta = {}) { // XXX this entire function is not what is to be expected. feature store expects styles as refs to be possible
|
|
37
|
+
if (style instanceof VectorStyleItem) {
|
|
38
|
+
vcsMeta.style = embedIconsInStyle(style.toJSON(), vcsMeta.embeddedIcons);
|
|
42
39
|
} else if (style instanceof DeclarativeStyleItem) {
|
|
43
|
-
vcsMeta.style = style.
|
|
40
|
+
vcsMeta.style = style.toJSON();
|
|
44
41
|
}
|
|
45
42
|
return vcsMeta;
|
|
46
43
|
}
|
|
@@ -4,13 +4,12 @@ import { Cesium3DTileset } from '@vcmap/cesium';
|
|
|
4
4
|
import { check } from '@vcsuite/check';
|
|
5
5
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
6
6
|
import { getLogger as getLoggerByName } from '@vcsuite/logger';
|
|
7
|
-
import CesiumMap from '../../
|
|
8
|
-
import VcsEvent from '../../
|
|
7
|
+
import CesiumMap from '../../map/cesiumMap.js';
|
|
8
|
+
import VcsEvent from '../../vcsEvent.js';
|
|
9
9
|
import LayerCollection from '../layerCollection.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @namespace clipping
|
|
13
|
-
* @export
|
|
14
13
|
* @api
|
|
15
14
|
*/
|
|
16
15
|
|
|
@@ -36,21 +35,20 @@ import LayerCollection from '../layerCollection.js';
|
|
|
36
35
|
* @returns {import("@vcsuite/logger").Logger}
|
|
37
36
|
*/
|
|
38
37
|
function getLogger() {
|
|
39
|
-
return getLoggerByName('
|
|
38
|
+
return getLoggerByName('ClippingObject');
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
const globeSymbol = Symbol('ClippingObjectGlobe');
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* The ClippingObject is a container for a Cesium.ClippingPlaneCollection. The container holds information on the
|
|
46
|
-
* targeted Cesium objects, based on layerNames (for [
|
|
47
|
-
* layerName and entity id for Cesium.
|
|
45
|
+
* targeted Cesium objects, based on layerNames (for [CesiumTilesetLayer]{@link CesiumTilesetLayer}) or
|
|
46
|
+
* layerName and entity id for Cesium.DataSourceLayer which are part of an [DataSourceLayer]{@link DataSource} layer.
|
|
48
47
|
* Adding a ClippingObject to the [ClippingObjectManager]{@link ClippingObjectManager} applies the
|
|
49
48
|
* objects Cesium.ClippingPlaneCollection where applicable. Once added, changes to the targets of the object are tracked.
|
|
50
49
|
* To update the Cesium.ClippingPlaneCollection or its definitions, you must trigger an update by setting the clippingPlaneCollection
|
|
51
50
|
* property to the new definition.
|
|
52
51
|
* @class
|
|
53
|
-
* @export
|
|
54
52
|
* @api stable
|
|
55
53
|
*/
|
|
56
54
|
class ClippingObject {
|
|
@@ -115,7 +113,7 @@ class ClippingObject {
|
|
|
115
113
|
this.clippingPlaneUpdated = new VcsEvent();
|
|
116
114
|
|
|
117
115
|
/**
|
|
118
|
-
* @type {Set<import("@vcmap/core").
|
|
116
|
+
* @type {Set<import("@vcmap/core").FeatureStoreLayer>}
|
|
119
117
|
* @private
|
|
120
118
|
*/
|
|
121
119
|
this._cachedFeatureStoreLayers = new Set();
|
|
@@ -264,11 +262,11 @@ class ClippingObject {
|
|
|
264
262
|
this.targetsUpdated.raiseEvent();
|
|
265
263
|
}
|
|
266
264
|
}
|
|
267
|
-
} else if (this.layerNames.includes(layer.name) && layer.className === '
|
|
265
|
+
} else if (this.layerNames.includes(layer.name) && layer.className === 'FeatureStoreLayer') {
|
|
268
266
|
if (layer.active) {
|
|
269
|
-
this._cachedFeatureStoreLayers.add(/** @type {import("@vcmap/core").
|
|
270
|
-
} else if (this._cachedFeatureStoreLayers.has(/** @type {import("@vcmap/core").
|
|
271
|
-
this._cachedFeatureStoreLayers.delete(/** @type {import("@vcmap/core").
|
|
267
|
+
this._cachedFeatureStoreLayers.add(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer));
|
|
268
|
+
} else if (this._cachedFeatureStoreLayers.has(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer))) {
|
|
269
|
+
this._cachedFeatureStoreLayers.delete(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer));
|
|
272
270
|
}
|
|
273
271
|
}
|
|
274
272
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { check } from '@vcsuite/check';
|
|
2
2
|
import { clearClippingPlanes, setClippingPlanes } from './clippingPlaneHelper.js';
|
|
3
3
|
import ClippingObject from './clippingObject.js';
|
|
4
|
-
import CesiumMap from '../../
|
|
4
|
+
import CesiumMap from '../../map/cesiumMap.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* ClippingObjectManager, a singleton Class for managing [ClippingObjects]{@link ClippingObject}. The manager takes care to only apply a
|
|
@@ -12,12 +12,11 @@ import CesiumMap from '../../maps/cesium.js';
|
|
|
12
12
|
* overwritten in the order they where added to the manager. Exclusive [ClippingObjects]{@link ClippingObject} are always applied last, even
|
|
13
13
|
* if a default [ClippingObject]{@link ClippingObject} is added after.
|
|
14
14
|
* @class
|
|
15
|
-
* @export
|
|
16
15
|
* @api stable
|
|
17
16
|
*/
|
|
18
17
|
class ClippingObjectManager {
|
|
19
18
|
static get className() {
|
|
20
|
-
return '
|
|
19
|
+
return 'ClippingObjectManager';
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
constructor(layerCollection) {
|
|
@@ -19,7 +19,7 @@ import Polygon from 'ol/geom/Polygon.js';
|
|
|
19
19
|
|
|
20
20
|
import { check, checkMaybe } from '@vcsuite/check';
|
|
21
21
|
import Projection, { mercatorProjection, wgs84Projection } from '../projection.js';
|
|
22
|
-
import
|
|
22
|
+
import Extent3D from '../featureconverter/extent3D.js';
|
|
23
23
|
import { enforceEndingVertex, enforceRightHand, getFlatCoordinatesFromGeometry } from '../geometryHelpers.js';
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -75,9 +75,9 @@ function createVerticalPlanes(coords) {
|
|
|
75
75
|
*/
|
|
76
76
|
function createHorizontalPlanes(feature, coords, options) {
|
|
77
77
|
const clippingPlanes = [];
|
|
78
|
-
const extent =
|
|
79
|
-
let min = Number.isFinite(extent
|
|
80
|
-
let max = Number.isFinite(extent
|
|
78
|
+
const extent = Extent3D.fromGeometry(feature.getGeometry());
|
|
79
|
+
let min = Number.isFinite(extent.minZ) ? extent.minZ : 0;
|
|
80
|
+
let max = Number.isFinite(extent.maxZ) ? extent.maxZ : 0;
|
|
81
81
|
const extruded = feature.get('olcs_extrudedHeight');
|
|
82
82
|
if (extruded) {
|
|
83
83
|
max += extruded;
|
|
@@ -139,7 +139,6 @@ function createEndingPlanes(coords) {
|
|
|
139
139
|
* @param {import("@vcmap/cesium").Matrix4=} transformMatrix - 4x4 matrix specifying the transform of clipping planes from Earth's fixed frame to another one
|
|
140
140
|
* @returns {import("@vcmap/cesium").ClippingPlaneCollection|null}
|
|
141
141
|
* @api stable
|
|
142
|
-
* @export
|
|
143
142
|
*/
|
|
144
143
|
export function createClippingPlaneCollection(feature, options = {}, transformMatrix) {
|
|
145
144
|
check(feature, Feature);
|
|
@@ -203,7 +202,6 @@ export function createClippingPlaneCollection(feature, options = {}, transformMa
|
|
|
203
202
|
* @param {import("@vcmap/cesium").Cartesian3=} originPoint - the origin point of the transformation target, so the plane distance can be set correctly
|
|
204
203
|
* @returns {import("@vcmap/cesium").ClippingPlaneCollection}
|
|
205
204
|
* @api stable
|
|
206
|
-
* @export
|
|
207
205
|
*/
|
|
208
206
|
export function copyClippingPlanesToCollection(source, result, transformMatrix, originPoint) {
|
|
209
207
|
check(source, ClippingPlaneCollection);
|
|
@@ -346,7 +344,6 @@ export function setClippingPlanes(target, clippingPlaneCollection, local) {
|
|
|
346
344
|
* @param {number} [offsetDistance=25] - the offset from the coordinate to use for the size of the geometry
|
|
347
345
|
* @returns {import("ol").Feature<import("ol/geom/Geometry").default>} - the features geometry is in web mercator
|
|
348
346
|
* @api
|
|
349
|
-
* @export
|
|
350
347
|
*/
|
|
351
348
|
export function createClippingFeature(coordinate, camera, vertical = false, offsetDistance = 25) {
|
|
352
349
|
check(coordinate, [Number]);
|
|
@@ -389,7 +386,6 @@ export function createClippingFeature(coordinate, camera, vertical = false, offs
|
|
|
389
386
|
* @param {boolean=} [infinite=false]
|
|
390
387
|
* @returns {CreationOptions}
|
|
391
388
|
* @api
|
|
392
|
-
* @export
|
|
393
389
|
*/
|
|
394
390
|
export function getClippingOptions(feature, infinite = false) {
|
|
395
391
|
checkMaybe(feature, Feature);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import VcsEvent from '../
|
|
1
|
+
import VcsEvent from '../vcsEvent.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A generic array based collection. Implements the Symbol.iterator (e.g. [...collection])
|
|
5
5
|
* @class
|
|
6
|
-
* @export
|
|
7
6
|
* @template {*} T
|
|
8
7
|
* @api
|
|
9
8
|
*/
|
|
@@ -135,15 +134,28 @@ class Collection {
|
|
|
135
134
|
return null;
|
|
136
135
|
}
|
|
137
136
|
|
|
137
|
+
/**
|
|
138
|
+
* internal remove function, to remove an item from the collection, does not raise an event.
|
|
139
|
+
* @param {T} item
|
|
140
|
+
* @returns {number} returns the index of the removed item or -1 if the item has not been found.
|
|
141
|
+
* @protected
|
|
142
|
+
*/
|
|
143
|
+
_remove(item) {
|
|
144
|
+
const index = this._array.indexOf(item);
|
|
145
|
+
if (index > -1) {
|
|
146
|
+
this._array.splice(index, 1);
|
|
147
|
+
}
|
|
148
|
+
return index;
|
|
149
|
+
}
|
|
150
|
+
|
|
138
151
|
/**
|
|
139
152
|
* Removes an item from the collection
|
|
140
153
|
* @param {T} item
|
|
141
154
|
* @api
|
|
142
155
|
*/
|
|
143
156
|
remove(item) {
|
|
144
|
-
const index = this.
|
|
157
|
+
const index = this._remove(item);
|
|
145
158
|
if (index > -1) {
|
|
146
|
-
this._array.splice(index, 1);
|
|
147
159
|
this.removed.raiseEvent(item);
|
|
148
160
|
}
|
|
149
161
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import Projection from './projection.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @typedef {
|
|
5
|
-
* @property {
|
|
4
|
+
* @typedef {Object} ExtentOptions
|
|
5
|
+
* @property {string} [type]
|
|
6
|
+
* @property {import("ol/extent").Extent|undefined} [coordinates] - if not specified, the extent of the projection is used
|
|
7
|
+
* @property {ProjectionOptions} [projection] - if not specified the default projection is assumed
|
|
6
8
|
* @api
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -31,20 +33,20 @@ function checkExtentValidity(extent) {
|
|
|
31
33
|
/**
|
|
32
34
|
* Extent Class
|
|
33
35
|
* @class
|
|
34
|
-
* @export
|
|
35
36
|
* @api
|
|
36
37
|
*/
|
|
37
38
|
class Extent {
|
|
39
|
+
/**
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
42
|
+
static get className() { return 'Extent'; }
|
|
43
|
+
|
|
38
44
|
/**
|
|
39
45
|
* @param {ExtentOptions=} options object
|
|
40
46
|
*/
|
|
41
47
|
constructor(options = {}) {
|
|
42
48
|
/** @type {Projection} */
|
|
43
|
-
this.projection = new Projection(
|
|
44
|
-
epsg: options.epsg,
|
|
45
|
-
proj4: options.proj4,
|
|
46
|
-
alias: options.alias,
|
|
47
|
-
});
|
|
49
|
+
this.projection = new Projection(options.projection);
|
|
48
50
|
|
|
49
51
|
/** @type {import("ol/extent").Extent|null} */
|
|
50
52
|
this.extent = options.coordinates || this.projection.proj.getExtent();
|
|
@@ -78,15 +80,19 @@ class Extent {
|
|
|
78
80
|
/**
|
|
79
81
|
* @returns {ExtentOptions}
|
|
80
82
|
*/
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
+
toJSON() {
|
|
84
|
+
return {
|
|
85
|
+
coordinates: this.extent.slice(),
|
|
86
|
+
projection: this.projection.toJSON(),
|
|
87
|
+
type: Extent.className,
|
|
88
|
+
};
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
/**
|
|
86
92
|
* @returns {Extent}
|
|
87
93
|
*/
|
|
88
94
|
clone() {
|
|
89
|
-
return new Extent(this.
|
|
95
|
+
return new Extent(this.toJSON());
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
/**
|
|
@@ -112,7 +118,7 @@ class Extent {
|
|
|
112
118
|
* @api
|
|
113
119
|
*/
|
|
114
120
|
static validateOptions(options) {
|
|
115
|
-
return Projection.validateOptions(options) && checkExtentValidity(options.coordinates);
|
|
121
|
+
return Projection.validateOptions(options.projection || {}) && checkExtentValidity(options.coordinates);
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
/**
|
|
File without changes
|
|
File without changes
|