@vcmap/core 5.0.0-rc.1 → 5.0.0-rc.10
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 +2208 -2072
- package/index.js +137 -131
- package/package.json +10 -22
- 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 +168 -0
- package/src/context.js +73 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -8
- 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 -17
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -17
- 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 -31
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +0 -0
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +8 -10
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -2
- package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -4
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +3 -3
- package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -1
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -36
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -16
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +13 -13
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -30
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -53
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -1
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +6 -5
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -37
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -21
- package/src/{vcs/vcm/layer → layer}/globalHider.js +1 -11
- package/src/{vcs/vcm/layer → layer}/layer.js +11 -11
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -2
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -0
- 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 -6
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -32
- package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -5
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +27 -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 -6
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -5
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +6 -6
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -6
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -33
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -18
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -19
- package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -13
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +82 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -7
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -5
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -19
- package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -47
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -3
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +32 -41
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -19
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -22
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -20
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -5
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -16
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -33
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -0
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -56
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -14
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +35 -20
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -41
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -36
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -24
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -1
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -4
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -11
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -1
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -0
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
- package/src/ol/geom/circle.js +1 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -19
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -0
- package/src/style/styleFactory.js +29 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -3
- package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -85
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -81
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -10
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -2
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -4
- package/src/{vcs/vcm/util → util}/collection.js +1 -1
- 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 -11
- 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 -1
- package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
- package/src/{vcs/vcm/util → util}/layerCollection.js +11 -6
- package/src/{vcs/vcm/util → util}/locale.js +1 -1
- package/src/{vcs/vcm/util → util}/mapCollection.js +63 -21
- package/src/{vcs/vcm/util → util}/math.js +0 -0
- package/src/util/overrideCollection.js +224 -0
- package/src/{vcs/vcm/util → util}/projection.js +39 -24
- 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 -5
- package/src/vcsApp.js +471 -0
- package/src/vcsAppContextHelpers.js +121 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -2
- package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
- 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,8 +1,8 @@
|
|
|
1
1
|
import { CzmlDataSource } from '@vcmap/cesium';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import DataSourceLayer from './dataSourceLayer.js';
|
|
4
4
|
import { vcsLayerName } from './layerSymbols.js';
|
|
5
|
-
import {
|
|
5
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {DataSourceOptions} CzmlOptions
|
|
@@ -13,17 +13,17 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* @class
|
|
15
15
|
* @export
|
|
16
|
-
* @extends {
|
|
16
|
+
* @extends {DataSourceLayer}
|
|
17
17
|
*/
|
|
18
|
-
class
|
|
19
|
-
static get className() { return '
|
|
18
|
+
class CzmlLayer extends DataSourceLayer {
|
|
19
|
+
static get className() { return 'CzmlLayer'; }
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @returns {CzmlOptions}
|
|
23
23
|
*/
|
|
24
24
|
static getDefaultOptions() {
|
|
25
25
|
return {
|
|
26
|
-
...
|
|
26
|
+
...DataSourceLayer.getDefaultOptions(),
|
|
27
27
|
sourceUri: undefined,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -36,7 +36,7 @@ class Czml extends DataSource {
|
|
|
36
36
|
this.dataSource = new CzmlDataSource();
|
|
37
37
|
this.entities = this.dataSource.entities;
|
|
38
38
|
|
|
39
|
-
const defaultOptions =
|
|
39
|
+
const defaultOptions = CzmlLayer.getDefaultOptions();
|
|
40
40
|
/** @type {string|null} */
|
|
41
41
|
this.sourceUri = options.sourceUri || defaultOptions.sourceUri;
|
|
42
42
|
/** @type {Function} */
|
|
@@ -44,7 +44,7 @@ class Czml extends DataSource {
|
|
|
44
44
|
/** @type {Function} */
|
|
45
45
|
this._loadedReject = () => {};
|
|
46
46
|
/**
|
|
47
|
-
* A Promise resolving with the
|
|
47
|
+
* A Promise resolving with the DataSourceLayer on load
|
|
48
48
|
* @type {Promise<void>}
|
|
49
49
|
* @api stable
|
|
50
50
|
*/
|
|
@@ -77,11 +77,9 @@ class Czml extends DataSource {
|
|
|
77
77
|
* @private
|
|
78
78
|
*/
|
|
79
79
|
async _loadData() {
|
|
80
|
-
|
|
80
|
+
await /** @type {import("@vcmap/cesium").CzmlDataSource} */ (this.dataSource)
|
|
81
81
|
.load(this.url, this.sourceUri ? { sourceUri: this.sourceUri } : undefined);
|
|
82
|
-
|
|
83
|
-
loaded.then(resolve, reject);
|
|
84
|
-
});
|
|
82
|
+
|
|
85
83
|
this.entities.values.forEach((entity) => {
|
|
86
84
|
entity[vcsLayerName] = this.name;
|
|
87
85
|
});
|
|
@@ -102,8 +100,8 @@ class Czml extends DataSource {
|
|
|
102
100
|
* @inheritDoc
|
|
103
101
|
* @returns {CzmlOptions}
|
|
104
102
|
*/
|
|
105
|
-
|
|
106
|
-
const config = /** @type {CzmlOptions} */ (super.
|
|
103
|
+
toJSON() {
|
|
104
|
+
const config = /** @type {CzmlOptions} */ (super.toJSON());
|
|
107
105
|
if (this.sourceUri) {
|
|
108
106
|
config.sourceUri = this.sourceUri;
|
|
109
107
|
}
|
|
@@ -137,5 +135,5 @@ class Czml extends DataSource {
|
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
|
|
141
|
-
export default
|
|
138
|
+
layerClassRegistry.registerClass(CzmlLayer.className, CzmlLayer);
|
|
139
|
+
export default CzmlLayer;
|
|
@@ -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
|
|
@@ -34,8 +34,8 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
34
34
|
* @extends {Layer}
|
|
35
35
|
* @api stable
|
|
36
36
|
*/
|
|
37
|
-
class
|
|
38
|
-
static get className() { return '
|
|
37
|
+
class DataSourceLayer extends Layer {
|
|
38
|
+
static get className() { return 'DataSourceLayer'; }
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* @returns {DataSourceOptions}
|
|
@@ -52,7 +52,7 @@ class DataSource extends Layer {
|
|
|
52
52
|
*/
|
|
53
53
|
constructor(options) {
|
|
54
54
|
super(options);
|
|
55
|
-
const defaultOptions =
|
|
55
|
+
const defaultOptions = DataSourceLayer.getDefaultOptions();
|
|
56
56
|
/**
|
|
57
57
|
* The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
|
|
58
58
|
* @type {import("@vcmap/cesium").EntityCollection}
|
|
@@ -151,11 +151,11 @@ class DataSource extends Layer {
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* @param {CesiumMap} map
|
|
154
|
-
* @returns {Array<
|
|
154
|
+
* @returns {Array<DataSourceCesiumImpl>}
|
|
155
155
|
*/
|
|
156
156
|
createImplementationsForMap(map) {
|
|
157
157
|
if (map instanceof CesiumMap) {
|
|
158
|
-
return [new
|
|
158
|
+
return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
|
|
159
159
|
}
|
|
160
160
|
return [];
|
|
161
161
|
}
|
|
@@ -183,7 +183,7 @@ class DataSource extends Layer {
|
|
|
183
183
|
*/
|
|
184
184
|
flyToEntity(id) {
|
|
185
185
|
this.getImplementations().forEach((impl) => {
|
|
186
|
-
/** @type {
|
|
186
|
+
/** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -235,8 +235,8 @@ class DataSource extends Layer {
|
|
|
235
235
|
* @inheritDoc
|
|
236
236
|
* @returns {DataSourceOptions}
|
|
237
237
|
*/
|
|
238
|
-
|
|
239
|
-
const config = /** @type {DataSourceOptions} */ (super.
|
|
238
|
+
toJSON() {
|
|
239
|
+
const config = /** @type {DataSourceOptions} */ (super.toJSON());
|
|
240
240
|
if (Object.keys(this._genericFeatureProperties).length > 0) {
|
|
241
241
|
config.genericFeatureProperties = { ...this._genericFeatureProperties };
|
|
242
242
|
}
|
|
@@ -255,5 +255,5 @@ class DataSource extends Layer {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
export default
|
|
258
|
+
layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
|
|
259
|
+
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,7 +40,7 @@ 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}
|
|
@@ -51,7 +49,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
51
49
|
*/
|
|
52
50
|
class FeatureLayer extends Layer {
|
|
53
51
|
/** @type {string} */
|
|
54
|
-
static get className() { return '
|
|
52
|
+
static get className() { return 'FeatureLayer'; }
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
55
|
* @returns {FeatureLayerOptions}
|
|
@@ -76,7 +74,7 @@ class FeatureLayer extends Layer {
|
|
|
76
74
|
* @type {import("@vcmap/core").StyleItem}
|
|
77
75
|
* @private
|
|
78
76
|
*/
|
|
79
|
-
this._style = this.getStyleOrDefaultStyle(options.
|
|
77
|
+
this._style = this.getStyleOrDefaultStyle(options.style);
|
|
80
78
|
/**
|
|
81
79
|
* @type {import("@vcmap/core").StyleItem}
|
|
82
80
|
* @private
|
|
@@ -180,7 +178,7 @@ class FeatureLayer extends Layer {
|
|
|
180
178
|
}
|
|
181
179
|
|
|
182
180
|
/**
|
|
183
|
-
* @param {(
|
|
181
|
+
* @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
|
|
184
182
|
* @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
|
|
185
183
|
* @returns {import("@vcmap/core").StyleItem}
|
|
186
184
|
*/
|
|
@@ -191,21 +189,14 @@ class FeatureLayer extends Layer {
|
|
|
191
189
|
|
|
192
190
|
/**
|
|
193
191
|
* Sets the style based on a styleName on a layer
|
|
194
|
-
* @param {
|
|
192
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
195
193
|
* @param {boolean=} silent
|
|
196
194
|
* @api
|
|
197
195
|
*/
|
|
198
196
|
setStyle(style, silent) {
|
|
199
|
-
check(style, [Style, StyleItem, Function
|
|
197
|
+
check(style, [Style, StyleItem, Function]);
|
|
200
198
|
|
|
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) {
|
|
199
|
+
if (style instanceof StyleItem) {
|
|
209
200
|
this._style = style;
|
|
210
201
|
} else {
|
|
211
202
|
this._style = new VectorStyleItem({});
|
|
@@ -229,14 +220,10 @@ class FeatureLayer extends Layer {
|
|
|
229
220
|
/**
|
|
230
221
|
* @returns {FeatureLayerOptions}
|
|
231
222
|
*/
|
|
232
|
-
|
|
233
|
-
const config = /** @type {FeatureLayerOptions} */ (super.
|
|
223
|
+
toJSON() {
|
|
224
|
+
const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
|
|
234
225
|
if (!this.getStyleOrDefaultStyle().equals(this._style)) {
|
|
235
|
-
|
|
236
|
-
config.style = this.style.getReference();
|
|
237
|
-
} else {
|
|
238
|
-
config.style = this.style.getOptions();
|
|
239
|
-
}
|
|
226
|
+
config.style = this.style.toJSON();
|
|
240
227
|
}
|
|
241
228
|
|
|
242
229
|
if (Object.keys(this._genericFeatureProperties).length > 0) {
|
|
@@ -257,5 +244,5 @@ class FeatureLayer extends Layer {
|
|
|
257
244
|
}
|
|
258
245
|
}
|
|
259
246
|
|
|
260
|
-
|
|
247
|
+
layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
|
|
261
248
|
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,14 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
74
74
|
export const isTiledFeature = Symbol('isTiledFeature');
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* FeatureStoreLayer Layer
|
|
78
78
|
* @class
|
|
79
79
|
* @export
|
|
80
|
-
* @extends {
|
|
80
|
+
* @extends {VectorLayer}
|
|
81
81
|
* @api
|
|
82
82
|
*/
|
|
83
|
-
class
|
|
84
|
-
static get className() { return '
|
|
83
|
+
class FeatureStoreLayer extends VectorLayer {
|
|
84
|
+
static get className() { return 'FeatureStoreLayer'; }
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* @returns {FeatureStoreOptions}
|
|
@@ -89,11 +89,11 @@ class FeatureStore extends Vector {
|
|
|
89
89
|
static getDefaultOptions() {
|
|
90
90
|
return {
|
|
91
91
|
id: '',
|
|
92
|
-
type: '
|
|
92
|
+
type: 'FeatureStoreLayer',
|
|
93
93
|
featureType: 'simple',
|
|
94
94
|
features: [],
|
|
95
|
-
...
|
|
96
|
-
projection: mercatorProjection.
|
|
95
|
+
...VectorLayer.getDefaultOptions(),
|
|
96
|
+
projection: mercatorProjection.toJSON(),
|
|
97
97
|
staticRepresentation: {},
|
|
98
98
|
hiddenStaticFeatureIds: [],
|
|
99
99
|
vcsMeta: {
|
|
@@ -108,7 +108,7 @@ class FeatureStore extends Vector {
|
|
|
108
108
|
* @param {FeatureStoreOptions} options
|
|
109
109
|
*/
|
|
110
110
|
constructor(options) {
|
|
111
|
-
const defaultOptions =
|
|
111
|
+
const defaultOptions = FeatureStoreLayer.getDefaultOptions();
|
|
112
112
|
const vectorOptions = {
|
|
113
113
|
projection: defaultOptions.projection,
|
|
114
114
|
...options,
|
|
@@ -116,8 +116,8 @@ class FeatureStore extends Vector {
|
|
|
116
116
|
super(vectorOptions);
|
|
117
117
|
this._supportedMaps = [
|
|
118
118
|
CesiumMap.className,
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
OpenlayersMap.className,
|
|
120
|
+
ObliqueMap.className,
|
|
121
121
|
];
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -136,10 +136,10 @@ class FeatureStore extends Vector {
|
|
|
136
136
|
this.hiddenStaticFeatureIds = new Set(options.hiddenStaticFeatureIds || defaultOptions.hiddenStaticFeatureIds);
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* @type {
|
|
139
|
+
* @type {FeatureStoreLayerChanges}
|
|
140
140
|
* @api
|
|
141
141
|
*/
|
|
142
|
-
this.changeTracker = new
|
|
142
|
+
this.changeTracker = new FeatureStoreLayerChanges(this);
|
|
143
143
|
|
|
144
144
|
const { vcsMeta } = defaultOptions;
|
|
145
145
|
if (options.vcsMeta) {
|
|
@@ -249,7 +249,7 @@ class FeatureStore extends Vector {
|
|
|
249
249
|
_loadTwoDim() {
|
|
250
250
|
if (!this._twoDimLoaded) {
|
|
251
251
|
this._twoDimLoaded = (async () => {
|
|
252
|
-
const
|
|
252
|
+
const data = await requestJson(this.staticRepresentation.twoDim);
|
|
253
253
|
const { features } = parseGeoJSON(data, {
|
|
254
254
|
targetProjection: mercatorProjection,
|
|
255
255
|
dynamicStyle: true,
|
|
@@ -288,14 +288,14 @@ class FeatureStore extends Vector {
|
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
290
|
* @param {import("@vcmap/core").VcsMap} map
|
|
291
|
-
* @returns {Array<
|
|
291
|
+
* @returns {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>}
|
|
292
292
|
*/
|
|
293
293
|
// @ts-ignore
|
|
294
294
|
createImplementationsForMap(map) {
|
|
295
295
|
const impls = /** @type {Array<import("@vcmap/core").LayerImplementation>} */
|
|
296
296
|
(super.createImplementationsForMap(map));
|
|
297
297
|
if (map instanceof CesiumMap && this.staticRepresentation && this.staticRepresentation.threeDim) {
|
|
298
|
-
impls.push(new
|
|
298
|
+
impls.push(new CesiumTilesetCesiumImpl(map, /** @type {CesiumTilesetImplementationOptions} */ ({
|
|
299
299
|
url: this.staticRepresentation.threeDim,
|
|
300
300
|
tilesetOptions: {
|
|
301
301
|
maximumScreenSpaceError: isMobile() ? this.screenSpaceErrorMobile : this.screenSpaceError,
|
|
@@ -310,19 +310,19 @@ class FeatureStore extends Vector {
|
|
|
310
310
|
name: this.name,
|
|
311
311
|
style: this.style,
|
|
312
312
|
featureVisibility: this._staticFeatureVisibility,
|
|
313
|
-
splitDirection:
|
|
313
|
+
splitDirection: SplitDirection.NONE,
|
|
314
314
|
jumpToLocation: false,
|
|
315
315
|
})));
|
|
316
316
|
} else if (this.staticRepresentation && this.staticRepresentation.twoDim) {
|
|
317
317
|
this._loadTwoDim();
|
|
318
|
-
if (map instanceof
|
|
319
|
-
impls.push(new
|
|
320
|
-
} else if (map instanceof
|
|
321
|
-
impls.push(new
|
|
318
|
+
if (map instanceof OpenlayersMap) {
|
|
319
|
+
impls.push(new VectorOpenlayersImpl(map, this._getTwoDimStaticImplOptions()));
|
|
320
|
+
} else if (map instanceof ObliqueMap) {
|
|
321
|
+
impls.push(new VectorObliqueImpl(map, this._getTwoDimStaticImplOptions()));
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
// eslint-disable-next-line max-len
|
|
325
|
-
return /** @type {Array<
|
|
325
|
+
return /** @type {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>} */ (impls);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
/**
|
|
@@ -371,7 +371,7 @@ class FeatureStore extends Vector {
|
|
|
371
371
|
|
|
372
372
|
/**
|
|
373
373
|
* @inheritDoc
|
|
374
|
-
* @param {
|
|
374
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
375
375
|
* @param {boolean=} silent
|
|
376
376
|
* @api
|
|
377
377
|
*/
|
|
@@ -409,7 +409,7 @@ class FeatureStore extends Vector {
|
|
|
409
409
|
*/
|
|
410
410
|
setEditing(symbol, featureType) {
|
|
411
411
|
this.getImplementations().forEach((impl) => {
|
|
412
|
-
if (impl instanceof
|
|
412
|
+
if (impl instanceof CesiumTilesetCesiumImpl) {
|
|
413
413
|
if (impl.initialized) {
|
|
414
414
|
if (featureType != null) {
|
|
415
415
|
impl.cesium3DTileset[symbol] = featureType;
|
|
@@ -447,7 +447,7 @@ class FeatureStore extends Vector {
|
|
|
447
447
|
*/
|
|
448
448
|
objectClickedHandler(feature) {
|
|
449
449
|
if ((feature instanceof Cesium3DTileFeature || feature instanceof Cesium3DTilePointFeature)) {
|
|
450
|
-
return
|
|
450
|
+
return CesiumTilesetLayer.prototype.objectClickedHandler.call(this, feature);
|
|
451
451
|
} else if (feature instanceof Feature) {
|
|
452
452
|
return super.objectClickedHandler(feature);
|
|
453
453
|
}
|
|
@@ -463,7 +463,7 @@ class FeatureStore extends Vector {
|
|
|
463
463
|
// @ts-ignore
|
|
464
464
|
return super.getGenericFeatureFromClickedObject(/** @type {VectorClickedObject} */ (object));
|
|
465
465
|
}
|
|
466
|
-
const generic =
|
|
466
|
+
const generic = CesiumTilesetLayer.prototype.getGenericFeatureFromClickedObject.call(this, object);
|
|
467
467
|
generic.layerName = this.name;
|
|
468
468
|
generic.layerClass = this.className;
|
|
469
469
|
return generic;
|
|
@@ -481,9 +481,9 @@ class FeatureStore extends Vector {
|
|
|
481
481
|
const extent = super.getZoomToExtent();
|
|
482
482
|
const mercatorExtent = extent ? extent.getCoordinatesInProjection(mercatorProjection) : createEmpty();
|
|
483
483
|
if (this.staticRepresentation.threeDim) {
|
|
484
|
-
const threeDImpl = /** @type {
|
|
484
|
+
const threeDImpl = /** @type {CesiumTilesetCesiumImpl} */ (this.getImplementations()
|
|
485
485
|
.find((impl) => {
|
|
486
|
-
return impl instanceof
|
|
486
|
+
return impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset;
|
|
487
487
|
}));
|
|
488
488
|
|
|
489
489
|
if (threeDImpl) {
|
|
@@ -497,7 +497,7 @@ class FeatureStore extends Vector {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
const actualExtent = new Extent({
|
|
500
|
-
|
|
500
|
+
projection: mercatorProjection.toJSON(),
|
|
501
501
|
coordinates: mercatorExtent,
|
|
502
502
|
});
|
|
503
503
|
|
|
@@ -522,7 +522,7 @@ class FeatureStore extends Vector {
|
|
|
522
522
|
|
|
523
523
|
this.getImplementations()
|
|
524
524
|
.forEach((impl) => {
|
|
525
|
-
if (impl instanceof
|
|
525
|
+
if (impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset) {
|
|
526
526
|
impl.cesium3DTileset.maximumScreenSpaceError = value;
|
|
527
527
|
}
|
|
528
528
|
});
|
|
@@ -530,7 +530,7 @@ class FeatureStore extends Vector {
|
|
|
530
530
|
|
|
531
531
|
/**
|
|
532
532
|
* 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
|
|
533
|
+
* This is done by hiding the static features and adding their dynamic counterparts to the FeatureStoreLayer layer
|
|
534
534
|
* @param {string|number} [featureId] input static feature ID
|
|
535
535
|
* @returns {Promise<import("ol").Feature<import("ol/geom/Geometry").default>>}
|
|
536
536
|
* @api
|
|
@@ -573,7 +573,7 @@ class FeatureStore extends Vector {
|
|
|
573
573
|
this.hiddenStaticFeatureIds.add(featureId);
|
|
574
574
|
const feature = new Feature();
|
|
575
575
|
feature.setId(featureId);
|
|
576
|
-
feature[featureStoreStateSymbol] =
|
|
576
|
+
feature[featureStoreStateSymbol] = FeatureStoreLayerState.STATIC;
|
|
577
577
|
this.changeTracker.removeFeature(feature);
|
|
578
578
|
}
|
|
579
579
|
|
|
@@ -596,9 +596,9 @@ class FeatureStore extends Vector {
|
|
|
596
596
|
* @inheritDoc
|
|
597
597
|
* @returns {FeatureStoreOptions}
|
|
598
598
|
*/
|
|
599
|
-
|
|
600
|
-
const config = /** @type {FeatureStoreOptions} */ (super.
|
|
601
|
-
const defaultOptions =
|
|
599
|
+
toJSON() {
|
|
600
|
+
const config = /** @type {FeatureStoreOptions} */ (super.toJSON());
|
|
601
|
+
const defaultOptions = FeatureStoreLayer.getDefaultOptions();
|
|
602
602
|
|
|
603
603
|
delete config.projection;
|
|
604
604
|
config.vcsMeta = this.vectorProperties
|
|
@@ -643,5 +643,5 @@ class FeatureStore extends Vector {
|
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
-
|
|
647
|
-
export default
|
|
646
|
+
layerClassRegistry.registerClass(FeatureStoreLayer.className, FeatureStoreLayer);
|
|
647
|
+
export default FeatureStoreLayer;
|