@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29
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/README.md +9 -3
- package/build/postinstall.js +13 -2
- package/index.d.ts +155 -106
- package/package.json +9 -4
- package/src/category/category.js +71 -32
- package/src/category/categoryCollection.js +27 -18
- package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
- package/src/cesium/entity.js +3 -1
- package/src/cesium/wallpaperMaterial.js +4 -2
- package/src/classRegistry.js +11 -4
- package/src/featureProvider/abstractFeatureProvider.js +43 -22
- package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
- package/src/featureProvider/wmsFeatureProvider.js +37 -15
- package/src/interaction/abstractInteraction.js +5 -1
- package/src/interaction/coordinateAtPixel.js +34 -12
- package/src/interaction/eventHandler.js +63 -23
- package/src/interaction/featureAtPixelInteraction.js +96 -32
- package/src/interaction/featureProviderInteraction.js +23 -8
- package/src/interaction/interactionChain.js +19 -9
- package/src/interaction/interactionType.js +23 -26
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
- package/src/layer/cesium/clusterContext.js +10 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
- package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
- package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
- package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
- package/src/layer/cesium/terrainCesiumImpl.js +3 -2
- package/src/layer/cesium/tmsCesiumImpl.js +15 -3
- package/src/layer/cesium/vectorCesiumImpl.js +69 -25
- package/src/layer/cesium/vectorContext.js +25 -5
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
- package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
- package/src/layer/cesium/wmsCesiumImpl.js +15 -3
- package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
- package/src/layer/cesium/x3dmHelper.js +4 -1
- package/src/layer/cesiumTilesetLayer.js +55 -26
- package/src/layer/czmlLayer.js +11 -5
- package/src/layer/dataSourceLayer.js +25 -17
- package/src/layer/featureLayer.js +33 -18
- package/src/layer/featureStoreLayer.js +161 -99
- package/src/layer/featureStoreLayerChanges.js +57 -17
- package/src/layer/featureVisibility.js +89 -59
- package/src/layer/geojsonHelpers.js +70 -29
- package/src/layer/geojsonLayer.js +17 -11
- package/src/layer/globalHider.js +14 -4
- package/src/layer/layer.js +77 -44
- package/src/layer/layerImplementation.js +12 -4
- package/src/layer/oblique/layerObliqueImpl.js +3 -1
- package/src/layer/oblique/obliqueHelpers.js +75 -30
- package/src/layer/oblique/vectorObliqueImpl.js +175 -69
- package/src/layer/openStreetMapLayer.js +34 -20
- package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
- package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
- package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
- package/src/layer/pointCloudLayer.js +21 -10
- package/src/layer/rasterLayer.js +73 -22
- package/src/layer/singleImageLayer.js +10 -7
- package/src/layer/terrainHelpers.js +30 -19
- package/src/layer/terrainLayer.js +16 -7
- package/src/layer/tileLoadedHelper.js +9 -4
- package/src/layer/tileProvider/mvtTileProvider.js +10 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
- package/src/layer/tileProvider/tileProvider.js +163 -87
- package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
- package/src/layer/tmsLayer.js +7 -6
- package/src/layer/vectorHelpers.js +34 -25
- package/src/layer/vectorLayer.js +77 -36
- package/src/layer/vectorProperties.js +245 -74
- package/src/layer/vectorSymbols.js +3 -1
- package/src/layer/vectorTileLayer.js +121 -70
- package/src/layer/wfsLayer.js +19 -8
- package/src/layer/wmsHelpers.js +11 -6
- package/src/layer/wmsLayer.js +36 -14
- package/src/layer/wmtsLayer.js +35 -20
- package/src/map/baseOLMap.js +57 -31
- package/src/map/cameraLimiter.js +67 -18
- package/src/map/cesiumMap.js +307 -95
- package/src/map/obliqueMap.js +84 -34
- package/src/map/openlayersMap.js +40 -19
- package/src/map/vcsMap.js +21 -8
- package/src/oblique/helpers.js +212 -64
- package/src/oblique/obliqueCollection.js +111 -48
- package/src/oblique/obliqueDataSet.js +53 -21
- package/src/oblique/obliqueImage.js +50 -17
- package/src/oblique/obliqueImageMeta.js +7 -6
- package/src/oblique/obliqueProvider.js +75 -27
- package/src/oblique/obliqueView.js +18 -7
- package/src/oblique/obliqueViewDirection.js +3 -2
- package/src/oblique/parseImageJson.js +57 -23
- package/src/ol/feature.js +8 -3
- package/src/ol/geom/circle.js +12 -3
- package/src/ol/geom/geometryCollection.js +11 -4
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
- package/src/overrideClassRegistry.js +13 -3
- package/src/style/arcStyle.js +129 -36
- package/src/style/arrowStyle.js +57 -22
- package/src/style/declarativeStyleItem.js +107 -62
- package/src/style/shapesCategory.js +8 -6
- package/src/style/styleFactory.js +4 -1
- package/src/style/styleHelpers.js +17 -8
- package/src/style/styleItem.js +28 -10
- package/src/style/vectorStyleItem.js +160 -74
- package/src/style/writeStyle.js +5 -7
- package/src/util/clipping/clippingObject.js +72 -38
- package/src/util/clipping/clippingObjectManager.js +53 -19
- package/src/util/clipping/clippingPlaneHelper.js +120 -53
- package/src/util/collection.js +12 -6
- package/src/util/editor/createFeatureSession.js +21 -6
- package/src/util/editor/editFeaturesSession.js +41 -15
- package/src/util/editor/editGeometrySession.js +55 -30
- package/src/util/editor/editorHelpers.js +114 -29
- package/src/util/editor/editorSessionHelpers.js +8 -3
- package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
- package/src/util/editor/interactions/createCircleInteraction.js +7 -2
- package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
- package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
- package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
- package/src/util/editor/interactions/mapInteractionController.js +31 -14
- package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
- package/src/util/editor/selectFeaturesSession.js +37 -21
- package/src/util/editor/transformation/create2DHandlers.js +82 -37
- package/src/util/editor/transformation/create3DHandlers.js +187 -84
- package/src/util/editor/transformation/extrudeInteraction.js +20 -5
- package/src/util/editor/transformation/rotateInteraction.js +29 -16
- package/src/util/editor/transformation/scaleInteraction.js +31 -15
- package/src/util/editor/transformation/transformationHandler.js +23 -8
- package/src/util/editor/transformation/transformationTypes.js +8 -4
- package/src/util/editor/transformation/translateInteraction.js +86 -32
- package/src/util/editor/validateGeoemetry.js +3 -1
- package/src/util/exclusiveManager.js +6 -3
- package/src/util/extent.js +20 -10
- package/src/util/featureconverter/arcToCesium.js +46 -12
- package/src/util/featureconverter/circleToCesium.js +61 -27
- package/src/util/featureconverter/convert.js +85 -13
- package/src/util/featureconverter/extent3D.js +69 -28
- package/src/util/featureconverter/featureconverterHelper.js +232 -79
- package/src/util/featureconverter/lineStringToCesium.js +107 -35
- package/src/util/featureconverter/pointHelpers.js +117 -45
- package/src/util/featureconverter/pointToCesium.js +128 -31
- package/src/util/featureconverter/polygonToCesium.js +50 -16
- package/src/util/fetch.js +3 -1
- package/src/util/geometryHelpers.js +15 -10
- package/src/util/indexedCollection.js +7 -3
- package/src/util/isMobile.js +8 -2
- package/src/util/layerCollection.js +28 -12
- package/src/util/mapCollection.js +37 -18
- package/src/util/math.js +35 -19
- package/src/util/overrideCollection.js +57 -32
- package/src/util/projection.js +21 -5
- package/src/util/urlHelpers.js +5 -3
- package/src/util/viewpoint.js +66 -33
- package/src/vcsApp.js +133 -69
- package/src/vcsModule.js +3 -2
- package/src/vcsModuleHelpers.js +24 -9
- package/src/vcsObject.js +3 -2
- package/tests/data/dynamicPointCzml.json +24 -35
- package/tests/data/oblique/imageData/imagev34.json +56 -272
- package/tests/data/oblique/imageData/imagev35.json +272 -19
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
- package/tests/data/oblique/tiledImageData/image.json +70 -1
- package/tests/data/terrain/layer.json +121 -130
- package/tests/data/testGeoJSON.json +4 -16
- package/tests/unit/helpers/cesiumHelpers.js +58 -33
- package/tests/unit/helpers/helpers.js +10 -2
- package/tests/unit/helpers/imageHelpers.js +8 -4
- package/tests/unit/helpers/obliqueData.js +39 -13
- package/tests/unit/helpers/obliqueHelpers.js +12 -9
- package/tests/unit/helpers/openlayersHelpers.js +4 -1
- package/tests/unit/helpers/terrain/terrainData.js +8 -7
|
@@ -35,14 +35,16 @@ class CategoryCollection extends IndexedCollection {
|
|
|
35
35
|
* @type {Function}
|
|
36
36
|
* @private
|
|
37
37
|
*/
|
|
38
|
-
this._moduleRemovedListener = this._app.moduleRemoved.addEventListener(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
this._moduleRemovedListener = this._app.moduleRemoved.addEventListener(
|
|
39
|
+
(module) => {
|
|
40
|
+
this._cache.forEach((moduleMap, name) => {
|
|
41
|
+
moduleMap.delete(module._id);
|
|
42
|
+
if (moduleMap.size === 0) {
|
|
43
|
+
this._cache.delete(name);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
/**
|
|
@@ -50,7 +52,8 @@ class CategoryCollection extends IndexedCollection {
|
|
|
50
52
|
* @param {Category<Object|import("@vcmap/core").VcsObject>} category
|
|
51
53
|
* @returns {number|null}
|
|
52
54
|
*/
|
|
53
|
-
add(category) {
|
|
55
|
+
add(category) {
|
|
56
|
+
// XXX use a symbol to enforce using request over add?
|
|
54
57
|
if (this.hasKey(category.name)) {
|
|
55
58
|
return null;
|
|
56
59
|
}
|
|
@@ -58,11 +61,9 @@ class CategoryCollection extends IndexedCollection {
|
|
|
58
61
|
category.setApp(this._app);
|
|
59
62
|
const added = super.add(category);
|
|
60
63
|
if (added != null && this._cache.has(category.name)) {
|
|
61
|
-
this._cache
|
|
62
|
-
.
|
|
63
|
-
|
|
64
|
-
this.parseCategoryItems(category.name, items, moduleId);
|
|
65
|
-
});
|
|
64
|
+
this._cache.get(category.name).forEach((items, moduleId) => {
|
|
65
|
+
this.parseCategoryItems(category.name, items, moduleId);
|
|
66
|
+
});
|
|
66
67
|
|
|
67
68
|
this._cache.delete(category.name);
|
|
68
69
|
}
|
|
@@ -73,7 +74,8 @@ class CategoryCollection extends IndexedCollection {
|
|
|
73
74
|
* Categories should be static. Removing them can lead to undefined behavior.
|
|
74
75
|
* @param {Category<Object|import("@vcmap/core").VcsObject>} category
|
|
75
76
|
*/
|
|
76
|
-
remove(category) {
|
|
77
|
+
remove(category) {
|
|
78
|
+
// XXX add logger warning?
|
|
77
79
|
super.remove(category);
|
|
78
80
|
this._cache.delete(category.name);
|
|
79
81
|
}
|
|
@@ -110,7 +112,9 @@ class CategoryCollection extends IndexedCollection {
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
if (!options.type) {
|
|
113
|
-
getLogger().warning(
|
|
115
|
+
getLogger().warning(
|
|
116
|
+
`Implicitly typing category ${options.name} as ${Category.className}`,
|
|
117
|
+
);
|
|
114
118
|
options.type = Category.className;
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -119,7 +123,10 @@ class CategoryCollection extends IndexedCollection {
|
|
|
119
123
|
category = this.getByKey(options.name);
|
|
120
124
|
category.mergeOptions(options);
|
|
121
125
|
} else {
|
|
122
|
-
category = await getObjectFromClassRegistry(
|
|
126
|
+
category = await getObjectFromClassRegistry(
|
|
127
|
+
this._app.categoryClassRegistry,
|
|
128
|
+
options,
|
|
129
|
+
);
|
|
123
130
|
if (category) {
|
|
124
131
|
if (this.add(category) == null) {
|
|
125
132
|
return null;
|
|
@@ -128,7 +135,9 @@ class CategoryCollection extends IndexedCollection {
|
|
|
128
135
|
}
|
|
129
136
|
|
|
130
137
|
if (!category) {
|
|
131
|
-
throw new Error(
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Category ${options.name} with type ${options.type} could not be created`,
|
|
140
|
+
);
|
|
132
141
|
}
|
|
133
142
|
return category;
|
|
134
143
|
}
|
|
@@ -43,7 +43,8 @@ class VcsCameraPrimitive {
|
|
|
43
43
|
this.show = typeof options.show === 'undefined' ? true : options.show;
|
|
44
44
|
this._camera = options.camera;
|
|
45
45
|
this._color = options.color || Color.YELLOW;
|
|
46
|
-
this.allowPicking =
|
|
46
|
+
this.allowPicking =
|
|
47
|
+
typeof options.allowPicking === 'undefined' ? true : options.allowPicking;
|
|
47
48
|
this.id = options.id || {};
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -74,7 +75,10 @@ class VcsCameraPrimitive {
|
|
|
74
75
|
Matrix3.setColumn(rotation, 1, up, rotation);
|
|
75
76
|
Matrix3.setColumn(rotation, 2, direction, rotation);
|
|
76
77
|
|
|
77
|
-
const orientation = Quaternion.fromRotationMatrix(
|
|
78
|
+
const orientation = Quaternion.fromRotationMatrix(
|
|
79
|
+
rotation,
|
|
80
|
+
scratchOrientation,
|
|
81
|
+
);
|
|
78
82
|
|
|
79
83
|
planesPrimitives.length = 1;
|
|
80
84
|
outlinePrimitives.length = 1;
|
|
@@ -92,7 +96,9 @@ class VcsCameraPrimitive {
|
|
|
92
96
|
_drawNearPlane: true,
|
|
93
97
|
}),
|
|
94
98
|
attributes: {
|
|
95
|
-
color: ColorGeometryInstanceAttribute.fromColor(
|
|
99
|
+
color: ColorGeometryInstanceAttribute.fromColor(
|
|
100
|
+
Color.fromAlpha(this._color, 0.1, scratchColor),
|
|
101
|
+
),
|
|
96
102
|
},
|
|
97
103
|
id: this.id,
|
|
98
104
|
pickPrimitive: this,
|
|
@@ -136,8 +142,10 @@ class VcsCameraPrimitive {
|
|
|
136
142
|
destroy() {
|
|
137
143
|
const { length } = this._planesPrimitives;
|
|
138
144
|
for (let i = 0; i < length; ++i) {
|
|
139
|
-
this._outlinePrimitives[i] =
|
|
140
|
-
|
|
145
|
+
this._outlinePrimitives[i] =
|
|
146
|
+
this._outlinePrimitives[i] && this._outlinePrimitives[i].destroy();
|
|
147
|
+
this._planesPrimitives[i] =
|
|
148
|
+
this._planesPrimitives[i] && this._planesPrimitives[i].destroy();
|
|
141
149
|
}
|
|
142
150
|
return destroyObject(this);
|
|
143
151
|
}
|
package/src/cesium/entity.js
CHANGED
|
@@ -22,6 +22,8 @@ Entity.prototype.getProperty = function getProperty(property) {
|
|
|
22
22
|
* @param {string} property
|
|
23
23
|
* @returns {*}
|
|
24
24
|
*/
|
|
25
|
-
Entity.prototype.getPropertyInherited = function getPropertyInherited(
|
|
25
|
+
Entity.prototype.getPropertyInherited = function getPropertyInherited(
|
|
26
|
+
property,
|
|
27
|
+
) {
|
|
26
28
|
return this.getProperty(property);
|
|
27
29
|
};
|
|
@@ -15,8 +15,10 @@ Material._materialCache.addMaterial('Wallpaper', {
|
|
|
15
15
|
anchor: new Cartesian2(0, 0),
|
|
16
16
|
},
|
|
17
17
|
components: {
|
|
18
|
-
diffuse:
|
|
19
|
-
|
|
18
|
+
diffuse:
|
|
19
|
+
'texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).rgb',
|
|
20
|
+
alpha:
|
|
21
|
+
'texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).a',
|
|
20
22
|
},
|
|
21
23
|
},
|
|
22
24
|
translucent: false,
|
package/src/classRegistry.js
CHANGED
|
@@ -41,7 +41,9 @@ class ClassRegistry {
|
|
|
41
41
|
check(ctor, Function);
|
|
42
42
|
|
|
43
43
|
if (this._classMap.has(className)) {
|
|
44
|
-
throw new Error(
|
|
44
|
+
throw new Error(
|
|
45
|
+
'a constructor with this className has already been registered',
|
|
46
|
+
);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
this._classMap.set(className, ctor);
|
|
@@ -137,14 +139,19 @@ export const categoryClassRegistry = new ClassRegistry();
|
|
|
137
139
|
* @param {...*} args
|
|
138
140
|
* @returns {T|null}
|
|
139
141
|
*/
|
|
140
|
-
export function getObjectFromClassRegistry(classRegistry, options, ...args) {
|
|
142
|
+
export function getObjectFromClassRegistry(classRegistry, options, ...args) {
|
|
143
|
+
// move to classReg
|
|
141
144
|
if (!is(classRegistry, [ClassRegistry, OverrideClassRegistry])) {
|
|
142
|
-
logger().error(
|
|
145
|
+
logger().error(
|
|
146
|
+
`ObjectCreation failed: no class registry provided for ${options}`,
|
|
147
|
+
);
|
|
143
148
|
return null;
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
if (!options?.type) {
|
|
147
|
-
logger().warning(
|
|
152
|
+
logger().warning(
|
|
153
|
+
`ObjectCreation failed: could not find type in options ${options}`,
|
|
154
|
+
);
|
|
148
155
|
return null;
|
|
149
156
|
}
|
|
150
157
|
let object;
|
|
@@ -5,7 +5,10 @@ import VcsObject from '../vcsObject.js';
|
|
|
5
5
|
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
6
6
|
import { defaultVectorStyle } from '../style/vectorStyleItem.js';
|
|
7
7
|
import VectorProperties from '../layer/vectorProperties.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
isProvidedFeature,
|
|
10
|
+
showProvidedFeature,
|
|
11
|
+
} from './featureProviderSymbols.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @namespace featureProvider
|
|
@@ -27,7 +30,9 @@ import { isProvidedFeature, showProvidedFeature } from './featureProviderSymbols
|
|
|
27
30
|
* @api
|
|
28
31
|
*/
|
|
29
32
|
class AbstractFeatureProvider extends VcsObject {
|
|
30
|
-
static get className() {
|
|
33
|
+
static get className() {
|
|
34
|
+
return 'AbstractFeatureProvider';
|
|
35
|
+
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* @returns {AbstractFeatureProviderOptions}
|
|
@@ -60,29 +65,38 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
60
65
|
* @type {import("@vcmap/core").StyleItem|undefined}
|
|
61
66
|
* @api
|
|
62
67
|
*/
|
|
63
|
-
this.style = options.style
|
|
64
|
-
getStyleOrDefaultStyle(options.style, defaultVectorStyle.clone())
|
|
65
|
-
undefined;
|
|
68
|
+
this.style = options.style
|
|
69
|
+
? getStyleOrDefaultStyle(options.style, defaultVectorStyle.clone())
|
|
70
|
+
: undefined;
|
|
66
71
|
/**
|
|
67
72
|
* Whether to show the geometry on selection.
|
|
68
73
|
* @type {boolean}
|
|
69
74
|
* @api
|
|
70
75
|
*/
|
|
71
|
-
this.showGeometry = parseBoolean(
|
|
76
|
+
this.showGeometry = parseBoolean(
|
|
77
|
+
options.showGeometry,
|
|
78
|
+
defaultOptions.showGeometry,
|
|
79
|
+
);
|
|
72
80
|
/**
|
|
73
81
|
* The vector properties assigned to features created by this provider
|
|
74
82
|
* @type {import("@vcmap/core").VectorProperties}
|
|
75
83
|
* @api
|
|
76
84
|
*/
|
|
77
|
-
this.vectorProperties =
|
|
78
|
-
options.vectorProperties
|
|
79
|
-
|
|
85
|
+
this.vectorProperties =
|
|
86
|
+
options.vectorProperties instanceof VectorProperties
|
|
87
|
+
? options.vectorProperties
|
|
88
|
+
: new VectorProperties({
|
|
89
|
+
...defaultOptions.vectorProperties,
|
|
90
|
+
...options.vectorProperties,
|
|
91
|
+
});
|
|
80
92
|
/**
|
|
81
93
|
* Map ClassNames Can be used to only apply this featureProvider to the specified maps
|
|
82
94
|
* @type {Array<string>}
|
|
83
95
|
* @api
|
|
84
96
|
*/
|
|
85
|
-
this.mapTypes = Array.isArray(options.mapTypes)
|
|
97
|
+
this.mapTypes = Array.isArray(options.mapTypes)
|
|
98
|
+
? options.mapTypes
|
|
99
|
+
: defaultOptions.mapTypes;
|
|
86
100
|
}
|
|
87
101
|
|
|
88
102
|
/**
|
|
@@ -92,8 +106,10 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
92
106
|
* @api stable
|
|
93
107
|
*/
|
|
94
108
|
isSupported(map) {
|
|
95
|
-
return
|
|
96
|
-
|
|
109
|
+
return (
|
|
110
|
+
map &&
|
|
111
|
+
(this.mapTypes.length === 0 || this.mapTypes.includes(map.className))
|
|
112
|
+
);
|
|
97
113
|
}
|
|
98
114
|
|
|
99
115
|
/**
|
|
@@ -113,12 +129,14 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
113
129
|
feature[vcsLayerName] = this.layerName;
|
|
114
130
|
feature[isProvidedFeature] = true;
|
|
115
131
|
feature[showProvidedFeature] = this.showGeometry;
|
|
116
|
-
Object.entries(this.vectorProperties.getValues()).forEach(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
feature.
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
Object.entries(this.vectorProperties.getValues()).forEach(
|
|
133
|
+
([key, value]) => {
|
|
134
|
+
const olcsKey = `olcs_${key}`;
|
|
135
|
+
if (feature.get(olcsKey) === undefined && value !== undefined) {
|
|
136
|
+
feature.set(olcsKey, value);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
);
|
|
122
140
|
return feature;
|
|
123
141
|
}
|
|
124
142
|
|
|
@@ -142,8 +160,9 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
142
160
|
* @api
|
|
143
161
|
*/
|
|
144
162
|
toJSON() {
|
|
145
|
-
const config =
|
|
146
|
-
|
|
163
|
+
const config = /** @type {AbstractFeatureProviderOptions} */ (
|
|
164
|
+
super.toJSON()
|
|
165
|
+
);
|
|
147
166
|
|
|
148
167
|
const defaultOptions = AbstractFeatureProvider.getDefaultOptions();
|
|
149
168
|
delete config.name; // the name is irrelevant, since its the layers name
|
|
@@ -156,8 +175,10 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
156
175
|
config.style = this.style.toJSON();
|
|
157
176
|
}
|
|
158
177
|
|
|
159
|
-
const vectorPropertiesConfig = this.vectorProperties
|
|
160
|
-
|
|
178
|
+
const vectorPropertiesConfig = this.vectorProperties.getVcsMeta({
|
|
179
|
+
...VectorProperties.getDefaultOptions(),
|
|
180
|
+
...defaultOptions.vectorProperties,
|
|
181
|
+
});
|
|
161
182
|
if (Object.keys(vectorPropertiesConfig).length > 0) {
|
|
162
183
|
config.vectorProperties = vectorPropertiesConfig;
|
|
163
184
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AbstractFeatureProvider from './abstractFeatureProvider.js';
|
|
2
2
|
import { featureProviderClassRegistry } from '../classRegistry.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* @typedef {AbstractFeatureProviderOptions} TileProviderFeatureProviderOptions
|
|
7
6
|
* @property {import("@vcmap/core").TileProvider} tileProvider
|
|
@@ -13,7 +12,9 @@ import { featureProviderClassRegistry } from '../classRegistry.js';
|
|
|
13
12
|
* @extends {AbstractFeatureProvider}
|
|
14
13
|
*/
|
|
15
14
|
class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
16
|
-
static get className() {
|
|
15
|
+
static get className() {
|
|
16
|
+
return 'TileProviderFeatureProvider';
|
|
17
|
+
}
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* @param {string} layerName
|
|
@@ -37,7 +38,6 @@ class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
|
37
38
|
this.tileProvider = options.tileProvider;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
41
|
/**
|
|
42
42
|
* @inheritDoc
|
|
43
43
|
* @param {import("ol/coordinate").Coordinate} coordinate
|
|
@@ -45,7 +45,10 @@ class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
|
45
45
|
* @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
|
|
46
46
|
*/
|
|
47
47
|
async getFeaturesByCoordinate(coordinate, resolution) {
|
|
48
|
-
const features = await this.tileProvider.getFeaturesByCoordinate(
|
|
48
|
+
const features = await this.tileProvider.getFeaturesByCoordinate(
|
|
49
|
+
coordinate,
|
|
50
|
+
resolution,
|
|
51
|
+
);
|
|
49
52
|
return features.filter((feature) => {
|
|
50
53
|
return this.vectorProperties.getAllowPicking(feature);
|
|
51
54
|
});
|
|
@@ -61,4 +64,7 @@ class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
export default TileProviderFeatureProvider;
|
|
64
|
-
featureProviderClassRegistry.registerClass(
|
|
67
|
+
featureProviderClassRegistry.registerClass(
|
|
68
|
+
TileProviderFeatureProvider.className,
|
|
69
|
+
TileProviderFeatureProvider,
|
|
70
|
+
);
|
|
@@ -52,7 +52,9 @@ const geojsonFormats = [
|
|
|
52
52
|
*/
|
|
53
53
|
export function getFormat(responseType, options = {}) {
|
|
54
54
|
if (responseType === 'text/xml') {
|
|
55
|
-
options.gmlFormat = options.gmlFormat
|
|
55
|
+
options.gmlFormat = options.gmlFormat
|
|
56
|
+
? new gmlFormats[options.gmlFormat]()
|
|
57
|
+
: new GML2();
|
|
56
58
|
return new WFS(options);
|
|
57
59
|
}
|
|
58
60
|
if (geojsonFormats.includes(responseType)) {
|
|
@@ -61,7 +63,10 @@ export function getFormat(responseType, options = {}) {
|
|
|
61
63
|
if (responseType === 'application/vnd.ogc.gml') {
|
|
62
64
|
return new GML2(options);
|
|
63
65
|
}
|
|
64
|
-
if (
|
|
66
|
+
if (
|
|
67
|
+
responseType === 'application/vnd.ogc.gml/3.1.1' ||
|
|
68
|
+
responseType === 'text/xml; subtype=gml/3.1.1'
|
|
69
|
+
) {
|
|
65
70
|
return new GML3(options);
|
|
66
71
|
}
|
|
67
72
|
return null;
|
|
@@ -72,7 +77,9 @@ export function getFormat(responseType, options = {}) {
|
|
|
72
77
|
* @extends {AbstractFeatureProvider}
|
|
73
78
|
*/
|
|
74
79
|
class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
75
|
-
static get className() {
|
|
80
|
+
static get className() {
|
|
81
|
+
return 'WMSFeatureProvider';
|
|
82
|
+
}
|
|
76
83
|
|
|
77
84
|
/**
|
|
78
85
|
* @returns {WMSFeatureProviderOptions}
|
|
@@ -135,7 +142,8 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
135
142
|
* @type {string}
|
|
136
143
|
* @api
|
|
137
144
|
*/
|
|
138
|
-
this.featureInfoResponseType =
|
|
145
|
+
this.featureInfoResponseType =
|
|
146
|
+
options.responseType || defaultOptions.responseType;
|
|
139
147
|
/**
|
|
140
148
|
* @type {Object}
|
|
141
149
|
* @private
|
|
@@ -146,13 +154,18 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
146
154
|
* @type {import("ol/format/Feature").default}
|
|
147
155
|
* @api
|
|
148
156
|
*/
|
|
149
|
-
this.featureFormat = getFormat(
|
|
157
|
+
this.featureFormat = getFormat(
|
|
158
|
+
this.featureInfoResponseType,
|
|
159
|
+
options.formatOptions,
|
|
160
|
+
);
|
|
150
161
|
/**
|
|
151
162
|
* The feature response projection, if not present in the response format.
|
|
152
163
|
* @type {Projection}
|
|
153
164
|
* @api
|
|
154
165
|
*/
|
|
155
|
-
this.projection = options.projection
|
|
166
|
+
this.projection = options.projection
|
|
167
|
+
? new Projection(options.projection)
|
|
168
|
+
: undefined;
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
/**
|
|
@@ -165,13 +178,18 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
165
178
|
let features;
|
|
166
179
|
|
|
167
180
|
try {
|
|
168
|
-
features =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
features =
|
|
182
|
+
/** @type {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} */
|
|
183
|
+
(
|
|
184
|
+
this.featureFormat.readFeatures(data, {
|
|
185
|
+
dataProjection: this.projection ? this.projection.proj : undefined,
|
|
186
|
+
featureProjection: mercatorProjection.proj,
|
|
187
|
+
})
|
|
188
|
+
);
|
|
173
189
|
} catch (ex) {
|
|
174
|
-
this.getLogger().warning(
|
|
190
|
+
this.getLogger().warning(
|
|
191
|
+
'Features could not be read, please verify the featureInfoResponseType with the capabilities from the server',
|
|
192
|
+
);
|
|
175
193
|
return [];
|
|
176
194
|
}
|
|
177
195
|
|
|
@@ -219,8 +237,9 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
219
237
|
this.getLogger().error(`Failed fetching WMS FeatureInfo ${url}`);
|
|
220
238
|
return [];
|
|
221
239
|
}
|
|
222
|
-
return this.featureResponseCallback(data, coordinate)
|
|
223
|
-
|
|
240
|
+
return this.featureResponseCallback(data, coordinate).map((f) =>
|
|
241
|
+
this.getProviderFeature(f),
|
|
242
|
+
);
|
|
224
243
|
}
|
|
225
244
|
return [];
|
|
226
245
|
}
|
|
@@ -285,4 +304,7 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
285
304
|
}
|
|
286
305
|
|
|
287
306
|
export default WMSFeatureProvider;
|
|
288
|
-
featureProviderClassRegistry.registerClass(
|
|
307
|
+
featureProviderClassRegistry.registerClass(
|
|
308
|
+
WMSFeatureProvider.className,
|
|
309
|
+
WMSFeatureProvider,
|
|
310
|
+
);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
EventType,
|
|
4
|
+
ModificationKeyType,
|
|
5
|
+
PointerKeyType,
|
|
6
|
+
} from './interactionType.js';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* @typedef {Object} ObliqueParameters
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Cartographic,
|
|
3
|
+
Cartesian3,
|
|
4
|
+
Math as CesiumMath,
|
|
5
|
+
} from '@vcmap-cesium/engine';
|
|
2
6
|
import AbstractInteraction from './abstractInteraction.js';
|
|
3
7
|
import Projection, { mercatorProjection } from '../util/projection.js';
|
|
4
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
EventType,
|
|
10
|
+
ModificationKeyType,
|
|
11
|
+
PointerKeyType,
|
|
12
|
+
} from './interactionType.js';
|
|
5
13
|
import { transformFromImage } from '../oblique/helpers.js';
|
|
6
14
|
|
|
7
15
|
/**
|
|
@@ -46,20 +54,32 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
46
54
|
* @private
|
|
47
55
|
*/
|
|
48
56
|
_cesiumHandler(event) {
|
|
49
|
-
const cesiumMap = /** @type {import("@vcmap/core").CesiumMap} */ (
|
|
57
|
+
const cesiumMap = /** @type {import("@vcmap/core").CesiumMap} */ (
|
|
58
|
+
event.map
|
|
59
|
+
);
|
|
50
60
|
const scene = cesiumMap.getScene();
|
|
51
61
|
event.ray = scene.camera.getPickRay(event.windowPosition);
|
|
52
|
-
const pickResult = scene.globe.pick(
|
|
62
|
+
const pickResult = scene.globe.pick(
|
|
63
|
+
event.ray,
|
|
64
|
+
scene,
|
|
65
|
+
this._scratchCartesian,
|
|
66
|
+
);
|
|
53
67
|
if (!pickResult) {
|
|
54
68
|
event.position = [0, 0, 0];
|
|
55
69
|
} else {
|
|
56
|
-
this._scratchCartographic = Cartographic
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
this._scratchCartographic = Cartographic.fromCartesian(
|
|
71
|
+
pickResult,
|
|
72
|
+
scene.globe.ellipsoid,
|
|
73
|
+
this._scratchCartographic,
|
|
74
|
+
);
|
|
75
|
+
event.position = Projection.wgs84ToMercator(
|
|
76
|
+
[
|
|
77
|
+
CesiumMath.toDegrees(this._scratchCartographic.longitude),
|
|
78
|
+
CesiumMath.toDegrees(this._scratchCartographic.latitude),
|
|
79
|
+
this._scratchCartographic.height,
|
|
80
|
+
],
|
|
81
|
+
true,
|
|
82
|
+
);
|
|
63
83
|
}
|
|
64
84
|
event.positionOrPixel = event.position;
|
|
65
85
|
return Promise.resolve(event);
|
|
@@ -71,7 +91,9 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
71
91
|
* @private
|
|
72
92
|
*/
|
|
73
93
|
static obliqueHandler(event) {
|
|
74
|
-
const obliqueMap = /** @type {import("@vcmap/core").ObliqueMap} */ (
|
|
94
|
+
const obliqueMap = /** @type {import("@vcmap/core").ObliqueMap} */ (
|
|
95
|
+
event.map
|
|
96
|
+
);
|
|
75
97
|
const image = obliqueMap.currentImage;
|
|
76
98
|
if (image) {
|
|
77
99
|
// don't use TerrainLayer for coordinate Transformation if the event is a move or drag event,
|