@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.
- package/LICENSE.md +21 -0
- package/README.md +44 -0
- package/build/postinstall.js +44 -0
- package/index.js +139 -0
- package/package.json +92 -0
- package/src/cesium/cesium3DTileFeature.js +9 -0
- package/src/cesium/cesium3DTilePointFeature.js +9 -0
- package/src/cesium/cesiumVcsCameraPrimitive.js +146 -0
- package/src/cesium/wallpaperMaterial.js +64 -0
- package/src/ol/feature.js +47 -0
- package/src/ol/geom/circle.js +24 -0
- package/src/ol/geom/geometryCollection.js +33 -0
- package/src/ol/render/canvas/canvasTileRenderer.js +179 -0
- package/src/ol/source/ClusterEnhancedVectorSource.js +39 -0
- package/src/ol/source/VcsCluster.js +37 -0
- package/src/vcs/vcm/classRegistry.js +106 -0
- package/src/vcs/vcm/event/vcsEvent.js +89 -0
- package/src/vcs/vcm/globalCollections.js +11 -0
- package/src/vcs/vcm/interaction/abstractInteraction.js +149 -0
- package/src/vcs/vcm/interaction/coordinateAtPixel.js +102 -0
- package/src/vcs/vcm/interaction/eventHandler.js +425 -0
- package/src/vcs/vcm/interaction/featureAtPixelInteraction.js +286 -0
- package/src/vcs/vcm/interaction/featureProviderInteraction.js +54 -0
- package/src/vcs/vcm/interaction/interactionChain.js +124 -0
- package/src/vcs/vcm/interaction/interactionType.js +114 -0
- package/src/vcs/vcm/layer/buildings.js +17 -0
- package/src/vcs/vcm/layer/cesium/cesiumTilesetCesium.js +359 -0
- package/src/vcs/vcm/layer/cesium/clusterContext.js +95 -0
- package/src/vcs/vcm/layer/cesium/dataSourceCesium.js +171 -0
- package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +29 -0
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +58 -0
- package/src/vcs/vcm/layer/cesium/rasterLayerCesium.js +110 -0
- package/src/vcs/vcm/layer/cesium/singleImageCesium.js +49 -0
- package/src/vcs/vcm/layer/cesium/terrainCesium.js +80 -0
- package/src/vcs/vcm/layer/cesium/tmsCesium.js +54 -0
- package/src/vcs/vcm/layer/cesium/vectorCesium.js +255 -0
- package/src/vcs/vcm/layer/cesium/vectorContext.js +167 -0
- package/src/vcs/vcm/layer/cesium/vectorRasterTileCesium.js +116 -0
- package/src/vcs/vcm/layer/cesium/vectorTileImageryProvider.js +246 -0
- package/src/vcs/vcm/layer/cesium/wmsCesium.js +71 -0
- package/src/vcs/vcm/layer/cesium/wmtsCesium.js +101 -0
- package/src/vcs/vcm/layer/cesium/x3dmHelper.js +22 -0
- package/src/vcs/vcm/layer/cesiumTileset.js +376 -0
- package/src/vcs/vcm/layer/czml.js +141 -0
- package/src/vcs/vcm/layer/dataSource.js +259 -0
- package/src/vcs/vcm/layer/featureLayer.js +261 -0
- package/src/vcs/vcm/layer/featureStore.js +647 -0
- package/src/vcs/vcm/layer/featureStoreChanges.js +360 -0
- package/src/vcs/vcm/layer/featureStoreState.js +19 -0
- package/src/vcs/vcm/layer/featureVisibility.js +435 -0
- package/src/vcs/vcm/layer/geojson.js +185 -0
- package/src/vcs/vcm/layer/geojsonHelpers.js +450 -0
- package/src/vcs/vcm/layer/globalHider.js +157 -0
- package/src/vcs/vcm/layer/layer.js +752 -0
- package/src/vcs/vcm/layer/layerImplementation.js +102 -0
- package/src/vcs/vcm/layer/layerState.js +17 -0
- package/src/vcs/vcm/layer/layerSymbols.js +6 -0
- package/src/vcs/vcm/layer/oblique/layerOblique.js +76 -0
- package/src/vcs/vcm/layer/oblique/obliqueHelpers.js +175 -0
- package/src/vcs/vcm/layer/oblique/vectorOblique.js +469 -0
- package/src/vcs/vcm/layer/openStreetMap.js +194 -0
- package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +79 -0
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +27 -0
- package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +121 -0
- package/src/vcs/vcm/layer/openlayers/singleImageOpenlayers.js +49 -0
- package/src/vcs/vcm/layer/openlayers/tileDebugOpenlayers.js +39 -0
- package/src/vcs/vcm/layer/openlayers/tmsOpenlayers.js +62 -0
- package/src/vcs/vcm/layer/openlayers/vectorOpenlayers.js +118 -0
- package/src/vcs/vcm/layer/openlayers/vectorTileOpenlayers.js +177 -0
- package/src/vcs/vcm/layer/openlayers/wmsOpenlayers.js +55 -0
- package/src/vcs/vcm/layer/openlayers/wmtsOpenlayers.js +141 -0
- package/src/vcs/vcm/layer/pointCloud.js +162 -0
- package/src/vcs/vcm/layer/rasterLayer.js +294 -0
- package/src/vcs/vcm/layer/singleImage.js +119 -0
- package/src/vcs/vcm/layer/terrain.js +122 -0
- package/src/vcs/vcm/layer/terrainHelpers.js +123 -0
- package/src/vcs/vcm/layer/tileLoadedHelper.js +72 -0
- package/src/vcs/vcm/layer/tileProvider/mvtTileProvider.js +104 -0
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +67 -0
- package/src/vcs/vcm/layer/tileProvider/tileProvider.js +584 -0
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +28 -0
- package/src/vcs/vcm/layer/tileProvider/urlTemplateTileProvider.js +106 -0
- package/src/vcs/vcm/layer/tms.js +121 -0
- package/src/vcs/vcm/layer/vector.js +632 -0
- package/src/vcs/vcm/layer/vectorHelpers.js +206 -0
- package/src/vcs/vcm/layer/vectorProperties.js +1391 -0
- package/src/vcs/vcm/layer/vectorSymbols.js +40 -0
- package/src/vcs/vcm/layer/vectorTile.js +480 -0
- package/src/vcs/vcm/layer/wfs.js +165 -0
- package/src/vcs/vcm/layer/wms.js +270 -0
- package/src/vcs/vcm/layer/wmsHelpers.js +65 -0
- package/src/vcs/vcm/layer/wmts.js +235 -0
- package/src/vcs/vcm/maps/baseOLMap.js +257 -0
- package/src/vcs/vcm/maps/cameraLimiter.js +219 -0
- package/src/vcs/vcm/maps/cesium.js +1192 -0
- package/src/vcs/vcm/maps/map.js +511 -0
- package/src/vcs/vcm/maps/mapState.js +17 -0
- package/src/vcs/vcm/maps/oblique.js +536 -0
- package/src/vcs/vcm/maps/openlayers.js +205 -0
- package/src/vcs/vcm/object.js +92 -0
- package/src/vcs/vcm/oblique/ObliqueCollection.js +572 -0
- package/src/vcs/vcm/oblique/ObliqueDataSet.js +357 -0
- package/src/vcs/vcm/oblique/ObliqueImage.js +247 -0
- package/src/vcs/vcm/oblique/ObliqueImageMeta.js +126 -0
- package/src/vcs/vcm/oblique/ObliqueProvider.js +433 -0
- package/src/vcs/vcm/oblique/ObliqueView.js +130 -0
- package/src/vcs/vcm/oblique/ObliqueViewDirection.js +40 -0
- package/src/vcs/vcm/oblique/helpers.js +483 -0
- package/src/vcs/vcm/oblique/parseImageJson.js +248 -0
- package/src/vcs/vcm/util/clipping/clippingObject.js +386 -0
- package/src/vcs/vcm/util/clipping/clippingObjectManager.js +312 -0
- package/src/vcs/vcm/util/clipping/clippingPlaneHelper.js +413 -0
- package/src/vcs/vcm/util/collection.js +193 -0
- package/src/vcs/vcm/util/dateTime.js +60 -0
- package/src/vcs/vcm/util/exclusiveManager.js +135 -0
- package/src/vcs/vcm/util/extent.js +124 -0
- package/src/vcs/vcm/util/featureProvider/abstractFeatureProvider.js +196 -0
- package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +51 -0
- package/src/vcs/vcm/util/featureProvider/featureProviderSymbols.js +11 -0
- package/src/vcs/vcm/util/featureProvider/tileProviderFeatureProvider.js +62 -0
- package/src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js +280 -0
- package/src/vcs/vcm/util/featureconverter/circleToCesium.js +215 -0
- package/src/vcs/vcm/util/featureconverter/convert.js +83 -0
- package/src/vcs/vcm/util/featureconverter/extent3d.js +154 -0
- package/src/vcs/vcm/util/featureconverter/featureconverterHelper.js +591 -0
- package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +171 -0
- package/src/vcs/vcm/util/featureconverter/pointToCesium.js +359 -0
- package/src/vcs/vcm/util/featureconverter/polygonToCesium.js +229 -0
- package/src/vcs/vcm/util/geometryHelpers.js +172 -0
- package/src/vcs/vcm/util/indexedCollection.js +158 -0
- package/src/vcs/vcm/util/isMobile.js +12 -0
- package/src/vcs/vcm/util/layerCollection.js +216 -0
- package/src/vcs/vcm/util/locale.js +53 -0
- package/src/vcs/vcm/util/mapCollection.js +363 -0
- package/src/vcs/vcm/util/math.js +71 -0
- package/src/vcs/vcm/util/projection.js +348 -0
- package/src/vcs/vcm/util/splitScreen.js +233 -0
- package/src/vcs/vcm/util/style/declarativeStyleItem.js +631 -0
- package/src/vcs/vcm/util/style/shapesCategory.js +67 -0
- package/src/vcs/vcm/util/style/styleFactory.js +48 -0
- package/src/vcs/vcm/util/style/styleHelpers.js +555 -0
- package/src/vcs/vcm/util/style/styleItem.js +226 -0
- package/src/vcs/vcm/util/style/vectorStyleItem.js +927 -0
- package/src/vcs/vcm/util/style/writeStyle.js +48 -0
- package/src/vcs/vcm/util/urlHelpers.js +16 -0
- package/src/vcs/vcm/util/viewpoint.js +333 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { Math as CesiumMath, Rectangle } from '@vcmap/cesium';
|
|
3
|
+
import { parseGeoJSON } from '../geojsonHelpers.js';
|
|
4
|
+
import TileProvider from './tileProvider.js';
|
|
5
|
+
import { getCurrentLocale } from '../../util/locale.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {TileProviderOptions} URLTemplateTileProviderOptions
|
|
9
|
+
* @property {string} url url Template in the form `http://myFeatureSource/layer/getFeatures?minx={minx}&miny={miny}&maxx={maxx}&maxy={maxy}` or `http://myFeatureSource/layer/getFeatures?x={x}&y={y}&level={z}`
|
|
10
|
+
* @api
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* replaces {x}, {y}, {z} with the x, y, z tiling coordinates
|
|
15
|
+
* replaces {minx}, {miny}, {maxx}, {maxy} with extent of the tile if tilingExtent is provided
|
|
16
|
+
* replaces {locale} with the current locale
|
|
17
|
+
*
|
|
18
|
+
* @param {string} url
|
|
19
|
+
* @param {number} x
|
|
20
|
+
* @param {number} y
|
|
21
|
+
* @param {number} z
|
|
22
|
+
* @param {import("@vcmap/cesium").Rectangle=} tilingExtent
|
|
23
|
+
* @returns {string}
|
|
24
|
+
*/
|
|
25
|
+
export function getURL(url, x, y, z, tilingExtent) {
|
|
26
|
+
let replacedURL = url;
|
|
27
|
+
if (tilingExtent) {
|
|
28
|
+
const southwest = Rectangle.southwest(tilingExtent);
|
|
29
|
+
const northeast = Rectangle.northeast(tilingExtent);
|
|
30
|
+
const minx = CesiumMath.toDegrees(southwest.longitude);
|
|
31
|
+
const miny = CesiumMath.toDegrees(southwest.latitude);
|
|
32
|
+
const maxx = CesiumMath.toDegrees(northeast.longitude);
|
|
33
|
+
const maxy = CesiumMath.toDegrees(northeast.latitude);
|
|
34
|
+
replacedURL = replacedURL
|
|
35
|
+
.replace(/\{minx\}/, String(minx))
|
|
36
|
+
.replace(/\{miny\}/, String(miny))
|
|
37
|
+
.replace(/\{maxx\}/, String(maxx))
|
|
38
|
+
.replace(/\{maxy\}/, String(maxy));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
replacedURL = replacedURL
|
|
42
|
+
.replace(/\{x\}/, String(x))
|
|
43
|
+
.replace(/\{y\}/, String(y))
|
|
44
|
+
.replace(/\{z\}/, String(z))
|
|
45
|
+
.replace(/\{locale\}/, getCurrentLocale());
|
|
46
|
+
return replacedURL;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* TileProvider loads GeoJSON from the provided URL. The URL has placeholders:
|
|
51
|
+
* the extent in latitude/longitude via: {minx}, {miny}, {maxx}, {maxy}
|
|
52
|
+
* tile Coordinates in x, y, z(level) via: {x}, {y}, {z}
|
|
53
|
+
* {locale} can be used to request locale aware content.
|
|
54
|
+
*
|
|
55
|
+
* @class
|
|
56
|
+
* @extends {TileProvider}
|
|
57
|
+
* @export
|
|
58
|
+
* @api
|
|
59
|
+
*/
|
|
60
|
+
class URLTemplateTileProvider extends TileProvider {
|
|
61
|
+
/**
|
|
62
|
+
* @readonly
|
|
63
|
+
* @returns {string}
|
|
64
|
+
*/
|
|
65
|
+
static get className() { return 'vcs.vcm.layer.tileProvider.URLTemplateTileProvider'; }
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @returns {URLTemplateTileProviderOptions}
|
|
69
|
+
*/
|
|
70
|
+
static getDefaultOptions() {
|
|
71
|
+
return {
|
|
72
|
+
...TileProvider.getDefaultOptions(),
|
|
73
|
+
url: undefined,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @param {URLTemplateTileProviderOptions} options
|
|
79
|
+
*/
|
|
80
|
+
constructor(options) {
|
|
81
|
+
const defaultOptions = URLTemplateTileProvider.getDefaultOptions();
|
|
82
|
+
super(options);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @type {string}
|
|
86
|
+
*/
|
|
87
|
+
this.url = options.url || defaultOptions.url;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @inheritDoc
|
|
92
|
+
* @param {number} x
|
|
93
|
+
* @param {number} y
|
|
94
|
+
* @param {number} z
|
|
95
|
+
* @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
|
|
96
|
+
*/
|
|
97
|
+
async loader(x, y, z) {
|
|
98
|
+
const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
|
|
99
|
+
const url = getURL(this.url, x, y, z, rectangle);
|
|
100
|
+
const response = await axios.get(url);
|
|
101
|
+
const { features } = parseGeoJSON(response.data, { dynamicStyle: true });
|
|
102
|
+
return features;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default URLTemplateTileProvider;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import RasterLayer from './rasterLayer.js';
|
|
2
|
+
import Openlayers from '../maps/openlayers.js';
|
|
3
|
+
import CesiumMap from '../maps/cesium.js';
|
|
4
|
+
import TMSOpenlayers from './openlayers/tmsOpenlayers.js';
|
|
5
|
+
import TMSCesium from './cesium/tmsCesium.js';
|
|
6
|
+
import { VcsClassRegistry } from '../classRegistry.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {RasterLayerOptions} TMSOptions
|
|
10
|
+
* @property {string} [format=jpeg]
|
|
11
|
+
* @property {import("ol/size").Size} [tileSize=[256, 256]]
|
|
12
|
+
* @api
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {RasterLayerImplementationOptions} TMSImplementationOptions
|
|
17
|
+
* @property {string} format
|
|
18
|
+
* @property {import("ol/size").Size} tileSize
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* TMS Layer
|
|
23
|
+
* @class
|
|
24
|
+
* @export
|
|
25
|
+
* @extends {RasterLayer}
|
|
26
|
+
* @api stable
|
|
27
|
+
*/
|
|
28
|
+
class TMS extends RasterLayer {
|
|
29
|
+
static get className() { return 'vcs.vcm.layer.TMS'; }
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @returns {TMSOptions}
|
|
33
|
+
*/
|
|
34
|
+
static getDefaultOptions() {
|
|
35
|
+
return {
|
|
36
|
+
...RasterLayer.getDefaultOptions(),
|
|
37
|
+
tilingSchema: 'mercator',
|
|
38
|
+
format: 'jpeg',
|
|
39
|
+
tileSize: [256, 256],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {TMSOptions} options
|
|
45
|
+
*/
|
|
46
|
+
constructor(options) {
|
|
47
|
+
const defaultOptions = TMS.getDefaultOptions();
|
|
48
|
+
options.tilingSchema = options.tilingSchema || defaultOptions.tilingSchema;
|
|
49
|
+
super(options);
|
|
50
|
+
|
|
51
|
+
this._supportedMaps = [
|
|
52
|
+
Openlayers.className,
|
|
53
|
+
CesiumMap.className,
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
/** @type {?string} */
|
|
57
|
+
this.format = options.format || defaultOptions.format;
|
|
58
|
+
|
|
59
|
+
/** @type {import("ol/size").Size} */
|
|
60
|
+
this.tileSize = Array.isArray(options.tileSize) ? options.tileSize.slice() : defaultOptions.tileSize;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
* @returns {TMSImplementationOptions}
|
|
66
|
+
*/
|
|
67
|
+
getImplementationOptions() {
|
|
68
|
+
return {
|
|
69
|
+
...super.getImplementationOptions(),
|
|
70
|
+
format: this.format,
|
|
71
|
+
tileSize: this.tileSize,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @inheritDoc
|
|
77
|
+
* @param {import("@vcmap/core").VcsMap} map
|
|
78
|
+
* @returns {Array<TMSOpenlayers|TMSCesium>}
|
|
79
|
+
*/
|
|
80
|
+
createImplementationsForMap(map) {
|
|
81
|
+
if (map instanceof Openlayers) {
|
|
82
|
+
return [new TMSOpenlayers(map, this.getImplementationOptions())];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (map instanceof CesiumMap) {
|
|
86
|
+
return [new TMSCesium(map, this.getImplementationOptions())];
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @inheritDoc
|
|
93
|
+
* @returns {TMSOptions}
|
|
94
|
+
*/
|
|
95
|
+
getConfigObject() {
|
|
96
|
+
const config = /** @type {TMSOptions} */ (super.getConfigObject());
|
|
97
|
+
const defaultOptions = TMS.getDefaultOptions();
|
|
98
|
+
|
|
99
|
+
if (this.tilingSchema !== defaultOptions.tilingSchema) {
|
|
100
|
+
config.tilingSchema = this.tilingSchema;
|
|
101
|
+
} else {
|
|
102
|
+
delete config.tilingSchema;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.format !== defaultOptions.format) {
|
|
106
|
+
config.format = this.format;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (
|
|
110
|
+
this.tileSize[0] !== defaultOptions.tileSize[0] ||
|
|
111
|
+
this.tileSize[1] !== defaultOptions.tileSize[1]
|
|
112
|
+
) {
|
|
113
|
+
config.tileSize = this.tileSize.slice();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return config;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
VcsClassRegistry.registerClass(TMS.className, TMS);
|
|
121
|
+
export default TMS;
|