@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.
Files changed (146) hide show
  1. package/dist/cesium.d.ts +3 -0
  2. package/dist/index.d.ts +16 -1
  3. package/dist/index.js +16 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/ol.d.ts +8 -1
  6. package/dist/src/featureProvider/featureProviderSymbols.d.ts +5 -0
  7. package/dist/src/featureProvider/featureProviderSymbols.js +5 -1
  8. package/dist/src/featureProvider/featureProviderSymbols.js.map +1 -1
  9. package/dist/src/interaction/featureAtPixelInteraction.js +58 -62
  10. package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
  11. package/dist/src/interaction/featureProviderInteraction.js +25 -13
  12. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  13. package/dist/src/layer/cesium/sourceVectorContextSync.d.ts +27 -0
  14. package/dist/src/layer/cesium/sourceVectorContextSync.js +94 -0
  15. package/dist/src/layer/cesium/sourceVectorContextSync.js.map +1 -0
  16. package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +4 -27
  17. package/dist/src/layer/cesium/vectorCesiumImpl.js +15 -107
  18. package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
  19. package/dist/src/layer/cesium/vectorContext.d.ts +12 -1
  20. package/dist/src/layer/cesium/vectorContext.js +6 -0
  21. package/dist/src/layer/cesium/vectorContext.js.map +1 -1
  22. package/dist/src/layer/layerSymbols.js +1 -1
  23. package/dist/src/layer/layerSymbols.js.map +1 -1
  24. package/dist/src/layer/oblique/sourceObliqueSync.d.ts +18 -0
  25. package/dist/src/layer/oblique/sourceObliqueSync.js +319 -0
  26. package/dist/src/layer/oblique/sourceObliqueSync.js.map +1 -0
  27. package/dist/src/layer/oblique/vectorObliqueImpl.d.ts +2 -40
  28. package/dist/src/layer/oblique/vectorObliqueImpl.js +8 -283
  29. package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
  30. package/dist/src/layer/vectorLayer.d.ts +10 -1
  31. package/dist/src/layer/vectorLayer.js +23 -1
  32. package/dist/src/layer/vectorLayer.js.map +1 -1
  33. package/dist/src/map/baseOLMap.js +8 -1
  34. package/dist/src/map/baseOLMap.js.map +1 -1
  35. package/dist/src/map/cesiumMap.d.ts +2 -0
  36. package/dist/src/map/cesiumMap.js +26 -1
  37. package/dist/src/map/cesiumMap.js.map +1 -1
  38. package/dist/src/map/vcsMap.d.ts +24 -12
  39. package/dist/src/map/vcsMap.js +92 -38
  40. package/dist/src/map/vcsMap.js.map +1 -1
  41. package/dist/src/ol/source/ClusterEnhancedVectorSource.d.ts +6 -4
  42. package/dist/src/ol/source/ClusterEnhancedVectorSource.js +4 -9
  43. package/dist/src/ol/source/ClusterEnhancedVectorSource.js.map +1 -1
  44. package/dist/src/ol/source/VcsCluster.d.ts +10 -10
  45. package/dist/src/ol/source/VcsCluster.js +23 -7
  46. package/dist/src/ol/source/VcsCluster.js.map +1 -1
  47. package/dist/src/util/clipping/clippingPolygonHelper.d.ts +7 -0
  48. package/dist/src/util/clipping/clippingPolygonHelper.js +53 -0
  49. package/dist/src/util/clipping/clippingPolygonHelper.js.map +1 -0
  50. package/dist/src/util/clipping/clippingPolygonObject.d.ts +59 -0
  51. package/dist/src/util/clipping/clippingPolygonObject.js +158 -0
  52. package/dist/src/util/clipping/clippingPolygonObject.js.map +1 -0
  53. package/dist/src/util/clipping/clippingPolygonObjectCollection.d.ts +18 -0
  54. package/dist/src/util/clipping/clippingPolygonObjectCollection.js +167 -0
  55. package/dist/src/util/clipping/clippingPolygonObjectCollection.js.map +1 -0
  56. package/dist/src/util/layerCollection.d.ts +11 -1
  57. package/dist/src/util/layerCollection.js +67 -12
  58. package/dist/src/util/layerCollection.js.map +1 -1
  59. package/dist/src/util/mapCollection.d.ts +16 -1
  60. package/dist/src/util/mapCollection.js +37 -3
  61. package/dist/src/util/mapCollection.js.map +1 -1
  62. package/dist/src/util/renderScreenshot.d.ts +9 -0
  63. package/dist/src/util/renderScreenshot.js +162 -0
  64. package/dist/src/util/renderScreenshot.js.map +1 -0
  65. package/dist/src/util/rotation.d.ts +30 -0
  66. package/dist/src/util/rotation.js +145 -0
  67. package/dist/src/util/rotation.js.map +1 -0
  68. package/dist/src/util/vcsTemplate.d.ts +7 -0
  69. package/dist/src/util/vcsTemplate.js +248 -0
  70. package/dist/src/util/vcsTemplate.js.map +1 -0
  71. package/dist/src/vcsApp.d.ts +7 -0
  72. package/dist/src/vcsApp.js +29 -0
  73. package/dist/src/vcsApp.js.map +1 -1
  74. package/dist/src/vcsModule.d.ts +6 -2
  75. package/dist/src/vcsModule.js.map +1 -1
  76. package/dist/src/vectorCluster/vectorClusterCesiumContext.d.ts +18 -0
  77. package/dist/src/{layer/cesium/clusterContext.js → vectorCluster/vectorClusterCesiumContext.js} +28 -42
  78. package/dist/src/vectorCluster/vectorClusterCesiumContext.js.map +1 -0
  79. package/dist/src/vectorCluster/vectorClusterGroup.d.ts +96 -0
  80. package/dist/src/vectorCluster/vectorClusterGroup.js +320 -0
  81. package/dist/src/vectorCluster/vectorClusterGroup.js.map +1 -0
  82. package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.d.ts +20 -0
  83. package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js +115 -0
  84. package/dist/src/vectorCluster/vectorClusterGroupCesiumImpl.js.map +1 -0
  85. package/dist/src/vectorCluster/vectorClusterGroupCollection.d.ts +19 -0
  86. package/dist/src/vectorCluster/vectorClusterGroupCollection.js +37 -0
  87. package/dist/src/vectorCluster/vectorClusterGroupCollection.js.map +1 -0
  88. package/dist/src/vectorCluster/vectorClusterGroupImpl.d.ts +31 -0
  89. package/dist/src/vectorCluster/vectorClusterGroupImpl.js +76 -0
  90. package/dist/src/vectorCluster/vectorClusterGroupImpl.js.map +1 -0
  91. package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.d.ts +17 -0
  92. package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js +62 -0
  93. package/dist/src/vectorCluster/vectorClusterGroupObliqueImpl.js.map +1 -0
  94. package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.d.ts +17 -0
  95. package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js +62 -0
  96. package/dist/src/vectorCluster/vectorClusterGroupOpenlayersImpl.js.map +1 -0
  97. package/dist/src/vectorCluster/vectorClusterStyleItem.d.ts +110 -0
  98. package/dist/src/vectorCluster/vectorClusterStyleItem.js +374 -0
  99. package/dist/src/vectorCluster/vectorClusterStyleItem.js.map +1 -0
  100. package/dist/src/vectorCluster/vectorClusterSymbols.d.ts +1 -0
  101. package/dist/src/vectorCluster/vectorClusterSymbols.js +3 -0
  102. package/dist/src/vectorCluster/vectorClusterSymbols.js.map +1 -0
  103. package/index.ts +42 -1
  104. package/package.json +3 -1
  105. package/src/cesium/cesium.d.ts +3 -0
  106. package/src/featureProvider/featureProviderSymbols.ts +6 -1
  107. package/src/interaction/featureAtPixelInteraction.ts +109 -84
  108. package/src/interaction/featureProviderInteraction.ts +42 -28
  109. package/src/layer/cesium/sourceVectorContextSync.ts +134 -0
  110. package/src/layer/cesium/vcsTile/vcsDebugTile.ts +1 -1
  111. package/src/layer/cesium/vcsTile/vcsVectorTile.ts +1 -1
  112. package/src/layer/cesium/vectorCesiumImpl.ts +30 -144
  113. package/src/layer/cesium/vectorContext.ts +17 -1
  114. package/src/layer/layerSymbols.ts +1 -1
  115. package/src/layer/oblique/sourceObliqueSync.ts +436 -0
  116. package/src/layer/oblique/vectorObliqueImpl.ts +11 -397
  117. package/src/layer/vectorLayer.ts +35 -2
  118. package/src/map/baseOLMap.ts +8 -1
  119. package/src/map/cesiumMap.ts +36 -3
  120. package/src/map/vcsMap.ts +121 -47
  121. package/src/ol/ol.d.ts +8 -1
  122. package/src/ol/source/{ClusterEnhancedVectorSource.js → ClusterEnhancedVectorSource.ts} +7 -10
  123. package/src/ol/source/VcsCluster.ts +58 -0
  124. package/src/util/clipping/clippingPolygonHelper.ts +86 -0
  125. package/src/util/clipping/clippingPolygonObject.ts +223 -0
  126. package/src/util/clipping/clippingPolygonObjectCollection.ts +249 -0
  127. package/src/util/layerCollection.ts +90 -12
  128. package/src/util/mapCollection.ts +53 -2
  129. package/src/util/renderScreenshot.ts +193 -0
  130. package/src/util/rotation.ts +215 -0
  131. package/src/util/vcsTemplate.ts +373 -0
  132. package/src/vcsApp.ts +65 -0
  133. package/src/vcsModule.ts +6 -2
  134. package/src/vectorCluster/vectorClusterCesiumContext.ts +123 -0
  135. package/src/vectorCluster/vectorClusterGroup.ts +463 -0
  136. package/src/vectorCluster/vectorClusterGroupCesiumImpl.ts +176 -0
  137. package/src/vectorCluster/vectorClusterGroupCollection.ts +43 -0
  138. package/src/vectorCluster/vectorClusterGroupImpl.ts +107 -0
  139. package/src/vectorCluster/vectorClusterGroupObliqueImpl.ts +84 -0
  140. package/src/vectorCluster/vectorClusterGroupOpenlayersImpl.ts +81 -0
  141. package/src/vectorCluster/vectorClusterStyleItem.ts +490 -0
  142. package/src/vectorCluster/vectorClusterSymbols.ts +2 -0
  143. package/dist/src/layer/cesium/clusterContext.d.ts +0 -20
  144. package/dist/src/layer/cesium/clusterContext.js.map +0 -1
  145. package/src/layer/cesium/clusterContext.ts +0 -140
  146. package/src/ol/source/VcsCluster.js +0 -37
