@vcmap/core 5.0.0-rc.24 → 5.0.0-rc.26
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/build/postinstall.js +2 -2
- package/index.d.ts +433 -313
- package/index.js +1 -2
- package/package.json +2 -2
- package/src/cesium/cesium3DTileFeature.js +1 -1
- package/src/cesium/cesium3DTilePointFeature.js +1 -1
- package/src/cesium/cesiumVcsCameraPrimitive.js +3 -3
- package/src/cesium/entity.js +1 -1
- package/src/cesium/wallpaperMaterial.js +1 -1
- package/src/interaction/abstractInteraction.js +2 -2
- package/src/interaction/coordinateAtPixel.js +3 -3
- package/src/interaction/eventHandler.js +3 -3
- package/src/interaction/featureAtPixelInteraction.js +1 -1
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +16 -31
- package/src/layer/cesium/clusterContext.js +12 -6
- package/src/layer/cesium/dataSourceCesiumImpl.js +6 -6
- package/src/layer/cesium/openStreetMapCesiumImpl.js +2 -2
- package/src/layer/cesium/rasterLayerCesiumImpl.js +4 -4
- package/src/layer/cesium/singleImageCesiumImpl.js +2 -2
- package/src/layer/cesium/tmsCesiumImpl.js +2 -2
- package/src/layer/cesium/vectorCesiumImpl.js +20 -5
- package/src/layer/cesium/vectorContext.js +101 -33
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +2 -3
- package/src/layer/cesium/vectorTileImageryProvider.js +7 -7
- package/src/layer/cesium/wmsCesiumImpl.js +1 -1
- package/src/layer/cesium/wmtsCesiumImpl.js +2 -2
- package/src/layer/cesium/x3dmHelper.js +1 -1
- package/src/layer/cesiumTilesetLayer.js +6 -54
- package/src/layer/czmlLayer.js +2 -2
- package/src/layer/dataSourceLayer.js +7 -7
- package/src/layer/featureLayer.js +49 -1
- package/src/layer/featureStoreLayer.js +3 -3
- package/src/layer/featureVisibility.js +18 -18
- package/src/layer/globalHider.js +3 -3
- package/src/layer/layer.js +8 -2
- package/src/layer/layerSymbols.js +2 -1
- package/src/layer/oblique/obliqueHelpers.js +1 -1
- package/src/layer/oblique/vectorObliqueImpl.js +6 -0
- package/src/layer/openStreetMapLayer.js +11 -5
- package/src/layer/openlayers/layerOpenlayersImpl.js +69 -4
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +0 -80
- package/src/layer/rasterLayer.js +9 -9
- package/src/layer/terrainHelpers.js +6 -6
- package/src/layer/tileLoadedHelper.js +1 -1
- package/src/layer/tileProvider/tileProvider.js +4 -4
- package/src/layer/tileProvider/urlTemplateTileProvider.js +2 -2
- package/src/layer/vectorLayer.js +7 -6
- package/src/layer/vectorProperties.js +33 -33
- package/src/map/baseOLMap.js +18 -1
- package/src/map/cameraLimiter.js +9 -9
- package/src/map/cesiumMap.js +71 -138
- package/src/map/openlayersMap.js +1 -1
- package/src/map/vcsMap.js +29 -11
- package/src/oblique/helpers.js +3 -3
- package/src/oblique/obliqueDataSet.js +2 -2
- package/src/oblique/obliqueImage.js +8 -8
- package/src/oblique/obliqueImageMeta.js +2 -2
- package/src/oblique/parseImageJson.js +2 -2
- package/src/style/arcStyle.js +1 -1
- package/src/style/arrowStyle.js +1 -1
- package/src/style/declarativeStyleItem.js +13 -9
- package/src/style/styleHelpers.js +4 -4
- package/src/style/styleItem.js +5 -5
- package/src/style/vectorStyleItem.js +4 -4
- package/src/util/clipping/clippingObject.js +8 -8
- package/src/util/clipping/clippingObjectManager.js +1 -1
- package/src/util/clipping/clippingPlaneHelper.js +28 -28
- package/src/util/editor/editorHelpers.js +9 -9
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +2 -2
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +2 -2
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +2 -2
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +2 -2
- package/src/util/editor/transformation/create2DHandlers.js +1 -1
- package/src/util/editor/transformation/create3DHandlers.js +21 -21
- package/src/util/editor/transformation/extrudeInteraction.js +1 -1
- package/src/util/editor/transformation/rotateInteraction.js +8 -8
- package/src/util/editor/transformation/scaleInteraction.js +6 -6
- package/src/util/editor/transformation/transformationHandler.js +1 -1
- package/src/util/editor/transformation/transformationTypes.js +2 -2
- package/src/util/editor/transformation/translateInteraction.js +6 -6
- package/src/util/featureconverter/arcToCesium.js +3 -3
- package/src/util/featureconverter/circleToCesium.js +8 -8
- package/src/util/featureconverter/convert.js +2 -2
- package/src/util/featureconverter/featureconverterHelper.js +18 -18
- package/src/util/featureconverter/lineStringToCesium.js +8 -8
- package/src/util/featureconverter/pointHelpers.js +20 -20
- package/src/util/featureconverter/pointToCesium.js +7 -7
- package/src/util/featureconverter/polygonToCesium.js +5 -5
- package/src/util/mapCollection.js +31 -25
- package/src/util/math.js +5 -5
- package/src/util/viewpoint.js +2 -2
- package/tests/unit/helpers/cesiumHelpers.js +1 -1
- package/tests/unit/helpers/helpers.js +1 -1
- package/tests/unit/helpers/terrain/terrainData.js +1 -1
- package/src/util/splitScreen.js +0 -233
|
@@ -2,6 +2,7 @@ import Style from 'ol/style/Style.js';
|
|
|
2
2
|
|
|
3
3
|
import { check } from '@vcsuite/check';
|
|
4
4
|
import { parseInteger } from '@vcsuite/parsers';
|
|
5
|
+
import { SplitDirection } from '@vcmap-cesium/engine';
|
|
5
6
|
import Layer from './layer.js';
|
|
6
7
|
import StyleItem from '../style/styleItem.js';
|
|
7
8
|
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
@@ -14,6 +15,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
14
15
|
* @typedef {LayerOptions} FeatureLayerOptions
|
|
15
16
|
* @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
|
|
16
17
|
* @property {number} [balloonHeightOffset=10]
|
|
18
|
+
* @property {string|undefined} splitDirection - either 'left' or 'right', if omitted none is applied (for 3D Vector currently only Models are split-able)
|
|
17
19
|
* @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
|
|
18
20
|
* @api
|
|
19
21
|
*/
|
|
@@ -21,6 +23,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
21
23
|
/**
|
|
22
24
|
* @typedef {LayerImplementationOptions} FeatureLayerImplementationOptions
|
|
23
25
|
* @property {GlobalHider} globalHider
|
|
26
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
24
27
|
* @property {FeatureVisibility} featureVisibility
|
|
25
28
|
* @property {import("@vcmap/core").StyleItem} style
|
|
26
29
|
* @api
|
|
@@ -37,6 +40,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
37
40
|
/**
|
|
38
41
|
* @typedef {import("@vcmap/core").LayerImplementation<import("@vcmap/core").VcsMap>} FeatureLayerImplementation
|
|
39
42
|
* @property {function(import("@vcmap/core").StyleItem, boolean=):void} updateStyle
|
|
43
|
+
* @property {function(import("@vcmap-cesium/engine").SplitDirection):void} updateSplitDirection
|
|
40
44
|
*/
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -44,6 +48,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
44
48
|
* @class
|
|
45
49
|
* @abstract
|
|
46
50
|
* @extends {Layer}
|
|
51
|
+
* @implements {SplitLayer}
|
|
47
52
|
* @api
|
|
48
53
|
*/
|
|
49
54
|
class FeatureLayer extends Layer {
|
|
@@ -58,6 +63,7 @@ class FeatureLayer extends Layer {
|
|
|
58
63
|
...Layer.getDefaultOptions(),
|
|
59
64
|
style: undefined,
|
|
60
65
|
balloonHeightOffset: 10,
|
|
66
|
+
splitDirection: undefined,
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -90,6 +96,21 @@ class FeatureLayer extends Layer {
|
|
|
90
96
|
* @api
|
|
91
97
|
*/
|
|
92
98
|
this.balloonHeightOffset = parseInteger(options.balloonHeightOffset, defaultOptions.balloonHeightOffset);
|
|
99
|
+
/** @type {import("@vcmap-cesium/engine").SplitDirection} */
|
|
100
|
+
this._splitDirection = SplitDirection.NONE;
|
|
101
|
+
|
|
102
|
+
if (options.splitDirection) {
|
|
103
|
+
this._splitDirection = options.splitDirection === 'left' ?
|
|
104
|
+
SplitDirection.LEFT :
|
|
105
|
+
SplitDirection.RIGHT;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* raised if the split direction changes, is passed the split direction as its only argument
|
|
110
|
+
* @type {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>}
|
|
111
|
+
* @api
|
|
112
|
+
*/
|
|
113
|
+
this.splitDirectionChanged = new VcsEvent();
|
|
93
114
|
/**
|
|
94
115
|
* FeatureVisibility tracks the highlighting and hiding of features on this layer
|
|
95
116
|
* @type {FeatureVisibility}
|
|
@@ -117,6 +138,26 @@ class FeatureLayer extends Layer {
|
|
|
117
138
|
return this._style;
|
|
118
139
|
}
|
|
119
140
|
|
|
141
|
+
/**
|
|
142
|
+
* @api
|
|
143
|
+
* The splitDirection to be applied - for 3D vector features currently only working on points with a Model
|
|
144
|
+
* @type {import("@vcmap-cesium/engine").SplitDirection}
|
|
145
|
+
*/
|
|
146
|
+
get splitDirection() { return this._splitDirection; }
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @param {import("@vcmap-cesium/engine").SplitDirection} direction
|
|
150
|
+
*/
|
|
151
|
+
set splitDirection(direction) {
|
|
152
|
+
if (direction !== this._splitDirection) {
|
|
153
|
+
this.getImplementations().forEach((impl) => {
|
|
154
|
+
/** @type {FeatureLayerImplementation} */ (impl).updateSplitDirection(direction);
|
|
155
|
+
});
|
|
156
|
+
this._splitDirection = direction;
|
|
157
|
+
this.splitDirectionChanged.raiseEvent(this._splitDirection);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
120
161
|
/**
|
|
121
162
|
* @returns {FeatureLayerImplementationOptions}
|
|
122
163
|
*/
|
|
@@ -126,6 +167,7 @@ class FeatureLayer extends Layer {
|
|
|
126
167
|
globalHider: this.globalHider,
|
|
127
168
|
featureVisibility: this.featureVisibility,
|
|
128
169
|
style: this.style,
|
|
170
|
+
splitDirection: this.splitDirection,
|
|
129
171
|
};
|
|
130
172
|
}
|
|
131
173
|
|
|
@@ -138,7 +180,7 @@ class FeatureLayer extends Layer {
|
|
|
138
180
|
}
|
|
139
181
|
|
|
140
182
|
/**
|
|
141
|
-
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
183
|
+
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Cesium3DTileFeature|DataSourcePickedObject} object
|
|
142
184
|
* @returns {?Object}
|
|
143
185
|
*/
|
|
144
186
|
// eslint-disable-next-line no-unused-vars,class-methods-use-this
|
|
@@ -194,6 +236,11 @@ class FeatureLayer extends Layer {
|
|
|
194
236
|
if (!this.getStyleOrDefaultStyle().equals(this._style)) {
|
|
195
237
|
config.style = this.style.toJSON();
|
|
196
238
|
}
|
|
239
|
+
if (this._splitDirection !== SplitDirection.NONE) {
|
|
240
|
+
config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
|
|
241
|
+
'right' :
|
|
242
|
+
'left';
|
|
243
|
+
}
|
|
197
244
|
return config;
|
|
198
245
|
}
|
|
199
246
|
|
|
@@ -205,6 +252,7 @@ class FeatureLayer extends Layer {
|
|
|
205
252
|
this.featureVisibility.destroy();
|
|
206
253
|
}
|
|
207
254
|
this.styleChanged.destroy();
|
|
255
|
+
this.splitDirectionChanged.destroy();
|
|
208
256
|
super.destroy();
|
|
209
257
|
}
|
|
210
258
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Feature from 'ol/Feature.js';
|
|
2
|
-
import { Cesium3DTileFeature, Cesium3DTilePointFeature, SplitDirection } from '@vcmap/
|
|
2
|
+
import { Cesium3DTileFeature, Cesium3DTilePointFeature, SplitDirection } from '@vcmap-cesium/engine';
|
|
3
3
|
import VectorSource from 'ol/source/Vector.js';
|
|
4
4
|
import { createEmpty, extend as extendExtent } from 'ol/extent.js';
|
|
5
5
|
|
|
@@ -155,7 +155,7 @@ class FeatureStoreLayer extends VectorLayer {
|
|
|
155
155
|
this.screenSpaceError = this.vcsMeta.screenSpaceError;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* @type {import("@vcmap/
|
|
158
|
+
* @type {import("@vcmap-cesium/engine").Event.RemoveCallback}
|
|
159
159
|
* @private
|
|
160
160
|
*/
|
|
161
161
|
this._removeVectorPropertiesChangeHandler = this.vectorProperties.propertyChanged.addEventListener(() => {
|
|
@@ -442,7 +442,7 @@ class FeatureStoreLayer extends VectorLayer {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
|
-
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
445
|
+
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Cesium3DTileFeature} feature
|
|
446
446
|
* @returns {?Object}
|
|
447
447
|
*/
|
|
448
448
|
objectClickedHandler(feature) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, Cesium3DTileFeature, Cesium3DTilePointFeature, Entity as CesiumEntity } from '@vcmap/
|
|
1
|
+
import { Color, Cesium3DTileFeature, Cesium3DTilePointFeature, Entity as CesiumEntity } from '@vcmap-cesium/engine';
|
|
2
2
|
import Feature from 'ol/Feature.js';
|
|
3
3
|
import Style from 'ol/style/Style.js';
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ export const globalHidden = Symbol('globalHidden');
|
|
|
37
37
|
/**
|
|
38
38
|
* @typedef {Object} HighlightedObject
|
|
39
39
|
* @property {VectorStyleItem} style
|
|
40
|
-
* @property {Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
40
|
+
* @property {Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature>} features
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -48,7 +48,7 @@ export const globalHidden = Symbol('globalHidden');
|
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* @param {import("@vcmap/
|
|
51
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature} feature
|
|
52
52
|
* @returns {boolean}
|
|
53
53
|
*/
|
|
54
54
|
export function featureExists(feature) {
|
|
@@ -59,7 +59,7 @@ export function featureExists(feature) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @param {import("@vcmap/
|
|
62
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
63
63
|
* @private
|
|
64
64
|
*/
|
|
65
65
|
export function hideFeature(feature) {
|
|
@@ -77,7 +77,7 @@ export function hideFeature(feature) {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Caches the original style on the feature using the originalStyle symbol
|
|
80
|
-
* @param {import("@vcmap/
|
|
80
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
81
81
|
* @private
|
|
82
82
|
*/
|
|
83
83
|
export function cacheOriginalStyle(feature) {
|
|
@@ -94,7 +94,7 @@ export function cacheOriginalStyle(feature) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* @param {import("@vcmap/
|
|
97
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
98
98
|
* @private
|
|
99
99
|
*/
|
|
100
100
|
export function resetOriginalStyle(feature) {
|
|
@@ -113,7 +113,7 @@ export function resetOriginalStyle(feature) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
* @param {import("@vcmap/
|
|
116
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
117
117
|
* @private
|
|
118
118
|
*/
|
|
119
119
|
export function highlightFeature(feature) {
|
|
@@ -132,7 +132,7 @@ export function highlightFeature(feature) {
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Updates the cached original style
|
|
135
|
-
* @param {import("@vcmap/
|
|
135
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
136
136
|
* @private
|
|
137
137
|
*/
|
|
138
138
|
export function updateOriginalStyle(feature) {
|
|
@@ -146,7 +146,7 @@ export function updateOriginalStyle(feature) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* @param {import("@vcmap/
|
|
149
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
150
150
|
*/
|
|
151
151
|
function unhighlightFeature(feature) {
|
|
152
152
|
delete feature[highlighted];
|
|
@@ -154,7 +154,7 @@ function unhighlightFeature(feature) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* @param {import("@vcmap/
|
|
157
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
158
158
|
* @param {symbol} symbol
|
|
159
159
|
* @private
|
|
160
160
|
*/
|
|
@@ -238,7 +238,7 @@ export function synchronizeFeatureVisibility(source, destination) {
|
|
|
238
238
|
*/
|
|
239
239
|
class FeatureVisibility {
|
|
240
240
|
constructor() {
|
|
241
|
-
/** @type {Object<string, Set<(import("@vcmap/
|
|
241
|
+
/** @type {Object<string, Set<(import("@vcmap-cesium/engine").Cesium3DTileFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity)>>} */
|
|
242
242
|
this.hiddenObjects = {};
|
|
243
243
|
/** @type {Object<string, HighlightedObject>} */
|
|
244
244
|
this.highlightedObjects = {};
|
|
@@ -253,8 +253,8 @@ class FeatureVisibility {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
|
-
* highlights a number of features by ID (import("@vcmap/
|
|
257
|
-
* @param {Object<string, (VectorStyleItem|import("@vcmap/
|
|
256
|
+
* highlights a number of features by ID (import("@vcmap-cesium/engine").Cesium3DTileFeature|ol/Feature) with the given color.
|
|
257
|
+
* @param {Object<string, (VectorStyleItem|import("@vcmap-cesium/engine").Color|import("ol/style/Style").default)>} toHighlight
|
|
258
258
|
* @api stable
|
|
259
259
|
*/
|
|
260
260
|
highlight(toHighlight) {
|
|
@@ -298,7 +298,7 @@ class FeatureVisibility {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
|
-
* unhighlights a number of features given by the ID (import("@vcmap/
|
|
301
|
+
* unhighlights a number of features given by the ID (import("@vcmap-cesium/engine").Cesium3DTileFeature|import("ol").Feature<import("ol/geom/Geometry").default>)
|
|
302
302
|
* @param {Array<string>} toUnHighlight Array with IDS to unhighlight
|
|
303
303
|
* @api stable
|
|
304
304
|
*/
|
|
@@ -330,7 +330,7 @@ class FeatureVisibility {
|
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
332
|
* @param {string|number} id
|
|
333
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
333
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature} feature
|
|
334
334
|
* @returns {boolean}
|
|
335
335
|
*/
|
|
336
336
|
hasHighlightFeature(id, feature) {
|
|
@@ -339,7 +339,7 @@ class FeatureVisibility {
|
|
|
339
339
|
|
|
340
340
|
/**
|
|
341
341
|
* @param {string|number} id
|
|
342
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
342
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature} feature
|
|
343
343
|
*/
|
|
344
344
|
addHighlightFeature(id, feature) {
|
|
345
345
|
if (this.highlightedObjects[id]) {
|
|
@@ -403,7 +403,7 @@ class FeatureVisibility {
|
|
|
403
403
|
|
|
404
404
|
/**
|
|
405
405
|
* @param {string|number} id
|
|
406
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
406
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
407
407
|
* @returns {boolean}
|
|
408
408
|
*/
|
|
409
409
|
hasHiddenFeature(id, feature) {
|
|
@@ -412,7 +412,7 @@ class FeatureVisibility {
|
|
|
412
412
|
|
|
413
413
|
/**
|
|
414
414
|
* @param {string|number} id
|
|
415
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
415
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
416
416
|
*/
|
|
417
417
|
addHiddenFeature(id, feature) {
|
|
418
418
|
if (this.hiddenObjects[id]) {
|
package/src/layer/globalHider.js
CHANGED
|
@@ -29,7 +29,7 @@ class GlobalHider {
|
|
|
29
29
|
*/
|
|
30
30
|
this.hiddenObjects = {};
|
|
31
31
|
/**
|
|
32
|
-
* @type {Object<string, Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
32
|
+
* @type {Object<string, Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Entity>>}
|
|
33
33
|
* @private
|
|
34
34
|
*/
|
|
35
35
|
this._hiddenObjectFeatures = {};
|
|
@@ -101,7 +101,7 @@ class GlobalHider {
|
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* @param {number|string} uuid
|
|
104
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
104
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
105
105
|
*/
|
|
106
106
|
addFeature(uuid, feature) {
|
|
107
107
|
if (!this._hiddenObjectFeatures[uuid]) {
|
|
@@ -115,7 +115,7 @@ class GlobalHider {
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* @param {string|number} uuid
|
|
118
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
118
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
119
119
|
* @returns {boolean}
|
|
120
120
|
*/
|
|
121
121
|
hasFeature(uuid, feature) {
|
package/src/layer/layer.js
CHANGED
|
@@ -10,8 +10,8 @@ import GlobalHider from './globalHider.js';
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("@vcmap/core").Layer} SplitLayer
|
|
13
|
-
* @property {import("@vcmap/
|
|
14
|
-
* @property {VcsEvent<import("@vcmap/
|
|
13
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
14
|
+
* @property {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>} splitDirectionChanged
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -57,6 +57,12 @@ import GlobalHider from './globalHider.js';
|
|
|
57
57
|
* @api
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {LayerImplementationOptions} SplitLayerImplementationOptions
|
|
62
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
63
|
+
* @api
|
|
64
|
+
*/
|
|
65
|
+
|
|
60
66
|
/**
|
|
61
67
|
* Layer implementations for the {@link CesiumMap} map
|
|
62
68
|
* @namespace cesium
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Circle from 'ol/geom/Circle.js';
|
|
2
2
|
import { fromCircle } from 'ol/geom/Polygon.js';
|
|
3
3
|
import { getTransform } from 'ol/proj.js';
|
|
4
|
-
import { Cartographic, sampleTerrainMostDetailed } from '@vcmap/
|
|
4
|
+
import { Cartographic, sampleTerrainMostDetailed } from '@vcmap-cesium/engine';
|
|
5
5
|
import { cartesian2DDistance } from '../../util/math.js';
|
|
6
6
|
import Projection, { mercatorProjection, wgs84Projection } from '../../util/projection.js';
|
|
7
7
|
import { actuallyIsCircle, alreadyTransformedToImage, obliqueGeometry } from '../vectorSymbols.js';
|
|
@@ -116,6 +116,12 @@ class VectorObliqueImpl extends LayerObliqueImpl {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @param {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
121
|
+
*/
|
|
122
|
+
// eslint-disable-next-line class-methods-use-this,no-unused-vars
|
|
123
|
+
updateSplitDirection(splitDirection) {}
|
|
124
|
+
|
|
119
125
|
/**
|
|
120
126
|
* clears the current image and fetches features for the next
|
|
121
127
|
* @private
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SplitDirection } from '@vcmap/
|
|
1
|
+
import { SplitDirection } from '@vcmap-cesium/engine';
|
|
2
2
|
|
|
3
3
|
import { parseNumberRange, parseInteger } from '@vcsuite/parsers';
|
|
4
4
|
import Layer from './layer.js';
|
|
@@ -46,7 +46,7 @@ class OpenStreetMapLayer extends Layer {
|
|
|
46
46
|
super(options);
|
|
47
47
|
const defaultOptions = OpenStreetMapLayer.getDefaultOptions();
|
|
48
48
|
/**
|
|
49
|
-
* @type {import("@vcmap/
|
|
49
|
+
* @type {import("@vcmap-cesium/engine").SplitDirection}
|
|
50
50
|
* @private
|
|
51
51
|
*/
|
|
52
52
|
this._splitDirection = SplitDirection.NONE;
|
|
@@ -70,7 +70,7 @@ class OpenStreetMapLayer extends Layer {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* raised if the split direction changes, is passed the split direction as its only argument
|
|
73
|
-
* @type {VcsEvent<import("@vcmap/
|
|
73
|
+
* @type {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>}
|
|
74
74
|
* @api
|
|
75
75
|
*/
|
|
76
76
|
this.splitDirectionChanged = new VcsEvent();
|
|
@@ -85,12 +85,12 @@ class OpenStreetMapLayer extends Layer {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* @api
|
|
88
|
-
* @type {import("@vcmap/
|
|
88
|
+
* @type {import("@vcmap-cesium/engine").SplitDirection}
|
|
89
89
|
*/
|
|
90
90
|
get splitDirection() { return this._splitDirection; }
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* @param {import("@vcmap/
|
|
93
|
+
* @param {import("@vcmap-cesium/engine").SplitDirection} direction
|
|
94
94
|
*/
|
|
95
95
|
set splitDirection(direction) {
|
|
96
96
|
if (direction !== this._splitDirection) {
|
|
@@ -177,6 +177,12 @@ class OpenStreetMapLayer extends Layer {
|
|
|
177
177
|
config.maxLevel = this.maxLevel;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
if (this._splitDirection !== SplitDirection.NONE) {
|
|
181
|
+
config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
|
|
182
|
+
'right' :
|
|
183
|
+
'left';
|
|
184
|
+
}
|
|
185
|
+
|
|
180
186
|
return config;
|
|
181
187
|
}
|
|
182
188
|
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { SplitDirection } from '@vcmap-cesium/engine';
|
|
2
|
+
import { unByKey } from 'ol/Observable.js';
|
|
1
3
|
import { vcsLayerName } from '../layerSymbols.js';
|
|
2
4
|
import LayerImplementation from '../layerImplementation.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
7
|
+
* @typedef {LayerImplementationOptions} LayerOpenlayersImplementationOptions
|
|
8
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Layer implementation for {@link OpenlayersMap}.
|
|
6
13
|
* @class
|
|
7
14
|
* @extends {LayerImplementation<import("@vcmap/core").OpenlayersMap>}}
|
|
8
15
|
*/
|
|
@@ -11,7 +18,7 @@ class LayerOpenlayersImpl extends LayerImplementation {
|
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* @param {import("@vcmap/core").OpenlayersMap} map
|
|
14
|
-
* @param {
|
|
21
|
+
* @param {LayerOpenlayersImplementationOptions} options
|
|
15
22
|
*/
|
|
16
23
|
constructor(map, options) {
|
|
17
24
|
super(map, options);
|
|
@@ -19,19 +26,27 @@ class LayerOpenlayersImpl extends LayerImplementation {
|
|
|
19
26
|
* @type {import("ol/layer").Layer<import("ol/source/Source").default>|null}
|
|
20
27
|
*/
|
|
21
28
|
this.olLayer = null;
|
|
29
|
+
/** @type {import("@vcmap-cesium/engine").SplitDirection} */
|
|
30
|
+
this.splitDirection = options.splitDirection;
|
|
31
|
+
/**
|
|
32
|
+
* @type {Array<import("ol/events").EventsKey>|null}
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
this._splitDirectionRenderListeners = null;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
38
|
/**
|
|
25
39
|
* @inheritDoc
|
|
26
40
|
* @returns {Promise<void>}
|
|
27
41
|
*/
|
|
28
|
-
initialize() {
|
|
42
|
+
async initialize() {
|
|
29
43
|
if (!this.initialized) {
|
|
30
44
|
this.olLayer = this.getOLLayer();
|
|
31
45
|
this.olLayer[vcsLayerName] = this.name;
|
|
32
46
|
this.map.addOLLayer(this.olLayer);
|
|
33
47
|
}
|
|
34
|
-
|
|
48
|
+
await super.initialize();
|
|
49
|
+
this.updateSplitDirection(this.splitDirection);
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
/**
|
|
@@ -63,6 +78,52 @@ class LayerOpenlayersImpl extends LayerImplementation {
|
|
|
63
78
|
// eslint-disable-next-line class-methods-use-this
|
|
64
79
|
getOLLayer() { throw new Error(); }
|
|
65
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @param {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
83
|
+
*/
|
|
84
|
+
updateSplitDirection(splitDirection) {
|
|
85
|
+
this.splitDirection = splitDirection;
|
|
86
|
+
if (this.initialized) {
|
|
87
|
+
if (this.splitDirection === SplitDirection.NONE && this._splitDirectionRenderListeners) {
|
|
88
|
+
unByKey(this._splitDirectionRenderListeners);
|
|
89
|
+
this._splitDirectionRenderListeners = null;
|
|
90
|
+
this.olLayer.changed();
|
|
91
|
+
} else if (splitDirection !== SplitDirection.NONE && !this._splitDirectionRenderListeners) {
|
|
92
|
+
this._splitDirectionRenderListeners = [];
|
|
93
|
+
this._splitDirectionRenderListeners
|
|
94
|
+
.push(/** @type {import("ol/events").EventsKey} */
|
|
95
|
+
(this.olLayer.on('prerender', this._splitPreRender.bind(this))),
|
|
96
|
+
);
|
|
97
|
+
this._splitDirectionRenderListeners
|
|
98
|
+
.push(/** @type {import("ol/events").EventsKey} */
|
|
99
|
+
(this.olLayer.on('postrender', (/** @type {import("ol/render/Event").default} */ event) => {
|
|
100
|
+
/** @type {CanvasRenderingContext2D} */ (event.context).restore();
|
|
101
|
+
})),
|
|
102
|
+
);
|
|
103
|
+
this.olLayer.changed();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {import("ol/render/Event").default} event
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
_splitPreRender(event) {
|
|
113
|
+
// eslint-disable-next-line prefer-destructuring
|
|
114
|
+
const context = /** @type {CanvasRenderingContext2D} */ (event.context);
|
|
115
|
+
const width = context.canvas.width * this.map.splitPosition;
|
|
116
|
+
context.save();
|
|
117
|
+
context.beginPath();
|
|
118
|
+
|
|
119
|
+
if (this.splitDirection === SplitDirection.LEFT) {
|
|
120
|
+
context.rect(0, 0, width, context.canvas.height);
|
|
121
|
+
} else {
|
|
122
|
+
context.rect(width, 0, context.canvas.width - width, context.canvas.height);
|
|
123
|
+
}
|
|
124
|
+
context.clip();
|
|
125
|
+
}
|
|
126
|
+
|
|
66
127
|
/**
|
|
67
128
|
* @inheritDoc
|
|
68
129
|
*/
|
|
@@ -71,6 +132,10 @@ class LayerOpenlayersImpl extends LayerImplementation {
|
|
|
71
132
|
this.map.removeOLLayer(this.olLayer);
|
|
72
133
|
}
|
|
73
134
|
this.olLayer = null;
|
|
135
|
+
if (this._splitDirectionRenderListeners) {
|
|
136
|
+
unByKey(this._splitDirectionRenderListeners);
|
|
137
|
+
this._splitDirectionRenderListeners = null;
|
|
138
|
+
}
|
|
74
139
|
super.destroy();
|
|
75
140
|
}
|
|
76
141
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SplitDirection } from '@vcmap/cesium';
|
|
2
|
-
import { unByKey } from 'ol/Observable.js';
|
|
3
1
|
import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -18,8 +16,6 @@ class RasterLayerOpenlayersImpl extends LayerOpenlayersImpl {
|
|
|
18
16
|
*/
|
|
19
17
|
constructor(map, options) {
|
|
20
18
|
super(map, options);
|
|
21
|
-
/** @type {import("@vcmap/cesium").SplitDirection} */
|
|
22
|
-
this.splitDirection = options.splitDirection;
|
|
23
19
|
/** @type {number} */
|
|
24
20
|
this.minLevel = options.minLevel;
|
|
25
21
|
/** @type {number} */
|
|
@@ -30,22 +26,6 @@ class RasterLayerOpenlayersImpl extends LayerOpenlayersImpl {
|
|
|
30
26
|
this.extent = options.extent;
|
|
31
27
|
/** @type {number} */
|
|
32
28
|
this.opacity = options.opacity;
|
|
33
|
-
/**
|
|
34
|
-
* @type {Array<import("ol/events").EventsKey>|null}
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
this._splitDirectionRenderListeners = null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @inheritDoc
|
|
42
|
-
* @returns {Promise<void>}
|
|
43
|
-
*/
|
|
44
|
-
initialize() {
|
|
45
|
-
return super.initialize()
|
|
46
|
-
.then(() => {
|
|
47
|
-
this.updateSplitDirection(this.splitDirection);
|
|
48
|
-
});
|
|
49
29
|
}
|
|
50
30
|
|
|
51
31
|
/**
|
|
@@ -57,66 +37,6 @@ class RasterLayerOpenlayersImpl extends LayerOpenlayersImpl {
|
|
|
57
37
|
this.olLayer.setOpacity(this.opacity);
|
|
58
38
|
}
|
|
59
39
|
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param {import("@vcmap/cesium").SplitDirection} splitDirection
|
|
63
|
-
*/
|
|
64
|
-
updateSplitDirection(splitDirection) {
|
|
65
|
-
this.splitDirection = splitDirection;
|
|
66
|
-
if (this.initialized) {
|
|
67
|
-
if (this.splitDirection === SplitDirection.NONE && this._splitDirectionRenderListeners) {
|
|
68
|
-
unByKey(this._splitDirectionRenderListeners);
|
|
69
|
-
this._splitDirectionRenderListeners = null;
|
|
70
|
-
this.olLayer.changed();
|
|
71
|
-
} else if (splitDirection !== SplitDirection.NONE && !this._splitDirectionRenderListeners) {
|
|
72
|
-
this._splitDirectionRenderListeners = [];
|
|
73
|
-
this._splitDirectionRenderListeners
|
|
74
|
-
.push(/** @type {import("ol/events").EventsKey} */
|
|
75
|
-
(this.olLayer.on('prerender', this._splitPreCompose.bind(this))),
|
|
76
|
-
);
|
|
77
|
-
this._splitDirectionRenderListeners
|
|
78
|
-
.push(/** @type {import("ol/events").EventsKey} */
|
|
79
|
-
(this.olLayer.on('postrender', (/** @type {import("ol/render/Event").default} */ event) => {
|
|
80
|
-
/** @type {CanvasRenderingContext2D} */ (event.context).restore();
|
|
81
|
-
})),
|
|
82
|
-
);
|
|
83
|
-
this.olLayer.changed();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @param {import("ol/render/Event").default} event
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
_splitPreCompose(event) {
|
|
93
|
-
if (!this.map.splitScreen) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
// eslint-disable-next-line prefer-destructuring
|
|
97
|
-
const context = /** @type {CanvasRenderingContext2D} */ (event.context);
|
|
98
|
-
const width = context.canvas.width * this.map.splitScreen.position;
|
|
99
|
-
context.save();
|
|
100
|
-
context.beginPath();
|
|
101
|
-
|
|
102
|
-
if (this.splitDirection === SplitDirection.LEFT) {
|
|
103
|
-
context.rect(0, 0, width, context.canvas.height);
|
|
104
|
-
} else {
|
|
105
|
-
context.rect(width, 0, context.canvas.width - width, context.canvas.height);
|
|
106
|
-
}
|
|
107
|
-
context.clip();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @inheritDoc
|
|
112
|
-
*/
|
|
113
|
-
destroy() {
|
|
114
|
-
if (this._splitDirectionRenderListeners) {
|
|
115
|
-
unByKey(this._splitDirectionRenderListeners);
|
|
116
|
-
this._splitDirectionRenderListeners = null;
|
|
117
|
-
}
|
|
118
|
-
super.destroy();
|
|
119
|
-
}
|
|
120
40
|
}
|
|
121
41
|
|
|
122
42
|
export default RasterLayerOpenlayersImpl;
|