@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
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 virtualcitySYSTEMS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # vcMap Core
2
+
3
+ ## Getting Started
4
+ - clone Repo
5
+ - npm install
6
+ - npm run serve
7
+
8
+ # Coding Conventions
9
+ ### Exporting from a module
10
+ - You should export all variables, functions, class etc. from a module
11
+ which are required to use the API.
12
+ - Make sure the names of exports have _meaning outside of their module_. E.g. a
13
+ function names `extend(destination: extent3D, source: extend3D):void` would need to be rephrased to `extend3DExtent`.
14
+ - If you export things _just for testing your unit_ or other _internals only_ make
15
+ sure to set the `@private` doclet.
16
+ ```javascript
17
+ /**
18
+ * Resets the foo. Exported for testing
19
+ * @private
20
+ */
21
+ export function resetFooInstance() {}
22
+ ```
23
+
24
+ ### TS & Typesafety
25
+ - You should use the imported name in your doclets, e.g.:
26
+ ```javascript
27
+ import Vector from 'ol/source/Vector.js';
28
+
29
+ /**
30
+ * @param {Vector} source
31
+ * @returns {Array<import("ol").Feature<import("ol/geom/Geometry").default>>}
32
+ */
33
+ function getAllFeatures(source) {
34
+ if (source instanceof Vector) {
35
+ return source.getFeatures();
36
+ }
37
+ return [];
38
+ }
39
+ ```
40
+ - You should use dump file imports where possible (WebStorm cannot generate
41
+ Intelisensse from default imports). Thus `@param {import("ol/Feature").default}`
42
+ would become: `@param {import("ol").Feature}`.
43
+ - You will need to import library own classes use `@param {import("@vcmap/core").CesiumMap}`.
44
+ - You do _not_ need to import `typedefs` since these are provided globally during type checking.
@@ -0,0 +1,44 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ /**
6
+ * This circumvents a bug in webstorm, where scoped module .d.ts files arent
7
+ * handled properly (there is no intellisense in webstorm otherwise)
8
+ * @returns {Promise<void>}
9
+ */
10
+ async function fixCesiumTypes() {
11
+ const fileName = fileURLToPath(import.meta.url);
12
+ if (
13
+ path.resolve(path.dirname(fileName), '..') === process.cwd() &&
14
+ fs.existsSync(path.join(process.cwd(), 'build', 'types'))
15
+ ) {
16
+ console.log('Moving Cesium.d.ts');
17
+ await fs.promises.cp(
18
+ path.join(process.cwd(), 'node_modules', '@vcmap', 'cesium', 'Source', 'Cesium.d.ts'),
19
+ path.join(process.cwd(), 'build', 'types', 'Cesium_module.d.ts'),
20
+ { force: true },
21
+ );
22
+ }
23
+ }
24
+
25
+ /**
26
+ * There is a known, unfixed bug in tinyqueue. This is the fix (otherwise tinyqueue is not a constructor)
27
+ * @returns {Promise<void>}
28
+ */
29
+ async function fixTinyQueue() {
30
+ const fileName = path.join(process.cwd(), 'node_modules', 'tinyqueue', 'package.json');
31
+ if (fs.existsSync(fileName)) {
32
+ const content = await fs.promises.readFile(fileName);
33
+ const jsonContent = JSON.parse(content);
34
+ jsonContent.browser = 'tinyqueue.min.js';
35
+ await fs.promises.writeFile(fileName, JSON.stringify(jsonContent, null, 2));
36
+ }
37
+ }
38
+
39
+ async function run() {
40
+ await Promise.all([fixTinyQueue(), fixCesiumTypes()]);
41
+ console.log('fixed modules');
42
+ }
43
+
44
+ await run();
package/index.js ADDED
@@ -0,0 +1,139 @@
1
+ import './src/ol/geom/circle.js';
2
+ import './src/ol/geom/geometryCollection.js';
3
+ import './src/ol/feature.js';
4
+ import './src/cesium/wallpaperMaterial.js';
5
+ import './src/cesium/cesium3DTilePointFeature.js';
6
+ import './src/cesium/cesium3DTileFeature.js';
7
+ import './src/cesium/cesiumVcsCameraPrimitive.js';
8
+
9
+ export { VcsClassRegistry, default as ClassRegistry } from './src/vcs/vcm/classRegistry.js';
10
+ export { default as VcsEvent } from './src/vcs/vcm/event/vcsEvent.js';
11
+ export { styleCollection, obliqueCollectionCollection } from './src/vcs/vcm/globalCollections.js';
12
+ export { default as AbstractInteraction } from './src/vcs/vcm/interaction/abstractInteraction.js';
13
+ export { default as CoordinateAtPixel } from './src/vcs/vcm/interaction/coordinateAtPixel.js';
14
+ export { default as EventHandler } from './src/vcs/vcm/interaction/eventHandler.js';
15
+ export { default as FeatureAtPixelInteraction } from './src/vcs/vcm/interaction/featureAtPixelInteraction.js';
16
+ export { default as FeatureProviderInteraction } from './src/vcs/vcm/interaction/featureProviderInteraction.js';
17
+ export { default as InteractionChain } from './src/vcs/vcm/interaction/interactionChain.js';
18
+ export { BitCounter, ModificationKeyType, EventType, PointerKeyType, PointerEventType } from './src/vcs/vcm/interaction/interactionType.js';
19
+ export { default as Buildings } from './src/vcs/vcm/layer/buildings.js';
20
+ export { cesiumTilesetLastUpdated, getExtentFromTileset, default as CesiumTilesetCesium } from './src/vcs/vcm/layer/cesium/cesiumTilesetCesium.js';
21
+ export { default as ClusterContext } from './src/vcs/vcm/layer/cesium/clusterContext.js';
22
+ export { default as DataSourceCesium } from './src/vcs/vcm/layer/cesium/dataSourceCesium.js';
23
+ export { default as OpenStreetMapCesium } from './src/vcs/vcm/layer/cesium/openStreetMapCesium.js';
24
+ export { default as PointCloudCesium } from './src/vcs/vcm/layer/cesium/pointCloudCesium.js';
25
+ export { default as RasterLayerCesium } from './src/vcs/vcm/layer/cesium/rasterLayerCesium.js';
26
+ export { default as SingleImageCesium } from './src/vcs/vcm/layer/cesium/singleImageCesium.js';
27
+ export { default as TerrainCesium } from './src/vcs/vcm/layer/cesium/terrainCesium.js';
28
+ export { default as TMSCesium } from './src/vcs/vcm/layer/cesium/tmsCesium.js';
29
+ export { default as VectorCesium } from './src/vcs/vcm/layer/cesium/vectorCesium.js';
30
+ export { setReferenceForPicking, removeArrayFromCollection, removeFeatureFromMap, addPrimitiveToContext, default as VectorContext } from './src/vcs/vcm/layer/cesium/vectorContext.js';
31
+ export { default as VectorRasterTileCesium } from './src/vcs/vcm/layer/cesium/vectorRasterTileCesium.js';
32
+ export { toContext, getCanvasFromFeatures, default as VectorTileImageryProvider } from './src/vcs/vcm/layer/cesium/vectorTileImageryProvider.js';
33
+ export { default as WMSCesium } from './src/vcs/vcm/layer/cesium/wmsCesium.js';
34
+ export { default as WMTSCesium } from './src/vcs/vcm/layer/cesium/wmtsCesium.js';
35
+ export { default as getJSONObjectFromObject } from './src/vcs/vcm/layer/cesium/x3dmHelper.js';
36
+ export { default as CesiumTileset } from './src/vcs/vcm/layer/cesiumTileset.js';
37
+ export { default as Czml } from './src/vcs/vcm/layer/czml.js';
38
+ export { default as DataSource } from './src/vcs/vcm/layer/dataSource.js';
39
+ export { default as FeatureLayer } from './src/vcs/vcm/layer/featureLayer.js';
40
+ export { isTiledFeature, default as FeatureStore } from './src/vcs/vcm/layer/featureStore.js';
41
+ export { default as FeatureStoreChanges } from './src/vcs/vcm/layer/featureStoreChanges.js';
42
+ export { featureStoreStateSymbol, featureStoreState } from './src/vcs/vcm/layer/featureStoreState.js';
43
+ export { originalStyle, highlighted, hidden, globalHidden, featureExists, FeatureVisibilityAction, synchronizeFeatureVisibility, default as FeatureVisibility } from './src/vcs/vcm/layer/featureVisibility.js';
44
+ export { featureFromOptions, default as GeoJSON } from './src/vcs/vcm/layer/geojson.js';
45
+ export { getEPSGCodeFromGeojson, updateLegacyFeature, parseGeoJSON, writeGeoJSONFeature, writeGeoJSON } from './src/vcs/vcm/layer/geojsonHelpers.js';
46
+ export { getGlobalHider, getInstance, default as GlobalHider } from './src/vcs/vcm/layer/globalHider.js';
47
+ export { vcsMetaVersion, default as Layer } from './src/vcs/vcm/layer/layer.js';
48
+ export { default as LayerImplementation } from './src/vcs/vcm/layer/layerImplementation.js';
49
+ export { default as LayerState } from './src/vcs/vcm/layer/layerState.js';
50
+ export { vcsLayerName } from './src/vcs/vcm/layer/layerSymbols.js';
51
+ export { default as LayerOblique } from './src/vcs/vcm/layer/oblique/layerOblique.js';
52
+ export { getLongestSide, getResolutionOptions, getZoom, mercatorGeometryToImageGeometry, imageGeometryToMercatorGeometry, getPolygonizedGeometry, setNewGeometry } from './src/vcs/vcm/layer/oblique/obliqueHelpers.js';
53
+ export { default as VectorOblique } from './src/vcs/vcm/layer/oblique/vectorOblique.js';
54
+ export { default as OpenStreetMap } from './src/vcs/vcm/layer/openStreetMap.js';
55
+ export { default as LayerOpenlayers } from './src/vcs/vcm/layer/openlayers/layerOpenlayers.js';
56
+ export { default as OpenStreetMapOpenlayers } from './src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js';
57
+ export { default as RasterLayerOpenlayers } from './src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js';
58
+ export { default as SingleImageOpenlayers } from './src/vcs/vcm/layer/openlayers/singleImageOpenlayers.js';
59
+ export { default as TileDebugOpenlayers } from './src/vcs/vcm/layer/openlayers/tileDebugOpenlayers.js';
60
+ export { default as TMSOpenlayers } from './src/vcs/vcm/layer/openlayers/tmsOpenlayers.js';
61
+ export { default as VectorOpenlayers } from './src/vcs/vcm/layer/openlayers/vectorOpenlayers.js';
62
+ export { default as VectorTileOpenlayers } from './src/vcs/vcm/layer/openlayers/vectorTileOpenlayers.js';
63
+ export { default as WMSOpenlayers } from './src/vcs/vcm/layer/openlayers/wmsOpenlayers.js';
64
+ export { default as WMTSOpenlayers } from './src/vcs/vcm/layer/openlayers/wmtsOpenlayers.js';
65
+ export { defaultPointCloudStyle, default as PointCloud } from './src/vcs/vcm/layer/pointCloud.js';
66
+ export { TilingScheme, getTilingScheme, calculateMinLevel, default as RasterLayer } from './src/vcs/vcm/layer/rasterLayer.js';
67
+ export { default as SingleImage } from './src/vcs/vcm/layer/singleImage.js';
68
+ export { default as Terrain } from './src/vcs/vcm/layer/terrain.js';
69
+ export { getTerrainProviderForUrl, sampleCesiumTerrainMostDetailed, sampleCesiumTerrain, getHeightFromTerrainProvider, isTerrainTileAvailable } from './src/vcs/vcm/layer/terrainHelpers.js';
70
+ export { tiledLayerLoaded, globeLoaded } from './src/vcs/vcm/layer/tileLoadedHelper.js';
71
+ export { default as MVTTileProvider } from './src/vcs/vcm/layer/tileProvider/mvtTileProvider.js';
72
+ export { default as StaticGeojsonTileProvider } from './src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js';
73
+ export { mercatorResolutionsToLevel, rectangleToExtent, default as TileProvider } from './src/vcs/vcm/layer/tileProvider/tileProvider.js';
74
+ export { default as factory } from './src/vcs/vcm/layer/tileProvider/tileProviderFactory.js';
75
+ export { getURL, default as URLTemplateTileProvider } from './src/vcs/vcm/layer/tileProvider/urlTemplateTileProvider.js';
76
+ export { default as TMS } from './src/vcs/vcm/layer/tms.js';
77
+ export { default as Vector } from './src/vcs/vcm/layer/vector.js';
78
+ export { fvLastUpdated, globalHiderLastUpdated, updateFeatureVisibility, updateGlobalHider, synchronizeFeatureVisibilityWithSource, getGenericFeatureFromClickedObject } from './src/vcs/vcm/layer/vectorHelpers.js';
79
+ export { AltitudeModeCesium, ClassificationTypeCesium, parseNearFarScalar, parseCartesian3, parseStoreyHeights, getAltitudeModeOptions, getClassificationTypeOptions, getNearFarValueOptions, getCartesian3Options, default as VectorProperties } from './src/vcs/vcm/layer/vectorProperties.js';
80
+ export { alreadyTransformedToMercator, alreadyTransformedToImage, obliqueGeometry, doNotTransform, originalFeatureSymbol, actuallyIsCircle } from './src/vcs/vcm/layer/vectorSymbols.js';
81
+ export { default as VectorTile } from './src/vcs/vcm/layer/vectorTile.js';
82
+ export { default as WFS } from './src/vcs/vcm/layer/wfs.js';
83
+ export { default as WMS } from './src/vcs/vcm/layer/wms.js';
84
+ export { getWMSSource } from './src/vcs/vcm/layer/wmsHelpers.js';
85
+ export { default as WMTS } from './src/vcs/vcm/layer/wmts.js';
86
+ export { default as BaseOLMap } from './src/vcs/vcm/maps/baseOLMap.js';
87
+ export { Mode, default as CameraLimiter } from './src/vcs/vcm/maps/cameraLimiter.js';
88
+ export { default as CesiumMap } from './src/vcs/vcm/maps/cesium.js';
89
+ export { default as VcsMap } from './src/vcs/vcm/maps/map.js';
90
+ export { default as MapState } from './src/vcs/vcm/maps/mapState.js';
91
+ export { getViewDirectionFromViewPoint, default as Oblique } from './src/vcs/vcm/maps/oblique.js';
92
+ export { default as Openlayers } from './src/vcs/vcm/maps/openlayers.js';
93
+ export { default as VcsObject } from './src/vcs/vcm/object.js';
94
+ export { default as ObliqueCollection } from './src/vcs/vcm/oblique/ObliqueCollection.js';
95
+ export { DataState, getStateFromStatesArray, default as ObliqueDataSet } from './src/vcs/vcm/oblique/ObliqueDataSet.js';
96
+ export { default as ObliqueImage } from './src/vcs/vcm/oblique/ObliqueImage.js';
97
+ export { default as ObliqueImageMeta } from './src/vcs/vcm/oblique/ObliqueImageMeta.js';
98
+ export { default as ObliqueProvider } from './src/vcs/vcm/oblique/ObliqueProvider.js';
99
+ export { default as ObliqueView } from './src/vcs/vcm/oblique/ObliqueView.js';
100
+ export { ObliqueViewDirection, obliqueViewDirectionNames, getDirectionName } from './src/vcs/vcm/oblique/ObliqueViewDirection.js';
101
+ export { sortRealWordEdgeCoordinates, checkLineIntersection, transformCWIFC, transformToImage, transformFromImage, hasSameOrigin, destroyCesiumEvent } from './src/vcs/vcm/oblique/helpers.js';
102
+ export { getVersionFromImageJson, parseImageMeta, parseImageData, parseLegacyImageData } from './src/vcs/vcm/oblique/parseImageJson.js';
103
+ export { default as ClippingObject } from './src/vcs/vcm/util/clipping/clippingObject.js';
104
+ export { default as ClippingObjectManager } from './src/vcs/vcm/util/clipping/clippingObjectManager.js';
105
+ export { createClippingPlaneCollection, copyClippingPlanesToCollection, clearClippingPlanes, setClippingPlanes, createClippingFeature, getClippingOptions } from './src/vcs/vcm/util/clipping/clippingPlaneHelper.js';
106
+ export { default as Collection } from './src/vcs/vcm/util/collection.js';
107
+ export { getShortLocaleDate, getShortLocaleTime, getISODateString, getDayOfYear, isLeapYear } from './src/vcs/vcm/util/dateTime.js';
108
+ export { default as ExclusiveManager } from './src/vcs/vcm/util/exclusiveManager.js';
109
+ export { default as Extent } from './src/vcs/vcm/util/extent.js';
110
+ export { default as AbstractFeatureProvider } from './src/vcs/vcm/util/featureProvider/abstractFeatureProvider.js';
111
+ export { getGenericFeatureFromProvidedFeature } from './src/vcs/vcm/util/featureProvider/featureProviderHelpers.js';
112
+ export { isProvidedFeature, showProvidedFeature } from './src/vcs/vcm/util/featureProvider/featureProviderSymbols.js';
113
+ export { default as TileProviderFeatureProvider } from './src/vcs/vcm/util/featureProvider/tileProviderFeatureProvider.js';
114
+ export { getFormat, default as WMSFeatureProvider } from './src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js';
115
+ export { validateCircle, default as circleToCesium } from './src/vcs/vcm/util/featureconverter/circleToCesium.js';
116
+ export { getStylesArray, default as convert } from './src/vcs/vcm/util/featureconverter/convert.js';
117
+ export { createEmpty3D, createOrUpdate3D, extendXYZ, extendXY, extendZ, extendFlatCoordinates, createOrUpdateFromGeometry, createOrUpdateFromHeightInfo, make2D } from './src/vcs/vcm/util/featureconverter/extent3d.js';
118
+ export { getMaterialAppearance, createClassificationPrimitive, createPrimitive, createOutlinePrimitive, createLinePrimitive, getMinHeightOrGroundLevel, getStoreyHeights, validateStoreys, getHeightAboveGround, getHeightInfo, getStoreyOptions, addPrimitivesToContext } from './src/vcs/vcm/util/featureconverter/featureconverterHelper.js';
119
+ export { validateLineString, default as lineStringToCesium } from './src/vcs/vcm/util/featureconverter/lineStringToCesium.js';
120
+ export { getBillboardOptions, getLabelOptions, getModelOptions, validatePoint, getCartesian3AndWGS84FromCoordinates, default as pointToCesium } from './src/vcs/vcm/util/featureconverter/pointToCesium.js';
121
+ export { validatePolygon, default as polygonToCesium } from './src/vcs/vcm/util/featureconverter/polygonToCesium.js';
122
+ export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, circleFromCenterRadius, convertGeometryToPolygon, enforceEndingVertex, removeEndingVertex, removeEndingVertexFromGeometry, enforceRightHand } from './src/vcs/vcm/util/geometryHelpers.js';
123
+ export { default as IndexedCollection } from './src/vcs/vcm/util/indexedCollection.js';
124
+ export { isMobile } from './src/vcs/vcm/util/isMobile.js';
125
+ export { default as LayerCollection } from './src/vcs/vcm/util/layerCollection.js';
126
+ export { getLocaleChangedEvent, detectBrowserLocale, getCurrentLocale, setCurrentLocale } from './src/vcs/vcm/util/locale.js';
127
+ export { default as MapCollection } from './src/vcs/vcm/util/mapCollection.js';
128
+ export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance } from './src/vcs/vcm/util/math.js';
129
+ export { wgs84ToMercatorTransformer, mercatorToWgs84Transformer, setDefaultProjectionOptions, getDefaultProjection, wgs84Projection, mercatorProjection, default as Projection } from './src/vcs/vcm/util/projection.js';
130
+ export { default as SplitScreen } from './src/vcs/vcm/util/splitScreen.js';
131
+ export { defaultDeclarativeStyle, default as DeclarativeStyleItem } from './src/vcs/vcm/util/style/declarativeStyleItem.js';
132
+ export { getShapeFromOptions, shapeCategory } from './src/vcs/vcm/util/style/shapesCategory.js';
133
+ export { getStyleOrDefaultStyle } from './src/vcs/vcm/util/style/styleFactory.js';
134
+ export { PatternType, hexToOlColor, cesiumColorToColor, olColorToCesiumColor, parseColor, getCesiumColor, getStringColor, createPattern, olColorToHex, validateHexColor, parseFont, combineFont, colorInCanvas, getFillOptions, getStrokeOptions, getTextOptions, getTextFromOptions, getCssStyleFromTextStyle, emptyStyle, emptyColor, whiteColor, blackColor, getDefaultVectorStyleItemOptions, getDefaultCondition, defaultExtrudedHeightCondition } from './src/vcs/vcm/util/style/styleHelpers.js';
135
+ export { StyleType, referenceableStyleSymbol, default as StyleItem } from './src/vcs/vcm/util/style/styleItem.js';
136
+ export { olcsGeometryType, vectorStyleSymbol, defaultVectorStyle, fromCesiumColor, default as VectorStyleItem } from './src/vcs/vcm/util/style/vectorStyleItem.js';
137
+ export { embedIconsInStyle, default as writeStyle } from './src/vcs/vcm/util/style/writeStyle.js';
138
+ export { isSameOrigin } from './src/vcs/vcm/util/urlHelpers.js';
139
+ export { propertyEqualsEpsilon, angleEqualsEpsilon, coordinateEqualsEpsilon, default as ViewPoint } from './src/vcs/vcm/util/viewpoint.js';
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@vcmap/core",
3
+ "version": "5.0.0-rc.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "types": "index.d.ts",
8
+ "scripts": {
9
+ "test": "node --experimental-json-modules node_modules/mocha/bin/_mocha --exit --require tests/setupJsdom.js --require tests/setup.js --file tests/vcs.js --recursive \"tests/**/*spec.js\"",
10
+ "lint": "eslint .",
11
+ "pretype-check": "npm run build-typedefs",
12
+ "type-check": "node build/typeCheck.js",
13
+ "postinstall": "node build/postinstall.js",
14
+ "coverage": "c8 --reporter text-summary npm run test",
15
+ "coverage:gitlab": "c8 --reporter text-summary npm run test -- --reporter mocha-junit-reporter",
16
+ "serve": "npx wds --node-resolve --open --watch",
17
+ "build-index": "jsdoc -c build/index/conf.json",
18
+ "build-typedefs": "jsdoc -c build/info/conf.json",
19
+ "build-tsd": "node build/buildDTs.js",
20
+ "prepare": "npm run build-index && npm run build-tsd"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/virtualcitySYSTEMS/map-core.git"
25
+ },
26
+ "files": [
27
+ "build/postinstall.js",
28
+ "src/",
29
+ "LICENSE.md",
30
+ "README.md",
31
+ "index.js"
32
+ ],
33
+ "author": "Virtual City Systems",
34
+ "license": "MIT",
35
+ "devDependencies": {
36
+ "@rollup/plugin-commonjs": "^18.0.0",
37
+ "@rollup/plugin-node-resolve": "^11.2.1",
38
+ "@vcmap/cesium": "^1.87.3",
39
+ "@vcsuite/eslint-config": "^2.0.3",
40
+ "@vcsuite/tsd-jsdoc": "^1.0.2",
41
+ "@web/dev-server": "^0.1.11",
42
+ "@web/dev-server-rollup": "^0.3.3",
43
+ "c8": "^7.7.1",
44
+ "canvas": "^2.8.0",
45
+ "chai": "^4.3.4",
46
+ "eslint": "^8.1.0",
47
+ "jsdoc": "^3.6.7",
48
+ "jsdoc-plugin-typescript": "^2.0.6",
49
+ "jsdom": "^16.5.2",
50
+ "jsdom-global": "^3.0.2",
51
+ "mocha": "^9.1.3",
52
+ "mocha-junit-reporter": "^2.0.2",
53
+ "ol": "^6.9.0",
54
+ "sinon": "^9.2.4",
55
+ "sinon-chai": "^3.6.0",
56
+ "typescript": "^4.4.4"
57
+ },
58
+ "peerDependencies": {
59
+ "@vcmap/cesium": "~1.87.2",
60
+ "ol": "^6.5.0"
61
+ },
62
+ "eslintConfig": {
63
+ "extends": [
64
+ "@vcsuite/eslint-config/vue"
65
+ ],
66
+ "rules": {
67
+ "import/extensions": [
68
+ "error",
69
+ "always"
70
+ ]
71
+ }
72
+ },
73
+ "eslintIgnore": [
74
+ "node_modules",
75
+ "coverage",
76
+ "index.js",
77
+ "*.d.ts"
78
+ ],
79
+ "dependencies": {
80
+ "@types/rbush": "^3.0.0",
81
+ "@vcsuite/check": "^1.0.3",
82
+ "@vcsuite/logger": "^1.0.1",
83
+ "@vcsuite/parsers": "^1.0.1",
84
+ "axios": "^0.21.4",
85
+ "fast-deep-equal": "^3.1.3",
86
+ "proj4": "^2.7.2",
87
+ "rbush": ">=3.0.1",
88
+ "rbush-knn": "^3.0.1",
89
+ "underscore.template": "^0.1.7",
90
+ "uuid": "^8.3.2"
91
+ }
92
+ }
@@ -0,0 +1,9 @@
1
+ // @ts-nocheck
2
+ import { Cesium3DTileFeature } from '@vcmap/cesium';
3
+
4
+ /**
5
+ * @returns {string|number}
6
+ */
7
+ Cesium3DTileFeature.prototype.getId = function getId() {
8
+ return this.getProperty('id') || `${this.content.url}${this._batchId}`;
9
+ };
@@ -0,0 +1,9 @@
1
+ // @ts-nocheck
2
+ import { Cesium3DTilePointFeature } from '@vcmap/cesium';
3
+
4
+ /**
5
+ * @returns {string|number}
6
+ */
7
+ Cesium3DTilePointFeature.prototype.getId = function getId() {
8
+ return this.getProperty('id') || `${this.content.url}${this._batchId}`;
9
+ };
@@ -0,0 +1,146 @@
1
+ // @ts-nocheck
2
+ import {
3
+ Cartesian3,
4
+ Matrix3,
5
+ Quaternion,
6
+ Color,
7
+ Primitive,
8
+ GeometryInstance,
9
+ FrustumGeometry,
10
+ ColorGeometryInstanceAttribute,
11
+ PerInstanceColorAppearance,
12
+ FrustumOutlineGeometry,
13
+ destroyObject,
14
+ } from '@vcmap/cesium';
15
+
16
+ const scratchRight = new Cartesian3();
17
+ const scratchRotation = new Matrix3();
18
+ const scratchOrientation = new Quaternion();
19
+
20
+ const scratchColor = new Color();
21
+ const scratchSplits = [1.0, 100000.0];
22
+
23
+ /**
24
+ * @typedef {Object} VcsCameraPrimitiveOptions
25
+ * @property {import("@vcmap/cesium").Camera} camera
26
+ * @property {import("@vcmap/cesium").Color|undefined} [color=Color.YELLOW]
27
+ * @property {boolean|undefined} [show=true]
28
+ * @property {boolean|undefined} [allowPicking=true]
29
+ * @property {Object|undefined} id
30
+ */
31
+
32
+ /**
33
+ * @class
34
+ */
35
+ class VcsCameraPrimitive {
36
+ /**
37
+ * @param {VcsCameraPrimitiveOptions} options
38
+ */
39
+ constructor(options) {
40
+ this._outlinePrimitives = [];
41
+ this._planesPrimitives = [];
42
+ /** @type {boolean} */
43
+ this.show = typeof options.show === 'undefined' ? true : options.show;
44
+ this._camera = options.camera;
45
+ this._color = options.color || Color.YELLOW;
46
+ this.allowPicking = typeof options.allowPicking === 'undefined' ? true : options.allowPicking;
47
+ this.id = options.id || {};
48
+ }
49
+
50
+ update(frameState) {
51
+ if (!this.show) {
52
+ return;
53
+ }
54
+
55
+ const planesPrimitives = this._planesPrimitives;
56
+ const outlinePrimitives = this._outlinePrimitives;
57
+ let i;
58
+ if (planesPrimitives.length === 0) {
59
+ const camera = this._camera;
60
+ const cameraFrustum = camera.frustum;
61
+ const frustum = cameraFrustum.clone();
62
+ const frustumSplits = scratchSplits; // Use near and far planes if no splits created
63
+ frustumSplits[0] = this._camera.frustum.near;
64
+ frustumSplits[1] = this._camera.frustum.far;
65
+
66
+ const position = camera.positionWC;
67
+ const direction = camera.directionWC;
68
+ const up = camera.upWC;
69
+ let right = camera.rightWC;
70
+ right = Cartesian3.negate(right, scratchRight);
71
+
72
+ const rotation = scratchRotation;
73
+ Matrix3.setColumn(rotation, 0, right, rotation);
74
+ Matrix3.setColumn(rotation, 1, up, rotation);
75
+ Matrix3.setColumn(rotation, 2, direction, rotation);
76
+
77
+ const orientation = Quaternion.fromRotationMatrix(rotation, scratchOrientation);
78
+
79
+ planesPrimitives.length = 1;
80
+ outlinePrimitives.length = 1;
81
+
82
+ frustum.near = frustumSplits[0];
83
+ frustum.far = frustumSplits[1];
84
+
85
+ planesPrimitives[0] = new Primitive({
86
+ allowPicking: this.allowPicking,
87
+ geometryInstances: new GeometryInstance({
88
+ geometry: new FrustumGeometry({
89
+ origin: position,
90
+ orientation,
91
+ frustum,
92
+ _drawNearPlane: true,
93
+ }),
94
+ attributes: {
95
+ color: ColorGeometryInstanceAttribute.fromColor(Color.fromAlpha(this._color, 0.1, scratchColor)),
96
+ },
97
+ id: this.id,
98
+ pickPrimitive: this,
99
+ }),
100
+ appearance: new PerInstanceColorAppearance({
101
+ translucent: true,
102
+ flat: true,
103
+ }),
104
+ asynchronous: false,
105
+ });
106
+
107
+ outlinePrimitives[0] = new Primitive({
108
+ allowPicking: this.allowPicking,
109
+ geometryInstances: new GeometryInstance({
110
+ geometry: new FrustumOutlineGeometry({
111
+ origin: position,
112
+ orientation,
113
+ frustum,
114
+ _drawNearPlane: true,
115
+ }),
116
+ attributes: {
117
+ color: ColorGeometryInstanceAttribute.fromColor(this._color),
118
+ },
119
+ id: this.id,
120
+ pickPrimitive: this,
121
+ }),
122
+ appearance: new PerInstanceColorAppearance({
123
+ translucent: false,
124
+ flat: true,
125
+ }),
126
+ asynchronous: false,
127
+ });
128
+ }
129
+ const { length } = planesPrimitives;
130
+ for (i = 0; i < length; ++i) {
131
+ outlinePrimitives[i].update(frameState);
132
+ planesPrimitives[i].update(frameState);
133
+ }
134
+ }
135
+
136
+ destroy() {
137
+ const { length } = this._planesPrimitives;
138
+ for (let i = 0; i < length; ++i) {
139
+ this._outlinePrimitives[i] = this._outlinePrimitives[i] && this._outlinePrimitives[i].destroy();
140
+ this._planesPrimitives[i] = this._planesPrimitives[i] && this._planesPrimitives[i].destroy();
141
+ }
142
+ return destroyObject(this);
143
+ }
144
+ }
145
+
146
+ export default VcsCameraPrimitive;
@@ -0,0 +1,64 @@
1
+ // @ts-nocheck
2
+ import { Material, Cartesian2 } from '@vcmap/cesium';
3
+
4
+ /**
5
+ * @file Wallpaper Material to implement openlayers pattern support in cesium
6
+ */
7
+
8
+ // Call this once at application startup
9
+ // eslint-disable-next-line no-underscore-dangle
10
+ Material._materialCache.addMaterial('Wallpaper', {
11
+ fabric: {
12
+ type: 'Wallpaper',
13
+ uniforms: {
14
+ image: Material.DefaultImageId,
15
+ anchor: new Cartesian2(0, 0),
16
+ },
17
+ components: {
18
+ diffuse: 'texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).rgb',
19
+ alpha: 'texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).a',
20
+ },
21
+ },
22
+ translucent: false,
23
+ });
24
+
25
+ // //Create an instance and assign to anything that has a material property.
26
+ // //scene - the scene
27
+ // //image - the image (I think both a url or Image object are supported)
28
+ // //anchor - A Cartesian3 that is the most southern and westard point of the geometry
29
+ // var WallPaperMaterialProperty = function(scene, image, anchor) {
30
+ // this._scene = scene;
31
+ // this._image = image;
32
+ // this._anchor = anchor;
33
+ // this.definitionChanged = new Cesium.Event();
34
+ // this.isConstant = true;
35
+ // };
36
+ //
37
+ // WallPaperMaterialProperty.prototype.getType = function(time) {
38
+ // return 'Wallpaper';
39
+ // };
40
+ //
41
+ // WallPaperMaterialProperty.prototype.getValue = function(time, result) {
42
+ // if (!Cesium.defined(result)) {
43
+ // result = {
44
+ // image : undefined,
45
+ // anchor : undefined
46
+ // };
47
+ // }
48
+ //
49
+ // result.image = this._image;
50
+ // result.anchor = Cesium.SceneTransforms.wgs84ToDrawingBufferCoordinates(this._scene, this._anchor, result.anchor);
51
+ // if(Cesium.defined(result.anchor)){
52
+ // result.anchor.x = Math.floor(result.anchor.x);
53
+ // result.anchor.y = Math.floor(result.anchor.y);
54
+ // } else {
55
+ // result.anchor = new Cesium.Cartesian2(0, 0);
56
+ // }
57
+ // return result;
58
+ // };
59
+ //
60
+ // WallPaperMaterialProperty.prototype.equals = function(other) {
61
+ // return this === other || //
62
+ // (other instanceof WallPaperMaterialProperty && //
63
+ // this._image === other._image);
64
+ // };
@@ -0,0 +1,47 @@
1
+ import Feature from 'ol/Feature.js';
2
+
3
+ /**
4
+ * To be used for cesium 3D style functions
5
+ * @param {string} property
6
+ * @returns {*}
7
+ */
8
+ Feature.prototype.getProperty = function getProperty(property) {
9
+ if (property === 'attributes') {
10
+ const properties = this.getProperties();
11
+ if (this.getGeometryName()) {
12
+ delete properties[this.getGeometryName()];
13
+ }
14
+ return properties;
15
+ } else if (property === 'olcs_geometryType') {
16
+ const type = this.getGeometry().getType();
17
+ if (type === 'Polygon') {
18
+ return 1;
19
+ } else if (type === 'LineString') {
20
+ return 2;
21
+ } else if (type === 'Point') {
22
+ return 3;
23
+ } else if (type === 'Circle') {
24
+ return 1;
25
+ } else if (type === 'MultiPolygon') {
26
+ return 1;
27
+ } else if (type === 'MultiLineString') {
28
+ return 2;
29
+ } else if (type === 'MultiPoint') {
30
+ return 3;
31
+ }
32
+ return undefined;
33
+ }
34
+ return this.get(property);
35
+ };
36
+
37
+ /**
38
+ * To be used for cesium 3D style functions
39
+ * @param {string} property
40
+ * @returns {*}
41
+ */
42
+ Feature.prototype.getPropertyInherited = function getPropertyInherited(property) {
43
+ return this.getProperty(property);
44
+ };
45
+
46
+ // TODO implement getExactClassName, isClass & isExactClass
47
+ // TODO implement feature.content.tileset.timeSinceLoad
@@ -0,0 +1,24 @@
1
+ import Circle from 'ol/geom/Circle.js';
2
+ import { check } from '@vcsuite/check';
3
+ import { cartesian2DDistance, cartesian3DDistance } from '../../vcs/vcm/util/math.js';
4
+
5
+ /**
6
+ * @returns {Array<import("ol/coordinate").Coordinate>} returns an Array where the first coordinate is the center, and the second the center with an x offset of radius
7
+ */
8
+ // @ts-ignore
9
+ Circle.prototype.getCoordinates = function getCoordinates() {
10
+ return [this.getCenter(), this.getLastCoordinate()];
11
+ };
12
+
13
+ /**
14
+ * @param {Array<import("ol/coordinate").Coordinate>} coordinates - array of length two. The first coordinate is treated as the center, the second as the center with an x offset of radius
15
+ * @param {import("ol/geom/GeometryLayout").default=} optLayout
16
+ */
17
+ Circle.prototype.setCoordinates = function setCoordinates(coordinates, optLayout) {
18
+ check(coordinates, [[Number]]);
19
+ check(coordinates.length, 2);
20
+
21
+ const layout = optLayout || this.getLayout();
22
+ const getRadius = /XYM?/.test(layout) ? cartesian2DDistance : cartesian3DDistance;
23
+ this.setCenterAndRadius(coordinates[0], getRadius(coordinates[0], coordinates[1]), optLayout);
24
+ };