@vcmap/core 5.0.0-rc.10 → 5.0.0-rc.13
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/index.d.ts +201 -125
- package/index.js +2 -3
- package/package.json +6 -2
- package/src/category/category.js +21 -5
- package/src/classRegistry.js +0 -6
- package/src/context.js +0 -1
- package/src/featureProvider/abstractFeatureProvider.js +0 -1
- package/src/featureProvider/wmsFeatureProvider.js +0 -1
- package/src/interaction/abstractInteraction.js +0 -1
- package/src/interaction/interactionChain.js +0 -1
- package/src/interaction/interactionType.js +1 -5
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +2 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +0 -1
- package/src/layer/cesium/openStreetMapCesiumImpl.js +0 -1
- package/src/layer/cesium/rasterLayerCesiumImpl.js +0 -1
- package/src/layer/cesium/singleImageCesiumImpl.js +0 -1
- package/src/layer/cesium/terrainCesiumImpl.js +0 -1
- package/src/layer/cesium/tmsCesiumImpl.js +0 -1
- package/src/layer/cesium/vectorCesiumImpl.js +3 -4
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +0 -1
- package/src/layer/cesium/vectorTileImageryProvider.js +0 -1
- package/src/layer/cesium/wmsCesiumImpl.js +0 -1
- package/src/layer/cesium/wmtsCesiumImpl.js +0 -1
- package/src/layer/cesiumTilesetLayer.js +0 -1
- package/src/layer/czmlLayer.js +0 -1
- package/src/layer/dataSourceLayer.js +25 -16
- package/src/layer/featureLayer.js +10 -1
- package/src/layer/featureStoreLayer.js +1 -1
- package/src/layer/featureStoreLayerState.js +0 -1
- package/src/layer/featureVisibility.js +3 -1
- package/src/layer/geojsonHelpers.js +0 -4
- package/src/layer/geojsonLayer.js +0 -1
- package/src/layer/globalHider.js +7 -21
- package/src/layer/layer.js +84 -38
- package/src/layer/layerImplementation.js +0 -1
- package/src/layer/layerState.js +0 -1
- package/src/layer/oblique/vectorObliqueImpl.js +1 -3
- package/src/layer/openStreetMapLayer.js +0 -1
- package/src/layer/openlayers/layerOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/vectorOpenlayersImpl.js +2 -3
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/wmsOpenlayersImpl.js +0 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +0 -1
- package/src/layer/pointCloudLayer.js +0 -1
- package/src/layer/rasterLayer.js +0 -2
- package/src/layer/singleImageLayer.js +0 -1
- package/src/layer/terrainLayer.js +0 -1
- package/src/layer/tileProvider/mvtTileProvider.js +21 -2
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +0 -1
- package/src/layer/tileProvider/tileProvider.js +27 -1
- package/src/layer/tileProvider/urlTemplateTileProvider.js +26 -6
- package/src/layer/tmsLayer.js +0 -1
- package/src/layer/vectorLayer.js +0 -1
- package/src/layer/vectorProperties.js +0 -1
- package/src/layer/vectorTileLayer.js +45 -13
- package/src/layer/wfsLayer.js +0 -1
- package/src/layer/wmsLayer.js +0 -1
- package/src/layer/wmtsLayer.js +0 -1
- package/src/map/baseOLMap.js +0 -1
- package/src/map/cameraLimiter.js +0 -1
- package/src/map/cesiumMap.js +0 -1
- package/src/map/mapState.js +0 -1
- package/src/map/obliqueMap.js +0 -1
- package/src/map/openlayersMap.js +0 -1
- package/src/map/vcsMap.js +6 -2
- package/src/oblique/helpers.js +0 -3
- package/src/oblique/obliqueCollection.js +0 -1
- package/src/oblique/obliqueDataSet.js +0 -2
- package/src/oblique/obliqueImage.js +0 -1
- package/src/oblique/obliqueImageMeta.js +0 -1
- package/src/oblique/obliqueProvider.js +0 -1
- package/src/oblique/obliqueView.js +0 -1
- package/src/oblique/obliqueViewDirection.js +0 -3
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/style/declarativeStyleItem.js +0 -1
- package/src/style/shapesCategory.js +0 -2
- package/src/style/styleHelpers.js +0 -11
- package/src/style/styleItem.js +0 -1
- package/src/style/vectorStyleItem.js +0 -4
- package/src/util/clipping/clippingObject.js +0 -2
- package/src/util/clipping/clippingObjectManager.js +0 -1
- package/src/util/clipping/clippingPlaneHelper.js +0 -4
- package/src/util/collection.js +15 -3
- package/src/util/extent.js +0 -1
- package/src/util/indexedCollection.js +0 -1
- package/src/util/layerCollection.js +71 -6
- package/src/util/locale.js +1 -42
- package/src/util/mapCollection.js +29 -14
- package/src/util/overrideCollection.js +8 -9
- package/src/util/projection.js +0 -5
- package/src/util/viewpoint.js +0 -4
- package/src/vcsApp.js +53 -0
- package/src/vcsEvent.js +0 -1
- package/tests/data/buildings/tileset.json +428 -0
- package/tests/data/dynamicPointCzml.json +64 -0
- package/tests/data/oblique/imageData/imagev34.json +352 -0
- package/tests/data/oblique/imageData/imagev35.json +54 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/image.json +1 -0
- package/tests/data/terrain/13/8800/6485.terrain +0 -0
- package/tests/data/terrain/13/8800/6486.terrain +0 -0
- package/tests/data/terrain/13/8801/6485.terrain +0 -0
- package/tests/data/terrain/13/8801/6486.terrain +0 -0
- package/tests/data/terrain/layer.json +136 -0
- package/tests/data/testGeoJSON.json +161 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +272 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +11 -0
- package/tests/unit/helpers/imageHelpers.js +20 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +76 -0
- package/tests/unit/helpers/obliqueHelpers.js +112 -0
- package/tests/unit/helpers/openlayersHelpers.js +22 -0
- package/tests/unit/helpers/terrain/terrainData.js +46 -0
- package/src/util/dateTime.js +0 -60
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tilejson": "2.1.0",
|
|
3
|
+
"qmc-version": "3.5-0-g0f89f13_64bit_QMC_virtualcitySYSTEMS_GmbH",
|
|
4
|
+
"version": "1.1536156513599457",
|
|
5
|
+
"format": "quantized-mesh-1.0",
|
|
6
|
+
"scheme": "tms",
|
|
7
|
+
"extensions": [
|
|
8
|
+
"octvertexnormals"
|
|
9
|
+
],
|
|
10
|
+
"tiles": [
|
|
11
|
+
"{z}/{x}/{y}.terrain?v={version}"
|
|
12
|
+
],
|
|
13
|
+
"minzoom": 0,
|
|
14
|
+
"maxzoom": 13,
|
|
15
|
+
"bounds": [
|
|
16
|
+
-180.0,
|
|
17
|
+
-90.0,
|
|
18
|
+
180.0,
|
|
19
|
+
90.0
|
|
20
|
+
],
|
|
21
|
+
"projection": "EPSG:4326",
|
|
22
|
+
"available": [
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
"endY": 0,
|
|
26
|
+
"endX": 1,
|
|
27
|
+
"startX": 0,
|
|
28
|
+
"startY": 0
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"endY": 1,
|
|
34
|
+
"endX": 2,
|
|
35
|
+
"startX": 2,
|
|
36
|
+
"startY": 1
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
"endY": 3,
|
|
42
|
+
"endX": 4,
|
|
43
|
+
"startX": 4,
|
|
44
|
+
"startY": 3
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
"endY": 6,
|
|
50
|
+
"endX": 8,
|
|
51
|
+
"startX": 8,
|
|
52
|
+
"startY": 6
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"endY": 12,
|
|
58
|
+
"endX": 17,
|
|
59
|
+
"startX": 17,
|
|
60
|
+
"startY": 12
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
{
|
|
65
|
+
"endY": 25,
|
|
66
|
+
"endX": 34,
|
|
67
|
+
"startX": 34,
|
|
68
|
+
"startY": 25
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
{
|
|
73
|
+
"endY": 50,
|
|
74
|
+
"endX": 68,
|
|
75
|
+
"startX": 68,
|
|
76
|
+
"startY": 50
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
"endY": 101,
|
|
82
|
+
"endX": 137,
|
|
83
|
+
"startX": 137,
|
|
84
|
+
"startY": 101
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
{
|
|
89
|
+
"endY": 202,
|
|
90
|
+
"endX": 275,
|
|
91
|
+
"startX": 275,
|
|
92
|
+
"startY": 202
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
"endY": 405,
|
|
98
|
+
"endX": 550,
|
|
99
|
+
"startX": 550,
|
|
100
|
+
"startY": 405
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
"endY": 810,
|
|
106
|
+
"endX": 1100,
|
|
107
|
+
"startX": 1100,
|
|
108
|
+
"startY": 810
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
"endY": 1621,
|
|
114
|
+
"endX": 2200,
|
|
115
|
+
"startX": 2200,
|
|
116
|
+
"startY": 1621
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
|
+
"endY": 3243,
|
|
122
|
+
"endX": 4400,
|
|
123
|
+
"startX": 4400,
|
|
124
|
+
"startY": 3242
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
"endY": 6486,
|
|
130
|
+
"endX": 8801,
|
|
131
|
+
"startX": 8800,
|
|
132
|
+
"startY": 6485
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
]
|
|
136
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"geometries": [
|
|
3
|
+
{
|
|
4
|
+
"type": "Point",
|
|
5
|
+
"coordinates": [
|
|
6
|
+
1,
|
|
7
|
+
1,
|
|
8
|
+
1
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "MultiPoint",
|
|
13
|
+
"coordinates": [
|
|
14
|
+
[
|
|
15
|
+
1,
|
|
16
|
+
1,
|
|
17
|
+
1
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
2,
|
|
21
|
+
2,
|
|
22
|
+
2
|
|
23
|
+
]
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "LineString",
|
|
28
|
+
"coordinates": [
|
|
29
|
+
[1, 1, 1],
|
|
30
|
+
[2, 2, 2]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "MultiLineString",
|
|
35
|
+
"coordinates": [
|
|
36
|
+
[
|
|
37
|
+
[1, 1, 1],
|
|
38
|
+
[2, 2, 2]
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
[3, 3, 3],
|
|
42
|
+
[4, 4, 4]
|
|
43
|
+
]
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "Polygon",
|
|
48
|
+
"coordinates": [
|
|
49
|
+
[
|
|
50
|
+
[0, 0, 0],
|
|
51
|
+
[10, 0, 0],
|
|
52
|
+
[10, 10, 0],
|
|
53
|
+
[0, 10, 0],
|
|
54
|
+
[0, 0, 0]
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
[2, 2, 0],
|
|
58
|
+
[2, 8, 0],
|
|
59
|
+
[8, 8, 0],
|
|
60
|
+
[8, 2, 0],
|
|
61
|
+
[2, 2, 0]
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "MultiPolygon",
|
|
67
|
+
"coordinates": [
|
|
68
|
+
[
|
|
69
|
+
[
|
|
70
|
+
[0, 0, 0],
|
|
71
|
+
[1, 1, 0],
|
|
72
|
+
[0, 1, 0],
|
|
73
|
+
[0, 0, 0]
|
|
74
|
+
]
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
[
|
|
78
|
+
[2, 2, 0],
|
|
79
|
+
[4, 2, 0],
|
|
80
|
+
[4, 4, 0],
|
|
81
|
+
[2, 2, 0]
|
|
82
|
+
]
|
|
83
|
+
]
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"feature": {
|
|
88
|
+
"type": "Feature",
|
|
89
|
+
"id": "test",
|
|
90
|
+
"properties": {
|
|
91
|
+
"foo": 1,
|
|
92
|
+
"bar": "test"
|
|
93
|
+
},
|
|
94
|
+
"geometry": {
|
|
95
|
+
"type": "Point",
|
|
96
|
+
"coordinates": [1, 1, 1]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"circle": {
|
|
100
|
+
"type": "Feature",
|
|
101
|
+
"radius": 10,
|
|
102
|
+
"properties": {
|
|
103
|
+
"foo": 1,
|
|
104
|
+
"bar": "test"
|
|
105
|
+
},
|
|
106
|
+
"geometry": {
|
|
107
|
+
"type": "Point",
|
|
108
|
+
"coordinates": [1, 1, 1]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"featureCollection": {
|
|
112
|
+
"type": "FeatureCollection",
|
|
113
|
+
"features": [
|
|
114
|
+
{
|
|
115
|
+
"type": "Feature",
|
|
116
|
+
"properties": {
|
|
117
|
+
"name": "foo"
|
|
118
|
+
},
|
|
119
|
+
"geometry": {
|
|
120
|
+
"type": "Point",
|
|
121
|
+
"coordinates": [1, 1, 1]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"type": "Feature",
|
|
126
|
+
"radius": 10,
|
|
127
|
+
"properties": {
|
|
128
|
+
"name": "bar"
|
|
129
|
+
},
|
|
130
|
+
"geometry": {
|
|
131
|
+
"type": "Point",
|
|
132
|
+
"coordinates": [1, 1, 1]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"featureWithStyle": {
|
|
138
|
+
"id": "test",
|
|
139
|
+
"geometry": {
|
|
140
|
+
"type": "Point",
|
|
141
|
+
"coordinates": [1, 1, 1]
|
|
142
|
+
},
|
|
143
|
+
"vcsMeta":{
|
|
144
|
+
"style": {
|
|
145
|
+
"fill": {
|
|
146
|
+
"color": [255, 0, 0, 1]
|
|
147
|
+
},
|
|
148
|
+
"stroke": {
|
|
149
|
+
"color": [255, 0, 0, 1],
|
|
150
|
+
"width": 2
|
|
151
|
+
},
|
|
152
|
+
"image": {
|
|
153
|
+
"src": "test"
|
|
154
|
+
},
|
|
155
|
+
"text": {
|
|
156
|
+
"fill": { "color": [255, 0, 0, 1] }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BoundingSphere,
|
|
3
|
+
Entity,
|
|
4
|
+
Camera,
|
|
5
|
+
WebMercatorProjection,
|
|
6
|
+
PrimitiveCollection,
|
|
7
|
+
Globe,
|
|
8
|
+
Event as CesiumEvent,
|
|
9
|
+
SceneMode,
|
|
10
|
+
ImageryLayerCollection,
|
|
11
|
+
Clock,
|
|
12
|
+
DataSourceCollection,
|
|
13
|
+
ScreenSpaceEventHandler,
|
|
14
|
+
Color,
|
|
15
|
+
Cesium3DTileFeature,
|
|
16
|
+
} from '@vcmap/cesium';
|
|
17
|
+
import TweenCollection from '@vcmap/cesium/Source/Scene/TweenCollection.js';
|
|
18
|
+
import ContextLimits from '@vcmap/cesium/Source/Renderer/ContextLimits.js';
|
|
19
|
+
|
|
20
|
+
import CesiumTilesetLayer from '../../../src/layer/cesiumTilesetLayer.js';
|
|
21
|
+
import DataSourceLayer from '../../../src/layer/dataSourceLayer.js';
|
|
22
|
+
import CesiumMap from '../../../src/map/cesiumMap.js';
|
|
23
|
+
import importJSON from './importJSON.js';
|
|
24
|
+
|
|
25
|
+
const defaultTileset = await importJSON('./tests/data/buildings/tileset.json');
|
|
26
|
+
defaultTileset.root.children = [];
|
|
27
|
+
defaultTileset.properties = {};
|
|
28
|
+
|
|
29
|
+
export const tilesetJSON = defaultTileset;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {Sinon.SinonSandbox} sandbox
|
|
33
|
+
* @param {string=} url
|
|
34
|
+
* @returns {*|Sinon.SinonFakeServer|null}
|
|
35
|
+
*/
|
|
36
|
+
export function createTilesetServer(sandbox, url) {
|
|
37
|
+
const server = sandbox ? sandbox.useFakeServer() : sinon.createFakeServer();
|
|
38
|
+
server.autoRespond = true;
|
|
39
|
+
server.respondImmediately = true;
|
|
40
|
+
server.respondWith(
|
|
41
|
+
url || 'http://test.com/tileset.json',
|
|
42
|
+
[200, { 'Content-Type': 'application/json' }, JSON.stringify(tilesetJSON)],
|
|
43
|
+
);
|
|
44
|
+
server.respond();
|
|
45
|
+
return server;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {Sinon.SinonSandbox} sandbox
|
|
50
|
+
* @param {CesiumMap=} cesiumMap
|
|
51
|
+
* @param {string=} name
|
|
52
|
+
* @returns {Promise<CesiumTilesetLayer>}
|
|
53
|
+
*/
|
|
54
|
+
export async function createInitializedTilesetLayer(sandbox, cesiumMap, name) {
|
|
55
|
+
createTilesetServer(sandbox);
|
|
56
|
+
const tilesetLayer = new CesiumTilesetLayer({
|
|
57
|
+
url: 'http://test.com/tileset.json',
|
|
58
|
+
name,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await tilesetLayer.initialize();
|
|
62
|
+
if (cesiumMap) {
|
|
63
|
+
cesiumMap.layerCollection.add(tilesetLayer);
|
|
64
|
+
const impls = tilesetLayer.getImplementationsForMap(cesiumMap);
|
|
65
|
+
await Promise.all(impls.map(async (impl) => {
|
|
66
|
+
await impl.initialize();
|
|
67
|
+
Object.defineProperty(impl.cesium3DTileset, 'boundingSphere', {
|
|
68
|
+
get() {
|
|
69
|
+
return new BoundingSphere();
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return tilesetLayer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function createEntities(numberOfEntities = 1) {
|
|
79
|
+
const layer = new DataSourceLayer({});
|
|
80
|
+
|
|
81
|
+
const entities = new Array(numberOfEntities);
|
|
82
|
+
for (let i = 0; i < numberOfEntities; i++) {
|
|
83
|
+
entities[i] = new Entity({
|
|
84
|
+
model: {},
|
|
85
|
+
});
|
|
86
|
+
layer.addEntity(entities[i]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
layer,
|
|
91
|
+
entities,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @param {sinon.sandbox} sandbox
|
|
97
|
+
* @param {Cesium/Event} event
|
|
98
|
+
* @returns {sinon.spy}
|
|
99
|
+
*/
|
|
100
|
+
export function getCesiumEventSpy(sandbox, event) {
|
|
101
|
+
const spy = sandbox.spy();
|
|
102
|
+
const listener = event.addEventListener(function callback() {
|
|
103
|
+
listener();
|
|
104
|
+
// eslint-disable-next-line prefer-rest-params
|
|
105
|
+
spy(...arguments);
|
|
106
|
+
});
|
|
107
|
+
return spy;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function getMockScene() {
|
|
111
|
+
const scene = {
|
|
112
|
+
screenSpaceCameraController: {
|
|
113
|
+
enableInputs: true,
|
|
114
|
+
},
|
|
115
|
+
globe: new Globe(),
|
|
116
|
+
mode: SceneMode.SCENE3D,
|
|
117
|
+
tweens: new TweenCollection(),
|
|
118
|
+
primitives: new PrimitiveCollection(),
|
|
119
|
+
groundPrimitives: new PrimitiveCollection(),
|
|
120
|
+
imageryLayers: new ImageryLayerCollection(),
|
|
121
|
+
drawingBufferHeight: 100,
|
|
122
|
+
drawingBufferWidth: 100,
|
|
123
|
+
postRender: new CesiumEvent(),
|
|
124
|
+
preUpdate: new CesiumEvent(),
|
|
125
|
+
mapProjection: new WebMercatorProjection(),
|
|
126
|
+
shadowMap: { enabled: false },
|
|
127
|
+
canvas: document.createElement('canvas'),
|
|
128
|
+
terrainProvider: {
|
|
129
|
+
readyPromise: Promise.resolve(),
|
|
130
|
+
},
|
|
131
|
+
frameState: {
|
|
132
|
+
mode: undefined,
|
|
133
|
+
context: {
|
|
134
|
+
depthTexture: true,
|
|
135
|
+
stencilBuffer: true,
|
|
136
|
+
},
|
|
137
|
+
lineWidth: 1,
|
|
138
|
+
},
|
|
139
|
+
context: {
|
|
140
|
+
depthTexture: true,
|
|
141
|
+
stencilBuffer: true,
|
|
142
|
+
},
|
|
143
|
+
render() {},
|
|
144
|
+
pick() {},
|
|
145
|
+
pickPosition() {},
|
|
146
|
+
destroy() {
|
|
147
|
+
this.primitives.destroy();
|
|
148
|
+
this.groundPrimitives.destroy();
|
|
149
|
+
this.imageryLayers.destroy();
|
|
150
|
+
this.globe.destroy();
|
|
151
|
+
this.canvas = null;
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
const camera = new Camera(scene);
|
|
155
|
+
const originalFlyTo = camera.flyTo;
|
|
156
|
+
|
|
157
|
+
camera.flyTo = function flyTo(options) {
|
|
158
|
+
options.duration = 0;
|
|
159
|
+
originalFlyTo.bind(camera)(options);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
scene.camera = camera;
|
|
163
|
+
return scene;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function getCesiumMap(mapOptions) {
|
|
167
|
+
const map = new CesiumMap(mapOptions || {});
|
|
168
|
+
const scene = getMockScene();
|
|
169
|
+
map._cesiumWidget = {
|
|
170
|
+
scene,
|
|
171
|
+
camera: scene.camera,
|
|
172
|
+
render: scene.render,
|
|
173
|
+
resolutionScale: 1,
|
|
174
|
+
clock: new Clock({}),
|
|
175
|
+
destroy() {
|
|
176
|
+
this.scene.destroy();
|
|
177
|
+
this.scene = null;
|
|
178
|
+
this.camera = null;
|
|
179
|
+
},
|
|
180
|
+
resize() {},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
map.screenSpaceEventHandler = new ScreenSpaceEventHandler(map._cesiumWidget.scene.canvas);
|
|
184
|
+
map.dataSourceDisplay = {
|
|
185
|
+
dataSources: new DataSourceCollection(),
|
|
186
|
+
isDestroyed() {
|
|
187
|
+
return false;
|
|
188
|
+
},
|
|
189
|
+
destroy() {
|
|
190
|
+
this.dataSources.destroy();
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
map.initialized = true;
|
|
194
|
+
|
|
195
|
+
return map;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param {VcsApp} app
|
|
200
|
+
* @returns {Promise<CesiumMap>}
|
|
201
|
+
*/
|
|
202
|
+
export async function setCesiumMap(app) {
|
|
203
|
+
const map = getCesiumMap({ layerCollection: app.layers, target: app.maps.target });
|
|
204
|
+
app.maps.add(map);
|
|
205
|
+
await app.maps.setActiveMap(map.name);
|
|
206
|
+
return map;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* creates usable default ContextLimits, copy pasted from chrome
|
|
211
|
+
*/
|
|
212
|
+
export function setupCesiumContextLimits() {
|
|
213
|
+
ContextLimits._highpFloatSupported = true;
|
|
214
|
+
ContextLimits._highpIntSupported = true;
|
|
215
|
+
ContextLimits._maximumAliasedLineWidth = 1;
|
|
216
|
+
ContextLimits._maximumAliasedPointSize = 1024;
|
|
217
|
+
ContextLimits._maximumColorAttachments = 8;
|
|
218
|
+
ContextLimits._maximumCombinedTextureImageUnits = 32;
|
|
219
|
+
ContextLimits._maximumCubeMapSize = 16384;
|
|
220
|
+
ContextLimits._maximumDrawBuffers = 8;
|
|
221
|
+
ContextLimits._maximumFragmentUniformVectors = 1024;
|
|
222
|
+
ContextLimits._maximumRenderbufferSize = 16384;
|
|
223
|
+
ContextLimits._maximumTextureFilterAnisotropy = 16;
|
|
224
|
+
ContextLimits._maximumTextureImageUnits = 16;
|
|
225
|
+
ContextLimits._maximumTextureSize = 16384;
|
|
226
|
+
ContextLimits._maximumVaryingVectors = 30;
|
|
227
|
+
ContextLimits._maximumVertexAttributes = 16;
|
|
228
|
+
ContextLimits._maximumVertexTextureImageUnits = 16;
|
|
229
|
+
ContextLimits._maximumVertexUniformVectors = 4095;
|
|
230
|
+
ContextLimits._maximumViewportHeight = 32767;
|
|
231
|
+
ContextLimits._maximumViewportWidth = 32767;
|
|
232
|
+
ContextLimits._minimumAliasedLineWidth = 1;
|
|
233
|
+
ContextLimits._minimumAliasedPointSize = 1;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
class BatchTable {
|
|
237
|
+
constructor(properties) {
|
|
238
|
+
this.properties = properties;
|
|
239
|
+
this.color = new Color();
|
|
240
|
+
this.show = true;
|
|
241
|
+
this.destroyed = false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
getPropertyNames() { return Object.keys(this.properties); }
|
|
245
|
+
|
|
246
|
+
getProperty(id, prop) { return this.properties[prop]; }
|
|
247
|
+
|
|
248
|
+
getColor() { return this.color; }
|
|
249
|
+
|
|
250
|
+
setColor(id, color) { this.color = color; }
|
|
251
|
+
|
|
252
|
+
getShow() { return this.show; }
|
|
253
|
+
|
|
254
|
+
setShow(id, show) { this.show = show; }
|
|
255
|
+
|
|
256
|
+
isDestroyed() { return this.destroyed; }
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @param {Object} properties
|
|
261
|
+
* @param {Object=} tileset
|
|
262
|
+
* @returns {Cesium.Cesium3DTileFeature}
|
|
263
|
+
*/
|
|
264
|
+
export function createDummyCesium3DTileFeature(properties = {}, tileset) {
|
|
265
|
+
const dummy = new Cesium3DTileFeature();
|
|
266
|
+
const content = { batchTable: new BatchTable(properties), isDestroyed() { return false; } };
|
|
267
|
+
if (tileset) {
|
|
268
|
+
content.tileset = tileset;
|
|
269
|
+
}
|
|
270
|
+
dummy._content = content;
|
|
271
|
+
return dummy;
|
|
272
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} url
|
|
6
|
+
* @param {string} fileName
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export default function getFileNameFromUrl(url, fileName) {
|
|
10
|
+
const dirName = fileURLToPath(url);
|
|
11
|
+
return path.join(dirName, fileName);
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* helper function to wait for a timeout use: await timeout(1);
|
|
3
|
+
* @param {number} ms
|
|
4
|
+
* @returns {Promise<void>}
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
7
|
+
export function timeout(ms) {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
setTimeout(resolve, ms);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* black Pixel dataURI
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export const blackPixelURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYV2NgYGD4DwABBAEAcCBlCwAAAABJRU5ErkJggg==';
|
|
6
|
+
/**
|
|
7
|
+
* green Pixel dataURI
|
|
8
|
+
* @type {string}
|
|
9
|
+
*/
|
|
10
|
+
export const greenPixelURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYV2Ng+M/wHwAEAQH/Xi7hpQAAAABJRU5ErkJggg==';
|
|
11
|
+
/**
|
|
12
|
+
* red Pixel dataURI
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
export const redPixelURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYV2P4z8DwHwAFAAH/plybXQAAAABJRU5ErkJggg==';
|
|
16
|
+
/**
|
|
17
|
+
* blue Pixel dataURI
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
export const bluePixelURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYV2NgYPj/HwADAgH/ybKt7gAAAABJRU5ErkJggg==';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} fileName
|
|
5
|
+
* @returns {Promise<Object>}
|
|
6
|
+
*/
|
|
7
|
+
export default async function importJSON(fileName) {
|
|
8
|
+
if (fs.existsSync(fileName)) {
|
|
9
|
+
const content = await fs.promises.readFile(fileName);
|
|
10
|
+
return JSON.parse(content.toString());
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line no-console
|
|
13
|
+
console.log(`${fileName} does not exist`);
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import nock from 'nock';
|
|
3
|
+
import importJSON from './importJSON.js';
|
|
4
|
+
|
|
5
|
+
const t2199_1342 = await importJSON('./tests/data/oblique/tiledImageData/12/2199/1342.json');
|
|
6
|
+
const t2199_1343 = await importJSON('./tests/data/oblique/tiledImageData/12/2199/1343.json');
|
|
7
|
+
const t2199_1344 = await importJSON('./tests/data/oblique/tiledImageData/12/2199/1344.json');
|
|
8
|
+
const t2200_1342 = await importJSON('./tests/data/oblique/tiledImageData/12/2200/1342.json');
|
|
9
|
+
const t2200_1343 = await importJSON('./tests/data/oblique/tiledImageData/12/2200/1343.json');
|
|
10
|
+
const t2200_1344 = await importJSON('./tests/data/oblique/tiledImageData/12/2200/1344.json');
|
|
11
|
+
const t2201_1342 = await importJSON('./tests/data/oblique/tiledImageData/12/2201/1342.json');
|
|
12
|
+
const t2201_1343 = await importJSON('./tests/data/oblique/tiledImageData/12/2201/1343.json');
|
|
13
|
+
const t2201_1344 = await importJSON('./tests/data/oblique/tiledImageData/12/2201/1344.json');
|
|
14
|
+
const imageJsonTiled = await importJSON('./tests/data/oblique/tiledImageData/image.json');
|
|
15
|
+
|
|
16
|
+
const tiledImageData = {
|
|
17
|
+
12: {
|
|
18
|
+
2199: {
|
|
19
|
+
1342: t2199_1342,
|
|
20
|
+
1343: t2199_1343,
|
|
21
|
+
1344: t2199_1344,
|
|
22
|
+
},
|
|
23
|
+
2200: {
|
|
24
|
+
1342: t2200_1342,
|
|
25
|
+
1343: t2200_1343,
|
|
26
|
+
1344: t2200_1344,
|
|
27
|
+
},
|
|
28
|
+
2201: {
|
|
29
|
+
1342: t2201_1342,
|
|
30
|
+
1343: t2201_1343,
|
|
31
|
+
1344: t2201_1344,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Center point of first image in 12/2200/1342
|
|
38
|
+
* @type {import("ol/coordinate").Coordinate}
|
|
39
|
+
*/
|
|
40
|
+
export const tiledMercatorCoordinate = [1487752.4290728183, 6888473.584735272, 0];
|
|
41
|
+
/**
|
|
42
|
+
* Center point of first image in 12/2199/1342
|
|
43
|
+
* @type {import("ol/coordinate").Coordinate}
|
|
44
|
+
*/
|
|
45
|
+
export const tiledMercatorCoordinate2 = [1477722.079812214, 6897970.75026968, 0];
|
|
46
|
+
/**
|
|
47
|
+
* Center point of first image
|
|
48
|
+
* @type {import("ol/coordinate").Coordinate}
|
|
49
|
+
*/
|
|
50
|
+
export const imagev35MercatorCoordinate = [1488644.796500772, 6892246.018669462, 0];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* serves http://localhost/tiledOblique/image.json
|
|
54
|
+
* @param {import("nock").Scope=} optScope
|
|
55
|
+
* @returns {import("nock").Scope} scope
|
|
56
|
+
*/
|
|
57
|
+
export default function getTiledObliqueImageServer(optScope) {
|
|
58
|
+
return (optScope || nock('http://localhost'))
|
|
59
|
+
.persist()
|
|
60
|
+
.get('/tiledOblique/image.json')
|
|
61
|
+
.reply(
|
|
62
|
+
200,
|
|
63
|
+
JSON.stringify(imageJsonTiled),
|
|
64
|
+
// zlib.gzipSync(Buffer.from(JSON.stringify(imageJsonTiled))),
|
|
65
|
+
{ 'Content-Type': 'application/json' },
|
|
66
|
+
)
|
|
67
|
+
.get(/tiledOblique\/12\/(\d{4})\/(\d{4})\.json/)
|
|
68
|
+
.reply((uri) => {
|
|
69
|
+
const [x, y] = uri.match(/(\d{4})/g);
|
|
70
|
+
return [
|
|
71
|
+
200,
|
|
72
|
+
JSON.stringify(tiledImageData['12'][x][y]),
|
|
73
|
+
{ 'Content-Type': 'application/json' },
|
|
74
|
+
];
|
|
75
|
+
});
|
|
76
|
+
}
|