@vcmap/core 5.0.0-rc.0

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/LICENSE.md +21 -0
  2. package/README.md +44 -0
  3. package/build/postinstall.js +44 -0
  4. package/index.js +139 -0
  5. package/package.json +92 -0
  6. package/src/cesium/cesium3DTileFeature.js +9 -0
  7. package/src/cesium/cesium3DTilePointFeature.js +9 -0
  8. package/src/cesium/cesiumVcsCameraPrimitive.js +146 -0
  9. package/src/cesium/wallpaperMaterial.js +64 -0
  10. package/src/ol/feature.js +47 -0
  11. package/src/ol/geom/circle.js +24 -0
  12. package/src/ol/geom/geometryCollection.js +33 -0
  13. package/src/ol/render/canvas/canvasTileRenderer.js +179 -0
  14. package/src/ol/source/ClusterEnhancedVectorSource.js +39 -0
  15. package/src/ol/source/VcsCluster.js +37 -0
  16. package/src/vcs/vcm/classRegistry.js +106 -0
  17. package/src/vcs/vcm/event/vcsEvent.js +89 -0
  18. package/src/vcs/vcm/globalCollections.js +11 -0
  19. package/src/vcs/vcm/interaction/abstractInteraction.js +149 -0
  20. package/src/vcs/vcm/interaction/coordinateAtPixel.js +102 -0
  21. package/src/vcs/vcm/interaction/eventHandler.js +425 -0
  22. package/src/vcs/vcm/interaction/featureAtPixelInteraction.js +286 -0
  23. package/src/vcs/vcm/interaction/featureProviderInteraction.js +54 -0
  24. package/src/vcs/vcm/interaction/interactionChain.js +124 -0
  25. package/src/vcs/vcm/interaction/interactionType.js +114 -0
  26. package/src/vcs/vcm/layer/buildings.js +17 -0
  27. package/src/vcs/vcm/layer/cesium/cesiumTilesetCesium.js +359 -0
  28. package/src/vcs/vcm/layer/cesium/clusterContext.js +95 -0
  29. package/src/vcs/vcm/layer/cesium/dataSourceCesium.js +171 -0
  30. package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +29 -0
  31. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +58 -0
  32. package/src/vcs/vcm/layer/cesium/rasterLayerCesium.js +110 -0
  33. package/src/vcs/vcm/layer/cesium/singleImageCesium.js +49 -0
  34. package/src/vcs/vcm/layer/cesium/terrainCesium.js +80 -0
  35. package/src/vcs/vcm/layer/cesium/tmsCesium.js +54 -0
  36. package/src/vcs/vcm/layer/cesium/vectorCesium.js +255 -0
  37. package/src/vcs/vcm/layer/cesium/vectorContext.js +167 -0
  38. package/src/vcs/vcm/layer/cesium/vectorRasterTileCesium.js +116 -0
  39. package/src/vcs/vcm/layer/cesium/vectorTileImageryProvider.js +246 -0
  40. package/src/vcs/vcm/layer/cesium/wmsCesium.js +71 -0
  41. package/src/vcs/vcm/layer/cesium/wmtsCesium.js +101 -0
  42. package/src/vcs/vcm/layer/cesium/x3dmHelper.js +22 -0
  43. package/src/vcs/vcm/layer/cesiumTileset.js +376 -0
  44. package/src/vcs/vcm/layer/czml.js +141 -0
  45. package/src/vcs/vcm/layer/dataSource.js +259 -0
  46. package/src/vcs/vcm/layer/featureLayer.js +261 -0
  47. package/src/vcs/vcm/layer/featureStore.js +647 -0
  48. package/src/vcs/vcm/layer/featureStoreChanges.js +360 -0
  49. package/src/vcs/vcm/layer/featureStoreState.js +19 -0
  50. package/src/vcs/vcm/layer/featureVisibility.js +435 -0
  51. package/src/vcs/vcm/layer/geojson.js +185 -0
  52. package/src/vcs/vcm/layer/geojsonHelpers.js +450 -0
  53. package/src/vcs/vcm/layer/globalHider.js +157 -0
  54. package/src/vcs/vcm/layer/layer.js +752 -0
  55. package/src/vcs/vcm/layer/layerImplementation.js +102 -0
  56. package/src/vcs/vcm/layer/layerState.js +17 -0
  57. package/src/vcs/vcm/layer/layerSymbols.js +6 -0
  58. package/src/vcs/vcm/layer/oblique/layerOblique.js +76 -0
  59. package/src/vcs/vcm/layer/oblique/obliqueHelpers.js +175 -0
  60. package/src/vcs/vcm/layer/oblique/vectorOblique.js +469 -0
  61. package/src/vcs/vcm/layer/openStreetMap.js +194 -0
  62. package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +79 -0
  63. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +27 -0
  64. package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +121 -0
  65. package/src/vcs/vcm/layer/openlayers/singleImageOpenlayers.js +49 -0
  66. package/src/vcs/vcm/layer/openlayers/tileDebugOpenlayers.js +39 -0
  67. package/src/vcs/vcm/layer/openlayers/tmsOpenlayers.js +62 -0
  68. package/src/vcs/vcm/layer/openlayers/vectorOpenlayers.js +118 -0
  69. package/src/vcs/vcm/layer/openlayers/vectorTileOpenlayers.js +177 -0
  70. package/src/vcs/vcm/layer/openlayers/wmsOpenlayers.js +55 -0
  71. package/src/vcs/vcm/layer/openlayers/wmtsOpenlayers.js +141 -0
  72. package/src/vcs/vcm/layer/pointCloud.js +162 -0
  73. package/src/vcs/vcm/layer/rasterLayer.js +294 -0
  74. package/src/vcs/vcm/layer/singleImage.js +119 -0
  75. package/src/vcs/vcm/layer/terrain.js +122 -0
  76. package/src/vcs/vcm/layer/terrainHelpers.js +123 -0
  77. package/src/vcs/vcm/layer/tileLoadedHelper.js +72 -0
  78. package/src/vcs/vcm/layer/tileProvider/mvtTileProvider.js +104 -0
  79. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +67 -0
  80. package/src/vcs/vcm/layer/tileProvider/tileProvider.js +584 -0
  81. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +28 -0
  82. package/src/vcs/vcm/layer/tileProvider/urlTemplateTileProvider.js +106 -0
  83. package/src/vcs/vcm/layer/tms.js +121 -0
  84. package/src/vcs/vcm/layer/vector.js +632 -0
  85. package/src/vcs/vcm/layer/vectorHelpers.js +206 -0
  86. package/src/vcs/vcm/layer/vectorProperties.js +1391 -0
  87. package/src/vcs/vcm/layer/vectorSymbols.js +40 -0
  88. package/src/vcs/vcm/layer/vectorTile.js +480 -0
  89. package/src/vcs/vcm/layer/wfs.js +165 -0
  90. package/src/vcs/vcm/layer/wms.js +270 -0
  91. package/src/vcs/vcm/layer/wmsHelpers.js +65 -0
  92. package/src/vcs/vcm/layer/wmts.js +235 -0
  93. package/src/vcs/vcm/maps/baseOLMap.js +257 -0
  94. package/src/vcs/vcm/maps/cameraLimiter.js +219 -0
  95. package/src/vcs/vcm/maps/cesium.js +1192 -0
  96. package/src/vcs/vcm/maps/map.js +511 -0
  97. package/src/vcs/vcm/maps/mapState.js +17 -0
  98. package/src/vcs/vcm/maps/oblique.js +536 -0
  99. package/src/vcs/vcm/maps/openlayers.js +205 -0
  100. package/src/vcs/vcm/object.js +92 -0
  101. package/src/vcs/vcm/oblique/ObliqueCollection.js +572 -0
  102. package/src/vcs/vcm/oblique/ObliqueDataSet.js +357 -0
  103. package/src/vcs/vcm/oblique/ObliqueImage.js +247 -0
  104. package/src/vcs/vcm/oblique/ObliqueImageMeta.js +126 -0
  105. package/src/vcs/vcm/oblique/ObliqueProvider.js +433 -0
  106. package/src/vcs/vcm/oblique/ObliqueView.js +130 -0
  107. package/src/vcs/vcm/oblique/ObliqueViewDirection.js +40 -0
  108. package/src/vcs/vcm/oblique/helpers.js +483 -0
  109. package/src/vcs/vcm/oblique/parseImageJson.js +248 -0
  110. package/src/vcs/vcm/util/clipping/clippingObject.js +386 -0
  111. package/src/vcs/vcm/util/clipping/clippingObjectManager.js +312 -0
  112. package/src/vcs/vcm/util/clipping/clippingPlaneHelper.js +413 -0
  113. package/src/vcs/vcm/util/collection.js +193 -0
  114. package/src/vcs/vcm/util/dateTime.js +60 -0
  115. package/src/vcs/vcm/util/exclusiveManager.js +135 -0
  116. package/src/vcs/vcm/util/extent.js +124 -0
  117. package/src/vcs/vcm/util/featureProvider/abstractFeatureProvider.js +196 -0
  118. package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +51 -0
  119. package/src/vcs/vcm/util/featureProvider/featureProviderSymbols.js +11 -0
  120. package/src/vcs/vcm/util/featureProvider/tileProviderFeatureProvider.js +62 -0
  121. package/src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js +280 -0
  122. package/src/vcs/vcm/util/featureconverter/circleToCesium.js +215 -0
  123. package/src/vcs/vcm/util/featureconverter/convert.js +83 -0
  124. package/src/vcs/vcm/util/featureconverter/extent3d.js +154 -0
  125. package/src/vcs/vcm/util/featureconverter/featureconverterHelper.js +591 -0
  126. package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +171 -0
  127. package/src/vcs/vcm/util/featureconverter/pointToCesium.js +359 -0
  128. package/src/vcs/vcm/util/featureconverter/polygonToCesium.js +229 -0
  129. package/src/vcs/vcm/util/geometryHelpers.js +172 -0
  130. package/src/vcs/vcm/util/indexedCollection.js +158 -0
  131. package/src/vcs/vcm/util/isMobile.js +12 -0
  132. package/src/vcs/vcm/util/layerCollection.js +216 -0
  133. package/src/vcs/vcm/util/locale.js +53 -0
  134. package/src/vcs/vcm/util/mapCollection.js +363 -0
  135. package/src/vcs/vcm/util/math.js +71 -0
  136. package/src/vcs/vcm/util/projection.js +348 -0
  137. package/src/vcs/vcm/util/splitScreen.js +233 -0
  138. package/src/vcs/vcm/util/style/declarativeStyleItem.js +631 -0
  139. package/src/vcs/vcm/util/style/shapesCategory.js +67 -0
  140. package/src/vcs/vcm/util/style/styleFactory.js +48 -0
  141. package/src/vcs/vcm/util/style/styleHelpers.js +555 -0
  142. package/src/vcs/vcm/util/style/styleItem.js +226 -0
  143. package/src/vcs/vcm/util/style/vectorStyleItem.js +927 -0
  144. package/src/vcs/vcm/util/style/writeStyle.js +48 -0
  145. package/src/vcs/vcm/util/urlHelpers.js +16 -0
  146. package/src/vcs/vcm/util/viewpoint.js +333 -0