@@ -0,0 +1,107 @@
1
+ import { StyleFunction } from 'ol/style/Style.js';
2
+ import type { VectorClusterGroupImplementationOptions } from './vectorClusterGroup.js';
3
+ import VcsObject from '../vcsObject.js';
4
+ import LayerState from '../layer/layerState.js';
5
+ import VectorProperties from '../layer/vectorProperties.js';
6
+ import ClusterEnhancedVectorSource from '../ol/source/ClusterEnhancedVectorSource.js';
7
+ import { synchronizeFeatureVisibilityWithSource } from '../layer/vectorHelpers.js';
8
+ import type GlobalHider from '../layer/globalHider.js';
9
+ import FeatureVisibility from '../layer/featureVisibility.js';
10
+ import VcsMap from '../map/vcsMap.js';
11
+
12
+ /**
13
+ * Clusters for vector layers containing point features only
14
+ */
15
+ export default class VectorClusterGroupImpl<
16
+ M extends VcsMap,
17
+ > extends VcsObject {
18
+ static get className(): string {
19
+ return 'VectorClusterCesiumImpl';
20
+ }
21
+
22
+ private _map: M | undefined;
23
+
24
+ private _state = LayerState.INACTIVE;
25
+
26
+ private _initialized = false;
27
+
28
+ style: StyleFunction;
29
+
30
+ protected _source: ClusterEnhancedVectorSource;
31
+
32
+ private _featureVisibilityListeners = [] as (() => void)[];
33
+
34
+ protected _featureVisibility: FeatureVisibility;
35
+
36
+ protected _globalHider: GlobalHider | undefined;
37
+
38
+ vectorProperties: VectorProperties;
39
+
40
+ constructor(map: M, options: VectorClusterGroupImplementationOptions) {
41
+ super(options);
42
+ this._map = map;
43
+
44
+ this.style = options.style;
45
+ this._source = options.source;
46
+ this.vectorProperties = options.vectorProperties;
47
+ this._featureVisibility = options.featureVisibility;
48
+ this._globalHider = options.globalHider;
49
+ }
50
+
51
+ get map(): M {
52
+ if (!this._map) {
53
+ throw new Error('Trying to access uninitialized VectorClusterGroupImpl');
54
+ }
55
+ return this._map;
56
+ }
57
+
58
+ get active(): boolean {
59
+ return this._state === LayerState.ACTIVE;
60
+ }
61
+
62
+ get initialized(): boolean {
63
+ return this._initialized;
64
+ }
65
+
66
+ initialize(): Promise<void> {
67
+ this._initialized = true;
68
+ return Promise.resolve();
69
+ }
70
+
71
+ async activate(): Promise<void> {
72
+ if (this.map.active && !this.active) {
73
+ this._state = LayerState.LOADING;
74
+ await this.initialize();
75
+ if (this._state === LayerState.LOADING) {
76
+ this._state = LayerState.ACTIVE;
77
+ if (this._featureVisibilityListeners.length === 0) {
78
+ this._featureVisibilityListeners =
79
+ synchronizeFeatureVisibilityWithSource(
80
+ this._featureVisibility,
81
+ this._source,
82
+ this._globalHider!,
83
+ );
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ deactivate(): void {
90
+ this._state = LayerState.INACTIVE;
91
+ this._featureVisibilityListeners.forEach((cb) => {
92
+ cb();
93
+ });
94
+ this._featureVisibilityListeners = [];
95
+ }
96
+
97
+ destroy(): void {
98
+ this._featureVisibilityListeners.forEach((cb) => {
99
+ cb();
100
+ });
101
+ this._featureVisibilityListeners = [];
102
+ this._initialized = false;
103
+ this._state = LayerState.INACTIVE;
104
+ this._map = undefined;
105
+ super.destroy();
106
+ }
107
+ }
@@ -0,0 +1,84 @@
1
+ import OLVectorLayer from 'ol/layer/Vector.js';
2
+ import VectorClusterGroupImpl from './vectorClusterGroupImpl.js';
3
+ import ObliqueMap from '../map/obliqueMap.js';
4
+ import VcsCluster from '../ol/source/VcsCluster.js';
5
+ import { VectorClusterGroupImplementationOptions } from './vectorClusterGroup.js';
6
+ import {
7
+ createSourceObliqueSync,
8
+ SourceObliqueSync,
9
+ } from '../layer/oblique/sourceObliqueSync.js';
10
+ import { vectorClusterGroupName } from './vectorClusterSymbols.js';
11
+
12
+ export default class VectorClusterGroupObliqueImpl extends VectorClusterGroupImpl<ObliqueMap> {
13
+ private _clusterSource: VcsCluster;
14
+
15
+ private _olLayer: OLVectorLayer | undefined;
16
+
17
+ private _sourceObliqueSync: SourceObliqueSync;
18
+
19
+ constructor(
20
+ map: ObliqueMap,
21
+ options: VectorClusterGroupImplementationOptions,
22
+ ) {
23
+ super(map, options);
24
+
25
+ this._sourceObliqueSync = createSourceObliqueSync(options.source, map);
26
+ this._clusterSource = new VcsCluster(
27
+ {
28
+ source: this._sourceObliqueSync.obliqueSource,
29
+ distance: options.clusterDistance,
30
+ },
31
+ this.name,
32
+ );
33
+ }
34
+
35
+ get clusterSource(): VcsCluster {
36
+ return this._clusterSource;
37
+ }
38
+
39
+ get olLayer(): OLVectorLayer | undefined {
40
+ return this._olLayer;
41
+ }
42
+
43
+ async initialize(): Promise<void> {
44
+ if (!this.initialized) {
45
+ const olLayer = new OLVectorLayer({
46
+ visible: false,
47
+ source: this._clusterSource,
48
+ style: this.style,
49
+ zIndex: Number.MAX_SAFE_INTEGER,
50
+ });
51
+ olLayer[vectorClusterGroupName] = this.name;
52
+ this._olLayer = olLayer;
53
+ this.map.addOLLayer(this._olLayer);
54
+ }
55
+ await super.initialize();
56
+ }
57
+
58
+ async activate(): Promise<void> {
59
+ await super.activate();
60
+ if (this.active) {
61
+ this._olLayer?.setVisible(true);
62
+ this._clusterSource.paused = false;
63
+ this._clusterSource.refresh();
64
+ this._sourceObliqueSync.activate();
65
+ }
66
+ }
67
+
68
+ deactivate(): void {
69
+ super.deactivate();
70
+ this._olLayer?.setVisible(false);
71
+ this._clusterSource.paused = true;
72
+ this._sourceObliqueSync.deactivate();
73
+ }
74
+
75
+ destroy(): void {
76
+ if (this._olLayer) {
77
+ this.map.removeOLLayer(this._olLayer);
78
+ }
79
+ this._olLayer = undefined;
80
+
81
+ this._sourceObliqueSync.destroy();
82
+ super.destroy();
83
+ }
84
+ }
@@ -0,0 +1,81 @@
1
+ import OLVectorLayer from 'ol/layer/Vector.js';
2
+ import { VectorClusterGroupImplementationOptions } from './vectorClusterGroup.js';
3
+ import OpenlayersMap from '../map/openlayersMap.js';
4
+ import VcsCluster from '../ol/source/VcsCluster.js';
5
+ import VectorClusterGroupImpl from './vectorClusterGroupImpl.js';
6
+ import { vectorClusterGroupName } from './vectorClusterSymbols.js';
7
+
8
+ export default class VectorClusterGroupOpenlayersImpl extends VectorClusterGroupImpl<OpenlayersMap> {
9
+ static get className(): string {
10
+ return 'VectorClusterGroupOpenlayersImpl';
11
+ }
12
+
13
+ private _clusterSource: VcsCluster;
14
+
15
+ private _olLayer: OLVectorLayer | undefined;
16
+
17
+ constructor(
18
+ map: OpenlayersMap,
19
+ options: VectorClusterGroupImplementationOptions,
20
+ ) {
21
+ super(map, options);
22
+ this._clusterSource = new VcsCluster(
23
+ {
24
+ source: options.source,
25
+ distance: options.clusterDistance,
26
+ },
27
+ this.name,
28
+ );
29
+ this._clusterSource.paused = true;
30
+ }
31
+
32
+ async initialize(): Promise<void> {
33
+ if (!this.initialized) {
34
+ const olLayer = new OLVectorLayer({
35
+ visible: false,
36
+ source: this._clusterSource,
37
+ style: this.style,
38
+ zIndex: Number.MAX_SAFE_INTEGER,
39
+ });
40
+
41
+ olLayer[vectorClusterGroupName] = this.name;
42
+ this._olLayer = olLayer;
43
+ this.map.addOLLayer(this._olLayer);
44
+ }
45
+ await super.initialize();
46
+ }
47
+
48
+ get clusterSource(): VcsCluster {
49
+ return this._clusterSource;
50
+ }
51
+
52
+ get olLayer(): OLVectorLayer | undefined {
53
+ return this._olLayer;
54
+ }
55
+
56
+ async activate(): Promise<void> {
57
+ await super.activate();
58
+ if (this.active) {
59
+ this._olLayer?.setVisible(true);
60
+ this._clusterSource.paused = false;
61
+ this._clusterSource.refresh();
62
+ }
63
+ }
64
+
65
+ deactivate(): void {
66
+ super.deactivate();
67
+ this._olLayer?.setVisible(false);
68
+ this._clusterSource.paused = true;
69
+ }
70
+
71
+ destroy(): void {
72
+ if (this._olLayer) {
73
+ this.map.removeOLLayer(this._olLayer);
74
+ }
75
+ this._olLayer = undefined;
76
+
77
+ this._clusterSource.clear(true);
78
+ this._clusterSource.dispose();
79
+ super.destroy();
80
+ }
81
+ }