@vcmap/core 6.0.7 → 6.1.0-rc.2
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/dist/cesium.d.ts +3 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +8 -1
- package/dist/src/featureProvider/featureProviderSymbols.d.ts +5 -0
- package/dist/src/featureProvider/featureProviderSymbols.js +5 -1
- package/dist/src/featureProvider/featureProviderSymbols.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.js +58 -62
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.js +25 -13
- package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
- package/dist/src/layer/cesium/sourceVectorContextSync.d.ts +27 -0
- package/dist/src/layer/cesium/sourceVectorContextSync.js +94 -0
- package/dist/src/layer/cesium/sourceVectorContextSync.js.map +1 -0
- package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +4 -27
- package/dist/src/layer/cesium/vectorCesiumImpl.js +15 -107
- package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.d.ts +12 -1
- package/dist/src/layer/cesium/vectorContext.js +6 -0
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/layerSymbols.js +1 -1
- package/dist/src/layer/layerSymbols.js.map +1 -1
- package/dist/src/layer/oblique/sourceObliqueSync.d.ts +18 -0
- package/dist/src/layer/oblique/sourceObliqueSync.js +319 -0
- package/dist/src/layer/oblique/sourceObliqueSync.js.map +1 -0
- package/dist/src/layer/oblique/vectorObliqueImpl.d.ts +2 -40
- package/dist/src/layer/oblique/vectorObliqueImpl.js +8 -283
- package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +10 -1
- package/dist/src/layer/vectorLayer.js +23 -1
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/map/baseOLMap.js +8 -1
- package/dist/src/map/baseOLMap.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +2 -0
- package/dist/src/map/cesiumMap.js +26 -1
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +24 -12
- package/dist/src/map/vcsMap.js +92 -38
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/ol/source/ClusterEnhancedVectorSource.d.ts +6 -4
- package/dist/src/ol/source/ClusterEnhancedVectorSource.js +4 -9
- package/dist/src/ol/source/ClusterEnhancedVectorSource.js.map +1 -1
- package/dist/src/ol/source/VcsCluster.d.ts +10 -10
- package/dist/src/ol/source/VcsCluster.js +23 -7
- package/dist/src/ol/source/VcsCluster.js.map +1 -1
- package/dist/src/util/clipping/clippingPolygonHelper.d.ts +7 -0
- package/dist/src/util/clipping/clippingPolygonHelper.js +53 -0
- package/dist/src/util/clipping/clippingPolygonHelper.js.map +1 -0
- package/dist/src/util/clipping/clippingPolygonObject.d.ts +59 -0
- package/dist/src/util/clipping/clippingPolygonObject.js +158 -0
- package/dist/src/util/clipping/clippingPolygonObject.js.map +1 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.d.ts +18 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.js +167 -0
- package/dist/src/util/clipping/clippingPolygonObjectCollection.js.map +1 -0
- package/dist/src/util/layerCollection.d.ts +11 -1
- package/dist/src/util/layerCollection.js +67 -12
- package/dist/src/util/layerCollection.js.map +1 -1
- package/dist/src/util/mapCollection.d.ts +16 -1
- package/dist/src/util/mapCollection.js +37 -3
- package/dist/src/util/mapCollection.js.map +1 -1
- package/dist/src/util/renderScreenshot.d.ts +9 -0
- package/dist/src/util/renderScreenshot.js +162 -0
- package/dist/src/util/renderScreenshot.js.map +1 -0
- package/dist/src/util/rotation.d.ts +30 -0
- package/dist/src/util/rotation.js +145 -0
- package/dist/src/util/rotation.js.map +1 -0
- package/dist/src/util/vcsTemplate.d.ts +7 -0
- package/dist/src/util/vcsTemplate.js +248 -0
- package/dist/src/util/vcsTemplate.js.map +1 -0
- package/dist/src/vcsApp.d.ts +7 -0
- package/dist/src/vcsApp.js +29 -0
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/src/vcsModule.d.ts +6 -2
- package/dist/src/vcsModule.js.map +1 -1
- package/dist/src/vectorCluster/vectorClusterCesiumContext.d.ts +18 -0
- package/dist/src/{layer/cesium/clusterContext.js → vectorCluster/vectorClusterCesiumContext.js} +28 -42
- package/dist/src/vectorCluster/vectorClusterCesiumContext.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroup.d.ts +96 -0
- package/dist/src/vectorCluster/vectorClusterGroup.js +320 -0
- package/dist/src/vectorCluster/vectorClusterGroup.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.d.ts +20 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js +115 -0
- package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.d.ts +19 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.js +37 -0
- package/dist/src/vectorCluster/vectorClusterGroupCollection.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.d.ts +31 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.js +76 -0
- package/dist/src/vectorCluster/vectorClusterGroupImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.d.ts +17 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js +62 -0
- package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.d.ts +17 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js +62 -0
- package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.d.ts +110 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.js +374 -0
- package/dist/src/vectorCluster/vectorClusterStyleItem.js.map +1 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.d.ts +1 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.js +3 -0
- package/dist/src/vectorCluster/vectorClusterSymbols.js.map +1 -0
- package/index.ts +42 -1
- package/package.json +3 -1
- package/src/cesium/cesium.d.ts +3 -0
- package/src/featureProvider/featureProviderSymbols.ts +6 -1
- package/src/interaction/featureAtPixelInteraction.ts +109 -84
- package/src/interaction/featureProviderInteraction.ts +42 -28
- package/src/layer/cesium/sourceVectorContextSync.ts +134 -0
- package/src/layer/cesium/vcsTile/vcsDebugTile.ts +1 -1
- package/src/layer/cesium/vcsTile/vcsVectorTile.ts +1 -1
- package/src/layer/cesium/vectorCesiumImpl.ts +30 -144
- package/src/layer/cesium/vectorContext.ts +17 -1
- package/src/layer/layerSymbols.ts +1 -1
- package/src/layer/oblique/sourceObliqueSync.ts +436 -0
- package/src/layer/oblique/vectorObliqueImpl.ts +11 -397
- package/src/layer/vectorLayer.ts +35 -2
- package/src/map/baseOLMap.ts +8 -1
- package/src/map/cesiumMap.ts +36 -3
- package/src/map/vcsMap.ts +121 -47
- package/src/ol/ol.d.ts +8 -1
- package/src/ol/source/{ClusterEnhancedVectorSource.js → ClusterEnhancedVectorSource.ts} +7 -10
- package/src/ol/source/VcsCluster.ts +58 -0
- package/src/util/clipping/clippingPolygonHelper.ts +86 -0
- package/src/util/clipping/clippingPolygonObject.ts +223 -0
- package/src/util/clipping/clippingPolygonObjectCollection.ts +249 -0
- package/src/util/layerCollection.ts +90 -12
- package/src/util/mapCollection.ts +53 -2
- package/src/util/renderScreenshot.ts +193 -0
- package/src/util/rotation.ts +215 -0
- package/src/util/vcsTemplate.ts +373 -0
- package/src/vcsApp.ts +65 -0
- package/src/vcsModule.ts +6 -2
- package/src/vectorCluster/vectorClusterCesiumContext.ts +123 -0
- package/src/vectorCluster/vectorClusterGroup.ts +463 -0
- package/src/vectorCluster/vectorClusterGroupCesiumImpl.ts +176 -0
- package/src/vectorCluster/vectorClusterGroupCollection.ts +43 -0
- package/src/vectorCluster/vectorClusterGroupImpl.ts +107 -0
- package/src/vectorCluster/vectorClusterGroupObliqueImpl.ts +84 -0
- package/src/vectorCluster/vectorClusterGroupOpenlayersImpl.ts +81 -0
- package/src/vectorCluster/vectorClusterStyleItem.ts +490 -0
- package/src/vectorCluster/vectorClusterSymbols.ts +2 -0
- package/dist/src/layer/cesium/clusterContext.d.ts +0 -20
- package/dist/src/layer/cesium/clusterContext.js.map +0 -1
- package/src/layer/cesium/clusterContext.ts +0 -140
- package/src/ol/source/VcsCluster.js +0 -37
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import Style, { StyleFunction } from 'ol/style/Style.js';
|
|
2
|
+
import Icon from 'ol/style/Icon.js';
|
|
3
|
+
import Feature from 'ol/Feature.js';
|
|
4
|
+
import { check, is, oneOf } from '@vcsuite/check';
|
|
5
|
+
import { parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
6
|
+
import deepEqual from 'fast-deep-equal';
|
|
7
|
+
import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
8
|
+
import { highlighted } from '../layer/featureVisibility.js';
|
|
9
|
+
import VcsObject, { VcsObjectOptions } from '../vcsObject.js';
|
|
10
|
+
import VcsEvent from '../vcsEvent.js';
|
|
11
|
+
import type VectorLayer from '../layer/vectorLayer.js';
|
|
12
|
+
import { renderTemplate } from '../util/vcsTemplate.js';
|
|
13
|
+
import { vectorClusterGroupName } from './vectorClusterSymbols.js';
|
|
14
|
+
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
15
|
+
|
|
16
|
+
export type VectorClusterStyleItemOptions = VcsObjectOptions & {
|
|
17
|
+
template?: string | VectorClusterTemplateFunction;
|
|
18
|
+
fillColor?: string;
|
|
19
|
+
strokeColor?: string;
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
textColor?: string;
|
|
22
|
+
font?: string;
|
|
23
|
+
breaks?: number[];
|
|
24
|
+
zeroScaleOffset?: number;
|
|
25
|
+
scaleFactor?: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type VectorClusterTemplateFunction = (
|
|
29
|
+
styleItem: VectorClusterStyleItem,
|
|
30
|
+
feature: Feature[],
|
|
31
|
+
getLayerByName: (layerName: string) => VectorLayer | undefined,
|
|
32
|
+
) => { template: string; cacheKey: string; context?: Record<string, unknown> };
|
|
33
|
+
|
|
34
|
+
function createDefaultTemplateFunction(
|
|
35
|
+
template: string,
|
|
36
|
+
): VectorClusterTemplateFunction {
|
|
37
|
+
return (styleItem, features) => ({
|
|
38
|
+
template,
|
|
39
|
+
cacheKey: String(styleItem.findBreakIndex(features.length)),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default class VectorClusterStyleItem extends VcsObject {
|
|
44
|
+
static get className(): string {
|
|
45
|
+
return 'VectorClusterStyleItem';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static getDefaultOptions(): Required<VectorClusterStyleItemOptions> {
|
|
49
|
+
return {
|
|
50
|
+
type: 'VectorClusterStyleItem',
|
|
51
|
+
name: '',
|
|
52
|
+
properties: {},
|
|
53
|
+
template: [
|
|
54
|
+
'<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">',
|
|
55
|
+
' <defs><style>',
|
|
56
|
+
' .cls-1 {',
|
|
57
|
+
' fill: {{ fillColor }};',
|
|
58
|
+
' stroke: {{ strokeColor }};',
|
|
59
|
+
' stroke-miterlimit: 10;',
|
|
60
|
+
' stroke-width: {{ strokeWidth }}px;',
|
|
61
|
+
' }',
|
|
62
|
+
' .text {',
|
|
63
|
+
' font: {{ font }};',
|
|
64
|
+
' fill: {{ textColor }};',
|
|
65
|
+
' text-anchor: middle;',
|
|
66
|
+
' alignment-baseline: middle;',
|
|
67
|
+
' dominant-baseline: middle;',
|
|
68
|
+
' }',
|
|
69
|
+
' </style></defs>',
|
|
70
|
+
' <circle id="outer" class="cls-1" cx="32" cy="32" r="30"/>',
|
|
71
|
+
' <text x="32" y="32" class="text">',
|
|
72
|
+
' {{ text }}',
|
|
73
|
+
' </text>',
|
|
74
|
+
'</svg>',
|
|
75
|
+
].join(''),
|
|
76
|
+
fillColor: '#ffffff',
|
|
77
|
+
strokeColor: '#2a2a2a',
|
|
78
|
+
strokeWidth: 4,
|
|
79
|
+
textColor: '#2a2a2a',
|
|
80
|
+
font: 'normal normal 700 32px Calibri-Bold,Calibri',
|
|
81
|
+
breaks: [2, 3, 4, 5, 10, 15, 20, 25],
|
|
82
|
+
zeroScaleOffset: 3,
|
|
83
|
+
scaleFactor: 0.08,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private _template: string | VectorClusterTemplateFunction = '';
|
|
88
|
+
|
|
89
|
+
private _templateFunction: VectorClusterTemplateFunction =
|
|
90
|
+
createDefaultTemplateFunction('');
|
|
91
|
+
|
|
92
|
+
private _breaks: number[] = [];
|
|
93
|
+
|
|
94
|
+
private _zeroScaleOffset: number;
|
|
95
|
+
|
|
96
|
+
private _fillColor: string;
|
|
97
|
+
|
|
98
|
+
private _strokeColor: string;
|
|
99
|
+
|
|
100
|
+
private _strokeWidth: number;
|
|
101
|
+
|
|
102
|
+
private _textColor: string;
|
|
103
|
+
|
|
104
|
+
private _font: string;
|
|
105
|
+
|
|
106
|
+
private _scaleFactor: number;
|
|
107
|
+
|
|
108
|
+
private _styleCache = new Map<string, Style>();
|
|
109
|
+
|
|
110
|
+
styleChanged = new VcsEvent<void>();
|
|
111
|
+
|
|
112
|
+
constructor(options: VectorClusterStyleItemOptions) {
|
|
113
|
+
super(options);
|
|
114
|
+
const defaultOptions = VectorClusterStyleItem.getDefaultOptions();
|
|
115
|
+
|
|
116
|
+
const configTemplate = Array.isArray(options.template)
|
|
117
|
+
? options.template.join('')
|
|
118
|
+
: options.template;
|
|
119
|
+
|
|
120
|
+
this.setTemplate(configTemplate ?? defaultOptions.template);
|
|
121
|
+
this._breaks = options.breaks?.slice() ?? defaultOptions.breaks;
|
|
122
|
+
this._zeroScaleOffset = parseInteger(
|
|
123
|
+
options.zeroScaleOffset,
|
|
124
|
+
defaultOptions.zeroScaleOffset,
|
|
125
|
+
);
|
|
126
|
+
this._fillColor = options.fillColor ?? defaultOptions.fillColor;
|
|
127
|
+
this._strokeColor = options.strokeColor ?? defaultOptions.strokeColor;
|
|
128
|
+
this._strokeWidth = parseNumber(
|
|
129
|
+
options.strokeWidth,
|
|
130
|
+
defaultOptions.strokeWidth,
|
|
131
|
+
);
|
|
132
|
+
this._textColor = options.textColor ?? defaultOptions.textColor;
|
|
133
|
+
this._font = options.font ?? defaultOptions.font;
|
|
134
|
+
this._scaleFactor = parseNumber(
|
|
135
|
+
options.scaleFactor,
|
|
136
|
+
defaultOptions.scaleFactor,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
this.styleChanged.addEventListener(() => {
|
|
140
|
+
this.clearCache();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* An array of cluster sizes to break at. Typically the first couple of sizes are
|
|
146
|
+
* a series (meaning: not grouped). Later breaks are non sequential and used for grouping
|
|
147
|
+
* clusters larger. [2, 3, 4, 5, 10] would start grouping at clusters larger or equal 5
|
|
148
|
+
* entries.
|
|
149
|
+
*/
|
|
150
|
+
get breaks(): number[] {
|
|
151
|
+
return this._breaks.slice();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
set breaks(breaks: number[]) {
|
|
155
|
+
check(breaks, [Number]);
|
|
156
|
+
|
|
157
|
+
const sortedBreaks = breaks.sort((a, b) => (a < b ? -1 : 1));
|
|
158
|
+
const changed = sortedBreaks.find((b, i) => b !== this._breaks[i]);
|
|
159
|
+
if (changed) {
|
|
160
|
+
this._breaks = breaks;
|
|
161
|
+
this.styleChanged.raiseEvent();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The index of breaks to st. for indexes [2, 3, 4, 5, 10] and a zeroScale offset of 3
|
|
167
|
+
* would lead to icons 2, 3, 4 having the same size and no "+" attached. 5 and 10
|
|
168
|
+
* would be scaled by the scale factor and a "+" added to the text
|
|
169
|
+
*/
|
|
170
|
+
get zeroScaleOffset(): number {
|
|
171
|
+
return this._zeroScaleOffset;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
set zeroScaleOffset(zeroScaleOffset: number) {
|
|
175
|
+
check(zeroScaleOffset, Number);
|
|
176
|
+
|
|
177
|
+
if (zeroScaleOffset !== this._zeroScaleOffset) {
|
|
178
|
+
this._zeroScaleOffset = zeroScaleOffset;
|
|
179
|
+
this.styleChanged.raiseEvent();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The fill color. This must be a css string.
|
|
185
|
+
*/
|
|
186
|
+
get fillColor(): string {
|
|
187
|
+
return this._fillColor;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
set fillColor(fillColor: string) {
|
|
191
|
+
check(fillColor, String);
|
|
192
|
+
|
|
193
|
+
if (fillColor !== this._fillColor) {
|
|
194
|
+
this._fillColor = fillColor;
|
|
195
|
+
this.styleChanged.raiseEvent();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The stroke color. This must be a css string.
|
|
201
|
+
*/
|
|
202
|
+
get strokeColor(): string {
|
|
203
|
+
return this._strokeColor;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
set strokeColor(strokeColor: string) {
|
|
207
|
+
check(strokeColor, String);
|
|
208
|
+
|
|
209
|
+
if (strokeColor !== this._strokeColor) {
|
|
210
|
+
this._strokeColor = strokeColor;
|
|
211
|
+
this.styleChanged.raiseEvent();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The stroke color. This must be a css string.
|
|
217
|
+
*/
|
|
218
|
+
get strokeWidth(): number {
|
|
219
|
+
return this._strokeWidth;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
set strokeWidth(strokeWidth: number) {
|
|
223
|
+
check(strokeWidth, Number);
|
|
224
|
+
|
|
225
|
+
if (strokeWidth !== this._strokeWidth) {
|
|
226
|
+
this._strokeWidth = strokeWidth;
|
|
227
|
+
this.styleChanged.raiseEvent();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The text color. This must be a css string.
|
|
233
|
+
*/
|
|
234
|
+
get textColor(): string {
|
|
235
|
+
return this._textColor;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
set textColor(textColor: string) {
|
|
239
|
+
check(textColor, String);
|
|
240
|
+
|
|
241
|
+
if (textColor !== this._textColor) {
|
|
242
|
+
this._textColor = textColor;
|
|
243
|
+
this.styleChanged.raiseEvent();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The font to use. Must be css font attribute.
|
|
249
|
+
*/
|
|
250
|
+
get font(): string {
|
|
251
|
+
return this._font;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
set font(font: string) {
|
|
255
|
+
check(font, String);
|
|
256
|
+
|
|
257
|
+
if (font !== this._font) {
|
|
258
|
+
this._font = font;
|
|
259
|
+
this.styleChanged.raiseEvent();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The factor by which to multiply the index of the used break grouping
|
|
265
|
+
* (subtracted by the zeroScaleOffset)
|
|
266
|
+
*/
|
|
267
|
+
get scaleFactor(): number {
|
|
268
|
+
return this._scaleFactor;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
set scaleFactor(scaleFactor: number) {
|
|
272
|
+
check(scaleFactor, Number);
|
|
273
|
+
|
|
274
|
+
if (scaleFactor !== this._scaleFactor) {
|
|
275
|
+
this._scaleFactor = scaleFactor;
|
|
276
|
+
this.styleChanged.raiseEvent();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
get template(): string | VectorClusterTemplateFunction {
|
|
281
|
+
return this._template;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
setTemplate(template: string | VectorClusterTemplateFunction): void {
|
|
285
|
+
check(template, oneOf(String, Function));
|
|
286
|
+
|
|
287
|
+
if (template !== this._template) {
|
|
288
|
+
this._template = template;
|
|
289
|
+
if (is(this._template, String)) {
|
|
290
|
+
this._templateFunction = createDefaultTemplateFunction(this._template);
|
|
291
|
+
} else {
|
|
292
|
+
this._templateFunction = this._template;
|
|
293
|
+
}
|
|
294
|
+
this.styleChanged.raiseEvent();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Finds the breaks index of a specified cluster size.
|
|
300
|
+
*/
|
|
301
|
+
findBreakIndex(size: number): number {
|
|
302
|
+
const clusterTextIndex = this._breaks.findIndex((classBreak, i) =>
|
|
303
|
+
i > this._zeroScaleOffset ? size < classBreak : size <= classBreak,
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
return clusterTextIndex === -1 ? this._breaks.length : clusterTextIndex;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Gets the cluster text based on breaks and zeroScaleOffset. Adds a + to all sizes with an index larger then the zeroScaleOffset.
|
|
311
|
+
*/
|
|
312
|
+
getClusterText(size: number): string {
|
|
313
|
+
if (size === 1) {
|
|
314
|
+
return '';
|
|
315
|
+
}
|
|
316
|
+
const clusterTextIndex = this.findBreakIndex(size);
|
|
317
|
+
let clusterText =
|
|
318
|
+
this._breaks[
|
|
319
|
+
clusterTextIndex > this._zeroScaleOffset
|
|
320
|
+
? clusterTextIndex - 1
|
|
321
|
+
: clusterTextIndex
|
|
322
|
+
].toString();
|
|
323
|
+
if (clusterTextIndex > this._zeroScaleOffset) {
|
|
324
|
+
clusterText = `${clusterText}+`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return clusterText;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Determines the scale based on break index and zeroScaleOffset. Cluster sizes with an index less then zeroScaleOffset
|
|
332
|
+
* are not scaled.
|
|
333
|
+
*/
|
|
334
|
+
determineScale(size: number): number {
|
|
335
|
+
const index = this.findBreakIndex(size);
|
|
336
|
+
|
|
337
|
+
let indexScale = index - this._zeroScaleOffset;
|
|
338
|
+
indexScale = indexScale > 0 ? indexScale : 0;
|
|
339
|
+
return 0.6 + this._scaleFactor * indexScale;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
createStyleFunction(
|
|
343
|
+
getLayerByName: (layerName: string) => VectorLayer | undefined,
|
|
344
|
+
): StyleFunction {
|
|
345
|
+
const styleFunction = (
|
|
346
|
+
feature: Feature,
|
|
347
|
+
resolution: number,
|
|
348
|
+
): Style | undefined => {
|
|
349
|
+
let features: Feature[] = [feature];
|
|
350
|
+
if (feature[vectorClusterGroupName]) {
|
|
351
|
+
features = (feature.get('features') as Feature[]) ?? [feature];
|
|
352
|
+
}
|
|
353
|
+
const size = features.length;
|
|
354
|
+
if (size > 1) {
|
|
355
|
+
const { template, cacheKey, context } = this._templateFunction(
|
|
356
|
+
this,
|
|
357
|
+
features,
|
|
358
|
+
getLayerByName,
|
|
359
|
+
);
|
|
360
|
+
if (!this._styleCache.has(cacheKey)) {
|
|
361
|
+
try {
|
|
362
|
+
const src = `data:image/svg+xml,${encodeURIComponent(
|
|
363
|
+
renderTemplate(template, {
|
|
364
|
+
// XXX document what parameters are past to the object
|
|
365
|
+
text: this.getClusterText(size),
|
|
366
|
+
fillColor: this._fillColor,
|
|
367
|
+
strokeColor: this._strokeColor,
|
|
368
|
+
strokeWidth: this._strokeWidth,
|
|
369
|
+
textColor: this._textColor,
|
|
370
|
+
font: this._font,
|
|
371
|
+
size,
|
|
372
|
+
...context,
|
|
373
|
+
}),
|
|
374
|
+
)}`;
|
|
375
|
+
const scale = this.determineScale(size);
|
|
376
|
+
this._styleCache.set(
|
|
377
|
+
cacheKey,
|
|
378
|
+
new Style({
|
|
379
|
+
image: new Icon({
|
|
380
|
+
src,
|
|
381
|
+
scale,
|
|
382
|
+
anchor: [0.5, 0.5], // XXX make configurable?
|
|
383
|
+
size: [64, 64], // XXX make configurable?
|
|
384
|
+
}),
|
|
385
|
+
}),
|
|
386
|
+
);
|
|
387
|
+
} catch (e) {
|
|
388
|
+
this.getLogger().error('Error creating cluster style', e);
|
|
389
|
+
this._styleCache.set(cacheKey, new Style({}));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return this._styleCache.get(cacheKey)!;
|
|
393
|
+
} else if (size === 1) {
|
|
394
|
+
const singleFeature = features[0][originalFeatureSymbol] || features[0];
|
|
395
|
+
if (singleFeature[vcsLayerName]) {
|
|
396
|
+
const layer = getLayerByName(singleFeature[vcsLayerName]);
|
|
397
|
+
|
|
398
|
+
let style =
|
|
399
|
+
singleFeature[highlighted]?.style ?? singleFeature.getStyle();
|
|
400
|
+
if (!style && layer) {
|
|
401
|
+
({ style } = layer.style);
|
|
402
|
+
}
|
|
403
|
+
if (style instanceof Style) {
|
|
404
|
+
return style;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (typeof style === 'function') {
|
|
408
|
+
return style(singleFeature, resolution) as Style;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return undefined;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
return styleFunction as StyleFunction;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Clears the style cache to ensure new changes can take effect.
|
|
421
|
+
* @api
|
|
422
|
+
*/
|
|
423
|
+
clearCache(): void {
|
|
424
|
+
this._styleCache.clear();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
toJSON(): VectorClusterStyleItemOptions {
|
|
428
|
+
const config: Partial<VectorClusterStyleItemOptions> = super.toJSON();
|
|
429
|
+
const defaultOptions = VectorClusterStyleItem.getDefaultOptions();
|
|
430
|
+
if (this.template !== defaultOptions.template) {
|
|
431
|
+
config.template = this.template;
|
|
432
|
+
}
|
|
433
|
+
if (this.fillColor !== defaultOptions.fillColor) {
|
|
434
|
+
config.fillColor = this.fillColor;
|
|
435
|
+
}
|
|
436
|
+
if (this.strokeColor !== defaultOptions.strokeColor) {
|
|
437
|
+
config.strokeColor = this.strokeColor;
|
|
438
|
+
}
|
|
439
|
+
if (this.strokeWidth !== defaultOptions.strokeWidth) {
|
|
440
|
+
config.strokeWidth = this.strokeWidth;
|
|
441
|
+
}
|
|
442
|
+
if (this.textColor !== defaultOptions.textColor) {
|
|
443
|
+
config.textColor = this.textColor;
|
|
444
|
+
}
|
|
445
|
+
if (this.font !== defaultOptions.font) {
|
|
446
|
+
config.font = this.font;
|
|
447
|
+
}
|
|
448
|
+
const { breaks } = this;
|
|
449
|
+
if (
|
|
450
|
+
breaks.length !== defaultOptions.breaks.length ||
|
|
451
|
+
breaks.some((b) => !defaultOptions.breaks.includes(b))
|
|
452
|
+
) {
|
|
453
|
+
config.breaks = breaks;
|
|
454
|
+
}
|
|
455
|
+
if (this.zeroScaleOffset !== defaultOptions.zeroScaleOffset) {
|
|
456
|
+
config.zeroScaleOffset = this.zeroScaleOffset;
|
|
457
|
+
}
|
|
458
|
+
if (this.scaleFactor !== defaultOptions.scaleFactor) {
|
|
459
|
+
config.scaleFactor = this.scaleFactor;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return config;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
equals(other: VectorClusterStyleItem): boolean {
|
|
466
|
+
const thisJson = this.toJSON();
|
|
467
|
+
delete thisJson.name;
|
|
468
|
+
|
|
469
|
+
const otherJson = other.toJSON();
|
|
470
|
+
delete otherJson.name;
|
|
471
|
+
|
|
472
|
+
return deepEqual(thisJson, otherJson);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
destroy(): void {
|
|
476
|
+
this.clearCache();
|
|
477
|
+
this.styleChanged.destroy();
|
|
478
|
+
super.destroy();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export function getDefaultClusterStyleItem(): VectorClusterStyleItem {
|
|
483
|
+
return new VectorClusterStyleItem({});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export function getDefaultClusterHighlightStyleItem(): VectorClusterStyleItemOptions {
|
|
487
|
+
return new VectorClusterStyleItem({
|
|
488
|
+
fillColor: '#409D76',
|
|
489
|
+
});
|
|
490
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CustomDataSource, EntityCollection, SplitDirection, Scene } from '@vcmap-cesium/engine';
|
|
2
|
-
import { StyleLike } from 'ol/style/Style.js';
|
|
3
|
-
import type { Feature } from 'ol/index.js';
|
|
4
|
-
import { CesiumVectorContext } from './vectorContext.js';
|
|
5
|
-
import VectorProperties from '../vectorProperties.js';
|
|
6
|
-
declare class ClusterContext implements CesiumVectorContext {
|
|
7
|
-
entities: EntityCollection;
|
|
8
|
-
splitDirection: SplitDirection;
|
|
9
|
-
private _splitDirectionProperty;
|
|
10
|
-
private _featureItems;
|
|
11
|
-
private _convertingFeatures;
|
|
12
|
-
constructor(dataSource: CustomDataSource, splitDirection: SplitDirection);
|
|
13
|
-
private _addConvertedItems;
|
|
14
|
-
addFeature(feature: Feature, style: StyleLike, vectorProperties: VectorProperties, scene: Scene): Promise<void>;
|
|
15
|
-
removeFeature(feature: Feature): void;
|
|
16
|
-
updateSplitDirection(splitDirection: SplitDirection): void;
|
|
17
|
-
clear(): void;
|
|
18
|
-
destroy(): void;
|
|
19
|
-
}
|
|
20
|
-
export default ClusterContext;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clusterContext.js","sourceRoot":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
|
4
|
-
Entity,
|
|
5
|
-
SplitDirection,
|
|
6
|
-
Scene,
|
|
7
|
-
ConstantProperty,
|
|
8
|
-
} from '@vcmap-cesium/engine';
|
|
9
|
-
import { StyleLike } from 'ol/style/Style.js';
|
|
10
|
-
import type { Feature } from 'ol/index.js';
|
|
11
|
-
import {
|
|
12
|
-
CesiumVectorContext,
|
|
13
|
-
setReferenceForPicking,
|
|
14
|
-
} from './vectorContext.js';
|
|
15
|
-
import VectorProperties from '../vectorProperties.js';
|
|
16
|
-
import convert, { ConvertedItem } from '../../util/featureconverter/convert.js';
|
|
17
|
-
|
|
18
|
-
class ClusterContext implements CesiumVectorContext {
|
|
19
|
-
entities: EntityCollection;
|
|
20
|
-
|
|
21
|
-
splitDirection: SplitDirection;
|
|
22
|
-
|
|
23
|
-
private _splitDirectionProperty: ConstantProperty;
|
|
24
|
-
|
|
25
|
-
private _featureItems = new Map<Feature, (() => void)[]>();
|
|
26
|
-
|
|
27
|
-
private _convertingFeatures: Map<Feature, () => void> = new Map();
|
|
28
|
-
|
|
29
|
-
constructor(dataSource: CustomDataSource, splitDirection: SplitDirection) {
|
|
30
|
-
this.entities = dataSource.entities;
|
|
31
|
-
this.splitDirection = splitDirection;
|
|
32
|
-
this._splitDirectionProperty = new ConstantProperty(splitDirection);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private _addConvertedItems(
|
|
36
|
-
feature: Feature,
|
|
37
|
-
allowPicking: boolean,
|
|
38
|
-
items: ConvertedItem[],
|
|
39
|
-
): void {
|
|
40
|
-
const removeItems = items
|
|
41
|
-
.map((item) => {
|
|
42
|
-
let instance: Entity | undefined;
|
|
43
|
-
let removeItem: (() => void) | undefined;
|
|
44
|
-
if (item.type === 'billboard') {
|
|
45
|
-
instance = this.entities.add({
|
|
46
|
-
billboard: {
|
|
47
|
-
...item.item,
|
|
48
|
-
splitDirection: this._splitDirectionProperty,
|
|
49
|
-
},
|
|
50
|
-
position: item.item.position,
|
|
51
|
-
});
|
|
52
|
-
} else if (item.type === 'label') {
|
|
53
|
-
instance = this.entities.add({
|
|
54
|
-
label: item.item,
|
|
55
|
-
position: item.item.position,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (instance) {
|
|
60
|
-
removeItem = (): void => {
|
|
61
|
-
this.entities.remove(instance);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (instance) {
|
|
66
|
-
if (allowPicking) {
|
|
67
|
-
setReferenceForPicking(feature, instance);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return removeItem;
|
|
71
|
-
})
|
|
72
|
-
.filter((i): i is () => void => i != null);
|
|
73
|
-
|
|
74
|
-
this._featureItems.set(feature, removeItems);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async addFeature(
|
|
78
|
-
feature: Feature,
|
|
79
|
-
style: StyleLike,
|
|
80
|
-
vectorProperties: VectorProperties,
|
|
81
|
-
scene: Scene,
|
|
82
|
-
): Promise<void> {
|
|
83
|
-
this._convertingFeatures.get(feature)?.();
|
|
84
|
-
let deleted = false;
|
|
85
|
-
this._convertingFeatures.set(feature, () => {
|
|
86
|
-
deleted = true;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const convertedItems = await convert(
|
|
90
|
-
feature,
|
|
91
|
-
style,
|
|
92
|
-
vectorProperties,
|
|
93
|
-
scene,
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
this._featureItems.get(feature)?.forEach((removeItem) => removeItem());
|
|
97
|
-
|
|
98
|
-
if (deleted) {
|
|
99
|
-
convertedItems.forEach((item) => {
|
|
100
|
-
if (item.type === 'primitive') {
|
|
101
|
-
item.item.destroy();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
this._addConvertedItems(
|
|
106
|
-
feature,
|
|
107
|
-
vectorProperties.getAllowPicking(feature),
|
|
108
|
-
convertedItems,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
removeFeature(feature: Feature): void {
|
|
114
|
-
this._convertingFeatures.get(feature)?.();
|
|
115
|
-
this._convertingFeatures.delete(feature);
|
|
116
|
-
this._featureItems.get(feature)?.forEach((removeItem) => removeItem());
|
|
117
|
-
this._featureItems.delete(feature);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// eslint-disable-next-line class-methods-use-this,no-unused-vars
|
|
121
|
-
updateSplitDirection(splitDirection: SplitDirection): void {
|
|
122
|
-
this.splitDirection = splitDirection;
|
|
123
|
-
this._splitDirectionProperty.setValue(this.splitDirection);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
clear(): void {
|
|
127
|
-
this.entities.removeAll();
|
|
128
|
-
this._featureItems.clear();
|
|
129
|
-
this._convertingFeatures.forEach((destroy) => {
|
|
130
|
-
destroy();
|
|
131
|
-
});
|
|
132
|
-
this._convertingFeatures.clear();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
destroy(): void {
|
|
136
|
-
this.clear();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default ClusterContext;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Cluster from 'ol/source/Cluster.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @class
|
|
5
|
-
* @extends {import("ol/source/Cluster").default}
|
|
6
|
-
* @memberOf ol
|
|
7
|
-
*/
|
|
8
|
-
class VcsCluster extends Cluster {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
/**
|
|
12
|
-
* @type {boolean}
|
|
13
|
-
*/
|
|
14
|
-
this._paused = false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
pause() {
|
|
18
|
-
this._paused = true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
resume() {
|
|
22
|
-
this._paused = false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
isPaused() {
|
|
26
|
-
return this._paused;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
refresh() {
|
|
30
|
-
if (this._paused) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
super.refresh();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default VcsCluster;
|