@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,10 +1,10 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import { unByKey } from 'ol/Observable.js';
|
|
3
2
|
import Feature from 'ol/Feature.js';
|
|
4
3
|
import { check } from '@vcsuite/check';
|
|
5
|
-
import {
|
|
4
|
+
import { FeatureStoreLayerState, featureStoreStateSymbol } from './featureStoreLayerState.js';
|
|
6
5
|
import { parseGeoJSON, writeGeoJSONFeature } from './geojsonHelpers.js';
|
|
7
|
-
import VcsObject from '../
|
|
6
|
+
import VcsObject from '../vcsObject.js';
|
|
7
|
+
import { requestJson } from '../util/fetch.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {Object} FeatureStoreTrackResults
|
|
@@ -26,22 +26,81 @@ import VcsObject from '../object.js';
|
|
|
26
26
|
* @property {boolean} changed
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {Object} CommitAction
|
|
31
|
+
* @property {string} action
|
|
32
|
+
* @property {import("ol/format/GeoJSON").GeoJSONFeature} feature
|
|
33
|
+
* @property {import("ol").Feature<import("ol/geom/Geometry").default>} original
|
|
34
|
+
* @property {function(string=):void} success
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Set<import("ol").Feature<import("ol/geom/Geometry").default>>} added
|
|
39
|
+
* @param {Set<import("ol").Feature<import("ol/geom/Geometry").default>>} edited
|
|
40
|
+
* @param {Set<import("ol").Feature<import("ol/geom/Geometry").default>>} removed
|
|
41
|
+
* @returns {Array<CommitAction>}
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export function createCommitActions(added, edited, removed) {
|
|
45
|
+
const actions = [];
|
|
46
|
+
added.forEach((f) => {
|
|
47
|
+
const feature = writeGeoJSONFeature(f, { writeStyle: true });
|
|
48
|
+
actions.push({
|
|
49
|
+
action: 'add',
|
|
50
|
+
feature,
|
|
51
|
+
original: f,
|
|
52
|
+
success(data) {
|
|
53
|
+
f.setId(data);
|
|
54
|
+
f[featureStoreStateSymbol] = FeatureStoreLayerState.DYNAMIC;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
edited.forEach((f) => {
|
|
60
|
+
const feature = writeGeoJSONFeature(f, { writeStyle: true });
|
|
61
|
+
feature._id = f.getId();
|
|
62
|
+
feature.geomety = 'test'; // XXX why test???
|
|
63
|
+
actions.push({
|
|
64
|
+
action: 'edit',
|
|
65
|
+
original: f,
|
|
66
|
+
feature,
|
|
67
|
+
success() {
|
|
68
|
+
if (f[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC) {
|
|
69
|
+
f[featureStoreStateSymbol] = FeatureStoreLayerState.EDITED;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
removed.forEach((f) => {
|
|
76
|
+
const _id = f.getId();
|
|
77
|
+
actions.push({
|
|
78
|
+
original: f,
|
|
79
|
+
action: 'remove',
|
|
80
|
+
feature: { _id },
|
|
81
|
+
success() {},
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return actions;
|
|
86
|
+
}
|
|
87
|
+
|
|
29
88
|
/**
|
|
30
89
|
* do not construct directly, use the layers .changeTracker instead
|
|
31
90
|
* @class
|
|
32
91
|
* @extends {VcsObject}
|
|
33
92
|
* @api
|
|
34
93
|
*/
|
|
35
|
-
class
|
|
36
|
-
static get className() { return '
|
|
94
|
+
class FeatureStoreLayerChanges extends VcsObject {
|
|
95
|
+
static get className() { return 'FeatureStoreLayerChanges'; }
|
|
37
96
|
|
|
38
97
|
/**
|
|
39
|
-
* @param {import("@vcmap/core").
|
|
98
|
+
* @param {import("@vcmap/core").FeatureStoreLayer} layer
|
|
40
99
|
*/
|
|
41
100
|
constructor(layer) {
|
|
42
101
|
super({});
|
|
43
102
|
|
|
44
|
-
/** @type {import("@vcmap/core").
|
|
103
|
+
/** @type {import("@vcmap/core").FeatureStoreLayer} */
|
|
45
104
|
this.layer = layer;
|
|
46
105
|
/** @type {FeatureStoreChangesListeners} */
|
|
47
106
|
this._changesListeners = {
|
|
@@ -107,85 +166,42 @@ class FeatureStoreChanges extends VcsObject {
|
|
|
107
166
|
* @returns {Promise<void>}
|
|
108
167
|
* @api
|
|
109
168
|
*/
|
|
110
|
-
commitChanges(url) {
|
|
111
|
-
const actions =
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
original: f,
|
|
118
|
-
success(data) {
|
|
119
|
-
f.setId(data);
|
|
120
|
-
f[featureStoreStateSymbol] = featureStoreState.DYNAMIC;
|
|
169
|
+
async commitChanges(url) {
|
|
170
|
+
const actions = createCommitActions(this._addedFeatures, this._editedFeatures, this._removedFeatures);
|
|
171
|
+
if (actions.length > 0) {
|
|
172
|
+
const data = await requestJson(url.toString(), {
|
|
173
|
+
method: 'POST',
|
|
174
|
+
headers: {
|
|
175
|
+
'Content-Type': 'application/json',
|
|
121
176
|
},
|
|
177
|
+
body: JSON.stringify(actions.map(a => ({ action: a.action, feature: a.feature }))),
|
|
122
178
|
});
|
|
123
|
-
});
|
|
124
179
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
action: 'edit',
|
|
131
|
-
original: f,
|
|
132
|
-
feature,
|
|
133
|
-
success() {
|
|
134
|
-
if (f[featureStoreStateSymbol] === featureStoreState.STATIC) {
|
|
135
|
-
f[featureStoreStateSymbol] = featureStoreState.EDITED;
|
|
136
|
-
}
|
|
137
|
-
},
|
|
180
|
+
const failures = data.failedActions.map(({ index, error }) => {
|
|
181
|
+
const action = actions[index];
|
|
182
|
+
this.getLogger().log(`failed action ${action.action}: ${error}`);
|
|
183
|
+
actions[index] = null;
|
|
184
|
+
return this._resetFeature(action.original);
|
|
138
185
|
});
|
|
139
|
-
});
|
|
140
186
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
/** @type {Promise<void>} */
|
|
151
|
-
let promise = Promise.resolve();
|
|
152
|
-
if (actions.length) {
|
|
153
|
-
// @ts-ignore
|
|
154
|
-
promise = axios.post(url.toString(), actions.map(a => ({ action: a.action, feature: a.feature })))
|
|
155
|
-
.then(({ data }) => {
|
|
156
|
-
const failures = data.failedActions.map(({ index, error }) => {
|
|
157
|
-
const action = actions[index];
|
|
158
|
-
this.getLogger().log(`failed action ${action.action}: ${error}`);
|
|
159
|
-
actions[index] = null;
|
|
160
|
-
return this._resetFeature(action.original);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
actions
|
|
164
|
-
.filter(a => a)
|
|
165
|
-
.forEach(({ action, success }) => {
|
|
166
|
-
if (action === 'add') {
|
|
167
|
-
success(data.insertedIds.shift()._id); // XXX should this be shift or should we find the index?
|
|
168
|
-
} else {
|
|
169
|
-
success();
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
return Promise.all(failures);
|
|
187
|
+
actions
|
|
188
|
+
.filter(a => a)
|
|
189
|
+
.forEach(({ action, success }) => {
|
|
190
|
+
if (action === 'add') {
|
|
191
|
+
success(data.insertedIds.shift()._id); // XXX should this be shift or should we find the index?
|
|
192
|
+
} else {
|
|
193
|
+
success();
|
|
194
|
+
}
|
|
173
195
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this._convertedFeatures.forEach((f) => { promises.push(this._resetFeature(f)); });
|
|
180
|
-
return Promise.all(promises);
|
|
181
|
-
})
|
|
182
|
-
.then(() => {
|
|
183
|
-
this._resetValues();
|
|
184
|
-
})
|
|
185
|
-
.catch((err) => {
|
|
186
|
-
this._resetValues();
|
|
196
|
+
await Promise.all(failures);
|
|
197
|
+
} else {
|
|
198
|
+
try {
|
|
199
|
+
await Promise.all([...this._convertedFeatures].map(async (f) => { await this._resetFeature(f); }));
|
|
200
|
+
} catch (err) {
|
|
187
201
|
this.getLogger().error(err.message);
|
|
188
|
-
}
|
|
202
|
+
}
|
|
203
|
+
this._resetValues();
|
|
204
|
+
}
|
|
189
205
|
}
|
|
190
206
|
|
|
191
207
|
/**
|
|
@@ -222,7 +238,7 @@ class FeatureStoreChanges extends VcsObject {
|
|
|
222
238
|
return Promise.resolve();
|
|
223
239
|
}
|
|
224
240
|
|
|
225
|
-
if (feature[featureStoreStateSymbol] ===
|
|
241
|
+
if (feature[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC) {
|
|
226
242
|
this.layer.resetStaticFeature(featureId);
|
|
227
243
|
return Promise.resolve();
|
|
228
244
|
}
|
|
@@ -279,7 +295,7 @@ class FeatureStoreChanges extends VcsObject {
|
|
|
279
295
|
if (!feature[featureStoreStateSymbol]) {
|
|
280
296
|
this._addedFeatures.add(feature);
|
|
281
297
|
this.values.changed = true;
|
|
282
|
-
} else if (feature[featureStoreStateSymbol] ===
|
|
298
|
+
} else if (feature[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC) {
|
|
283
299
|
this._convertedFeatures.add(feature);
|
|
284
300
|
this.values.changed = true;
|
|
285
301
|
}
|
|
@@ -357,4 +373,4 @@ class FeatureStoreChanges extends VcsObject {
|
|
|
357
373
|
}
|
|
358
374
|
}
|
|
359
375
|
|
|
360
|
-
export default
|
|
376
|
+
export default FeatureStoreLayerChanges;
|
|
@@ -10,9 +10,8 @@ export const featureStoreStateSymbol = Symbol('vcsFeatureType');
|
|
|
10
10
|
* @property {string} STATIC
|
|
11
11
|
* @property {string} EDITED
|
|
12
12
|
* @api
|
|
13
|
-
* @export
|
|
14
13
|
*/
|
|
15
|
-
export const
|
|
14
|
+
export const FeatureStoreLayerState = {
|
|
16
15
|
DYNAMIC: 'dynamic',
|
|
17
16
|
STATIC: 'static',
|
|
18
17
|
EDITED: 'edited',
|
|
@@ -2,9 +2,9 @@ import { Color, Cesium3DTileFeature, Cesium3DTilePointFeature, Entity as CesiumE
|
|
|
2
2
|
import Feature from 'ol/Feature.js';
|
|
3
3
|
import Style from 'ol/style/Style.js';
|
|
4
4
|
|
|
5
|
-
import VectorStyleItem, { fromCesiumColor } from '../
|
|
6
|
-
import { emptyStyle } from '../
|
|
7
|
-
import VcsEvent from '../
|
|
5
|
+
import VectorStyleItem, { fromCesiumColor } from '../style/vectorStyleItem.js';
|
|
6
|
+
import { emptyStyle } from '../style/styleHelpers.js';
|
|
7
|
+
import VcsEvent from '../vcsEvent.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Set on an ol.Feature or Cesium.Cesium3DTileFeature to indicate its style before it was hidden or highlighted.
|
|
@@ -181,7 +181,6 @@ export function showFeature(feature, symbol) {
|
|
|
181
181
|
/**
|
|
182
182
|
* Enumeration of feature visibility actions.
|
|
183
183
|
* @enum {number}
|
|
184
|
-
* @export
|
|
185
184
|
* @api
|
|
186
185
|
* @property {number} HIGHLIGHT
|
|
187
186
|
* @property {number} UNHIGHLIGHT
|
|
@@ -264,8 +263,9 @@ class FeatureVisibility {
|
|
|
264
263
|
usedStyle = fromCesiumColor(style);
|
|
265
264
|
} else if (style instanceof Style) {
|
|
266
265
|
usedStyle = new VectorStyleItem({});
|
|
267
|
-
if (style.getText() && style.getText().getText()) {
|
|
268
|
-
|
|
266
|
+
if (style.getText() && style.getText().getText() && !Array.isArray(style.getText().getText())) {
|
|
267
|
+
// getText can return a rich Text Array<string> We do not support this at the moment.
|
|
268
|
+
usedStyle.label = String(style.getText().getText());
|
|
269
269
|
}
|
|
270
270
|
usedStyle.style = style;
|
|
271
271
|
}
|
|
@@ -6,18 +6,15 @@ import Point from 'ol/geom/Point.js';
|
|
|
6
6
|
import Circle from 'ol/geom/Circle.js';
|
|
7
7
|
|
|
8
8
|
import { getDistance as haversineDistance } from 'ol/sphere.js';
|
|
9
|
-
import { getLogger as getLoggerByName } from '@vcsuite/logger';
|
|
10
9
|
import Projection, { mercatorProjection, wgs84Projection } from '../util/projection.js';
|
|
11
|
-
import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../
|
|
12
|
-
import { parseColor } from '../
|
|
13
|
-
import
|
|
14
|
-
import { featureStoreStateSymbol } from './
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import DeclarativeStyleItem from '../util/style/declarativeStyleItem.js';
|
|
10
|
+
import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../style/vectorStyleItem.js';
|
|
11
|
+
import { parseColor } from '../style/styleHelpers.js';
|
|
12
|
+
import VectorLayer from './vectorLayer.js';
|
|
13
|
+
import { featureStoreStateSymbol } from './featureStoreLayerState.js';
|
|
14
|
+
import { embedIconsInStyle } from '../style/writeStyle.js';
|
|
15
|
+
import DeclarativeStyleItem from '../style/declarativeStyleItem.js';
|
|
18
16
|
import { vcsMetaVersion } from './layer.js';
|
|
19
|
-
import
|
|
20
|
-
import { styleCollection } from '../globalCollections.js';
|
|
17
|
+
import Extent3D from '../util/featureconverter/extent3D.js';
|
|
21
18
|
import { circleFromCenterRadius, enforceEndingVertex, removeEndingVertexFromGeometry } from '../util/geometryHelpers.js';
|
|
22
19
|
|
|
23
20
|
const featureProjection = 'EPSG:3857';
|
|
@@ -38,13 +35,6 @@ function getFormat() {
|
|
|
38
35
|
return format;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
/**
|
|
42
|
-
* @returns {import("@vcsuite/logger").Logger}
|
|
43
|
-
*/
|
|
44
|
-
function getLogger() {
|
|
45
|
-
return getLoggerByName('vcs.vcm.layer.GeoJSONHelper');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
38
|
/**
|
|
49
39
|
* @typedef {Object} GeoJSONData
|
|
50
40
|
* @property {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} features
|
|
@@ -84,7 +74,6 @@ function getLogger() {
|
|
|
84
74
|
/**
|
|
85
75
|
* @param {Object} geojson
|
|
86
76
|
* @returns {string|null}
|
|
87
|
-
* @export
|
|
88
77
|
*/
|
|
89
78
|
export function getEPSGCodeFromGeojson(geojson) {
|
|
90
79
|
const { crs } = geojson;
|
|
@@ -92,7 +81,7 @@ export function getEPSGCodeFromGeojson(geojson) {
|
|
|
92
81
|
if (crs.type === 'name') {
|
|
93
82
|
return crs.properties.name;
|
|
94
83
|
} else if (crs.type === 'EPSG') {
|
|
95
|
-
// 'EPSG' is not part of the
|
|
84
|
+
// 'EPSG' is not part of the GeojsonLayer specification, but is generated by
|
|
96
85
|
// GeoServer.
|
|
97
86
|
// TODO: remove this when http://jira.codehaus.org/browse/GEOS-5996
|
|
98
87
|
// is fixed and widely deployed.
|
|
@@ -105,7 +94,6 @@ export function getEPSGCodeFromGeojson(geojson) {
|
|
|
105
94
|
/**
|
|
106
95
|
* updates legacy features to the new olcesium namespaceing olcs_
|
|
107
96
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
108
|
-
* @export
|
|
109
97
|
*/
|
|
110
98
|
export function updateLegacyFeature(feature) {
|
|
111
99
|
// these changes can be done silently, because the features haven't been added to any layer
|
|
@@ -117,8 +105,8 @@ export function updateLegacyFeature(feature) {
|
|
|
117
105
|
if (feature.get('drawingType')) {
|
|
118
106
|
feature.set('olcs_extrudedHeight', feature.get('extrudedHeight'), true);
|
|
119
107
|
} else {
|
|
120
|
-
const extent =
|
|
121
|
-
const minHeight = Number.isFinite(extent
|
|
108
|
+
const extent = Extent3D.fromGeometry(feature.getGeometry());
|
|
109
|
+
const minHeight = Number.isFinite(extent.minZ) ? extent.minZ : 0;
|
|
122
110
|
feature.set('olcs_extrudedHeight', feature.get('extrudedHeight') - minHeight, true);
|
|
123
111
|
}
|
|
124
112
|
feature.unset('extrudedHeight', true);
|
|
@@ -141,7 +129,7 @@ export function updateLegacyFeature(feature) {
|
|
|
141
129
|
function readGeometry(geometryObj, options) {
|
|
142
130
|
const geometry = getFormat().readGeometry(geometryObj, options.formatOptions);
|
|
143
131
|
if (String(options.formatOptions.featureProjection) === 'EPSG:3857') {
|
|
144
|
-
geometry[
|
|
132
|
+
geometry[VectorLayer.alreadyTransformedToMercator] = true;
|
|
145
133
|
}
|
|
146
134
|
removeEndingVertexFromGeometry(geometry);
|
|
147
135
|
return new Feature({ geometry });
|
|
@@ -246,7 +234,7 @@ function readFeature(featureObj, options) {
|
|
|
246
234
|
geometry = circleFromCenterRadius(coordinates, radius);
|
|
247
235
|
}
|
|
248
236
|
if (String(options.formatOptions.featureProjection) === 'EPSG:3857') {
|
|
249
|
-
geometry[
|
|
237
|
+
geometry[VectorLayer.alreadyTransformedToMercator] = true;
|
|
250
238
|
}
|
|
251
239
|
|
|
252
240
|
featureObj.vcsMeta = featureObj.vcsMeta || {};
|
|
@@ -288,12 +276,11 @@ function readFeature(featureObj, options) {
|
|
|
288
276
|
}
|
|
289
277
|
|
|
290
278
|
/**
|
|
291
|
-
* parses a string to
|
|
279
|
+
* parses a string to GeojsonLayer
|
|
292
280
|
* @param {string|Object} input
|
|
293
281
|
* @param {GeoJSONreadOptions=} readOptions
|
|
294
282
|
* @returns {GeoJSONData}
|
|
295
283
|
* @throws SyntaxError
|
|
296
|
-
* @export
|
|
297
284
|
* @api
|
|
298
285
|
*/
|
|
299
286
|
export function parseGeoJSON(input, readOptions = {}) {
|
|
@@ -331,14 +318,7 @@ export function parseGeoJSON(input, readOptions = {}) {
|
|
|
331
318
|
options.embeddedIcons = geoJSON.vcsMeta.embeddedIcons;
|
|
332
319
|
}
|
|
333
320
|
if (geoJSON.vcsMeta.style && readOptions.dynamicStyle) {
|
|
334
|
-
if (geoJSON.vcsMeta.style.type ===
|
|
335
|
-
style = styleCollection.getByKey(geoJSON.vcsMeta.style.name);
|
|
336
|
-
if (!style) {
|
|
337
|
-
getLogger().warning(`could not load referenced style ${geoJSON.vcsMeta.style.name}`);
|
|
338
|
-
} else if (style instanceof VectorStyleItem) {
|
|
339
|
-
options.defaultStyle = style;
|
|
340
|
-
}
|
|
341
|
-
} else if (geoJSON.vcsMeta.style.type === StyleType.DECLARATIVE) {
|
|
321
|
+
if (geoJSON.vcsMeta.style.type === DeclarativeStyleItem.className) {
|
|
342
322
|
style = new DeclarativeStyleItem(geoJSON.vcsMeta.style);
|
|
343
323
|
} else {
|
|
344
324
|
geoJSON.vcsMeta.style = setEmbeddedIcons(geoJSON.vcsMeta.style, options);
|
|
@@ -425,11 +405,10 @@ export function writeGeoJSONFeature(feature, options = {}, embeddedIcons) {
|
|
|
425
405
|
}
|
|
426
406
|
|
|
427
407
|
/**
|
|
428
|
-
* Writes all the features of the current layer to
|
|
408
|
+
* Writes all the features of the current layer to GeojsonLayer
|
|
429
409
|
* @param {GeoJSONData} data
|
|
430
410
|
* @param {GeoJSONwriteOptions=} options
|
|
431
411
|
* @returns {string|Object}
|
|
432
|
-
* @export
|
|
433
412
|
*/
|
|
434
413
|
export function writeGeoJSON(data, options = {}) { // how to handel embedded icons when they are not set on the vcsMeta but options is true?
|
|
435
414
|
const vcsMeta = data.vcsMeta || {};
|
|
@@ -441,10 +420,5 @@ export function writeGeoJSON(data, options = {}) { // how to handel embedded ico
|
|
|
441
420
|
vcsMeta,
|
|
442
421
|
};
|
|
443
422
|
|
|
444
|
-
if (options.writeStyle && data.style) { // legacy fallback for plugin use
|
|
445
|
-
getLogger().deprecate('data.style', 'use layer.getVcsMeta and pass that in instead');
|
|
446
|
-
writeStyle(data.style, obj.vcsMeta);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
423
|
return options.asObject ? obj : JSON.stringify(obj, null, options.prettyPrint ? 2 : null);
|
|
450
424
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Vector from './vector.js';
|
|
1
|
+
import VectorLayer from './vectorLayer.js';
|
|
3
2
|
import { parseGeoJSON, writeGeoJSONFeature } from './geojsonHelpers.js';
|
|
4
3
|
import Projection, { wgs84Projection } from '../util/projection.js';
|
|
5
|
-
import {
|
|
4
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
5
|
+
import { requestJson } from '../util/fetch.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {VectorOptions} GeoJSONOptions
|
|
9
|
-
* @property {Array<Object>|undefined} features - an array of
|
|
9
|
+
* @property {Array<Object>|undefined} features - an array of GeojsonLayer features to parse
|
|
10
10
|
* @api
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -18,22 +18,21 @@ export const featureFromOptions = Symbol('featureFromOptions');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* GeojsonLayer layer for Cesium, OpenlayersMap and ObliqueMap
|
|
22
22
|
* @class
|
|
23
|
-
* @
|
|
24
|
-
* @extends {Vector}
|
|
23
|
+
* @extends {VectorLayer}
|
|
25
24
|
* @api stable
|
|
26
25
|
*/
|
|
27
|
-
class
|
|
28
|
-
static get className() { return '
|
|
26
|
+
class GeoJSONLayer extends VectorLayer {
|
|
27
|
+
static get className() { return 'GeoJSONLayer'; }
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* @returns {GeoJSONOptions}
|
|
32
31
|
*/
|
|
33
32
|
static getDefaultOptions() {
|
|
34
33
|
return {
|
|
35
|
-
...
|
|
36
|
-
projection: wgs84Projection.
|
|
34
|
+
...VectorLayer.getDefaultOptions(),
|
|
35
|
+
projection: wgs84Projection.toJSON(),
|
|
37
36
|
features: undefined,
|
|
38
37
|
};
|
|
39
38
|
}
|
|
@@ -42,7 +41,7 @@ class GeoJSON extends Vector {
|
|
|
42
41
|
* @param {GeoJSONOptions} options
|
|
43
42
|
*/
|
|
44
43
|
constructor(options) {
|
|
45
|
-
const defaultOptions =
|
|
44
|
+
const defaultOptions = GeoJSONLayer.getDefaultOptions();
|
|
46
45
|
options.projection = options.projection || defaultOptions.projection;
|
|
47
46
|
|
|
48
47
|
super(options);
|
|
@@ -111,10 +110,8 @@ class GeoJSON extends Vector {
|
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
if (this.url) {
|
|
114
|
-
this._dataFetchedPromise =
|
|
115
|
-
.then(
|
|
116
|
-
this._parseGeojsonData(response.data);
|
|
117
|
-
})
|
|
113
|
+
this._dataFetchedPromise = requestJson(this.url)
|
|
114
|
+
.then(data => this._parseGeojsonData(data))
|
|
118
115
|
.catch((err) => {
|
|
119
116
|
this.getLogger().warning(`Could not send request for loading layer content (${err.message})`);
|
|
120
117
|
return Promise.reject(err);
|
|
@@ -149,13 +146,13 @@ class GeoJSON extends Vector {
|
|
|
149
146
|
* @inheritDoc
|
|
150
147
|
* @returns {GeoJSONOptions}
|
|
151
148
|
*/
|
|
152
|
-
|
|
153
|
-
const config = /** @type {GeoJSONOptions} */ (super.
|
|
154
|
-
const defaultOptions =
|
|
149
|
+
toJSON() {
|
|
150
|
+
const config = /** @type {GeoJSONOptions} */ (super.toJSON());
|
|
151
|
+
const defaultOptions = GeoJSONLayer.getDefaultOptions();
|
|
155
152
|
|
|
156
153
|
const defaultProjection = new Projection(defaultOptions.projection);
|
|
157
154
|
if (!this.projection.equals(defaultProjection)) {
|
|
158
|
-
config.projection = this.projection.
|
|
155
|
+
config.projection = this.projection.toJSON();
|
|
159
156
|
} else {
|
|
160
157
|
delete config.projection;
|
|
161
158
|
}
|
|
@@ -181,5 +178,5 @@ class GeoJSON extends Vector {
|
|
|
181
178
|
}
|
|
182
179
|
}
|
|
183
180
|
|
|
184
|
-
|
|
185
|
-
export default
|
|
181
|
+
layerClassRegistry.registerClass(GeoJSONLayer.className, GeoJSONLayer);
|
|
182
|
+
export default GeoJSONLayer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { check } from '@vcsuite/check';
|
|
2
|
-
import { getLogger } from '@vcsuite/logger';
|
|
3
2
|
import {
|
|
4
3
|
globalHidden,
|
|
5
4
|
hideFeature,
|
|
@@ -7,7 +6,7 @@ import {
|
|
|
7
6
|
showFeature,
|
|
8
7
|
FeatureVisibilityAction,
|
|
9
8
|
} from './featureVisibility.js';
|
|
10
|
-
import VcsEvent from '../
|
|
9
|
+
import VcsEvent from '../vcsEvent.js';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @type {GlobalHider}
|
|
@@ -135,7 +134,6 @@ class GlobalHider {
|
|
|
135
134
|
|
|
136
135
|
/**
|
|
137
136
|
* @returns {GlobalHider}
|
|
138
|
-
* @export
|
|
139
137
|
* @api
|
|
140
138
|
*/
|
|
141
139
|
export function getGlobalHider() {
|
|
@@ -145,13 +143,4 @@ export function getGlobalHider() {
|
|
|
145
143
|
return instance;
|
|
146
144
|
}
|
|
147
145
|
|
|
148
|
-
/**
|
|
149
|
-
* @returns {GlobalHider}
|
|
150
|
-
* @deprecated v4.1
|
|
151
|
-
*/
|
|
152
|
-
export function getInstance() {
|
|
153
|
-
getLogger('vcs.vcm.layer.GlobalHider').deprecate('getInstance', 'use getGlobalHider instead');
|
|
154
|
-
return getGlobalHider();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
146
|
export default GlobalHider;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { check } from '@vcsuite/check';
|
|
2
2
|
import { parseBoolean, parseInteger } from '@vcsuite/parsers';
|
|
3
|
-
import VcsObject from '../
|
|
3
|
+
import VcsObject from '../vcsObject.js';
|
|
4
4
|
import Extent from '../util/extent.js';
|
|
5
5
|
import { getGlobalHider } from './globalHider.js';
|
|
6
6
|
import { vcsLayerName } from './layerSymbols.js';
|
|
7
7
|
import LayerState from './layerState.js';
|
|
8
|
-
import VcsEvent from '../
|
|
8
|
+
import VcsEvent from '../vcsEvent.js';
|
|
9
9
|
import { getCurrentLocale, getLocaleChangedEvent } from '../util/locale.js';
|
|
10
|
-
import {
|
|
10
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {Object} GenericFeature
|
|
@@ -22,8 +22,8 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @typedef {import("@vcmap/core").Layer} SplitLayer
|
|
25
|
-
* @property {import("@vcmap/cesium").
|
|
26
|
-
* @property {VcsEvent<import("@vcmap/cesium").
|
|
25
|
+
* @property {import("@vcmap/cesium").SplitDirection} splitDirection
|
|
26
|
+
* @property {VcsEvent<import("@vcmap/cesium").SplitDirection>} splitDirectionChanged
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -38,7 +38,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
38
38
|
/**
|
|
39
39
|
* @typedef {VectorPropertiesOptions} VcsMeta
|
|
40
40
|
* @property {string|undefined} version - the version of the vcsMeta schema
|
|
41
|
-
* @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|
|
|
41
|
+
* @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|undefined} style
|
|
42
42
|
* @property {Array<string>|undefined} embeddedIcons
|
|
43
43
|
* @property {number|undefined} screenSpaceError
|
|
44
44
|
* @property {*|undefined} flightOptions
|
|
@@ -100,13 +100,12 @@ export const vcsMetaVersion = '2.0';
|
|
|
100
100
|
* To receive implementation options, implement `geImplementationOptions`
|
|
101
101
|
* @abstract
|
|
102
102
|
* @class
|
|
103
|
-
* @export
|
|
104
103
|
* @extends {VcsObject}
|
|
105
104
|
* @api stable
|
|
106
105
|
*/
|
|
107
106
|
class Layer extends VcsObject {
|
|
108
107
|
/** @type {string} */
|
|
109
|
-
static get className() { return '
|
|
108
|
+
static get className() { return 'Layer'; }
|
|
110
109
|
|
|
111
110
|
/**
|
|
112
111
|
* Symbol to declare a layers name on its visualizations, e.g. ol.layer.Layer, Cesium.Cesium3DTileset
|
|
@@ -680,9 +679,9 @@ class Layer extends VcsObject {
|
|
|
680
679
|
/**
|
|
681
680
|
* @returns {LayerOptions}
|
|
682
681
|
*/
|
|
683
|
-
|
|
682
|
+
toJSON() {
|
|
684
683
|
/** @type {LayerOptions} */
|
|
685
|
-
const config = super.
|
|
684
|
+
const config = super.toJSON();
|
|
686
685
|
const defaultOptions = Layer.getDefaultOptions();
|
|
687
686
|
|
|
688
687
|
if (this.activeOnStartup !== defaultOptions.activeOnStartup) {
|
|
@@ -706,7 +705,7 @@ class Layer extends VcsObject {
|
|
|
706
705
|
}
|
|
707
706
|
|
|
708
707
|
if (this.extent && this.extent.isValid()) {
|
|
709
|
-
config.extent = this.extent.
|
|
708
|
+
config.extent = this.extent.toJSON();
|
|
710
709
|
}
|
|
711
710
|
|
|
712
711
|
if (this._exclusiveGroups.length > 0) {
|
|
@@ -748,5 +747,5 @@ class Layer extends VcsObject {
|
|
|
748
747
|
}
|
|
749
748
|
}
|
|
750
749
|
|
|
751
|
-
|
|
750
|
+
layerClassRegistry.registerClass(Layer.className, Layer);
|
|
752
751
|
export default Layer;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import VcsObject from '../
|
|
1
|
+
import VcsObject from '../vcsObject.js';
|
|
2
2
|
import LayerState from './layerState.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* represents an implementation for a Layer for a specific Map
|
|
6
6
|
* @class
|
|
7
|
-
* @export
|
|
8
7
|
* @extends {VcsObject}
|
|
9
8
|
* @abstract
|
|
10
9
|
* @api
|
|
11
10
|
* @template {import("@vcmap/core").VcsMap} T
|
|
12
11
|
*/
|
|
13
12
|
class LayerImplementation extends VcsObject {
|
|
14
|
-
static get className() { return '
|
|
13
|
+
static get className() { return 'LayerImplementation'; }
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* @param {T} map
|
|
File without changes
|