@vcmap/core 5.0.0-rc.0 → 5.0.0-rc.11
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 +7578 -0
- package/index.js +137 -131
- package/package.json +16 -23
- package/src/category/appBackedCategory.js +76 -0
- package/src/category/category.js +401 -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} +8 -11
- 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} +3 -4
- 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} +13 -14
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -31
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -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 +6 -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 +1 -12
- package/src/{vcs/vcm/layer → layer}/layer.js +11 -12
- 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} +6 -7
- 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} +6 -7
- 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} +32 -42
- 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 +16 -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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EntityCollection } from '@vcmap/cesium';
|
|
2
2
|
import Layer from './layer.js';
|
|
3
|
-
import CesiumMap from '../
|
|
4
|
-
import
|
|
3
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
4
|
+
import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
|
|
5
5
|
import { vcsLayerName } from './layerSymbols.js';
|
|
6
6
|
import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
|
|
7
7
|
import { getGlobalHider } from './globalHider.js';
|
|
8
|
-
import {
|
|
8
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {LayerOptions} DataSourceOptions
|
|
@@ -30,12 +30,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
30
30
|
/**
|
|
31
31
|
* Represents a layer of Cesium.Entity
|
|
32
32
|
* @class
|
|
33
|
-
* @export
|
|
34
33
|
* @extends {Layer}
|
|
35
34
|
* @api stable
|
|
36
35
|
*/
|
|
37
|
-
class
|
|
38
|
-
static get className() { return '
|
|
36
|
+
class DataSourceLayer extends Layer {
|
|
37
|
+
static get className() { return 'DataSourceLayer'; }
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* @returns {DataSourceOptions}
|
|
@@ -52,7 +51,7 @@ class DataSource extends Layer {
|
|
|
52
51
|
*/
|
|
53
52
|
constructor(options) {
|
|
54
53
|
super(options);
|
|
55
|
-
const defaultOptions =
|
|
54
|
+
const defaultOptions = DataSourceLayer.getDefaultOptions();
|
|
56
55
|
/**
|
|
57
56
|
* The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
|
|
58
57
|
* @type {import("@vcmap/cesium").EntityCollection}
|
|
@@ -151,11 +150,11 @@ class DataSource extends Layer {
|
|
|
151
150
|
|
|
152
151
|
/**
|
|
153
152
|
* @param {CesiumMap} map
|
|
154
|
-
* @returns {Array<
|
|
153
|
+
* @returns {Array<DataSourceCesiumImpl>}
|
|
155
154
|
*/
|
|
156
155
|
createImplementationsForMap(map) {
|
|
157
156
|
if (map instanceof CesiumMap) {
|
|
158
|
-
return [new
|
|
157
|
+
return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
|
|
159
158
|
}
|
|
160
159
|
return [];
|
|
161
160
|
}
|
|
@@ -183,7 +182,7 @@ class DataSource extends Layer {
|
|
|
183
182
|
*/
|
|
184
183
|
flyToEntity(id) {
|
|
185
184
|
this.getImplementations().forEach((impl) => {
|
|
186
|
-
/** @type {
|
|
185
|
+
/** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
|
|
187
186
|
});
|
|
188
187
|
}
|
|
189
188
|
|
|
@@ -235,8 +234,8 @@ class DataSource extends Layer {
|
|
|
235
234
|
* @inheritDoc
|
|
236
235
|
* @returns {DataSourceOptions}
|
|
237
236
|
*/
|
|
238
|
-
|
|
239
|
-
const config = /** @type {DataSourceOptions} */ (super.
|
|
237
|
+
toJSON() {
|
|
238
|
+
const config = /** @type {DataSourceOptions} */ (super.toJSON());
|
|
240
239
|
if (Object.keys(this._genericFeatureProperties).length > 0) {
|
|
241
240
|
config.genericFeatureProperties = { ...this._genericFeatureProperties };
|
|
242
241
|
}
|
|
@@ -255,5 +254,5 @@ class DataSource extends Layer {
|
|
|
255
254
|
}
|
|
256
255
|
}
|
|
257
256
|
|
|
258
|
-
|
|
259
|
-
export default
|
|
257
|
+
layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
|
|
258
|
+
export default DataSourceLayer;
|
|
@@ -3,18 +3,16 @@ import Style from 'ol/style/Style.js';
|
|
|
3
3
|
import { check } from '@vcsuite/check';
|
|
4
4
|
import { parseInteger } from '@vcsuite/parsers';
|
|
5
5
|
import Layer from './layer.js';
|
|
6
|
-
import StyleItem
|
|
7
|
-
import VectorStyleItem from '../
|
|
6
|
+
import StyleItem from '../style/styleItem.js';
|
|
7
|
+
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
8
8
|
import FeatureVisibility from './featureVisibility.js';
|
|
9
|
-
import { getStyleOrDefaultStyle } from '../
|
|
10
|
-
import VcsEvent from '../
|
|
11
|
-
import {
|
|
12
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
9
|
+
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
10
|
+
import VcsEvent from '../vcsEvent.js';
|
|
11
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {LayerOptions} FeatureLayerOptions
|
|
16
|
-
* @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|
|
|
17
|
-
* @property {string|undefined} activeStyleName - vcs:undocumented
|
|
15
|
+
* @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
|
|
18
16
|
* @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
|
|
19
17
|
* @property {number} [balloonHeightOffset=10]
|
|
20
18
|
* @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
|
|
@@ -42,16 +40,15 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
42
40
|
*/
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
|
-
* Base class for all layers representing features, e.g.
|
|
43
|
+
* Base class for all layers representing features, e.g. VectorLayer, Buildings, POIs
|
|
46
44
|
* @class
|
|
47
45
|
* @abstract
|
|
48
46
|
* @extends {Layer}
|
|
49
|
-
* @export
|
|
50
47
|
* @api
|
|
51
48
|
*/
|
|
52
49
|
class FeatureLayer extends Layer {
|
|
53
50
|
/** @type {string} */
|
|
54
|
-
static get className() { return '
|
|
51
|
+
static get className() { return 'FeatureLayer'; }
|
|
55
52
|
|
|
56
53
|
/**
|
|
57
54
|
* @returns {FeatureLayerOptions}
|
|
@@ -76,7 +73,7 @@ class FeatureLayer extends Layer {
|
|
|
76
73
|
* @type {import("@vcmap/core").StyleItem}
|
|
77
74
|
* @private
|
|
78
75
|
*/
|
|
79
|
-
this._style = this.getStyleOrDefaultStyle(options.
|
|
76
|
+
this._style = this.getStyleOrDefaultStyle(options.style);
|
|
80
77
|
/**
|
|
81
78
|
* @type {import("@vcmap/core").StyleItem}
|
|
82
79
|
* @private
|
|
@@ -180,7 +177,7 @@ class FeatureLayer extends Layer {
|
|
|
180
177
|
}
|
|
181
178
|
|
|
182
179
|
/**
|
|
183
|
-
* @param {(
|
|
180
|
+
* @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
|
|
184
181
|
* @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
|
|
185
182
|
* @returns {import("@vcmap/core").StyleItem}
|
|
186
183
|
*/
|
|
@@ -191,21 +188,14 @@ class FeatureLayer extends Layer {
|
|
|
191
188
|
|
|
192
189
|
/**
|
|
193
190
|
* Sets the style based on a styleName on a layer
|
|
194
|
-
* @param {
|
|
191
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
195
192
|
* @param {boolean=} silent
|
|
196
193
|
* @api
|
|
197
194
|
*/
|
|
198
195
|
setStyle(style, silent) {
|
|
199
|
-
check(style, [Style, StyleItem, Function
|
|
196
|
+
check(style, [Style, StyleItem, Function]);
|
|
200
197
|
|
|
201
|
-
if (
|
|
202
|
-
const styleItem = styleCollection.getByKey(style);
|
|
203
|
-
if (!styleItem) {
|
|
204
|
-
this.getLogger().warning(`could not find style with name ${style}`);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
this._style = styleItem;
|
|
208
|
-
} else if (style instanceof StyleItem) {
|
|
198
|
+
if (style instanceof StyleItem) {
|
|
209
199
|
this._style = style;
|
|
210
200
|
} else {
|
|
211
201
|
this._style = new VectorStyleItem({});
|
|
@@ -229,14 +219,10 @@ class FeatureLayer extends Layer {
|
|
|
229
219
|
/**
|
|
230
220
|
* @returns {FeatureLayerOptions}
|
|
231
221
|
*/
|
|
232
|
-
|
|
233
|
-
const config = /** @type {FeatureLayerOptions} */ (super.
|
|
222
|
+
toJSON() {
|
|
223
|
+
const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
|
|
234
224
|
if (!this.getStyleOrDefaultStyle().equals(this._style)) {
|
|
235
|
-
|
|
236
|
-
config.style = this.style.getReference();
|
|
237
|
-
} else {
|
|
238
|
-
config.style = this.style.getOptions();
|
|
239
|
-
}
|
|
225
|
+
config.style = this.style.toJSON();
|
|
240
226
|
}
|
|
241
227
|
|
|
242
228
|
if (Object.keys(this._genericFeatureProperties).length > 0) {
|
|
@@ -257,5 +243,5 @@ class FeatureLayer extends Layer {
|
|
|
257
243
|
}
|
|
258
244
|
}
|
|
259
245
|
|
|
260
|
-
|
|
246
|
+
layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
|
|
261
247
|
export default FeatureLayer;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import Feature from 'ol/Feature.js';
|
|
3
|
-
import { Cesium3DTileFeature, Cesium3DTilePointFeature,
|
|
2
|
+
import { Cesium3DTileFeature, Cesium3DTilePointFeature, SplitDirection } from '@vcmap/cesium';
|
|
4
3
|
import VectorSource from 'ol/source/Vector.js';
|
|
5
4
|
import { createEmpty, extend as extendExtent } from 'ol/extent.js';
|
|
6
5
|
|
|
7
|
-
import
|
|
8
|
-
import { featureStoreStateSymbol,
|
|
6
|
+
import VectorLayer from './vectorLayer.js';
|
|
7
|
+
import { featureStoreStateSymbol, FeatureStoreLayerState } from './featureStoreLayerState.js';
|
|
9
8
|
import { parseGeoJSON } from './geojsonHelpers.js';
|
|
10
9
|
import { mercatorProjection } from '../util/projection.js';
|
|
11
|
-
import
|
|
12
|
-
import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../
|
|
10
|
+
import FeatureStoreLayerChanges from './featureStoreLayerChanges.js';
|
|
11
|
+
import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../style/vectorStyleItem.js';
|
|
13
12
|
import FeatureVisibility, {
|
|
14
13
|
FeatureVisibilityAction,
|
|
15
14
|
originalStyle,
|
|
16
15
|
synchronizeFeatureVisibility,
|
|
17
16
|
updateOriginalStyle,
|
|
18
17
|
} from './featureVisibility.js';
|
|
19
|
-
import
|
|
20
|
-
import CesiumMap from '../
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
18
|
+
import CesiumTilesetCesiumImpl, { getExtentFromTileset } from './cesium/cesiumTilesetCesiumImpl.js';
|
|
19
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
20
|
+
import OpenlayersMap from '../map/openlayersMap.js';
|
|
21
|
+
import ObliqueMap from '../map/obliqueMap.js';
|
|
22
|
+
import CesiumTilesetLayer from './cesiumTilesetLayer.js';
|
|
24
23
|
import VectorProperties from './vectorProperties.js';
|
|
25
|
-
import
|
|
24
|
+
import VectorOpenlayersImpl from './openlayers/vectorOpenlayersImpl.js';
|
|
26
25
|
import Layer from './layer.js';
|
|
27
|
-
import DeclarativeStyleItem from '../
|
|
28
|
-
import
|
|
26
|
+
import DeclarativeStyleItem from '../style/declarativeStyleItem.js';
|
|
27
|
+
import VectorObliqueImpl from './oblique/vectorObliqueImpl.js';
|
|
29
28
|
import Extent from '../util/extent.js';
|
|
30
29
|
import { isMobile } from '../util/isMobile.js';
|
|
31
|
-
import {
|
|
30
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
31
|
+
import { requestJson } from '../util/fetch.js';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @typedef {Object} FeatureStoreStaticRepresentation
|
|
@@ -43,7 +43,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
43
43
|
* @property {Object} properties - the properties bag
|
|
44
44
|
* @property {Object} geometry
|
|
45
45
|
* @property {Object|undefined} vcsMeta
|
|
46
|
-
* @property {
|
|
46
|
+
* @property {FeatureStoreLayerState} state
|
|
47
47
|
* @property {string} type - the featureType
|
|
48
48
|
* @todo write vcsMeta for features
|
|
49
49
|
* @todo set type to be one of an enum
|
|
@@ -66,7 +66,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @typedef {FeatureStoreLayerSchema} FeatureStoreOptions
|
|
69
|
-
* @property {Function|undefined} injectedFetchDynamicFeatureFunc - injected function for fetching dynamic features from a remote
|
|
69
|
+
* @property {Function|undefined} injectedFetchDynamicFeatureFunc - injected function for fetching dynamic features from a remote FeatureStoreLayer server
|
|
70
70
|
* @api
|
|
71
71
|
*/
|
|
72
72
|
|
|
@@ -74,14 +74,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
74
74
|
export const isTiledFeature = Symbol('isTiledFeature');
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* FeatureStoreLayer Layer
|
|
78
78
|
* @class
|
|
79
|
-
* @
|
|
80
|
-
* @extends {Vector}
|
|
79
|
+
* @extends {VectorLayer}
|
|
81
80
|
* @api
|
|
82
81
|
*/
|
|
83
|
-
class
|
|
84
|
-
static get className() { return '
|
|
82
|
+
class FeatureStoreLayer extends VectorLayer {
|
|
83
|
+
static get className() { return 'FeatureStoreLayer'; }
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* @returns {FeatureStoreOptions}
|
|
@@ -89,11 +88,11 @@ class FeatureStore extends Vector {
|
|
|
89
88
|
static getDefaultOptions() {
|
|
90
89
|
return {
|
|
91
90
|
id: '',
|
|
92
|
-
type: '
|
|
91
|
+
type: 'FeatureStoreLayer',
|
|
93
92
|
featureType: 'simple',
|
|
94
93
|
features: [],
|
|
95
|
-
...
|
|
96
|
-
projection: mercatorProjection.
|
|
94
|
+
...VectorLayer.getDefaultOptions(),
|
|
95
|
+
projection: mercatorProjection.toJSON(),
|
|
97
96
|
staticRepresentation: {},
|
|
98
97
|
hiddenStaticFeatureIds: [],
|
|
99
98
|
vcsMeta: {
|
|
@@ -108,7 +107,7 @@ class FeatureStore extends Vector {
|
|
|
108
107
|
* @param {FeatureStoreOptions} options
|
|
109
108
|
*/
|
|
110
109
|
constructor(options) {
|
|
111
|
-
const defaultOptions =
|
|
110
|
+
const defaultOptions = FeatureStoreLayer.getDefaultOptions();
|
|
112
111
|
const vectorOptions = {
|
|
113
112
|
projection: defaultOptions.projection,
|
|
114
113
|
...options,
|
|
@@ -116,8 +115,8 @@ class FeatureStore extends Vector {
|
|
|
116
115
|
super(vectorOptions);
|
|
117
116
|
this._supportedMaps = [
|
|
118
117
|
CesiumMap.className,
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
OpenlayersMap.className,
|
|
119
|
+
ObliqueMap.className,
|
|
121
120
|
];
|
|
122
121
|
|
|
123
122
|
/**
|
|
@@ -136,10 +135,10 @@ class FeatureStore extends Vector {
|
|
|
136
135
|
this.hiddenStaticFeatureIds = new Set(options.hiddenStaticFeatureIds || defaultOptions.hiddenStaticFeatureIds);
|
|
137
136
|
|
|
138
137
|
/**
|
|
139
|
-
* @type {
|
|
138
|
+
* @type {FeatureStoreLayerChanges}
|
|
140
139
|
* @api
|
|
141
140
|
*/
|
|
142
|
-
this.changeTracker = new
|
|
141
|
+
this.changeTracker = new FeatureStoreLayerChanges(this);
|
|
143
142
|
|
|
144
143
|
const { vcsMeta } = defaultOptions;
|
|
145
144
|
if (options.vcsMeta) {
|
|
@@ -249,7 +248,7 @@ class FeatureStore extends Vector {
|
|
|
249
248
|
_loadTwoDim() {
|
|
250
249
|
if (!this._twoDimLoaded) {
|
|
251
250
|
this._twoDimLoaded = (async () => {
|
|
252
|
-
const
|
|
251
|
+
const data = await requestJson(this.staticRepresentation.twoDim);
|
|
253
252
|
const { features } = parseGeoJSON(data, {
|
|
254
253
|
targetProjection: mercatorProjection,
|
|
255
254
|
dynamicStyle: true,
|
|
@@ -288,14 +287,14 @@ class FeatureStore extends Vector {
|
|
|
288
287
|
|
|
289
288
|
/**
|
|
290
289
|
* @param {import("@vcmap/core").VcsMap} map
|
|
291
|
-
* @returns {Array<
|
|
290
|
+
* @returns {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>}
|
|
292
291
|
*/
|
|
293
292
|
// @ts-ignore
|
|
294
293
|
createImplementationsForMap(map) {
|
|
295
294
|
const impls = /** @type {Array<import("@vcmap/core").LayerImplementation>} */
|
|
296
295
|
(super.createImplementationsForMap(map));
|
|
297
296
|
if (map instanceof CesiumMap && this.staticRepresentation && this.staticRepresentation.threeDim) {
|
|
298
|
-
impls.push(new
|
|
297
|
+
impls.push(new CesiumTilesetCesiumImpl(map, /** @type {CesiumTilesetImplementationOptions} */ ({
|
|
299
298
|
url: this.staticRepresentation.threeDim,
|
|
300
299
|
tilesetOptions: {
|
|
301
300
|
maximumScreenSpaceError: isMobile() ? this.screenSpaceErrorMobile : this.screenSpaceError,
|
|
@@ -310,19 +309,19 @@ class FeatureStore extends Vector {
|
|
|
310
309
|
name: this.name,
|
|
311
310
|
style: this.style,
|
|
312
311
|
featureVisibility: this._staticFeatureVisibility,
|
|
313
|
-
splitDirection:
|
|
312
|
+
splitDirection: SplitDirection.NONE,
|
|
314
313
|
jumpToLocation: false,
|
|
315
314
|
})));
|
|
316
315
|
} else if (this.staticRepresentation && this.staticRepresentation.twoDim) {
|
|
317
316
|
this._loadTwoDim();
|
|
318
|
-
if (map instanceof
|
|
319
|
-
impls.push(new
|
|
320
|
-
} else if (map instanceof
|
|
321
|
-
impls.push(new
|
|
317
|
+
if (map instanceof OpenlayersMap) {
|
|
318
|
+
impls.push(new VectorOpenlayersImpl(map, this._getTwoDimStaticImplOptions()));
|
|
319
|
+
} else if (map instanceof ObliqueMap) {
|
|
320
|
+
impls.push(new VectorObliqueImpl(map, this._getTwoDimStaticImplOptions()));
|
|
322
321
|
}
|
|
323
322
|
}
|
|
324
323
|
// eslint-disable-next-line max-len
|
|
325
|
-
return /** @type {Array<
|
|
324
|
+
return /** @type {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>} */ (impls);
|
|
326
325
|
}
|
|
327
326
|
|
|
328
327
|
/**
|
|
@@ -371,7 +370,7 @@ class FeatureStore extends Vector {
|
|
|
371
370
|
|
|
372
371
|
/**
|
|
373
372
|
* @inheritDoc
|
|
374
|
-
* @param {
|
|
373
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
375
374
|
* @param {boolean=} silent
|
|
376
375
|
* @api
|
|
377
376
|
*/
|
|
@@ -409,7 +408,7 @@ class FeatureStore extends Vector {
|
|
|
409
408
|
*/
|
|
410
409
|
setEditing(symbol, featureType) {
|
|
411
410
|
this.getImplementations().forEach((impl) => {
|
|
412
|
-
if (impl instanceof
|
|
411
|
+
if (impl instanceof CesiumTilesetCesiumImpl) {
|
|
413
412
|
if (impl.initialized) {
|
|
414
413
|
if (featureType != null) {
|
|
415
414
|
impl.cesium3DTileset[symbol] = featureType;
|
|
@@ -447,7 +446,7 @@ class FeatureStore extends Vector {
|
|
|
447
446
|
*/
|
|
448
447
|
objectClickedHandler(feature) {
|
|
449
448
|
if ((feature instanceof Cesium3DTileFeature || feature instanceof Cesium3DTilePointFeature)) {
|
|
450
|
-
return
|
|
449
|
+
return CesiumTilesetLayer.prototype.objectClickedHandler.call(this, feature);
|
|
451
450
|
} else if (feature instanceof Feature) {
|
|
452
451
|
return super.objectClickedHandler(feature);
|
|
453
452
|
}
|
|
@@ -463,7 +462,7 @@ class FeatureStore extends Vector {
|
|
|
463
462
|
// @ts-ignore
|
|
464
463
|
return super.getGenericFeatureFromClickedObject(/** @type {VectorClickedObject} */ (object));
|
|
465
464
|
}
|
|
466
|
-
const generic =
|
|
465
|
+
const generic = CesiumTilesetLayer.prototype.getGenericFeatureFromClickedObject.call(this, object);
|
|
467
466
|
generic.layerName = this.name;
|
|
468
467
|
generic.layerClass = this.className;
|
|
469
468
|
return generic;
|
|
@@ -481,9 +480,9 @@ class FeatureStore extends Vector {
|
|
|
481
480
|
const extent = super.getZoomToExtent();
|
|
482
481
|
const mercatorExtent = extent ? extent.getCoordinatesInProjection(mercatorProjection) : createEmpty();
|
|
483
482
|
if (this.staticRepresentation.threeDim) {
|
|
484
|
-
const threeDImpl = /** @type {
|
|
483
|
+
const threeDImpl = /** @type {CesiumTilesetCesiumImpl} */ (this.getImplementations()
|
|
485
484
|
.find((impl) => {
|
|
486
|
-
return impl instanceof
|
|
485
|
+
return impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset;
|
|
487
486
|
}));
|
|
488
487
|
|
|
489
488
|
if (threeDImpl) {
|
|
@@ -497,7 +496,7 @@ class FeatureStore extends Vector {
|
|
|
497
496
|
}
|
|
498
497
|
|
|
499
498
|
const actualExtent = new Extent({
|
|
500
|
-
|
|
499
|
+
projection: mercatorProjection.toJSON(),
|
|
501
500
|
coordinates: mercatorExtent,
|
|
502
501
|
});
|
|
503
502
|
|
|
@@ -522,7 +521,7 @@ class FeatureStore extends Vector {
|
|
|
522
521
|
|
|
523
522
|
this.getImplementations()
|
|
524
523
|
.forEach((impl) => {
|
|
525
|
-
if (impl instanceof
|
|
524
|
+
if (impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset) {
|
|
526
525
|
impl.cesium3DTileset.maximumScreenSpaceError = value;
|
|
527
526
|
}
|
|
528
527
|
});
|
|
@@ -530,7 +529,7 @@ class FeatureStore extends Vector {
|
|
|
530
529
|
|
|
531
530
|
/**
|
|
532
531
|
* switch an array of static features to dynamic features
|
|
533
|
-
* This is done by hiding the static features and adding their dynamic counterparts to the
|
|
532
|
+
* This is done by hiding the static features and adding their dynamic counterparts to the FeatureStoreLayer layer
|
|
534
533
|
* @param {string|number} [featureId] input static feature ID
|
|
535
534
|
* @returns {Promise<import("ol").Feature<import("ol/geom/Geometry").default>>}
|
|
536
535
|
* @api
|
|
@@ -573,7 +572,7 @@ class FeatureStore extends Vector {
|
|
|
573
572
|
this.hiddenStaticFeatureIds.add(featureId);
|
|
574
573
|
const feature = new Feature();
|
|
575
574
|
feature.setId(featureId);
|
|
576
|
-
feature[featureStoreStateSymbol] =
|
|
575
|
+
feature[featureStoreStateSymbol] = FeatureStoreLayerState.STATIC;
|
|
577
576
|
this.changeTracker.removeFeature(feature);
|
|
578
577
|
}
|
|
579
578
|
|
|
@@ -596,9 +595,9 @@ class FeatureStore extends Vector {
|
|
|
596
595
|
* @inheritDoc
|
|
597
596
|
* @returns {FeatureStoreOptions}
|
|
598
597
|
*/
|
|
599
|
-
|
|
600
|
-
const config = /** @type {FeatureStoreOptions} */ (super.
|
|
601
|
-
const defaultOptions =
|
|
598
|
+
toJSON() {
|
|
599
|
+
const config = /** @type {FeatureStoreOptions} */ (super.toJSON());
|
|
600
|
+
const defaultOptions = FeatureStoreLayer.getDefaultOptions();
|
|
602
601
|
|
|
603
602
|
delete config.projection;
|
|
604
603
|
config.vcsMeta = this.vectorProperties
|
|
@@ -643,5 +642,5 @@ class FeatureStore extends Vector {
|
|
|
643
642
|
}
|
|
644
643
|
}
|
|
645
644
|
|
|
646
|
-
|
|
647
|
-
export default
|
|
645
|
+
layerClassRegistry.registerClass(FeatureStoreLayer.className, FeatureStoreLayer);
|
|
646
|
+
export default FeatureStoreLayer;
|