@vcmap/core 5.0.0-rc.10 → 5.0.0-rc.13
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/index.d.ts +201 -125
- package/index.js +2 -3
- package/package.json +6 -2
- package/src/category/category.js +21 -5
- package/src/classRegistry.js +0 -6
- package/src/context.js +0 -1
- package/src/featureProvider/abstractFeatureProvider.js +0 -1
- package/src/featureProvider/wmsFeatureProvider.js +0 -1
- package/src/interaction/abstractInteraction.js +0 -1
- package/src/interaction/interactionChain.js +0 -1
- package/src/interaction/interactionType.js +1 -5
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +2 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +0 -1
- package/src/layer/cesium/openStreetMapCesiumImpl.js +0 -1
- package/src/layer/cesium/rasterLayerCesiumImpl.js +0 -1
- package/src/layer/cesium/singleImageCesiumImpl.js +0 -1
- package/src/layer/cesium/terrainCesiumImpl.js +0 -1
- package/src/layer/cesium/tmsCesiumImpl.js +0 -1
- package/src/layer/cesium/vectorCesiumImpl.js +3 -4
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +0 -1
- package/src/layer/cesium/vectorTileImageryProvider.js +0 -1
- package/src/layer/cesium/wmsCesiumImpl.js +0 -1
- package/src/layer/cesium/wmtsCesiumImpl.js +0 -1
- package/src/layer/cesiumTilesetLayer.js +0 -1
- package/src/layer/czmlLayer.js +0 -1
- package/src/layer/dataSourceLayer.js +25 -16
- package/src/layer/featureLayer.js +10 -1
- package/src/layer/featureStoreLayer.js +1 -1
- package/src/layer/featureStoreLayerState.js +0 -1
- package/src/layer/featureVisibility.js +3 -1
- package/src/layer/geojsonHelpers.js +0 -4
- package/src/layer/geojsonLayer.js +0 -1
- package/src/layer/globalHider.js +7 -21
- package/src/layer/layer.js +84 -38
- package/src/layer/layerImplementation.js +0 -1
- package/src/layer/layerState.js +0 -1
- package/src/layer/oblique/vectorObliqueImpl.js +1 -3
- package/src/layer/openStreetMapLayer.js +0 -1
- package/src/layer/openlayers/layerOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/vectorOpenlayersImpl.js +2 -3
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/wmsOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +0 -1
- package/src/layer/pointCloudLayer.js +0 -1
- package/src/layer/rasterLayer.js +0 -2
- package/src/layer/singleImageLayer.js +0 -1
- package/src/layer/terrainLayer.js +0 -1
- package/src/layer/tileProvider/mvtTileProvider.js +21 -2
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +0 -1
- package/src/layer/tileProvider/tileProvider.js +27 -1
- package/src/layer/tileProvider/urlTemplateTileProvider.js +26 -6
- package/src/layer/tmsLayer.js +0 -1
- package/src/layer/vectorLayer.js +0 -1
- package/src/layer/vectorProperties.js +0 -1
- package/src/layer/vectorTileLayer.js +45 -13
- package/src/layer/wfsLayer.js +0 -1
- package/src/layer/wmsLayer.js +0 -1
- package/src/layer/wmtsLayer.js +0 -1
- package/src/map/baseOLMap.js +0 -1
- package/src/map/cameraLimiter.js +0 -1
- package/src/map/cesiumMap.js +0 -1
- package/src/map/mapState.js +0 -1
- package/src/map/obliqueMap.js +0 -1
- package/src/map/openlayersMap.js +0 -1
- package/src/map/vcsMap.js +6 -2
- package/src/oblique/helpers.js +0 -3
- package/src/oblique/obliqueCollection.js +0 -1
- package/src/oblique/obliqueDataSet.js +0 -2
- package/src/oblique/obliqueImage.js +0 -1
- package/src/oblique/obliqueImageMeta.js +0 -1
- package/src/oblique/obliqueProvider.js +0 -1
- package/src/oblique/obliqueView.js +0 -1
- package/src/oblique/obliqueViewDirection.js +0 -3
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/style/declarativeStyleItem.js +0 -1
- package/src/style/shapesCategory.js +0 -2
- package/src/style/styleHelpers.js +0 -11
- package/src/style/styleItem.js +0 -1
- package/src/style/vectorStyleItem.js +0 -4
- package/src/util/clipping/clippingObject.js +0 -2
- package/src/util/clipping/clippingObjectManager.js +0 -1
- package/src/util/clipping/clippingPlaneHelper.js +0 -4
- package/src/util/collection.js +15 -3
- package/src/util/extent.js +0 -1
- package/src/util/indexedCollection.js +0 -1
- package/src/util/layerCollection.js +71 -6
- package/src/util/locale.js +1 -42
- package/src/util/mapCollection.js +29 -14
- package/src/util/overrideCollection.js +8 -9
- package/src/util/projection.js +0 -5
- package/src/util/viewpoint.js +0 -4
- package/src/vcsApp.js +53 -0
- package/src/vcsEvent.js +0 -1
- 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/util/dateTime.js +0 -60
package/index.js
CHANGED
|
@@ -48,7 +48,7 @@ export { featureStoreStateSymbol, FeatureStoreLayerState } from './src/layer/fea
|
|
|
48
48
|
export { originalStyle, highlighted, hidden, globalHidden, featureExists, FeatureVisibilityAction, synchronizeFeatureVisibility, default as FeatureVisibility } from './src/layer/featureVisibility.js';
|
|
49
49
|
export { getEPSGCodeFromGeojson, updateLegacyFeature, parseGeoJSON, writeGeoJSONFeature, writeGeoJSON } from './src/layer/geojsonHelpers.js';
|
|
50
50
|
export { featureFromOptions, default as GeoJSONLayer } from './src/layer/geojsonLayer.js';
|
|
51
|
-
export {
|
|
51
|
+
export { default as GlobalHider } from './src/layer/globalHider.js';
|
|
52
52
|
export { vcsMetaVersion, default as Layer } from './src/layer/layer.js';
|
|
53
53
|
export { default as LayerImplementation } from './src/layer/layerImplementation.js';
|
|
54
54
|
export { default as LayerState } from './src/layer/layerState.js';
|
|
@@ -116,7 +116,6 @@ export { default as ClippingObject } from './src/util/clipping/clippingObject.js
|
|
|
116
116
|
export { default as ClippingObjectManager } from './src/util/clipping/clippingObjectManager.js';
|
|
117
117
|
export { createClippingPlaneCollection, copyClippingPlanesToCollection, clearClippingPlanes, setClippingPlanes, createClippingFeature, getClippingOptions } from './src/util/clipping/clippingPlaneHelper.js';
|
|
118
118
|
export { default as Collection } from './src/util/collection.js';
|
|
119
|
-
export { getShortLocaleDate, getShortLocaleTime, getISODateString, getDayOfYear, isLeapYear } from './src/util/dateTime.js';
|
|
120
119
|
export { default as ExclusiveManager } from './src/util/exclusiveManager.js';
|
|
121
120
|
export { default as Extent } from './src/util/extent.js';
|
|
122
121
|
export { validateCircle, default as circleToCesium } from './src/util/featureconverter/circleToCesium.js';
|
|
@@ -131,7 +130,7 @@ export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, c
|
|
|
131
130
|
export { default as IndexedCollection } from './src/util/indexedCollection.js';
|
|
132
131
|
export { isMobile } from './src/util/isMobile.js';
|
|
133
132
|
export { default as LayerCollection } from './src/util/layerCollection.js';
|
|
134
|
-
export {
|
|
133
|
+
export { detectBrowserLocale } from './src/util/locale.js';
|
|
135
134
|
export { default as MapCollection } from './src/util/mapCollection.js';
|
|
136
135
|
export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance } from './src/util/math.js';
|
|
137
136
|
export { isOverrideCollection, default as makeOverrideCollection } from './src/util/overrideCollection.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"postinstall": "node build/postinstall.js",
|
|
14
14
|
"coverage": "c8 --reporter text-summary npm run test",
|
|
15
15
|
"coverage:gitlab": "c8 --reporter text-summary npm run test -- --reporter mocha-junit-reporter",
|
|
16
|
+
"build-docs": "jsdoc -c build/docs/conf.json",
|
|
16
17
|
"build-index": "jsdoc -c build/index/conf.json",
|
|
17
18
|
"build-typedefs": "jsdoc -c build/info/conf.json",
|
|
18
19
|
"build-tsd": "node build/buildDTs.js",
|
|
@@ -25,6 +26,8 @@
|
|
|
25
26
|
"files": [
|
|
26
27
|
"build/postinstall.js",
|
|
27
28
|
"src/",
|
|
29
|
+
"tests/data/",
|
|
30
|
+
"tests/unit/helpers/",
|
|
28
31
|
"LICENSE.md",
|
|
29
32
|
"README.md",
|
|
30
33
|
"index.js",
|
|
@@ -49,10 +52,11 @@
|
|
|
49
52
|
"node-fetch": "^3.2.0",
|
|
50
53
|
"sinon": "^9.2.4",
|
|
51
54
|
"sinon-chai": "^3.6.0",
|
|
55
|
+
"tui-jsdoc-template": "^1.2.2",
|
|
52
56
|
"typescript": "^4.6.2"
|
|
53
57
|
},
|
|
54
58
|
"peerDependencies": {
|
|
55
|
-
"@vcmap/cesium": "
|
|
59
|
+
"@vcmap/cesium": "~1.93.1",
|
|
56
60
|
"ol": "~6.13.0"
|
|
57
61
|
},
|
|
58
62
|
"eslintConfig": {
|
package/src/category/category.js
CHANGED
|
@@ -11,11 +11,12 @@ import Collection from '../util/collection.js';
|
|
|
11
11
|
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
12
12
|
import { categoryClassRegistry, getObjectFromClassRegistry } from '../classRegistry.js';
|
|
13
13
|
import OverrideClassRegistry from '../overrideClassRegistry.js';
|
|
14
|
+
import VcsEvent from '../vcsEvent.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @typedef {VcsObjectOptions} CategoryOptions
|
|
17
18
|
* @property {string|Object<string, string>} [title]
|
|
18
|
-
* @property {string} [classRegistryName
|
|
19
|
+
* @property {string|symbol} [classRegistryName] - the class registry name on the current app to provide classes for this category. if provided, parseItems will deserialize using this class registry. See: {@link getObjectFromClassRegistry}.
|
|
19
20
|
* @property {string|undefined} [featureProperty]
|
|
20
21
|
* @property {VectorOptions} [layerOptions={}]
|
|
21
22
|
* @property {Array<Object>} [items] - items are not evaluated by the constructor but passed to parseItem during deserialization.
|
|
@@ -56,7 +57,7 @@ function assignLayerOptions(layer, options) {
|
|
|
56
57
|
* @param {T} value
|
|
57
58
|
* @param {T} defaultOption
|
|
58
59
|
* @param {T=} option
|
|
59
|
-
* @template {number|boolean|string} T
|
|
60
|
+
* @template {number|boolean|string|symbol} T
|
|
60
61
|
* @returns {void}
|
|
61
62
|
*/
|
|
62
63
|
function checkMergeOptionOverride(key, value, defaultOption, option) {
|
|
@@ -113,7 +114,7 @@ class Category extends VcsObject {
|
|
|
113
114
|
*/
|
|
114
115
|
this._featureProperty = options.featureProperty || defaultOptions.featureProperty;
|
|
115
116
|
/**
|
|
116
|
-
* @type {string}
|
|
117
|
+
* @type {string|symbol}
|
|
117
118
|
* @private
|
|
118
119
|
*/
|
|
119
120
|
this._classRegistryName = options.classRegistryName;
|
|
@@ -136,6 +137,12 @@ class Category extends VcsObject {
|
|
|
136
137
|
* @private
|
|
137
138
|
*/
|
|
138
139
|
this._keyProperty = options.keyProperty || defaultOptions.keyProperty;
|
|
140
|
+
/**
|
|
141
|
+
* Event raised if the collection is reset
|
|
142
|
+
* @type {VcsEvent<void>}
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
this._collectionChanged = new VcsEvent();
|
|
139
146
|
/**
|
|
140
147
|
* @type {Array<function():void>}
|
|
141
148
|
* @private
|
|
@@ -155,7 +162,7 @@ class Category extends VcsObject {
|
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
/**
|
|
158
|
-
* @type {string}
|
|
165
|
+
* @type {string|symbol}
|
|
159
166
|
* @readonly
|
|
160
167
|
*/
|
|
161
168
|
get classRegistryName() { return this._classRegistryName; }
|
|
@@ -169,6 +176,13 @@ class Category extends VcsObject {
|
|
|
169
176
|
return this._collection;
|
|
170
177
|
}
|
|
171
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Event raised if the collection is reset
|
|
181
|
+
* @type {VcsEvent<void>}
|
|
182
|
+
* @readonly
|
|
183
|
+
*/
|
|
184
|
+
get collectionChanged() { return this._collectionChanged; }
|
|
185
|
+
|
|
172
186
|
/**
|
|
173
187
|
* Returns the layer of this collection. Caution, do not use the layer API to add or remove items.
|
|
174
188
|
* When adding items to the collection, the features are added to the layer async (timeout of 0), since there is weird behavior
|
|
@@ -268,7 +282,7 @@ class Category extends VcsObject {
|
|
|
268
282
|
}
|
|
269
283
|
|
|
270
284
|
/**
|
|
271
|
-
* When setting the category, it MUST use the same
|
|
285
|
+
* When setting the category, it MUST use the same uniqueKey as the previous collection (default is "name").
|
|
272
286
|
* All items in the current collection _will be destroyed_ and the current collection will be destroyed. The category will take
|
|
273
287
|
* complete ownership of the collection and destroy it once the category is destroyed. The collection will
|
|
274
288
|
* be turned into an {@see OverrideCollection}.
|
|
@@ -314,6 +328,7 @@ class Category extends VcsObject {
|
|
|
314
328
|
// @ts-ignore
|
|
315
329
|
this._collectionListeners.push(this._collection.moved.addEventListener(this._itemMoved.bind(this)));
|
|
316
330
|
}
|
|
331
|
+
this.collectionChanged.raiseEvent();
|
|
317
332
|
}
|
|
318
333
|
|
|
319
334
|
/**
|
|
@@ -393,6 +408,7 @@ class Category extends VcsObject {
|
|
|
393
408
|
this._contextRemovedListener();
|
|
394
409
|
this._contextRemovedListener = () => {};
|
|
395
410
|
destroyCollection(this._collection);
|
|
411
|
+
this._collectionChanged.destroy();
|
|
396
412
|
this._app = null;
|
|
397
413
|
}
|
|
398
414
|
}
|
package/src/classRegistry.js
CHANGED
|
@@ -104,32 +104,26 @@ class ClassRegistry {
|
|
|
104
104
|
export default ClassRegistry;
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* @export
|
|
108
107
|
* @type {ClassRegistry<import("@vcmap/core").Layer>}
|
|
109
108
|
*/
|
|
110
109
|
export const layerClassRegistry = new ClassRegistry();
|
|
111
110
|
/**
|
|
112
|
-
* @export
|
|
113
111
|
* @type {ClassRegistry<import("@vcmap/core").TileProvider>}
|
|
114
112
|
*/
|
|
115
113
|
export const tileProviderClassRegistry = new ClassRegistry();
|
|
116
114
|
/**
|
|
117
|
-
* @export
|
|
118
115
|
* @type {ClassRegistry<import("@vcmap/core").AbstractFeatureProvider>}
|
|
119
116
|
*/
|
|
120
117
|
export const featureProviderClassRegistry = new ClassRegistry();
|
|
121
118
|
/**
|
|
122
|
-
* @export
|
|
123
119
|
* @type {ClassRegistry<import("@vcmap/core").VcsMap>}
|
|
124
120
|
*/
|
|
125
121
|
export const mapClassRegistry = new ClassRegistry();
|
|
126
122
|
/**
|
|
127
|
-
* @export
|
|
128
123
|
* @type {ClassRegistry<import("@vcmap/core").StyleItem>}
|
|
129
124
|
*/
|
|
130
125
|
export const styleClassRegistry = new ClassRegistry();
|
|
131
126
|
/**
|
|
132
|
-
* @export
|
|
133
127
|
* @type {ClassRegistry<import("@vcmap/core").Category<*>>}
|
|
134
128
|
*/
|
|
135
129
|
export const categoryClassRegistry = new ClassRegistry();
|
package/src/context.js
CHANGED
|
@@ -24,7 +24,6 @@ import { isProvidedFeature, showProvidedFeature } from './featureProviderSymbols
|
|
|
24
24
|
* An abstract class providing features for {@link Layer}s which cannot provide features directly, but can provide features for
|
|
25
25
|
* a given location, e.g. WmsLayer with a getFeatureInfo configuration. In this case, a feature provider can be created for this layer.
|
|
26
26
|
* @class
|
|
27
|
-
* @export
|
|
28
27
|
* @abstract
|
|
29
28
|
* @api
|
|
30
29
|
*/
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
let nextBit = 1;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Provides
|
|
4
|
+
* Provides information to other interaction plugins for creating bitmasks
|
|
5
5
|
* @class
|
|
6
|
-
* @export
|
|
7
6
|
*/
|
|
8
7
|
export class BitCounter {
|
|
9
8
|
/**
|
|
@@ -19,7 +18,6 @@ export class BitCounter {
|
|
|
19
18
|
/**
|
|
20
19
|
* Enumeration of modification key types
|
|
21
20
|
* @enum {number}
|
|
22
|
-
* @export
|
|
23
21
|
* @property {number} NONE
|
|
24
22
|
* @property {number} ALT
|
|
25
23
|
* @property {number} CTRL
|
|
@@ -53,7 +51,6 @@ ModificationKeyType.ALL = ModificationKeyType.NONE |
|
|
|
53
51
|
* @property {number} DRAGEVENTS
|
|
54
52
|
* @property {number} CLICKMOVE
|
|
55
53
|
* @property {number} ALL
|
|
56
|
-
* @export
|
|
57
54
|
* @api
|
|
58
55
|
*/
|
|
59
56
|
export const EventType = {
|
|
@@ -85,7 +82,6 @@ EventType.ALL = Object.values(EventType)
|
|
|
85
82
|
* @property {number} RIGHT
|
|
86
83
|
* @property {number} MIDDLE
|
|
87
84
|
* @property {number} ALL
|
|
88
|
-
* @export
|
|
89
85
|
* @api
|
|
90
86
|
*/
|
|
91
87
|
export const PointerKeyType = {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
import { createEmpty } from 'ol/extent.js';
|
|
12
12
|
import LayerImplementation from '../layerImplementation.js';
|
|
13
13
|
import { vcsLayerName } from '../layerSymbols.js';
|
|
14
|
-
import { getGlobalHider } from '../globalHider.js';
|
|
15
14
|
import { originalStyle, updateOriginalStyle } from '../featureVisibility.js';
|
|
16
15
|
import Projection from '../../util/projection.js';
|
|
17
16
|
import { circleFromCenterRadius } from '../../util/geometryHelpers.js';
|
|
@@ -59,7 +58,6 @@ export function getExtentFromTileset(cesium3DTileset) {
|
|
|
59
58
|
/**
|
|
60
59
|
* represents the cesium implementation for a {@link CesiumTileset} layer.
|
|
61
60
|
* @class
|
|
62
|
-
* @export
|
|
63
61
|
* @extends {LayerImplementation<import("@vcmap/core").CesiumMap>}}
|
|
64
62
|
* @implements {FeatureLayerImplementation}
|
|
65
63
|
* @api stable
|
|
@@ -85,6 +83,8 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
85
83
|
this.style = options.style;
|
|
86
84
|
/** @type {import("@vcmap/core").FeatureVisibility} */
|
|
87
85
|
this.featureVisibility = options.featureVisibility;
|
|
86
|
+
/** @type {import("@vcmap/core").GlobalHider} */
|
|
87
|
+
this.globalHider = options.globalHider;
|
|
88
88
|
/** @type {Array<CesiumTilesetTilesetProperties>} */
|
|
89
89
|
this.tilesetProperties = options.tilesetProperties;
|
|
90
90
|
/** @type {import("@vcmap/cesium").Matrix4} */
|
|
@@ -106,7 +106,6 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
106
106
|
* @private
|
|
107
107
|
*/
|
|
108
108
|
this._styleLastUpdated = Date.now();
|
|
109
|
-
this.globalHider = getGlobalHider();
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
/**
|
|
@@ -6,7 +6,6 @@ import { getTerrainProviderForUrl } from '../terrainHelpers.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* TerrainLayer implementation for {@link CesiumMap}
|
|
8
8
|
* @class
|
|
9
|
-
* @export
|
|
10
9
|
* @extends {LayerImplementation<import("@vcmap/core").CesiumMap>}}
|
|
11
10
|
*/
|
|
12
11
|
class TerrainCesiumImpl extends LayerImplementation {
|
|
@@ -5,13 +5,11 @@ import convert from '../../util/featureconverter/convert.js';
|
|
|
5
5
|
import VectorContext from './vectorContext.js';
|
|
6
6
|
import { vcsLayerName } from '../layerSymbols.js';
|
|
7
7
|
import LayerImplementation from '../layerImplementation.js';
|
|
8
|
-
import { getGlobalHider } from '../globalHider.js';
|
|
9
8
|
import { synchronizeFeatureVisibilityWithSource } from '../vectorHelpers.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* represents a specific vector layer for cesium.
|
|
13
12
|
* @class
|
|
14
|
-
* @export
|
|
15
13
|
* @extends {LayerImplementation<import("@vcmap/core").CesiumMap>}}
|
|
16
14
|
* @implements {FeatureLayerImplementation}
|
|
17
15
|
*/
|
|
@@ -72,7 +70,8 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
72
70
|
* @private
|
|
73
71
|
*/
|
|
74
72
|
this._scene = null;
|
|
75
|
-
|
|
73
|
+
/** @type {import("@vcmap/core").GlobalHider} */
|
|
74
|
+
this.globalHider = options.globalHider;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
/**
|
|
@@ -116,9 +115,9 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
116
115
|
async initialize() {
|
|
117
116
|
if (!this.initialized) {
|
|
118
117
|
this._scene = this.map.getScene();
|
|
119
|
-
await this._setupContext(this.map);
|
|
120
118
|
this._addListeners();
|
|
121
119
|
this._addFeatures(this.source.getFeatures());
|
|
120
|
+
await this._setupContext(this.map);
|
|
122
121
|
}
|
|
123
122
|
await super.initialize();
|
|
124
123
|
}
|
package/src/layer/czmlLayer.js
CHANGED
|
@@ -4,7 +4,6 @@ import CesiumMap from '../map/cesiumMap.js';
|
|
|
4
4
|
import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
|
|
5
5
|
import { vcsLayerName } from './layerSymbols.js';
|
|
6
6
|
import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
|
|
7
|
-
import { getGlobalHider } from './globalHider.js';
|
|
8
7
|
import { layerClassRegistry } from '../classRegistry.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -30,7 +29,6 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
30
29
|
/**
|
|
31
30
|
* Represents a layer of Cesium.Entity
|
|
32
31
|
* @class
|
|
33
|
-
* @export
|
|
34
32
|
* @extends {Layer}
|
|
35
33
|
* @api stable
|
|
36
34
|
*/
|
|
@@ -86,12 +84,21 @@ class DataSourceLayer extends Layer {
|
|
|
86
84
|
];
|
|
87
85
|
}
|
|
88
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
89
|
+
*/
|
|
90
|
+
setGlobalHider(globalHider) {
|
|
91
|
+
super.setGlobalHider(globalHider);
|
|
92
|
+
this._setUpFeatureVisibility();
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
/**
|
|
90
96
|
* Sets up listeners for featureVisibility and global hider
|
|
91
97
|
* @private
|
|
92
98
|
*/
|
|
93
99
|
_setUpFeatureVisibility() {
|
|
94
|
-
|
|
100
|
+
this._featureVisibilityListeners.forEach((cb) => { cb(); });
|
|
101
|
+
|
|
95
102
|
this._featureVisibilityListeners = [
|
|
96
103
|
this.featureVisibility.changed.addEventListener(({ action, ids }) => {
|
|
97
104
|
if (action === FeatureVisibilityAction.HIDE) {
|
|
@@ -103,28 +110,30 @@ class DataSourceLayer extends Layer {
|
|
|
103
110
|
});
|
|
104
111
|
} // highlight is _possible_ but very tricky with all the possible entity values with potential materials
|
|
105
112
|
}),
|
|
106
|
-
globalHider.changed.addEventListener(({ action, ids }) => {
|
|
107
|
-
if (action === FeatureVisibilityAction.HIDE) {
|
|
108
|
-
ids.forEach((id) => {
|
|
109
|
-
const entity = this.entities.getById(id);
|
|
110
|
-
if (entity) {
|
|
111
|
-
globalHider.addFeature(id, entity);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
113
|
this.entities.collectionChanged.addEventListener((c, added) => {
|
|
117
114
|
added.forEach((entity) => {
|
|
118
115
|
if (this.featureVisibility.hiddenObjects[entity.id]) {
|
|
119
116
|
this.featureVisibility.addHiddenFeature(entity.id, entity);
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
globalHider.addFeature(entity.id, entity);
|
|
118
|
+
if (this.globalHider && this.globalHider.hiddenObjects[entity.id]) {
|
|
119
|
+
this.globalHider.addFeature(entity.id, entity);
|
|
124
120
|
}
|
|
125
121
|
});
|
|
126
122
|
}),
|
|
127
123
|
];
|
|
124
|
+
|
|
125
|
+
if (this.globalHider) {
|
|
126
|
+
this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({ action, ids }) => {
|
|
127
|
+
if (action === FeatureVisibilityAction.HIDE) {
|
|
128
|
+
ids.forEach((id) => {
|
|
129
|
+
const entity = this.entities.getById(id);
|
|
130
|
+
if (entity) {
|
|
131
|
+
this.globalHider.addFeature(id, entity);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
/**
|
|
@@ -21,6 +21,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @typedef {LayerImplementationOptions} FeatureLayerImplementationOptions
|
|
24
|
+
* @property {GlobalHider} globalHider
|
|
24
25
|
* @property {FeatureVisibility} featureVisibility
|
|
25
26
|
* @property {import("@vcmap/core").StyleItem} style
|
|
26
27
|
* @api
|
|
@@ -44,7 +45,6 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
44
45
|
* @class
|
|
45
46
|
* @abstract
|
|
46
47
|
* @extends {Layer}
|
|
47
|
-
* @export
|
|
48
48
|
* @api
|
|
49
49
|
*/
|
|
50
50
|
class FeatureLayer extends Layer {
|
|
@@ -141,11 +141,20 @@ class FeatureLayer extends Layer {
|
|
|
141
141
|
getImplementationOptions() {
|
|
142
142
|
return {
|
|
143
143
|
...super.getImplementationOptions(),
|
|
144
|
+
globalHider: this.globalHider,
|
|
144
145
|
featureVisibility: this.featureVisibility,
|
|
145
146
|
style: this.style,
|
|
146
147
|
};
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
152
|
+
*/
|
|
153
|
+
setGlobalHider(globalHider) {
|
|
154
|
+
super.setGlobalHider(globalHider);
|
|
155
|
+
this.forceRedraw();
|
|
156
|
+
}
|
|
157
|
+
|
|
149
158
|
/**
|
|
150
159
|
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/cesium").Cesium3DTilePointFeature|import("@vcmap/cesium").Cesium3DTileFeature|DataSourcePickedObject} object
|
|
151
160
|
* @returns {?Object}
|
|
@@ -76,7 +76,6 @@ export const isTiledFeature = Symbol('isTiledFeature');
|
|
|
76
76
|
/**
|
|
77
77
|
* FeatureStoreLayer Layer
|
|
78
78
|
* @class
|
|
79
|
-
* @export
|
|
80
79
|
* @extends {VectorLayer}
|
|
81
80
|
* @api
|
|
82
81
|
*/
|
|
@@ -310,6 +309,7 @@ class FeatureStoreLayer extends VectorLayer {
|
|
|
310
309
|
name: this.name,
|
|
311
310
|
style: this.style,
|
|
312
311
|
featureVisibility: this._staticFeatureVisibility,
|
|
312
|
+
globalHider: this.globalHider,
|
|
313
313
|
splitDirection: SplitDirection.NONE,
|
|
314
314
|
jumpToLocation: false,
|
|
315
315
|
})));
|
|
@@ -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
|
|
@@ -232,6 +231,9 @@ export function synchronizeFeatureVisibility(source, destination) {
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
/**
|
|
234
|
+
* FeatureVisibility handles the visibility and highlighting of features of a specific {@link FeatureLayer} or {@link DataSourceLayer}
|
|
235
|
+
* and its {@link FeatureLayerImplementation} resp. {@link DataSourceCesiumImpl}.
|
|
236
|
+
* The visibility is being synchronized with the {@link GlobalHider}.
|
|
235
237
|
* @class
|
|
236
238
|
*/
|
|
237
239
|
class FeatureVisibility {
|
|
@@ -74,7 +74,6 @@ function getFormat() {
|
|
|
74
74
|
/**
|
|
75
75
|
* @param {Object} geojson
|
|
76
76
|
* @returns {string|null}
|
|
77
|
-
* @export
|
|
78
77
|
*/
|
|
79
78
|
export function getEPSGCodeFromGeojson(geojson) {
|
|
80
79
|
const { crs } = geojson;
|
|
@@ -95,7 +94,6 @@ export function getEPSGCodeFromGeojson(geojson) {
|
|
|
95
94
|
/**
|
|
96
95
|
* updates legacy features to the new olcesium namespaceing olcs_
|
|
97
96
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
98
|
-
* @export
|
|
99
97
|
*/
|
|
100
98
|
export function updateLegacyFeature(feature) {
|
|
101
99
|
// these changes can be done silently, because the features haven't been added to any layer
|
|
@@ -283,7 +281,6 @@ function readFeature(featureObj, options) {
|
|
|
283
281
|
* @param {GeoJSONreadOptions=} readOptions
|
|
284
282
|
* @returns {GeoJSONData}
|
|
285
283
|
* @throws SyntaxError
|
|
286
|
-
* @export
|
|
287
284
|
* @api
|
|
288
285
|
*/
|
|
289
286
|
export function parseGeoJSON(input, readOptions = {}) {
|
|
@@ -412,7 +409,6 @@ export function writeGeoJSONFeature(feature, options = {}, embeddedIcons) {
|
|
|
412
409
|
* @param {GeoJSONData} data
|
|
413
410
|
* @param {GeoJSONwriteOptions=} options
|
|
414
411
|
* @returns {string|Object}
|
|
415
|
-
* @export
|
|
416
412
|
*/
|
|
417
413
|
export function writeGeoJSON(data, options = {}) { // how to handel embedded icons when they are not set on the vcsMeta but options is true?
|
|
418
414
|
const vcsMeta = data.vcsMeta || {};
|