@@ -0,0 +1,226 @@
1
+ import { Cesium3DTileStyle, Cesium3DTileColorBlendMode } from '@vcmap/cesium';
2
+ import deepEqual from 'fast-deep-equal';
3
+
4
+ import { parseEnumValue } from '@vcsuite/parsers';
5
+ import VcsObject from '../../object.js';
6
+ import VcsEvent from '../../event/vcsEvent.js';
7
+
8
+ /**
9
+ * @namespace style
10
+ * @export
11
+ * @api
12
+ */
13
+
14
+ /**
15
+ * @typedef {Object} StyleItemLegendEntry
16
+ * @property {string} color - the color to display
17
+ * @property {string|Object<string, string>} name - the name to display for the given color
18
+ * @api
19
+ */
20
+
21
+ /**
22
+ * @typedef {VcsObjectOptions} StyleItemOptions
23
+ * @property {string|undefined} [type] - used in configuration to differentiate vector from declarative styles
24
+ * @property {string|Object<string, string>|undefined} title - name is used when none is specifies
25
+ * @property {Array<StyleItemLegendEntry>|undefined} [legend]
26
+ * @property {number} [colorBlendMode=import("@vcmap/cesium").Cesium3DTileColorBlendMode.HIGHLIGHT] - colorBlendMode for 3D Tiledataset @see https://cesiumjs.org/import("@vcmap/cesium").Build/Documentation/Cesium3DTileColorBlendMode.html
27
+ * @api
28
+ */
29
+
30
+ /**
31
+ * @typedef {Object} Reference
32
+ * @property {string} [type=StyleType.REFERENCE]
33
+ * @property {string} name
34
+ * @property {string|undefined} [url] - vcs:undocumented this is not yet implemented
35
+ * @api
36
+ */
37
+
38
+ /**
39
+ * @typedef {Object} StyleItemSections
40
+ * @property {boolean|undefined} [meta]
41
+ * @api
42
+ */
43
+
44
+ /**
45
+ * Enumeration of possible style types.
46
+ * @enum {string}
47
+ * @property {string} VECTOR
48
+ * @property {string} DECLARATIVE
49
+ * @property {string} REFERENCE
50
+ * @export
51
+ * @api
52
+ */
53
+ export const StyleType = {
54
+ VECTOR: 'vector',
55
+ DECLARATIVE: 'declarative',
56
+ REFERENCE: 'reference',
57
+ CLUSTER: 'cluster',
58
+ };
59
+
60
+ /**
61
+ * indicates, that this style is part of the config and can be referenced by name
62
+ * @type {symbol}
63
+ * @export
64
+ * @api
65
+ */
66
+ export const referenceableStyleSymbol = Symbol('referencableStyleSymbol');
67
+
68
+ /**
69
+ * An abstract style definition which can be applied to a layer
70
+ * @class
71
+ * @export
72
+ * @api
73
+ * @abstract
74
+ * @extends {VcsObject}
75
+ */
76
+ class StyleItem extends VcsObject {
77
+ static get className() { return 'vcs.vcm.util.style.StyleItem'; }
78
+
79
+ /**
80
+ * @param {StyleItemOptions} options
81
+ */
82
+ constructor(options) {
83
+ super(options);
84
+
85
+ /**
86
+ * @type {string|Object<string, string>}
87
+ */
88
+ this.title = options.title || this.name.toString();
89
+
90
+ /**
91
+ * Legend entries
92
+ * @type {Array<StyleItemLegendEntry>}
93
+ * @api
94
+ */
95
+ this.legend = options.legend || [];
96
+
97
+ /** @type {Array<string>} */
98
+ this.supportedLayers = [];
99
+
100
+ /**
101
+ * The 3D representation of this style
102
+ * @type {import("@vcmap/cesium").Cesium3DTileStyle}
103
+ * @api
104
+ */
105
+ this.cesiumStyle = new Cesium3DTileStyle({ show: true });
106
+
107
+ /**
108
+ * Fired on style updates
109
+ * @type {VcsEvent<void>}
110
+ * @api
111
+ */
112
+ this.styleChanged = new VcsEvent();
113
+
114
+ /** @type {import("@vcmap/cesium").Cesium3DTileColorBlendMode} */
115
+ this.colorBlendMode = /** @type {import("@vcmap/cesium").Cesium3DTileColorBlendMode} */(parseEnumValue(
116
+ options.colorBlendMode, Cesium3DTileColorBlendMode, Cesium3DTileColorBlendMode.HIGHLIGHT,
117
+ ));
118
+
119
+ /**
120
+ * @type {import("ol/style/Style").default|import("ol/style/Style").StyleFunction}
121
+ * @protected
122
+ */
123
+ this._style = null;
124
+ }
125
+
126
+ /**
127
+ * The 2D representation of this style
128
+ * @type {import("ol/style/Style").default|import("ol/style/Style").StyleFunction}
129
+ * @api
130
+ */
131
+ get style() { return this._style; }
132
+
133
+ /**
134
+ * @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction} style
135
+ */
136
+ set style(style) { this._style = style; }
137
+
138
+ /**
139
+ * @param {string} className
140
+ * @returns {boolean}
141
+ * @todo redundant, remove
142
+ */
143
+ isSupported(className) {
144
+ return this.supportedLayers.length === 0 ||
145
+ this.supportedLayers.indexOf(className) > -1;
146
+ }
147
+
148
+ /**
149
+ * Gets the options for this style item to be used in a config or vcsMeta
150
+ * @param {(VectorStyleItemSections|DeclarativeStyleItemSections)=} sections
151
+ * @returns {VectorStyleItemOptions|DeclarativeStyleItemOptions}
152
+ * @api
153
+ */
154
+ getOptions(sections) {
155
+ if (sections && sections.meta) {
156
+ return {
157
+ name: this.name.toString(),
158
+ title: this.title,
159
+ legend: this.legend.length ? this.legend : undefined,
160
+ };
161
+ }
162
+ return {};
163
+ }
164
+
165
+ /**
166
+ * Clones this style
167
+ * @param {StyleItem=} result
168
+ * @returns {StyleItem}
169
+ * @api
170
+ */
171
+ // eslint-disable-next-line class-methods-use-this
172
+ clone(result) { return result; }
173
+
174
+ /**
175
+ * @param {StyleItem} styleItem
176
+ * @returns {StyleItem}
177
+ * @api
178
+ */
179
+ // eslint-disable-next-line class-methods-use-this
180
+ assign(styleItem) { return styleItem; }
181
+
182
+ /**
183
+ * @param {StyleItem} styleItem
184
+ * @returns {boolean}
185
+ * @api
186
+ */
187
+ equals(styleItem) {
188
+ if (this !== styleItem) {
189
+ const options = this.getOptions();
190
+ const candidateOptions = styleItem.getOptions();
191
+ return deepEqual(options, candidateOptions);
192
+ }
193
+
194
+ return true;
195
+ }
196
+
197
+ /**
198
+ * gets a reference to this style by its name. should only be used for static styles, aka styles already part of the config
199
+ * @returns {Reference}
200
+ * @api
201
+ */
202
+ getReference() {
203
+ return {
204
+ type: StyleType.REFERENCE,
205
+ name: this.name.toString(),
206
+ };
207
+ }
208
+
209
+ /**
210
+ * @protected
211
+ */
212
+ _styleChanged() {
213
+ this.styleChanged.raiseEvent();
214
+ }
215
+
216
+ /**
217
+ * @api
218
+ */
219
+ destroy() {
220
+ this.cesiumStyle = null;
221
+ this.styleChanged.destroy();
222
+ super.destroy();
223
+ }
224
+ }
225
+
226
+ export default StyleItem;