itowns 2.44.3-next.8 → 2.45.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/README.md +3 -129
- package/examples/3dtiles_loader.html +123 -48
- package/examples/config.json +3 -10
- package/examples/copc_simple_loader.html +15 -5
- package/examples/effects_stereo.html +2 -2
- package/examples/entwine_3d_loader.html +3 -1
- package/examples/entwine_simple_loader.html +1 -1
- package/examples/images/itowns_logo.svg +123 -0
- package/examples/js/plugins/COGParser.js +1 -1
- package/examples/jsm/OGC3DTilesHelper.js +6 -1
- package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
- package/examples/misc_collada.html +2 -2
- package/examples/source_file_geojson_3d.html +0 -1
- package/examples/source_file_kml_raster_usgs.html +0 -1
- package/examples/source_stream_wfs_raster.html +0 -7
- package/examples/vector_tile_mapbox_raster.html +91 -0
- package/examples/view_3d_map_webxr.html +3 -1
- package/examples/view_multi_25d.html +2 -2
- package/package.json +21 -75
- package/CODING.md +0 -120
- package/CONTRIBUTING.md +0 -150
- package/CONTRIBUTORS.md +0 -55
- package/LICENSE.md +0 -44
- package/changelog.md +0 -1361
- package/dist/455.js +0 -2
- package/dist/455.js.map +0 -1
- package/dist/debug.js +0 -3
- package/dist/debug.js.LICENSE.txt +0 -13
- package/dist/debug.js.map +0 -1
- package/dist/itowns.js +0 -3
- package/dist/itowns.js.LICENSE.txt +0 -7
- package/dist/itowns.js.map +0 -1
- package/dist/itowns_lasparser.js +0 -2
- package/dist/itowns_lasparser.js.map +0 -1
- package/dist/itowns_lasworker.js +0 -2
- package/dist/itowns_lasworker.js.map +0 -1
- package/dist/itowns_potree2worker.js +0 -2
- package/dist/itowns_potree2worker.js.map +0 -1
- package/dist/itowns_widgets.js +0 -2
- package/dist/itowns_widgets.js.map +0 -1
- package/examples/.eslintrc.cjs +0 -35
- package/examples/3dtiles_25d.html +0 -120
- package/examples/3dtiles_basic.html +0 -94
- package/examples/3dtiles_batch_table.html +0 -86
- package/examples/3dtiles_ion.html +0 -126
- package/examples/3dtiles_pointcloud.html +0 -95
- package/examples/jsm/.eslintrc.cjs +0 -38
- package/lib/Controls/FirstPersonControls.js +0 -308
- package/lib/Controls/FlyControls.js +0 -175
- package/lib/Controls/GlobeControls.js +0 -1162
- package/lib/Controls/PlanarControls.js +0 -1025
- package/lib/Controls/StateControl.js +0 -429
- package/lib/Controls/StreetControls.js +0 -392
- package/lib/Converter/Feature2Mesh.js +0 -615
- package/lib/Converter/Feature2Texture.js +0 -170
- package/lib/Converter/convertToTile.js +0 -75
- package/lib/Converter/textureConverter.js +0 -44
- package/lib/Core/3DTiles/C3DTBatchTable.js +0 -131
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +0 -96
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +0 -157
- package/lib/Core/3DTiles/C3DTExtensions.js +0 -97
- package/lib/Core/3DTiles/C3DTFeature.js +0 -110
- package/lib/Core/3DTiles/C3DTilesEnums.js +0 -20
- package/lib/Core/3DTiles/C3DTileset.js +0 -99
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +0 -100
- package/lib/Core/AnimationPlayer.js +0 -142
- package/lib/Core/CopcNode.js +0 -174
- package/lib/Core/Deprecated/Undeprecator.js +0 -75
- package/lib/Core/EntwinePointTileNode.js +0 -126
- package/lib/Core/Feature.js +0 -490
- package/lib/Core/Geographic/CoordStars.js +0 -80
- package/lib/Core/Geographic/Coordinates.js +0 -320
- package/lib/Core/Geographic/Crs.js +0 -175
- package/lib/Core/Geographic/Extent.js +0 -534
- package/lib/Core/Geographic/GeoidGrid.js +0 -109
- package/lib/Core/Label.js +0 -222
- package/lib/Core/MainLoop.js +0 -211
- package/lib/Core/Math/Ellipsoid.js +0 -144
- package/lib/Core/Picking.js +0 -255
- package/lib/Core/PointCloudNode.js +0 -42
- package/lib/Core/Potree2Node.js +0 -206
- package/lib/Core/Potree2PointAttributes.js +0 -139
- package/lib/Core/PotreeNode.js +0 -101
- package/lib/Core/Prefab/Globe/Atmosphere.js +0 -299
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
- package/lib/Core/Prefab/Globe/GlobeLayer.js +0 -145
- package/lib/Core/Prefab/Globe/SkyShader.js +0 -78
- package/lib/Core/Prefab/GlobeView.js +0 -161
- package/lib/Core/Prefab/Planar/PlanarLayer.js +0 -53
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +0 -72
- package/lib/Core/Prefab/PlanarView.js +0 -62
- package/lib/Core/Prefab/TileBuilder.js +0 -80
- package/lib/Core/Prefab/computeBufferTileGeometry.js +0 -183
- package/lib/Core/Scheduler/Cache.js +0 -256
- package/lib/Core/Scheduler/CancelledCommandException.js +0 -15
- package/lib/Core/Scheduler/Scheduler.js +0 -294
- package/lib/Core/Style.js +0 -1121
- package/lib/Core/System/Capabilities.js +0 -63
- package/lib/Core/Tile/Tile.js +0 -219
- package/lib/Core/Tile/TileGrid.js +0 -46
- package/lib/Core/TileGeometry.js +0 -40
- package/lib/Core/TileMesh.js +0 -109
- package/lib/Core/View.js +0 -1109
- package/lib/Layer/C3DTilesLayer.js +0 -455
- package/lib/Layer/ColorLayer.js +0 -128
- package/lib/Layer/CopcLayer.js +0 -58
- package/lib/Layer/ElevationLayer.js +0 -107
- package/lib/Layer/EntwinePointTileLayer.js +0 -64
- package/lib/Layer/FeatureGeometryLayer.js +0 -63
- package/lib/Layer/GeoidLayer.js +0 -80
- package/lib/Layer/GeometryLayer.js +0 -202
- package/lib/Layer/InfoLayer.js +0 -64
- package/lib/Layer/LabelLayer.js +0 -456
- package/lib/Layer/Layer.js +0 -304
- package/lib/Layer/LayerUpdateState.js +0 -89
- package/lib/Layer/LayerUpdateStrategy.js +0 -80
- package/lib/Layer/OGC3DTilesLayer.js +0 -387
- package/lib/Layer/OrientedImageLayer.js +0 -222
- package/lib/Layer/PointCloudLayer.js +0 -359
- package/lib/Layer/Potree2Layer.js +0 -164
- package/lib/Layer/PotreeLayer.js +0 -65
- package/lib/Layer/RasterLayer.js +0 -27
- package/lib/Layer/ReferencingLayerProperties.js +0 -62
- package/lib/Layer/TiledGeometryLayer.js +0 -403
- package/lib/Loader/LASLoader.js +0 -193
- package/lib/Loader/Potree2BrotliLoader.js +0 -261
- package/lib/Loader/Potree2Loader.js +0 -207
- package/lib/Main.js +0 -115
- package/lib/MainBundle.js +0 -4
- package/lib/Parser/B3dmParser.js +0 -174
- package/lib/Parser/CameraCalibrationParser.js +0 -94
- package/lib/Parser/GDFParser.js +0 -72
- package/lib/Parser/GTXParser.js +0 -75
- package/lib/Parser/GeoJsonParser.js +0 -212
- package/lib/Parser/GpxParser.js +0 -25
- package/lib/Parser/ISGParser.js +0 -71
- package/lib/Parser/KMLParser.js +0 -25
- package/lib/Parser/LASParser.js +0 -137
- package/lib/Parser/MapBoxUrlParser.js +0 -83
- package/lib/Parser/PntsParser.js +0 -131
- package/lib/Parser/Potree2BinParser.js +0 -92
- package/lib/Parser/PotreeBinParser.js +0 -106
- package/lib/Parser/PotreeCinParser.js +0 -29
- package/lib/Parser/ShapefileParser.js +0 -78
- package/lib/Parser/VectorTileParser.js +0 -202
- package/lib/Parser/XbilParser.js +0 -119
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +0 -1386
- package/lib/Parser/iGLTFLoader.js +0 -168
- package/lib/Process/3dTilesProcessing.js +0 -304
- package/lib/Process/FeatureProcessing.js +0 -76
- package/lib/Process/LayeredMaterialNodeProcessing.js +0 -221
- package/lib/Process/ObjectRemovalHelper.js +0 -97
- package/lib/Process/handlerNodeError.js +0 -23
- package/lib/Provider/3dTilesProvider.js +0 -149
- package/lib/Provider/DataSourceProvider.js +0 -8
- package/lib/Provider/Fetcher.js +0 -229
- package/lib/Provider/PointCloudProvider.js +0 -45
- package/lib/Provider/TileProvider.js +0 -16
- package/lib/Provider/URLBuilder.js +0 -116
- package/lib/Renderer/Camera.js +0 -281
- package/lib/Renderer/Color.js +0 -56
- package/lib/Renderer/ColorLayersOrdering.js +0 -115
- package/lib/Renderer/CommonMaterial.js +0 -31
- package/lib/Renderer/Label2DRenderer.js +0 -190
- package/lib/Renderer/LayeredMaterial.js +0 -243
- package/lib/Renderer/OBB.js +0 -153
- package/lib/Renderer/OrientedImageCamera.js +0 -118
- package/lib/Renderer/OrientedImageMaterial.js +0 -167
- package/lib/Renderer/PointsMaterial.js +0 -485
- package/lib/Renderer/RasterTile.js +0 -209
- package/lib/Renderer/RenderMode.js +0 -31
- package/lib/Renderer/Shader/ShaderChunk.js +0 -160
- package/lib/Renderer/Shader/ShaderUtils.js +0 -47
- package/lib/Renderer/SphereHelper.js +0 -23
- package/lib/Renderer/WebXR.js +0 -51
- package/lib/Renderer/c3DEngine.js +0 -214
- package/lib/Source/C3DTilesGoogleSource.js +0 -74
- package/lib/Source/C3DTilesIonSource.js +0 -54
- package/lib/Source/C3DTilesSource.js +0 -30
- package/lib/Source/CopcSource.js +0 -115
- package/lib/Source/EntwinePointTileSource.js +0 -62
- package/lib/Source/FileSource.js +0 -189
- package/lib/Source/OGC3DTilesGoogleSource.js +0 -29
- package/lib/Source/OGC3DTilesIonSource.js +0 -34
- package/lib/Source/OGC3DTilesSource.js +0 -21
- package/lib/Source/OrientedImageSource.js +0 -59
- package/lib/Source/Potree2Source.js +0 -167
- package/lib/Source/PotreeSource.js +0 -82
- package/lib/Source/Source.js +0 -223
- package/lib/Source/TMSSource.js +0 -145
- package/lib/Source/VectorTilesSource.js +0 -178
- package/lib/Source/WFSSource.js +0 -168
- package/lib/Source/WMSSource.js +0 -133
- package/lib/Source/WMTSSource.js +0 -86
- package/lib/ThreeExtended/capabilities/WebGL.js +0 -69
- package/lib/ThreeExtended/libs/ktx-parse.module.js +0 -470
- package/lib/ThreeExtended/libs/zstddec.module.js +0 -29
- package/lib/ThreeExtended/loaders/DDSLoader.js +0 -200
- package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -399
- package/lib/ThreeExtended/loaders/GLTFLoader.js +0 -2876
- package/lib/ThreeExtended/loaders/KTX2Loader.js +0 -625
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +0 -846
- package/lib/ThreeExtended/utils/WorkerPool.js +0 -70
- package/lib/Utils/CameraUtils.js +0 -555
- package/lib/Utils/DEMUtils.js +0 -350
- package/lib/Utils/FeaturesUtils.js +0 -156
- package/lib/Utils/Gradients.js +0 -16
- package/lib/Utils/OrientationUtils.js +0 -457
- package/lib/Utils/ThreeUtils.js +0 -115
- package/lib/Utils/gui/C3DTilesStyle.js +0 -215
- package/lib/Utils/gui/Main.js +0 -7
- package/lib/Utils/gui/Minimap.js +0 -154
- package/lib/Utils/gui/Navigation.js +0 -245
- package/lib/Utils/gui/Scale.js +0 -107
- package/lib/Utils/gui/Searchbar.js +0 -234
- package/lib/Utils/gui/Widget.js +0 -80
- package/lib/Utils/placeObjectOnGround.js +0 -137
- package/lib/Worker/LASLoaderWorker.js +0 -19
- package/lib/Worker/Potree2Worker.js +0 -21
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* babel-plugin-inline-import '../../Renderer/Shader/SampleTestFS.glsl' */
|
|
2
|
-
const SampleTestFS = "uniform sampler2D uni[SAMPLE];\nvoid main() {\n gl_FragColor += texture2D(uni[SAMPLE-1], vec2(0));\n}";
|
|
3
|
-
/* babel-plugin-inline-import '../../Renderer/Shader/SampleTestVS.glsl' */
|
|
4
|
-
const SampleTestVS = "void main() {\n gl_Position = vec4( 0.0, 0.0, 0.0, 1.0 );\n}"; // default values
|
|
5
|
-
let logDepthBufferSupported = false;
|
|
6
|
-
let maxTexturesUnits = 8;
|
|
7
|
-
let maxTextureSize = 4096;
|
|
8
|
-
function _WebGLShader(renderer, type, string) {
|
|
9
|
-
const gl = renderer.getContext();
|
|
10
|
-
const shader = gl.createShader(type);
|
|
11
|
-
gl.shaderSource(shader, string);
|
|
12
|
-
gl.compileShader(shader);
|
|
13
|
-
return shader;
|
|
14
|
-
}
|
|
15
|
-
function isFirefox() {
|
|
16
|
-
return navigator && navigator.userAgent && navigator.userAgent.toLowerCase().includes('firefox');
|
|
17
|
-
}
|
|
18
|
-
export default {
|
|
19
|
-
isLogDepthBufferSupported() {
|
|
20
|
-
return logDepthBufferSupported;
|
|
21
|
-
},
|
|
22
|
-
isFirefox,
|
|
23
|
-
getMaxTextureUnitsCount() {
|
|
24
|
-
return maxTexturesUnits;
|
|
25
|
-
},
|
|
26
|
-
getMaxTextureSize() {
|
|
27
|
-
return maxTextureSize;
|
|
28
|
-
},
|
|
29
|
-
updateCapabilities(renderer) {
|
|
30
|
-
const gl = renderer.getContext();
|
|
31
|
-
maxTexturesUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
32
|
-
maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
33
|
-
const program = gl.createProgram();
|
|
34
|
-
const glVertexShader = _WebGLShader(renderer, gl.VERTEX_SHADER, SampleTestVS);
|
|
35
|
-
let fragmentShader = `#define SAMPLE ${maxTexturesUnits}\n`;
|
|
36
|
-
fragmentShader += SampleTestFS;
|
|
37
|
-
const glFragmentShader = _WebGLShader(renderer, gl.FRAGMENT_SHADER, fragmentShader);
|
|
38
|
-
gl.attachShader(program, glVertexShader);
|
|
39
|
-
gl.attachShader(program, glFragmentShader);
|
|
40
|
-
gl.linkProgram(program);
|
|
41
|
-
if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {
|
|
42
|
-
if (maxTexturesUnits > 16) {
|
|
43
|
-
const info = gl.getProgramInfoLog(program);
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
|
-
console.warn(`${info}: using a maximum of 16 texture units instead of the reported value (${maxTexturesUnits})`);
|
|
46
|
-
if (isFirefox()) {
|
|
47
|
-
// eslint-disable-next-line no-console
|
|
48
|
-
console.warn(`It can come from a Mesa/Firefox bug;
|
|
49
|
-
the shader compiles to an error when using more than 16 sampler uniforms,
|
|
50
|
-
see https://bugzilla.mozilla.org/show_bug.cgi?id=777028`);
|
|
51
|
-
}
|
|
52
|
-
maxTexturesUnits = 16;
|
|
53
|
-
} else {
|
|
54
|
-
throw new Error(`The GPU capabilities could not be determined accurately.
|
|
55
|
-
Impossible to link a shader with the Maximum texture units ${maxTexturesUnits}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
gl.deleteProgram(program);
|
|
59
|
-
gl.deleteShader(glVertexShader);
|
|
60
|
-
gl.deleteShader(glFragmentShader);
|
|
61
|
-
logDepthBufferSupported = renderer.capabilities.logarithmicDepthBuffer;
|
|
62
|
-
}
|
|
63
|
-
};
|
package/lib/Core/Tile/Tile.js
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import Coordinates from "../Geographic/Coordinates.js";
|
|
3
|
-
import CRS from "../Geographic/Crs.js";
|
|
4
|
-
import Extent from "../Geographic/Extent.js";
|
|
5
|
-
import { getInfoTms, getCountTiles } from "./TileGrid.js";
|
|
6
|
-
const _tmsCoord = new THREE.Vector2();
|
|
7
|
-
const _dimensionTile = new THREE.Vector2();
|
|
8
|
-
const r = {
|
|
9
|
-
row: 0,
|
|
10
|
-
col: 0,
|
|
11
|
-
invDiff: 0
|
|
12
|
-
};
|
|
13
|
-
function _rowColfromParent(/** @type {Tile} */tile, /** @type {number} */zoom) {
|
|
14
|
-
const diffLevel = tile.zoom - zoom;
|
|
15
|
-
const diff = 2 ** diffLevel;
|
|
16
|
-
r.invDiff = 1 / diff;
|
|
17
|
-
r.row = (tile.row - tile.row % diff) * r.invDiff;
|
|
18
|
-
r.col = (tile.col - tile.col % diff) * r.invDiff;
|
|
19
|
-
return r;
|
|
20
|
-
}
|
|
21
|
-
const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
22
|
-
const _extent2 = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
23
|
-
const _c = new Coordinates('EPSG:4326', 0, 0);
|
|
24
|
-
class Tile {
|
|
25
|
-
/**
|
|
26
|
-
* Tile is a geographical bounding rectangle defined by zoom, row and column.
|
|
27
|
-
*
|
|
28
|
-
* @param {String} crs projection of limit values.
|
|
29
|
-
* @param {number} [zoom=0] zoom value
|
|
30
|
-
* @param {number} [row=0] row value
|
|
31
|
-
* @param {number} [col=0] column value
|
|
32
|
-
*/
|
|
33
|
-
constructor(crs) {
|
|
34
|
-
let zoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
35
|
-
let row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
36
|
-
let col = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
37
|
-
this.isTile = true;
|
|
38
|
-
this.crs = crs;
|
|
39
|
-
this.zoom = zoom;
|
|
40
|
-
this.row = row;
|
|
41
|
-
this.col = col;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Clone this tile
|
|
46
|
-
* @return {Tile} cloned tile
|
|
47
|
-
*/
|
|
48
|
-
clone() {
|
|
49
|
-
return new Tile(this.crs, this.zoom, this.row, this.col);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Convert tile to the specified extent.
|
|
54
|
-
* @param {string} crs the projection of destination.
|
|
55
|
-
* @param {Extent} target copy the destination to target.
|
|
56
|
-
* @return {Extent}
|
|
57
|
-
*/
|
|
58
|
-
toExtent(crs, target) {
|
|
59
|
-
CRS.isValid(crs);
|
|
60
|
-
target = target || new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
61
|
-
const {
|
|
62
|
-
epsg,
|
|
63
|
-
globalExtent,
|
|
64
|
-
globalDimension
|
|
65
|
-
} = getInfoTms(this.crs);
|
|
66
|
-
const countTiles = getCountTiles(this.crs, this.zoom);
|
|
67
|
-
_dimensionTile.set(1, 1).divide(countTiles).multiply(globalDimension);
|
|
68
|
-
target.west = globalExtent.west + (globalDimension.x - _dimensionTile.x * (countTiles.x - this.col));
|
|
69
|
-
target.east = target.west + _dimensionTile.x;
|
|
70
|
-
target.south = globalExtent.south + _dimensionTile.y * (countTiles.y - this.row - 1);
|
|
71
|
-
target.north = target.south + _dimensionTile.y;
|
|
72
|
-
target.crs = epsg;
|
|
73
|
-
target.zoom = this.zoom;
|
|
74
|
-
return crs == epsg ? target : target.as(crs, target);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Return true if `tile` is inside this tile.
|
|
79
|
-
*
|
|
80
|
-
* @param {Tile} tile the tile to check
|
|
81
|
-
*
|
|
82
|
-
* @return {boolean}
|
|
83
|
-
*/
|
|
84
|
-
isInside(tile) {
|
|
85
|
-
if (this.zoom == tile.zoom) {
|
|
86
|
-
return this.row == tile.row && this.col == tile.col;
|
|
87
|
-
} else if (this.zoom < tile.zoom) {
|
|
88
|
-
return false;
|
|
89
|
-
} else {
|
|
90
|
-
_rowColfromParent(this, tile.zoom);
|
|
91
|
-
return r.row == tile.row && r.col == tile.col;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Return the translation and scale to transform this tile to input tile.
|
|
97
|
-
*
|
|
98
|
-
* @param {Tile} tile input tile
|
|
99
|
-
* @param {THREE.Vector4} target copy the result to target.
|
|
100
|
-
* @return {THREE.Vector4} {x: translation on west-east, y: translation on south-north, z: scale on west-east, w: scale on south-north}
|
|
101
|
-
*/
|
|
102
|
-
offsetToParent(tile) {
|
|
103
|
-
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new THREE.Vector4();
|
|
104
|
-
if (this.crs != tile.crs) {
|
|
105
|
-
throw new Error('unsupported mix');
|
|
106
|
-
}
|
|
107
|
-
_rowColfromParent(this, tile.zoom);
|
|
108
|
-
return target.set(this.col * r.invDiff - r.col, this.row * r.invDiff - r.row, r.invDiff, r.invDiff);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Return parent tile with input level
|
|
113
|
-
*
|
|
114
|
-
* @param {number} levelParent level of parent.
|
|
115
|
-
* @return {Tile}
|
|
116
|
-
*/
|
|
117
|
-
tiledExtentParent(levelParent) {
|
|
118
|
-
if (levelParent && levelParent < this.zoom) {
|
|
119
|
-
_rowColfromParent(this, levelParent);
|
|
120
|
-
return new Tile(this.crs, levelParent, r.row, r.col);
|
|
121
|
-
} else {
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Set zoom, row and column values
|
|
128
|
-
*
|
|
129
|
-
* @param {number} [zoom=0] zoom value
|
|
130
|
-
* @param {number} [row=0] row value
|
|
131
|
-
* @param {number} [col=0] column value
|
|
132
|
-
*
|
|
133
|
-
* @return {Tile}
|
|
134
|
-
*/
|
|
135
|
-
set() {
|
|
136
|
-
let zoom = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
137
|
-
let row = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
138
|
-
let col = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
139
|
-
this.zoom = zoom;
|
|
140
|
-
this.row = row;
|
|
141
|
-
this.col = col;
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Copy to this tile to input tile.
|
|
147
|
-
* @param {Tile} tile
|
|
148
|
-
* @return {Tile} copied extent
|
|
149
|
-
*/
|
|
150
|
-
copy(tile) {
|
|
151
|
-
this.crs = tile.crs;
|
|
152
|
-
return this.set(tile.zoom, tile.row, tile.col);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Return values of tile in string, separated by the separator input.
|
|
157
|
-
* @param {string} separator
|
|
158
|
-
* @return {string}
|
|
159
|
-
*/
|
|
160
|
-
toString() {
|
|
161
|
-
let separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
162
|
-
return `${this.zoom}${separator}${this.row}${separator}${this.col}`;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* @param {Extent} e
|
|
168
|
-
* @param {string} tms
|
|
169
|
-
* @returns {Tile[]}
|
|
170
|
-
*/
|
|
171
|
-
export function tiledCovering(e, tms) {
|
|
172
|
-
if (e.crs == 'EPSG:4326' && tms == CRS.tms_3857) {
|
|
173
|
-
const WMTS_PM = [];
|
|
174
|
-
const extent = _extent.copy(e).as(CRS.formatToEPSG(tms), _extent2);
|
|
175
|
-
const {
|
|
176
|
-
globalExtent,
|
|
177
|
-
globalDimension,
|
|
178
|
-
sTs
|
|
179
|
-
} = getInfoTms(CRS.formatToEPSG(tms));
|
|
180
|
-
extent.clampByExtent(globalExtent);
|
|
181
|
-
extent.planarDimensions(_dimensionTile);
|
|
182
|
-
const zoom = e.zoom + 1 || Math.floor(Math.log2(Math.round(globalDimension.x / (_dimensionTile.x * sTs.x))));
|
|
183
|
-
const countTiles = getCountTiles(tms, zoom);
|
|
184
|
-
const center = extent.center(_c);
|
|
185
|
-
_tmsCoord.x = center.x - globalExtent.west;
|
|
186
|
-
_tmsCoord.y = globalExtent.north - extent.north;
|
|
187
|
-
_tmsCoord.divide(globalDimension).multiply(countTiles).floor();
|
|
188
|
-
|
|
189
|
-
// ]N; N+1] => N
|
|
190
|
-
const maxRow = Math.ceil((globalExtent.north - extent.south) / globalDimension.x * countTiles.y) - 1;
|
|
191
|
-
for (let r = maxRow; r >= _tmsCoord.y; r--) {
|
|
192
|
-
WMTS_PM.push(new Tile(tms, zoom, r, _tmsCoord.x));
|
|
193
|
-
}
|
|
194
|
-
return WMTS_PM;
|
|
195
|
-
} else {
|
|
196
|
-
const target = new Tile(tms, 0, 0, 0);
|
|
197
|
-
const {
|
|
198
|
-
globalExtent,
|
|
199
|
-
globalDimension,
|
|
200
|
-
sTs,
|
|
201
|
-
isInverted
|
|
202
|
-
} = getInfoTms(e.crs);
|
|
203
|
-
const center = e.center(_c);
|
|
204
|
-
e.planarDimensions(_dimensionTile);
|
|
205
|
-
// Each level has 2^n * 2^n tiles...
|
|
206
|
-
// ... so we count how many tiles of the same width as tile we can fit in the layer
|
|
207
|
-
// ... 2^zoom = tilecount => zoom = log2(tilecount)
|
|
208
|
-
const zoom = Math.floor(Math.log2(Math.round(globalDimension.x / (_dimensionTile.x * sTs.x))));
|
|
209
|
-
const countTiles = getCountTiles(tms, zoom);
|
|
210
|
-
|
|
211
|
-
// Now that we have computed zoom, we can deduce x and y (or row / column)
|
|
212
|
-
_tmsCoord.x = center.x - globalExtent.west;
|
|
213
|
-
_tmsCoord.y = isInverted ? globalExtent.north - center.y : center.y - globalExtent.south;
|
|
214
|
-
_tmsCoord.divide(globalDimension).multiply(countTiles).floor();
|
|
215
|
-
target.set(zoom, _tmsCoord.y, _tmsCoord.x);
|
|
216
|
-
return [target];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
export default Tile;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import CRS from "../Geographic/Crs.js";
|
|
3
|
-
import Extent from "../Geographic/Extent.js";
|
|
4
|
-
const _countTiles = new THREE.Vector2();
|
|
5
|
-
const _dim = new THREE.Vector2();
|
|
6
|
-
export const globalExtentTMS = new Map();
|
|
7
|
-
export const schemeTiles = new Map();
|
|
8
|
-
const extent4326 = new Extent('EPSG:4326', -180, 180, -90, 90);
|
|
9
|
-
globalExtentTMS.set('EPSG:4326', extent4326);
|
|
10
|
-
|
|
11
|
-
// Compute global extent of TMS in EPSG:3857
|
|
12
|
-
// It's square whose a side is between -180° to 180°.
|
|
13
|
-
// So, west extent, it's 180 convert in EPSG:3857
|
|
14
|
-
const extent3857 = extent4326.as('EPSG:3857');
|
|
15
|
-
extent3857.clampSouthNorth(extent3857.west, extent3857.east);
|
|
16
|
-
globalExtentTMS.set('EPSG:3857', extent3857);
|
|
17
|
-
schemeTiles.set('default', new THREE.Vector2(1, 1));
|
|
18
|
-
schemeTiles.set(CRS.tms_3857, schemeTiles.get('default'));
|
|
19
|
-
schemeTiles.set(CRS.tms_4326, new THREE.Vector2(2, 1));
|
|
20
|
-
export function getInfoTms(/** @type {string} */crs) {
|
|
21
|
-
const epsg = CRS.formatToEPSG(crs);
|
|
22
|
-
const globalExtent = globalExtentTMS.get(epsg);
|
|
23
|
-
const globalDimension = globalExtent.planarDimensions(_dim);
|
|
24
|
-
const tms = CRS.formatToTms(crs);
|
|
25
|
-
const sTs = schemeTiles.get(tms) || schemeTiles.get('default');
|
|
26
|
-
// The isInverted parameter is to be set to the correct value, true or false
|
|
27
|
-
// (default being false) if the computation of the coordinates needs to be
|
|
28
|
-
// inverted to match the same scheme as OSM, Google Maps or other system.
|
|
29
|
-
// See link below for more information
|
|
30
|
-
// https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/
|
|
31
|
-
// in crs includes ':NI' => tms isn't inverted (NOT INVERTED)
|
|
32
|
-
const isInverted = !tms.includes(':NI');
|
|
33
|
-
return {
|
|
34
|
-
epsg,
|
|
35
|
-
globalExtent,
|
|
36
|
-
globalDimension,
|
|
37
|
-
sTs,
|
|
38
|
-
isInverted
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export function getCountTiles(/** @type {string} */crs, /** @type {number} */zoom) {
|
|
42
|
-
const sTs = schemeTiles.get(CRS.formatToTms(crs)) || schemeTiles.get('default');
|
|
43
|
-
const count = 2 ** zoom;
|
|
44
|
-
_countTiles.set(count, count).multiply(sTs);
|
|
45
|
-
return _countTiles;
|
|
46
|
-
}
|
package/lib/Core/TileGeometry.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import computeBuffers, { getBufferIndexSize } from "./Prefab/computeBufferTileGeometry.js";
|
|
3
|
-
function defaultBuffers(params) {
|
|
4
|
-
params.buildIndexAndUv_0 = true;
|
|
5
|
-
params.center = params.builder.center(params.extent).clone();
|
|
6
|
-
const buffers = computeBuffers(params);
|
|
7
|
-
buffers.index = new THREE.BufferAttribute(buffers.index, 1);
|
|
8
|
-
buffers.uvs[0] = new THREE.BufferAttribute(buffers.uvs[0], 2);
|
|
9
|
-
buffers.position = new THREE.BufferAttribute(buffers.position, 3);
|
|
10
|
-
buffers.normal = new THREE.BufferAttribute(buffers.normal, 3);
|
|
11
|
-
for (let i = 1; i < params.builder.uvCount; i++) {
|
|
12
|
-
buffers.uvs[1] = new THREE.BufferAttribute(buffers.uvs[1], 1);
|
|
13
|
-
}
|
|
14
|
-
return buffers;
|
|
15
|
-
}
|
|
16
|
-
class TileGeometry extends THREE.BufferGeometry {
|
|
17
|
-
constructor(params) {
|
|
18
|
-
let buffers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBuffers(params);
|
|
19
|
-
super();
|
|
20
|
-
this.center = params.center;
|
|
21
|
-
this.extent = params.extent;
|
|
22
|
-
this.segments = params.segments;
|
|
23
|
-
this.setIndex(buffers.index);
|
|
24
|
-
this.setAttribute('position', buffers.position);
|
|
25
|
-
this.setAttribute('normal', buffers.normal);
|
|
26
|
-
this.setAttribute('uv', buffers.uvs[0]);
|
|
27
|
-
for (let i = 1; i < buffers.uvs.length; i++) {
|
|
28
|
-
this.setAttribute(`uv_${i}`, buffers.uvs[i]);
|
|
29
|
-
}
|
|
30
|
-
this.computeBoundingBox();
|
|
31
|
-
this.OBB = {};
|
|
32
|
-
if (params.hideSkirt) {
|
|
33
|
-
this.hideSkirt = params.hideSkirt;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
set hideSkirt(value) {
|
|
37
|
-
this.setDrawRange(0, getBufferIndexSize(this.segments, value));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export default TileGeometry;
|
package/lib/Core/TileMesh.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import CRS from "./Geographic/Crs.js";
|
|
3
|
-
import { geoidLayerIsVisible } from "../Layer/GeoidLayer.js";
|
|
4
|
-
import { tiledCovering } from "./Tile/Tile.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A TileMesh is a THREE.Mesh with a geometricError and an OBB
|
|
8
|
-
* The objectId property of the material is the with the id of the TileMesh
|
|
9
|
-
* @param {TileGeometry} geometry - the tile geometry
|
|
10
|
-
* @param {THREE.Material} material - a THREE.Material compatible with THREE.Mesh
|
|
11
|
-
* @param {Layer} layer - the layer the tile is added to
|
|
12
|
-
* @param {Extent} extent - the tile extent
|
|
13
|
-
* @param {?number} level - the tile level (default = 0)
|
|
14
|
-
*/
|
|
15
|
-
class TileMesh extends THREE.Mesh {
|
|
16
|
-
#_tms = (() => new Map())();
|
|
17
|
-
#visible = true;
|
|
18
|
-
constructor(geometry, material, layer, extent) {
|
|
19
|
-
let level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
20
|
-
super(geometry, material);
|
|
21
|
-
if (!extent) {
|
|
22
|
-
throw new Error('extent is mandatory to build a TileMesh');
|
|
23
|
-
}
|
|
24
|
-
this.layer = layer;
|
|
25
|
-
this.extent = extent;
|
|
26
|
-
this.extent.zoom = level;
|
|
27
|
-
this.level = level;
|
|
28
|
-
this.material.objectId = this.id;
|
|
29
|
-
this.obb = this.geometry.OBB.clone();
|
|
30
|
-
this.boundingSphere = new THREE.Sphere();
|
|
31
|
-
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
32
|
-
for (const tms of layer.tileMatrixSets) {
|
|
33
|
-
this.#_tms.set(tms, tiledCovering(this.extent, tms));
|
|
34
|
-
}
|
|
35
|
-
this.frustumCulled = false;
|
|
36
|
-
this.matrixAutoUpdate = false;
|
|
37
|
-
this.rotationAutoUpdate = false;
|
|
38
|
-
this.layerUpdateState = {};
|
|
39
|
-
this.isTileMesh = true;
|
|
40
|
-
this.geoidHeight = 0;
|
|
41
|
-
this.link = {};
|
|
42
|
-
Object.defineProperty(this, 'visible', {
|
|
43
|
-
get() {
|
|
44
|
-
return this.#visible;
|
|
45
|
-
},
|
|
46
|
-
set(v) {
|
|
47
|
-
if (this.#visible != v) {
|
|
48
|
-
this.#visible = v;
|
|
49
|
-
this.dispatchEvent({
|
|
50
|
-
type: v ? 'shown' : 'hidden'
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* If specified, update the min and max elevation of the OBB
|
|
58
|
-
* and updates accordingly the bounding sphere and the geometric error
|
|
59
|
-
*
|
|
60
|
-
* @param {Object} elevation
|
|
61
|
-
* @param {number} [elevation.min]
|
|
62
|
-
* @param {number} [elevation.max]
|
|
63
|
-
* @param {number} [elevation.scale]
|
|
64
|
-
*/
|
|
65
|
-
setBBoxZ(elevation) {
|
|
66
|
-
elevation.geoidHeight = geoidLayerIsVisible(this.layer) ? this.geoidHeight : 0;
|
|
67
|
-
this.obb.updateZ(elevation);
|
|
68
|
-
if (this.horizonCullingPointElevationScaled) {
|
|
69
|
-
this.horizonCullingPointElevationScaled.setLength(this.obb.z.delta + this.horizonCullingPoint.length());
|
|
70
|
-
}
|
|
71
|
-
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
72
|
-
}
|
|
73
|
-
getExtentsByProjection(crs) {
|
|
74
|
-
return this.#_tms.get(CRS.formatToTms(crs));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Search for a common ancestor between this tile and another one. It goes
|
|
79
|
-
* through parents on each side until one is found.
|
|
80
|
-
*
|
|
81
|
-
* @param {TileMesh} tile
|
|
82
|
-
*
|
|
83
|
-
* @return {TileMesh} the resulting common ancestor
|
|
84
|
-
*/
|
|
85
|
-
findCommonAncestor(tile) {
|
|
86
|
-
if (!tile) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
if (tile.level == this.level) {
|
|
90
|
-
if (tile.id == this.id) {
|
|
91
|
-
return tile;
|
|
92
|
-
} else if (tile.level != 0) {
|
|
93
|
-
return this.parent.findCommonAncestor(tile.parent);
|
|
94
|
-
} else {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
} else if (tile.level < this.level) {
|
|
98
|
-
return this.parent.findCommonAncestor(tile);
|
|
99
|
-
} else {
|
|
100
|
-
return this.findCommonAncestor(tile.parent);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
onBeforeRender() {
|
|
104
|
-
if (this.material.layersNeedUpdate) {
|
|
105
|
-
this.material.updateLayersUniforms();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
export default TileMesh;
|