@vcmap/core 6.0.7 → 6.1.0-rc.1
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 +13 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +3 -0
- package/dist/src/interaction/abstractInteraction.d.ts +4 -0
- package/dist/src/interaction/abstractInteraction.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.d.ts +3 -0
- package/dist/src/interaction/featureAtPixelInteraction.js +98 -62
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.js +16 -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 +16 -12
- package/dist/src/map/vcsMap.js +78 -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/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/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 +4 -0
- package/dist/src/vcsApp.js +10 -0
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/src/vcsModule.d.ts +4 -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 +35 -1
- package/package.json +3 -1
- package/src/cesium/cesium.d.ts +3 -0
- package/src/interaction/abstractInteraction.ts +4 -0
- package/src/interaction/featureAtPixelInteraction.ts +158 -84
- package/src/interaction/featureProviderInteraction.ts +31 -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 +102 -47
- package/src/ol/ol.d.ts +3 -0
- package/src/ol/source/{ClusterEnhancedVectorSource.js → ClusterEnhancedVectorSource.ts} +7 -10
- package/src/ol/source/VcsCluster.ts +58 -0
- package/src/util/layerCollection.ts +90 -12
- package/src/util/mapCollection.ts +53 -2
- package/src/util/rotation.ts +215 -0
- package/src/util/vcsTemplate.ts +373 -0
- package/src/vcsApp.ts +29 -0
- package/src/vcsModule.ts +4 -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,374 @@
|
|
|
1
|
+
import Style from 'ol/style/Style.js';
|
|
2
|
+
import Icon from 'ol/style/Icon.js';
|
|
3
|
+
import { check, is, oneOf } from '@vcsuite/check';
|
|
4
|
+
import { parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
5
|
+
import deepEqual from 'fast-deep-equal';
|
|
6
|
+
import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
7
|
+
import { highlighted } from '../layer/featureVisibility.js';
|
|
8
|
+
import VcsObject from '../vcsObject.js';
|
|
9
|
+
import VcsEvent from '../vcsEvent.js';
|
|
10
|
+
import { renderTemplate } from '../util/vcsTemplate.js';
|
|
11
|
+
import { vectorClusterGroupName } from './vectorClusterSymbols.js';
|
|
12
|
+
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
13
|
+
function createDefaultTemplateFunction(template) {
|
|
14
|
+
return (styleItem, features) => ({
|
|
15
|
+
template,
|
|
16
|
+
cacheKey: String(styleItem.findBreakIndex(features.length)),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export default class VectorClusterStyleItem extends VcsObject {
|
|
20
|
+
static get className() {
|
|
21
|
+
return 'VectorClusterStyleItem';
|
|
22
|
+
}
|
|
23
|
+
static getDefaultOptions() {
|
|
24
|
+
return {
|
|
25
|
+
type: 'VectorClusterStyleItem',
|
|
26
|
+
name: '',
|
|
27
|
+
properties: {},
|
|
28
|
+
template: [
|
|
29
|
+
'<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">',
|
|
30
|
+
' <defs><style>',
|
|
31
|
+
' .cls-1 {',
|
|
32
|
+
' fill: {{ fillColor }};',
|
|
33
|
+
' stroke: {{ strokeColor }};',
|
|
34
|
+
' stroke-miterlimit: 10;',
|
|
35
|
+
' stroke-width: {{ strokeWidth }}px;',
|
|
36
|
+
' }',
|
|
37
|
+
' .text {',
|
|
38
|
+
' font: {{ font }};',
|
|
39
|
+
' fill: {{ textColor }};',
|
|
40
|
+
' text-anchor: middle;',
|
|
41
|
+
' alignment-baseline: middle;',
|
|
42
|
+
' dominant-baseline: middle;',
|
|
43
|
+
' }',
|
|
44
|
+
' </style></defs>',
|
|
45
|
+
' <circle id="outer" class="cls-1" cx="32" cy="32" r="30"/>',
|
|
46
|
+
' <text x="32" y="32" class="text">',
|
|
47
|
+
' {{ text }}',
|
|
48
|
+
' </text>',
|
|
49
|
+
'</svg>',
|
|
50
|
+
].join(''),
|
|
51
|
+
fillColor: '#ffffff',
|
|
52
|
+
strokeColor: '#2a2a2a',
|
|
53
|
+
strokeWidth: 4,
|
|
54
|
+
textColor: '#2a2a2a',
|
|
55
|
+
font: 'normal normal 700 32px Calibri-Bold,Calibri',
|
|
56
|
+
breaks: [2, 3, 4, 5, 10, 15, 20, 25],
|
|
57
|
+
zeroScaleOffset: 3,
|
|
58
|
+
scaleFactor: 0.08,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
_template = '';
|
|
62
|
+
_templateFunction = createDefaultTemplateFunction('');
|
|
63
|
+
_breaks = [];
|
|
64
|
+
_zeroScaleOffset;
|
|
65
|
+
_fillColor;
|
|
66
|
+
_strokeColor;
|
|
67
|
+
_strokeWidth;
|
|
68
|
+
_textColor;
|
|
69
|
+
_font;
|
|
70
|
+
_scaleFactor;
|
|
71
|
+
_styleCache = new Map();
|
|
72
|
+
styleChanged = new VcsEvent();
|
|
73
|
+
constructor(options) {
|
|
74
|
+
super(options);
|
|
75
|
+
const defaultOptions = VectorClusterStyleItem.getDefaultOptions();
|
|
76
|
+
const configTemplate = Array.isArray(options.template)
|
|
77
|
+
? options.template.join('')
|
|
78
|
+
: options.template;
|
|
79
|
+
this.setTemplate(configTemplate ?? defaultOptions.template);
|
|
80
|
+
this._breaks = options.breaks?.slice() ?? defaultOptions.breaks;
|
|
81
|
+
this._zeroScaleOffset = parseInteger(options.zeroScaleOffset, defaultOptions.zeroScaleOffset);
|
|
82
|
+
this._fillColor = options.fillColor ?? defaultOptions.fillColor;
|
|
83
|
+
this._strokeColor = options.strokeColor ?? defaultOptions.strokeColor;
|
|
84
|
+
this._strokeWidth = parseNumber(options.strokeWidth, defaultOptions.strokeWidth);
|
|
85
|
+
this._textColor = options.textColor ?? defaultOptions.textColor;
|
|
86
|
+
this._font = options.font ?? defaultOptions.font;
|
|
87
|
+
this._scaleFactor = parseNumber(options.scaleFactor, defaultOptions.scaleFactor);
|
|
88
|
+
this.styleChanged.addEventListener(() => {
|
|
89
|
+
this.clearCache();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* An array of cluster sizes to break at. Typically the first couple of sizes are
|
|
94
|
+
* a series (meaning: not grouped). Later breaks are non sequential and used for grouping
|
|
95
|
+
* clusters larger. [2, 3, 4, 5, 10] would start grouping at clusters larger or equal 5
|
|
96
|
+
* entries.
|
|
97
|
+
*/
|
|
98
|
+
get breaks() {
|
|
99
|
+
return this._breaks.slice();
|
|
100
|
+
}
|
|
101
|
+
set breaks(breaks) {
|
|
102
|
+
check(breaks, [Number]);
|
|
103
|
+
const sortedBreaks = breaks.sort((a, b) => (a < b ? -1 : 1));
|
|
104
|
+
const changed = sortedBreaks.find((b, i) => b !== this._breaks[i]);
|
|
105
|
+
if (changed) {
|
|
106
|
+
this._breaks = breaks;
|
|
107
|
+
this.styleChanged.raiseEvent();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The index of breaks to st. for indexes [2, 3, 4, 5, 10] and a zeroScale offset of 3
|
|
112
|
+
* would lead to icons 2, 3, 4 having the same size and no "+" attached. 5 and 10
|
|
113
|
+
* would be scaled by the scale factor and a "+" added to the text
|
|
114
|
+
*/
|
|
115
|
+
get zeroScaleOffset() {
|
|
116
|
+
return this._zeroScaleOffset;
|
|
117
|
+
}
|
|
118
|
+
set zeroScaleOffset(zeroScaleOffset) {
|
|
119
|
+
check(zeroScaleOffset, Number);
|
|
120
|
+
if (zeroScaleOffset !== this._zeroScaleOffset) {
|
|
121
|
+
this._zeroScaleOffset = zeroScaleOffset;
|
|
122
|
+
this.styleChanged.raiseEvent();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The fill color. This must be a css string.
|
|
127
|
+
*/
|
|
128
|
+
get fillColor() {
|
|
129
|
+
return this._fillColor;
|
|
130
|
+
}
|
|
131
|
+
set fillColor(fillColor) {
|
|
132
|
+
check(fillColor, String);
|
|
133
|
+
if (fillColor !== this._fillColor) {
|
|
134
|
+
this._fillColor = fillColor;
|
|
135
|
+
this.styleChanged.raiseEvent();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The stroke color. This must be a css string.
|
|
140
|
+
*/
|
|
141
|
+
get strokeColor() {
|
|
142
|
+
return this._strokeColor;
|
|
143
|
+
}
|
|
144
|
+
set strokeColor(strokeColor) {
|
|
145
|
+
check(strokeColor, String);
|
|
146
|
+
if (strokeColor !== this._strokeColor) {
|
|
147
|
+
this._strokeColor = strokeColor;
|
|
148
|
+
this.styleChanged.raiseEvent();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The stroke color. This must be a css string.
|
|
153
|
+
*/
|
|
154
|
+
get strokeWidth() {
|
|
155
|
+
return this._strokeWidth;
|
|
156
|
+
}
|
|
157
|
+
set strokeWidth(strokeWidth) {
|
|
158
|
+
check(strokeWidth, Number);
|
|
159
|
+
if (strokeWidth !== this._strokeWidth) {
|
|
160
|
+
this._strokeWidth = strokeWidth;
|
|
161
|
+
this.styleChanged.raiseEvent();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The text color. This must be a css string.
|
|
166
|
+
*/
|
|
167
|
+
get textColor() {
|
|
168
|
+
return this._textColor;
|
|
169
|
+
}
|
|
170
|
+
set textColor(textColor) {
|
|
171
|
+
check(textColor, String);
|
|
172
|
+
if (textColor !== this._textColor) {
|
|
173
|
+
this._textColor = textColor;
|
|
174
|
+
this.styleChanged.raiseEvent();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The font to use. Must be css font attribute.
|
|
179
|
+
*/
|
|
180
|
+
get font() {
|
|
181
|
+
return this._font;
|
|
182
|
+
}
|
|
183
|
+
set font(font) {
|
|
184
|
+
check(font, String);
|
|
185
|
+
if (font !== this._font) {
|
|
186
|
+
this._font = font;
|
|
187
|
+
this.styleChanged.raiseEvent();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The factor by which to multiply the index of the used break grouping
|
|
192
|
+
* (subtracted by the zeroScaleOffset)
|
|
193
|
+
*/
|
|
194
|
+
get scaleFactor() {
|
|
195
|
+
return this._scaleFactor;
|
|
196
|
+
}
|
|
197
|
+
set scaleFactor(scaleFactor) {
|
|
198
|
+
check(scaleFactor, Number);
|
|
199
|
+
if (scaleFactor !== this._scaleFactor) {
|
|
200
|
+
this._scaleFactor = scaleFactor;
|
|
201
|
+
this.styleChanged.raiseEvent();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
get template() {
|
|
205
|
+
return this._template;
|
|
206
|
+
}
|
|
207
|
+
setTemplate(template) {
|
|
208
|
+
check(template, oneOf(String, Function));
|
|
209
|
+
if (template !== this._template) {
|
|
210
|
+
this._template = template;
|
|
211
|
+
if (is(this._template, String)) {
|
|
212
|
+
this._templateFunction = createDefaultTemplateFunction(this._template);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this._templateFunction = this._template;
|
|
216
|
+
}
|
|
217
|
+
this.styleChanged.raiseEvent();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Finds the breaks index of a specified cluster size.
|
|
222
|
+
*/
|
|
223
|
+
findBreakIndex(size) {
|
|
224
|
+
const clusterTextIndex = this._breaks.findIndex((classBreak, i) => i > this._zeroScaleOffset ? size < classBreak : size <= classBreak);
|
|
225
|
+
return clusterTextIndex === -1 ? this._breaks.length : clusterTextIndex;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Gets the cluster text based on breaks and zeroScaleOffset. Adds a + to all sizes with an index larger then the zeroScaleOffset.
|
|
229
|
+
*/
|
|
230
|
+
getClusterText(size) {
|
|
231
|
+
if (size === 1) {
|
|
232
|
+
return '';
|
|
233
|
+
}
|
|
234
|
+
const clusterTextIndex = this.findBreakIndex(size);
|
|
235
|
+
let clusterText = this._breaks[clusterTextIndex > this._zeroScaleOffset
|
|
236
|
+
? clusterTextIndex - 1
|
|
237
|
+
: clusterTextIndex].toString();
|
|
238
|
+
if (clusterTextIndex > this._zeroScaleOffset) {
|
|
239
|
+
clusterText = `${clusterText}+`;
|
|
240
|
+
}
|
|
241
|
+
return clusterText;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Determines the scale based on break index and zeroScaleOffset. Cluster sizes with an index less then zeroScaleOffset
|
|
245
|
+
* are not scaled.
|
|
246
|
+
*/
|
|
247
|
+
determineScale(size) {
|
|
248
|
+
const index = this.findBreakIndex(size);
|
|
249
|
+
let indexScale = index - this._zeroScaleOffset;
|
|
250
|
+
indexScale = indexScale > 0 ? indexScale : 0;
|
|
251
|
+
return 0.6 + this._scaleFactor * indexScale;
|
|
252
|
+
}
|
|
253
|
+
createStyleFunction(getLayerByName) {
|
|
254
|
+
const styleFunction = (feature, resolution) => {
|
|
255
|
+
let features = [feature];
|
|
256
|
+
if (feature[vectorClusterGroupName]) {
|
|
257
|
+
features = feature.get('features') ?? [feature];
|
|
258
|
+
}
|
|
259
|
+
const size = features.length;
|
|
260
|
+
if (size > 1) {
|
|
261
|
+
const { template, cacheKey, context } = this._templateFunction(this, features, getLayerByName);
|
|
262
|
+
if (!this._styleCache.has(cacheKey)) {
|
|
263
|
+
try {
|
|
264
|
+
const src = `data:image/svg+xml,${encodeURIComponent(renderTemplate(template, {
|
|
265
|
+
// XXX document what parameters are past to the object
|
|
266
|
+
text: this.getClusterText(size),
|
|
267
|
+
fillColor: this._fillColor,
|
|
268
|
+
strokeColor: this._strokeColor,
|
|
269
|
+
strokeWidth: this._strokeWidth,
|
|
270
|
+
textColor: this._textColor,
|
|
271
|
+
font: this._font,
|
|
272
|
+
size,
|
|
273
|
+
...context,
|
|
274
|
+
}))}`;
|
|
275
|
+
const scale = this.determineScale(size);
|
|
276
|
+
this._styleCache.set(cacheKey, new Style({
|
|
277
|
+
image: new Icon({
|
|
278
|
+
src,
|
|
279
|
+
scale,
|
|
280
|
+
anchor: [0.5, 0.5], // XXX make configurable?
|
|
281
|
+
size: [64, 64], // XXX make configurable?
|
|
282
|
+
}),
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
catch (e) {
|
|
286
|
+
this.getLogger().error('Error creating cluster style', e);
|
|
287
|
+
this._styleCache.set(cacheKey, new Style({}));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return this._styleCache.get(cacheKey);
|
|
291
|
+
}
|
|
292
|
+
else if (size === 1) {
|
|
293
|
+
const singleFeature = features[0][originalFeatureSymbol] || features[0];
|
|
294
|
+
if (singleFeature[vcsLayerName]) {
|
|
295
|
+
const layer = getLayerByName(singleFeature[vcsLayerName]);
|
|
296
|
+
let style = singleFeature[highlighted]?.style ?? singleFeature.getStyle();
|
|
297
|
+
if (!style && layer) {
|
|
298
|
+
({ style } = layer.style);
|
|
299
|
+
}
|
|
300
|
+
if (style instanceof Style) {
|
|
301
|
+
return style;
|
|
302
|
+
}
|
|
303
|
+
if (typeof style === 'function') {
|
|
304
|
+
return style(singleFeature, resolution);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return undefined;
|
|
309
|
+
};
|
|
310
|
+
return styleFunction;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Clears the style cache to ensure new changes can take effect.
|
|
314
|
+
* @api
|
|
315
|
+
*/
|
|
316
|
+
clearCache() {
|
|
317
|
+
this._styleCache.clear();
|
|
318
|
+
}
|
|
319
|
+
toJSON() {
|
|
320
|
+
const config = super.toJSON();
|
|
321
|
+
const defaultOptions = VectorClusterStyleItem.getDefaultOptions();
|
|
322
|
+
if (this.template !== defaultOptions.template) {
|
|
323
|
+
config.template = this.template;
|
|
324
|
+
}
|
|
325
|
+
if (this.fillColor !== defaultOptions.fillColor) {
|
|
326
|
+
config.fillColor = this.fillColor;
|
|
327
|
+
}
|
|
328
|
+
if (this.strokeColor !== defaultOptions.strokeColor) {
|
|
329
|
+
config.strokeColor = this.strokeColor;
|
|
330
|
+
}
|
|
331
|
+
if (this.strokeWidth !== defaultOptions.strokeWidth) {
|
|
332
|
+
config.strokeWidth = this.strokeWidth;
|
|
333
|
+
}
|
|
334
|
+
if (this.textColor !== defaultOptions.textColor) {
|
|
335
|
+
config.textColor = this.textColor;
|
|
336
|
+
}
|
|
337
|
+
if (this.font !== defaultOptions.font) {
|
|
338
|
+
config.font = this.font;
|
|
339
|
+
}
|
|
340
|
+
const { breaks } = this;
|
|
341
|
+
if (breaks.length !== defaultOptions.breaks.length ||
|
|
342
|
+
breaks.some((b) => !defaultOptions.breaks.includes(b))) {
|
|
343
|
+
config.breaks = breaks;
|
|
344
|
+
}
|
|
345
|
+
if (this.zeroScaleOffset !== defaultOptions.zeroScaleOffset) {
|
|
346
|
+
config.zeroScaleOffset = this.zeroScaleOffset;
|
|
347
|
+
}
|
|
348
|
+
if (this.scaleFactor !== defaultOptions.scaleFactor) {
|
|
349
|
+
config.scaleFactor = this.scaleFactor;
|
|
350
|
+
}
|
|
351
|
+
return config;
|
|
352
|
+
}
|
|
353
|
+
equals(other) {
|
|
354
|
+
const thisJson = this.toJSON();
|
|
355
|
+
delete thisJson.name;
|
|
356
|
+
const otherJson = other.toJSON();
|
|
357
|
+
delete otherJson.name;
|
|
358
|
+
return deepEqual(thisJson, otherJson);
|
|
359
|
+
}
|
|
360
|
+
destroy() {
|
|
361
|
+
this.clearCache();
|
|
362
|
+
this.styleChanged.destroy();
|
|
363
|
+
super.destroy();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
export function getDefaultClusterStyleItem() {
|
|
367
|
+
return new VectorClusterStyleItem({});
|
|
368
|
+
}
|
|
369
|
+
export function getDefaultClusterHighlightStyleItem() {
|
|
370
|
+
return new VectorClusterStyleItem({
|
|
371
|
+
fillColor: '#409D76',
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=vectorClusterStyleItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorClusterStyleItem.js","sourceRoot":"","sources":["../../../src/vectorCluster/vectorClusterStyleItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,mBAAmB,CAAC;AACzD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,SAA+B,MAAM,iBAAiB,CAAC;AAC9D,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoBxD,SAAS,6BAA6B,CACpC,QAAgB;IAEhB,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC/B,QAAQ;QACR,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC5D,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAS;IAC3D,MAAM,KAAK,SAAS;QAClB,OAAO,wBAAwB,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,iBAAiB;QACtB,OAA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AW,GAAG,IAAI,CAAC,WAAW,CAAC;QACxC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAA6B;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC/B,OAAO,QAAQ,CAAC,IAAI,CAAC;QAErB,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC,IAAI,CAAC;QAEtB,OAAO,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5B,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,sBAAsB,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,OAAO,IAAI,sBAAsB,CAAC;QAChC,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const vectorClusterGroupName: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorClusterSymbols.js","sourceRoot":"","sources":["../../../src/vectorCluster/vectorClusterSymbols.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC"}
|
package/index.ts
CHANGED
|
@@ -62,7 +62,6 @@ export {
|
|
|
62
62
|
getExtentFromTileset,
|
|
63
63
|
default as CesiumTilesetCesiumImpl,
|
|
64
64
|
} from './src/layer/cesium/cesiumTilesetCesiumImpl.js';
|
|
65
|
-
export { default as ClusterContext } from './src/layer/cesium/clusterContext.js';
|
|
66
65
|
export { default as DataSourceCesiumImpl } from './src/layer/cesium/dataSourceCesiumImpl.js';
|
|
67
66
|
export { default as OpenStreetMapCesiumImpl } from './src/layer/cesium/openStreetMapCesiumImpl.js';
|
|
68
67
|
export { default as RasterLayerCesiumImpl } from './src/layer/cesium/rasterLayerCesiumImpl.js';
|
|
@@ -105,6 +104,10 @@ export {
|
|
|
105
104
|
getTileHash,
|
|
106
105
|
getTileWgs84Extent,
|
|
107
106
|
} from './src/layer/cesium/vcsTile/vcsTileHelpers.js';
|
|
107
|
+
export {
|
|
108
|
+
createSourceVectorContextSync,
|
|
109
|
+
SourceVectorContextSync,
|
|
110
|
+
} from './src/layer/cesium/sourceVectorContextSync.js';
|
|
108
111
|
export { default as CzmlLayer, CzmlOptions } from './src/layer/czmlLayer.js';
|
|
109
112
|
export {
|
|
110
113
|
default as DataSourceLayer,
|
|
@@ -183,6 +186,10 @@ export {
|
|
|
183
186
|
setNewGeometry,
|
|
184
187
|
} from './src/layer/oblique/obliqueHelpers.js';
|
|
185
188
|
export { default as VectorObliqueImpl } from './src/layer/oblique/vectorObliqueImpl.js';
|
|
189
|
+
export {
|
|
190
|
+
createSourceObliqueSync,
|
|
191
|
+
SourceObliqueSync,
|
|
192
|
+
} from './src/layer/oblique/sourceObliqueSync.js';
|
|
186
193
|
export {
|
|
187
194
|
default as OpenStreetMapLayer,
|
|
188
195
|
OpenStreetMapOptions,
|
|
@@ -257,6 +264,28 @@ export {
|
|
|
257
264
|
default as URLTemplateTileProvider,
|
|
258
265
|
URLTemplateTileProviderOptions,
|
|
259
266
|
} from './src/layer/tileProvider/urlTemplateTileProvider.js';
|
|
267
|
+
export {
|
|
268
|
+
default as ClusterContext,
|
|
269
|
+
default as VectorClusterCesiumContext,
|
|
270
|
+
} from './src/vectorCluster/vectorClusterCesiumContext.js';
|
|
271
|
+
export {
|
|
272
|
+
default as VectorClusterStyleItem,
|
|
273
|
+
VectorClusterStyleItemOptions,
|
|
274
|
+
VectorClusterTemplateFunction,
|
|
275
|
+
getDefaultClusterStyleItem,
|
|
276
|
+
getDefaultClusterHighlightStyleItem,
|
|
277
|
+
} from './src/vectorCluster/vectorClusterStyleItem.js';
|
|
278
|
+
export { default as VectorClusterGroupCesiumImpl } from './src/vectorCluster/vectorClusterGroupCesiumImpl.js';
|
|
279
|
+
export { default as VectorClusterGroupOpenlayersImpl } from './src/vectorCluster/vectorClusterGroupOpenlayersImpl.js';
|
|
280
|
+
export {
|
|
281
|
+
default as VectorClusterGroup,
|
|
282
|
+
VectorClusterGroupOptions,
|
|
283
|
+
VectorClusterGroupImplementationOptions,
|
|
284
|
+
} from './src/vectorCluster/vectorClusterGroup.js';
|
|
285
|
+
export { default as VectorClusterGroupImpl } from './src/vectorCluster/vectorClusterGroupImpl.js';
|
|
286
|
+
export { default as VectorClusterGroupObliqueImpl } from './src/vectorCluster/vectorClusterGroupObliqueImpl.js';
|
|
287
|
+
export { default as VectorClusterGroupCollection } from './src/vectorCluster/vectorClusterGroupCollection.js';
|
|
288
|
+
export { vectorClusterGroupName } from './src/vectorCluster/vectorClusterSymbols.js';
|
|
260
289
|
export {
|
|
261
290
|
default as TMSLayer,
|
|
262
291
|
TMSOptions,
|
|
@@ -833,3 +862,8 @@ export {
|
|
|
833
862
|
} from './src/util/flight/flightVisualizer.js';
|
|
834
863
|
export { getTileLoadFunction } from './src/layer/openlayers/loadFunctionHelpers.js';
|
|
835
864
|
export { default as ModelFill } from './src/style/modelFill.js';
|
|
865
|
+
export { renderTemplate } from './src/util/vcsTemplate.js';
|
|
866
|
+
export {
|
|
867
|
+
startRotation,
|
|
868
|
+
rotationMapControlSymbol,
|
|
869
|
+
} from './src/util/rotation.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/core",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-rc.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/chai": "^4.3.16",
|
|
42
|
+
"@types/chai-as-promised": "^8.0.1",
|
|
42
43
|
"@types/geojson": "^7946.0.10",
|
|
43
44
|
"@types/mocha": "^10.0.7",
|
|
44
45
|
"@types/node": "^20.16.5",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"c8": "^10.1.2",
|
|
51
52
|
"canvas": "^2.11.2",
|
|
52
53
|
"chai": "^4.4.1",
|
|
54
|
+
"chai-as-promised": "^8.0.1",
|
|
53
55
|
"eslint": "^8.38.0",
|
|
54
56
|
"jsdom": "^24.1.0",
|
|
55
57
|
"jsdom-global": "^3.0.2",
|
package/src/cesium/cesium.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
updateFeatureOverride,
|
|
28
28
|
} from '../layer/cesium/cesiumTilesetCesiumImpl.js';
|
|
29
29
|
import { isTiledFeature } from '../layer/featureStoreLayer.js';
|
|
30
|
+
import { vectorClusterGroupName } from '../vectorCluster/vectorClusterSymbols.js';
|
|
30
31
|
|
|
31
32
|
declare module '@vcmap-cesium/engine' {
|
|
32
33
|
interface Scene {
|
|
@@ -61,6 +62,7 @@ declare module '@vcmap-cesium/engine' {
|
|
|
61
62
|
getPropertyInherited(key: string): any;
|
|
62
63
|
getAttributes(): Record<string, unknown>;
|
|
63
64
|
[vcsLayerName]?: string;
|
|
65
|
+
[vectorClusterGroupName]?: string;
|
|
64
66
|
[globalHidden]?: boolean;
|
|
65
67
|
[hidden]?: boolean;
|
|
66
68
|
[highlighted]?: VectorStyleItem;
|
|
@@ -112,6 +114,7 @@ declare module '@vcmap-cesium/engine' {
|
|
|
112
114
|
|
|
113
115
|
interface CustomDataSource {
|
|
114
116
|
[vcsLayerName]?: string;
|
|
117
|
+
[vectorClusterGroupName]?: string;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
interface CzmlDataSource {
|
|
@@ -58,6 +58,10 @@ export type InteractionEvent = MapEvent & {
|
|
|
58
58
|
* a potential feature at said location
|
|
59
59
|
*/
|
|
60
60
|
feature?: EventFeature;
|
|
61
|
+
/**
|
|
62
|
+
* further features at said location. includes .feature
|
|
63
|
+
*/
|
|
64
|
+
features?: EventFeature[];
|
|
61
65
|
/**
|
|
62
66
|
* if set to true, the event chain is interrupted
|
|
63
67
|
*/
|