itowns 2.42.1-next.15 → 2.42.1-next.17
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/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/lib/Controls/FirstPersonControls.js +5 -12
- package/lib/Controls/FlyControls.js +4 -13
- package/lib/Controls/GlobeControls.js +33 -43
- package/lib/Controls/PlanarControls.js +9 -20
- package/lib/Controls/StateControl.js +2 -11
- package/lib/Controls/StreetControls.js +14 -24
- package/lib/Converter/Feature2Mesh.js +28 -38
- package/lib/Converter/Feature2Texture.js +15 -25
- package/lib/Converter/convertToTile.js +13 -24
- package/lib/Converter/textureConverter.js +9 -19
- package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
- package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
- package/lib/Core/3DTiles/C3DTFeature.js +3 -10
- package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
- package/lib/Core/3DTiles/C3DTileset.js +7 -16
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
- package/lib/Core/AnimationPlayer.js +2 -11
- package/lib/Core/Deprecated/Undeprecator.js +8 -19
- package/lib/Core/EntwinePointTileNode.js +6 -16
- package/lib/Core/Feature.js +16 -30
- package/lib/Core/Geographic/CoordStars.js +3 -12
- package/lib/Core/Geographic/Coordinates.js +12 -22
- package/lib/Core/Geographic/Crs.js +7 -15
- package/lib/Core/Geographic/Extent.js +36 -47
- package/lib/Core/Geographic/GeoidGrid.js +6 -16
- package/lib/Core/Label.js +7 -17
- package/lib/Core/MainLoop.js +7 -16
- package/lib/Core/Math/Ellipsoid.js +6 -17
- package/lib/Core/Picking.js +10 -20
- package/lib/Core/PointCloudNode.js +2 -11
- package/lib/Core/PotreeNode.js +4 -13
- package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
- package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
- package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
- package/lib/Core/Prefab/GlobeView.js +27 -37
- package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
- package/lib/Core/Prefab/PlanarView.js +10 -20
- package/lib/Core/Prefab/TileBuilder.js +10 -19
- package/lib/Core/Prefab/computeBufferTileGeometry.js +3 -12
- package/lib/Core/Scheduler/Cache.js +2 -10
- package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
- package/lib/Core/Scheduler/Scheduler.js +15 -23
- package/lib/Core/Style.js +21 -34
- package/lib/Core/System/Capabilities.js +2 -9
- package/lib/Core/TileGeometry.js +5 -14
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -53
- package/lib/Layer/C3DTilesLayer.js +25 -37
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +8 -18
- package/lib/Layer/FeatureGeometryLayer.js +9 -16
- package/lib/Layer/GeoidLayer.js +6 -15
- package/lib/Layer/GeometryLayer.js +11 -17
- package/lib/Layer/InfoLayer.js +5 -14
- package/lib/Layer/LabelLayer.js +22 -32
- package/lib/Layer/Layer.js +16 -26
- package/lib/Layer/LayerUpdateState.js +1 -8
- package/lib/Layer/LayerUpdateStrategy.js +7 -18
- package/lib/Layer/OrientedImageLayer.js +15 -25
- package/lib/Layer/PointCloudLayer.js +9 -19
- package/lib/Layer/PotreeLayer.js +8 -18
- package/lib/Layer/RasterLayer.js +9 -17
- package/lib/Layer/ReferencingLayerProperties.js +1 -8
- package/lib/Layer/TiledGeometryLayer.js +21 -31
- package/lib/Main.js +86 -720
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +20 -28
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +13 -28
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +13 -21
- package/lib/Parser/GpxParser.js +7 -14
- package/lib/Parser/ISGParser.js +19 -28
- package/lib/Parser/KMLParser.js +7 -14
- package/lib/Parser/LASLoader.js +11 -16
- package/lib/Parser/LASParser.js +5 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +3 -11
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +18 -26
- package/lib/Parser/XbilParser.js +5 -13
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
- package/lib/Process/3dTilesProcessing.js +14 -27
- package/lib/Process/FeatureProcessing.js +14 -22
- package/lib/Process/LayeredMaterialNodeProcessing.js +14 -26
- package/lib/Process/ObjectRemovalHelper.js +2 -9
- package/lib/Process/handlerNodeError.js +1 -7
- package/lib/Provider/3dTilesProvider.js +16 -27
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +6 -13
- package/lib/Provider/PointCloudProvider.js +5 -15
- package/lib/Provider/TileProvider.js +4 -12
- package/lib/Provider/URLBuilder.js +4 -12
- package/lib/Renderer/Camera.js +7 -17
- package/lib/Renderer/Color.js +3 -11
- package/lib/Renderer/ColorLayersOrdering.js +14 -22
- package/lib/Renderer/CommonMaterial.js +3 -12
- package/lib/Renderer/Label2DRenderer.js +5 -16
- package/lib/Renderer/LayeredMaterial.js +27 -41
- package/lib/Renderer/OBB.js +10 -19
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +7 -17
- package/lib/Renderer/PointsMaterial.js +34 -48
- package/lib/Renderer/RasterTile.js +15 -28
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +2 -11
- package/lib/Renderer/Shader/ShaderUtils.js +2 -9
- package/lib/Renderer/SphereHelper.js +2 -11
- package/lib/Renderer/WebXR.js +2 -11
- package/lib/Renderer/c3DEngine.js +18 -28
- package/lib/Source/C3DTilesGoogleSource.js +5 -13
- package/lib/Source/C3DTilesIonSource.js +6 -13
- package/lib/Source/C3DTilesSource.js +5 -12
- package/lib/Source/EntwinePointTileSource.js +12 -19
- package/lib/Source/FileSource.js +7 -14
- package/lib/Source/OrientedImageSource.js +6 -13
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +17 -26
- package/lib/Source/TMSSource.js +11 -21
- package/lib/Source/VectorTilesSource.js +18 -26
- package/lib/Source/WFSSource.js +7 -14
- package/lib/Source/WMSSource.js +5 -12
- package/lib/Source/WMTSSource.js +3 -10
- package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
- package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
- package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
- package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
- package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
- package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
- package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
- package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
- package/lib/Utils/CameraUtils.js +32 -44
- package/lib/Utils/DEMUtils.js +8 -19
- package/lib/Utils/FeaturesUtils.js +8 -16
- package/lib/Utils/Gradients.js +3 -12
- package/lib/Utils/OrientationUtils.js +8 -18
- package/lib/Utils/ThreeUtils.js +2 -9
- package/lib/Utils/gui/C3DTilesStyle.js +7 -15
- package/lib/Utils/gui/Main.js +7 -48
- package/lib/Utils/gui/Minimap.js +12 -20
- package/lib/Utils/gui/Navigation.js +6 -14
- package/lib/Utils/gui/Scale.js +11 -19
- package/lib/Utils/gui/Searchbar.js +5 -13
- package/lib/Utils/gui/Widget.js +1 -8
- package/lib/Utils/placeObjectOnGround.js +13 -23
- package/package.json +10 -7
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
1
|
/*
|
|
11
2
|
* To change this license header, choose License Headers in Project Properties.
|
|
12
3
|
* To change this template file, choose Tools | Templates
|
|
13
4
|
* and open the template in the editor.
|
|
14
5
|
*/
|
|
15
6
|
|
|
7
|
+
import * as THREE from 'three';
|
|
16
8
|
function SphereHelper(radius) {
|
|
17
9
|
THREE.Mesh.call(this);
|
|
18
10
|
this.geometry = new THREE.SphereGeometry(radius, 8, 8);
|
|
@@ -28,5 +20,4 @@ SphereHelper.prototype.update = function (radius) {
|
|
|
28
20
|
this.geometry.dispose();
|
|
29
21
|
this.geometry = new THREE.SphereGeometry(radius, 8, 8);
|
|
30
22
|
};
|
|
31
|
-
|
|
32
|
-
exports.default = _default;
|
|
23
|
+
export default SphereHelper;
|
package/lib/Renderer/WebXR.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
10
2
|
async function shutdownXR(session) {
|
|
11
3
|
if (session) {
|
|
12
4
|
await session.end();
|
|
@@ -56,5 +48,4 @@ const initializeWebXR = (view, options) => {
|
|
|
56
48
|
});
|
|
57
49
|
});
|
|
58
50
|
};
|
|
59
|
-
|
|
60
|
-
exports.default = _default;
|
|
51
|
+
export default initializeWebXR;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Capabilities = _interopRequireDefault(require("../Core/System/Capabilities"));
|
|
10
|
-
var _LayeredMaterial = require("./LayeredMaterial");
|
|
11
|
-
var _WebGL = _interopRequireDefault(require("../ThreeExtended/capabilities/WebGL"));
|
|
12
|
-
var _Label2DRenderer = _interopRequireDefault(require("./Label2DRenderer"));
|
|
13
|
-
var _Undeprecator = require("../Core/Deprecated/Undeprecator");
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
1
|
/**
|
|
17
2
|
* Generated On: 2015-10-5
|
|
18
3
|
* Class: c3DEngine
|
|
19
4
|
* Description: 3DEngine est l'interface avec le framework webGL.
|
|
20
5
|
*/
|
|
21
6
|
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import Capabilities from "../Core/System/Capabilities.js";
|
|
9
|
+
import { unpack1K } from "./LayeredMaterial.js";
|
|
10
|
+
import WEBGL from "../ThreeExtended/capabilities/WebGL.js";
|
|
11
|
+
import Label2DRenderer from "./Label2DRenderer.js";
|
|
12
|
+
import { deprecatedC3DEngineWebGLOptions } from "../Core/Deprecated/Undeprecator.js";
|
|
22
13
|
const depthRGBA = new THREE.Vector4();
|
|
23
14
|
class c3DEngine {
|
|
24
15
|
constructor(rendererOrDiv) {
|
|
25
16
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
-
|
|
27
|
-
const NOIE = !
|
|
17
|
+
deprecatedC3DEngineWebGLOptions(options);
|
|
18
|
+
const NOIE = !Capabilities.isInternetExplorer();
|
|
28
19
|
// pick sensible default options
|
|
29
20
|
if (options.antialias === undefined) {
|
|
30
21
|
options.antialias = true;
|
|
@@ -84,7 +75,7 @@ class c3DEngine {
|
|
|
84
75
|
|
|
85
76
|
// Create renderer
|
|
86
77
|
try {
|
|
87
|
-
this.label2dRenderer = new
|
|
78
|
+
this.label2dRenderer = new Label2DRenderer();
|
|
88
79
|
this.label2dRenderer.setSize(this.width, this.height);
|
|
89
80
|
viewerDiv.appendChild(this.label2dRenderer.domElement);
|
|
90
81
|
this.renderer = renderer || new (options.isWebGL2 ? THREE.WebGLRenderer : THREE.WebGL1Renderer)({
|
|
@@ -102,10 +93,10 @@ class c3DEngine {
|
|
|
102
93
|
this.renderer = null;
|
|
103
94
|
}
|
|
104
95
|
if (!this.renderer) {
|
|
105
|
-
if (!
|
|
106
|
-
viewerDiv.appendChild(
|
|
107
|
-
} else if (!
|
|
108
|
-
viewerDiv.appendChild(
|
|
96
|
+
if (!WEBGL.isWebGLAvailable()) {
|
|
97
|
+
viewerDiv.appendChild(WEBGL.getErrorMessage(1));
|
|
98
|
+
} else if (!WEBGL.isWebGL2Available()) {
|
|
99
|
+
viewerDiv.appendChild(WEBGL.getErrorMessage(2));
|
|
109
100
|
}
|
|
110
101
|
throw new Error('WebGL unsupported');
|
|
111
102
|
}
|
|
@@ -131,7 +122,7 @@ class c3DEngine {
|
|
|
131
122
|
if (this.renderer.domElement.tabIndex === -1) {
|
|
132
123
|
this.renderer.domElement.tabIndex = -1;
|
|
133
124
|
}
|
|
134
|
-
|
|
125
|
+
Capabilities.updateCapabilities(this.renderer);
|
|
135
126
|
this.renderer.setClearColor(0x030508);
|
|
136
127
|
this.renderer.autoClear = false;
|
|
137
128
|
this.renderer.sortObjects = true;
|
|
@@ -231,17 +222,16 @@ class c3DEngine {
|
|
|
231
222
|
}
|
|
232
223
|
depthBufferRGBAValueToOrthoZ(depthBufferRGBA, camera) {
|
|
233
224
|
depthRGBA.fromArray(depthBufferRGBA).divideScalar(255.0);
|
|
234
|
-
if (
|
|
235
|
-
const gl_FragDepthEXT =
|
|
225
|
+
if (Capabilities.isLogDepthBufferSupported() && camera.type == 'PerspectiveCamera') {
|
|
226
|
+
const gl_FragDepthEXT = unpack1K(depthRGBA);
|
|
236
227
|
const logDepthBufFC = 2.0 / (Math.log(camera.far + 1.0) / Math.LN2);
|
|
237
228
|
// invert function : gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
|
|
238
229
|
return 2 ** (2 * gl_FragDepthEXT / logDepthBufFC);
|
|
239
230
|
} else {
|
|
240
|
-
let gl_FragCoord_Z =
|
|
231
|
+
let gl_FragCoord_Z = unpack1K(depthRGBA);
|
|
241
232
|
gl_FragCoord_Z = gl_FragCoord_Z * 2.0 - 1.0;
|
|
242
233
|
return gl_FragCoord_Z;
|
|
243
234
|
}
|
|
244
235
|
}
|
|
245
236
|
}
|
|
246
|
-
|
|
247
|
-
exports.default = _default;
|
|
237
|
+
export default c3DEngine;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
9
|
-
var _C3DTilesSource = _interopRequireDefault(require("./C3DTilesSource"));
|
|
1
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
2
|
+
import C3DTilesSource from "./C3DTilesSource.js";
|
|
10
3
|
function findSessionId(tile) {
|
|
11
4
|
if (!tile) {
|
|
12
5
|
return null;
|
|
@@ -36,7 +29,7 @@ function findSessionId(tile) {
|
|
|
36
29
|
* @property {string} url - The URL to the tileset json.
|
|
37
30
|
* @property {string} baseUrl - The base URL to access tiles.
|
|
38
31
|
*/
|
|
39
|
-
class C3DTilesGoogleSource extends
|
|
32
|
+
class C3DTilesGoogleSource extends C3DTilesSource {
|
|
40
33
|
/**
|
|
41
34
|
* Create a new Source for 3D Tiles data from Google api (experimental).
|
|
42
35
|
*
|
|
@@ -58,7 +51,7 @@ class C3DTilesGoogleSource extends _C3DTilesSource.default {
|
|
|
58
51
|
this.isC3DTilesGoogleSource = true;
|
|
59
52
|
this.baseUrl = 'https://tile.googleapis.com';
|
|
60
53
|
this.key = source.key;
|
|
61
|
-
this.whenReady =
|
|
54
|
+
this.whenReady = Fetcher.json(source.url, this.networkOptions).then(json => {
|
|
62
55
|
if (json && json.root) {
|
|
63
56
|
this.sessionId = findSessionId(json.root);
|
|
64
57
|
if (this.sessionId === null) {
|
|
@@ -80,5 +73,4 @@ class C3DTilesGoogleSource extends _C3DTilesSource.default {
|
|
|
80
73
|
return /\?/.test(url) ? `${url}&${extraParameters}` : `${url}?${extraParameters}`;
|
|
81
74
|
}
|
|
82
75
|
}
|
|
83
|
-
|
|
84
|
-
exports.default = _default;
|
|
76
|
+
export default C3DTilesGoogleSource;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
2
|
+
import C3DTilesSource from "./C3DTilesSource.js";
|
|
2
3
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
9
|
-
var _C3DTilesSource = _interopRequireDefault(require("./C3DTilesSource"));
|
|
10
4
|
/**
|
|
11
5
|
* @classdesc
|
|
12
6
|
* An object defining the source connection to a 3DTiles asset of a [Cesium ion server](https://cesium.com/learn/ion/).
|
|
@@ -20,7 +14,7 @@ var _C3DTilesSource = _interopRequireDefault(require("./C3DTilesSource"));
|
|
|
20
14
|
* @property {string} accessToken - The Cesium ion access token used to retrieve the resource.
|
|
21
15
|
* @property {string} assetId - The id of the asset on Cesium ion.
|
|
22
16
|
*/
|
|
23
|
-
class C3DTilesIonSource extends
|
|
17
|
+
class C3DTilesIonSource extends C3DTilesSource {
|
|
24
18
|
/**
|
|
25
19
|
* Create a new Source for 3D Tiles data from Cesium ion.
|
|
26
20
|
*
|
|
@@ -46,7 +40,7 @@ class C3DTilesIonSource extends _C3DTilesSource.default {
|
|
|
46
40
|
this.assetId = source.assetId;
|
|
47
41
|
|
|
48
42
|
// get asset metadata
|
|
49
|
-
this.whenReady =
|
|
43
|
+
this.whenReady = Fetcher.json(source.url, this.networkOptions).then(json => {
|
|
50
44
|
if (json.type !== '3DTILES') {
|
|
51
45
|
throw new Error(`${json.type} datasets from Cesium ion are not supported with C3DTilesIonSource. ` + 'Only 3D Tiles datasets are supported.');
|
|
52
46
|
}
|
|
@@ -55,9 +49,8 @@ class C3DTilesIonSource extends _C3DTilesSource.default {
|
|
|
55
49
|
this.networkOptions.headers = {};
|
|
56
50
|
this.networkOptions.headers.Authorization = `Bearer ${json.accessToken}`;
|
|
57
51
|
this.attribution = json.attributions;
|
|
58
|
-
return
|
|
52
|
+
return Fetcher.json(this.url, this.networkOptions);
|
|
59
53
|
});
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
|
-
|
|
63
|
-
exports.default = _default;
|
|
56
|
+
export default C3DTilesIonSource;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
2
3
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
9
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
10
4
|
/**
|
|
11
5
|
* @classdesc
|
|
12
6
|
* An object defining the source connection to a 3DTiles dataset from a web server.
|
|
@@ -18,7 +12,7 @@ var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
|
18
12
|
* @property {string} url - The URL of the tileset json.
|
|
19
13
|
* @property {string} baseUrl - The base URL to access tiles.
|
|
20
14
|
*/
|
|
21
|
-
class C3DTilesSource extends
|
|
15
|
+
class C3DTilesSource extends Source {
|
|
22
16
|
/**
|
|
23
17
|
* Create a new Source for 3D Tiles data from a web server.
|
|
24
18
|
*
|
|
@@ -32,8 +26,7 @@ class C3DTilesSource extends _Source.default {
|
|
|
32
26
|
super(source);
|
|
33
27
|
this.isC3DTilesSource = true;
|
|
34
28
|
this.baseUrl = this.url.slice(0, this.url.lastIndexOf('/') + 1);
|
|
35
|
-
this.whenReady =
|
|
29
|
+
this.whenReady = Fetcher.json(this.url, this.networkOptions);
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
exports.default = _default;
|
|
32
|
+
export default C3DTilesSource;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import proj4 from 'proj4';
|
|
2
|
+
import LASParser from "../Parser/LASParser.js";
|
|
3
|
+
import PotreeBinParser from "../Parser/PotreeBinParser.js";
|
|
4
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
5
|
+
import Source from "./Source.js";
|
|
2
6
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _proj = _interopRequireDefault(require("proj4"));
|
|
9
|
-
var _LASParser = _interopRequireDefault(require("../Parser/LASParser"));
|
|
10
|
-
var _PotreeBinParser = _interopRequireDefault(require("../Parser/PotreeBinParser"));
|
|
11
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
12
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
13
7
|
/**
|
|
14
8
|
* @classdesc
|
|
15
9
|
* An object defining the source of Entwine Point Tile data. It fetches and
|
|
@@ -24,7 +18,7 @@ var _Source = _interopRequireDefault(require("./Source"));
|
|
|
24
18
|
* @property {string} url - The URL of the directory containing the whole
|
|
25
19
|
* Entwine Point Tile structure.
|
|
26
20
|
*/
|
|
27
|
-
class EntwinePointTileSource extends
|
|
21
|
+
class EntwinePointTileSource extends Source {
|
|
28
22
|
/**
|
|
29
23
|
* @constructor
|
|
30
24
|
*
|
|
@@ -43,14 +37,14 @@ class EntwinePointTileSource extends _Source.default {
|
|
|
43
37
|
this.url = this.url.replace('/ept.json', '');
|
|
44
38
|
|
|
45
39
|
// https://entwine.io/entwine-point-tile.html#ept-json
|
|
46
|
-
this.whenReady =
|
|
40
|
+
this.whenReady = Fetcher.json(`${this.url}/ept.json`, this.networkOptions).then(metadata => {
|
|
47
41
|
// Set parser and its configuration from schema
|
|
48
|
-
this.parse = metadata.dataType === 'laszip' ?
|
|
42
|
+
this.parse = metadata.dataType === 'laszip' ? LASParser.parse : PotreeBinParser.parse;
|
|
49
43
|
this.extension = metadata.dataType === 'laszip' ? 'laz' : 'bin';
|
|
50
44
|
if (metadata.srs && metadata.srs.authority && metadata.srs.horizontal) {
|
|
51
45
|
this.crs = `${metadata.srs.authority}:${metadata.srs.horizontal}`;
|
|
52
|
-
if (!
|
|
53
|
-
|
|
46
|
+
if (!proj4.defs(this.crs)) {
|
|
47
|
+
proj4.defs(this.crs, metadata.srs.wkt);
|
|
54
48
|
}
|
|
55
49
|
if (metadata.srs.vertical && metadata.srs.vertical !== metadata.srs.horizontal) {
|
|
56
50
|
console.warn('EntwinePointTileSource: Vertical coordinates system code is not yet supported.');
|
|
@@ -65,8 +59,7 @@ class EntwinePointTileSource extends _Source.default {
|
|
|
65
59
|
this.span = metadata.span;
|
|
66
60
|
return this;
|
|
67
61
|
});
|
|
68
|
-
this.fetcher =
|
|
62
|
+
this.fetcher = Fetcher.arrayBuffer;
|
|
69
63
|
}
|
|
70
64
|
}
|
|
71
|
-
|
|
72
|
-
exports.default = _default;
|
|
65
|
+
export default EntwinePointTileSource;
|
package/lib/Source/FileSource.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Cache from "../Core/Scheduler/Cache.js";
|
|
3
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
2
4
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
9
|
-
var _Cache = _interopRequireDefault(require("../Core/Scheduler/Cache"));
|
|
10
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
11
5
|
/**
|
|
12
6
|
* @classdesc
|
|
13
7
|
* An object defining the source of a single resource to get from a direct
|
|
@@ -104,7 +98,7 @@ var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
|
104
98
|
* return view.addLayer(ariegeLayer);
|
|
105
99
|
* });
|
|
106
100
|
*/
|
|
107
|
-
class FileSource extends
|
|
101
|
+
class FileSource extends Source {
|
|
108
102
|
/**
|
|
109
103
|
* @param {Object} source - An object that can contain all properties of a
|
|
110
104
|
* FileSource and {@link Source}. Only `crs` is mandatory, but if it
|
|
@@ -145,7 +139,7 @@ class FileSource extends _Source.default {
|
|
|
145
139
|
this.fetchedData = f;
|
|
146
140
|
});
|
|
147
141
|
} else if (source.features) {
|
|
148
|
-
this._featuresCaches[source.features.crs] = new
|
|
142
|
+
this._featuresCaches[source.features.crs] = new Cache();
|
|
149
143
|
this._featuresCaches[source.features.crs].setByArray(Promise.resolve(source.features), [0]);
|
|
150
144
|
}
|
|
151
145
|
this.whenReady.then(() => this.fetchedData);
|
|
@@ -164,7 +158,7 @@ class FileSource extends _Source.default {
|
|
|
164
158
|
if (!features) {
|
|
165
159
|
options.out.buildExtent = this.crs != 'EPSG:4978';
|
|
166
160
|
if (options.out.buildExtent) {
|
|
167
|
-
options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs :
|
|
161
|
+
options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs : CRS.formatToEPSG(this.crs);
|
|
168
162
|
}
|
|
169
163
|
features = this.parser(this.fetchedData, options);
|
|
170
164
|
this._featuresCaches[options.out.crs].setByArray(features, [0]);
|
|
@@ -195,5 +189,4 @@ class FileSource extends _Source.default {
|
|
|
195
189
|
return this.extent.intersectsExtent(extent);
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
|
-
|
|
199
|
-
exports.default = _default;
|
|
192
|
+
export default FileSource;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
2
3
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
9
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
10
4
|
/**
|
|
11
5
|
* @classdesc OrientedImageSource is a specific source used to load oriented images.
|
|
12
6
|
* @extends Source
|
|
13
7
|
*/
|
|
14
|
-
class OrientedImageSource extends
|
|
8
|
+
class OrientedImageSource extends Source {
|
|
15
9
|
/**
|
|
16
10
|
* @constructor
|
|
17
11
|
* @param { Object } source - Configuration object
|
|
@@ -28,8 +22,8 @@ class OrientedImageSource extends _Source.default {
|
|
|
28
22
|
|
|
29
23
|
// Fetch the two files
|
|
30
24
|
const promises = [];
|
|
31
|
-
promises.push(source.orientationsUrl ?
|
|
32
|
-
promises.push(source.calibrationUrl ?
|
|
25
|
+
promises.push(source.orientationsUrl ? Fetcher.json(source.orientationsUrl, this.networkOptions) : Promise.resolve());
|
|
26
|
+
promises.push(source.calibrationUrl ? Fetcher.json(source.calibrationUrl, this.networkOptions) : Promise.resolve());
|
|
33
27
|
this.whenReady = Promise.all(promises).then(data => ({
|
|
34
28
|
orientation: data[0],
|
|
35
29
|
calibration: data[1]
|
|
@@ -62,5 +56,4 @@ class OrientedImageSource extends _Source.default {
|
|
|
62
56
|
return this.url.replace('{cameraId}', cameraId).replace('{panoId}', panoId);
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
exports.default = _default;
|
|
59
|
+
export default OrientedImageSource;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
3
|
+
import PotreeBinParser from "../Parser/PotreeBinParser.js";
|
|
4
|
+
import PotreeCinParser from "../Parser/PotreeCinParser.js";
|
|
2
5
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
9
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
10
|
-
var _PotreeBinParser = _interopRequireDefault(require("../Parser/PotreeBinParser"));
|
|
11
|
-
var _PotreeCinParser = _interopRequireDefault(require("../Parser/PotreeCinParser"));
|
|
12
6
|
/**
|
|
13
7
|
* @classdesc
|
|
14
8
|
* PotreeSource are object containing informations on how to fetch points cloud resources.
|
|
@@ -16,7 +10,7 @@ var _PotreeCinParser = _interopRequireDefault(require("../Parser/PotreeCinParser
|
|
|
16
10
|
*
|
|
17
11
|
*/
|
|
18
12
|
|
|
19
|
-
class PotreeSource extends
|
|
13
|
+
class PotreeSource extends Source {
|
|
20
14
|
/**
|
|
21
15
|
* @param {Object} source - An object that can contain all properties of a
|
|
22
16
|
* PotreeSource
|
|
@@ -76,19 +70,18 @@ class PotreeSource extends _Source.default {
|
|
|
76
70
|
}
|
|
77
71
|
super(source);
|
|
78
72
|
this.file = source.file;
|
|
79
|
-
this.fetcher =
|
|
73
|
+
this.fetcher = Fetcher.arrayBuffer;
|
|
80
74
|
this.extensionOctree = 'hrc';
|
|
81
75
|
|
|
82
76
|
// For cloud specification visit:
|
|
83
77
|
// https://github.com/PropellerAero/potree-propeller-private/blob/master/docs/file_format.md#cloudjs
|
|
84
|
-
this.whenReady = (source.cloud ? Promise.resolve(source.cloud) :
|
|
78
|
+
this.whenReady = (source.cloud ? Promise.resolve(source.cloud) : Fetcher.json(`${this.url}/${this.file}`, this.networkOptions)).then(cloud => {
|
|
85
79
|
this.pointAttributes = cloud.pointAttributes;
|
|
86
80
|
this.baseurl = `${this.url}/${cloud.octreeDir}/r`;
|
|
87
81
|
this.extension = cloud.pointAttributes === 'CIN' ? 'cin' : 'bin';
|
|
88
|
-
this.parse = this.extension === 'cin' ?
|
|
82
|
+
this.parse = this.extension === 'cin' ? PotreeCinParser.parse : PotreeBinParser.parse;
|
|
89
83
|
return cloud;
|
|
90
84
|
});
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
|
-
|
|
94
|
-
exports.default = _default;
|
|
87
|
+
export default PotreeSource;
|
package/lib/Source/Source.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _GTXParser = _interopRequireDefault(require("../Parser/GTXParser"));
|
|
14
|
-
var _ISGParser = _interopRequireDefault(require("../Parser/ISGParser"));
|
|
15
|
-
var _VectorTileParser = _interopRequireDefault(require("../Parser/VectorTileParser"));
|
|
16
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
17
|
-
var _Cache = _interopRequireDefault(require("../Core/Scheduler/Cache"));
|
|
18
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
19
|
-
const supportedParsers = new Map([['application/geo+json', _GeoJsonParser.default.parse], ['application/json', _GeoJsonParser.default.parse], ['application/kml', _KMLParser.default.parse], ['application/gpx', _GpxParser.default.parse], ['application/x-protobuf;type=mapbox-vector', _VectorTileParser.default.parse], ['application/gtx', _GTXParser.default.parse], ['application/isg', _ISGParser.default.parse], ['application/gdf', _GDFParser.default.parse]]);
|
|
20
|
-
exports.supportedParsers = supportedParsers;
|
|
1
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
2
|
+
import GeoJsonParser from "../Parser/GeoJsonParser.js";
|
|
3
|
+
import KMLParser from "../Parser/KMLParser.js";
|
|
4
|
+
import GDFParser from "../Parser/GDFParser.js";
|
|
5
|
+
import GpxParser from "../Parser/GpxParser.js";
|
|
6
|
+
import GTXParser from "../Parser/GTXParser.js";
|
|
7
|
+
import ISGParser from "../Parser/ISGParser.js";
|
|
8
|
+
import VectorTileParser from "../Parser/VectorTileParser.js";
|
|
9
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
10
|
+
import Cache from "../Core/Scheduler/Cache.js";
|
|
11
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
12
|
+
export const supportedParsers = new Map([['application/geo+json', GeoJsonParser.parse], ['application/json', GeoJsonParser.parse], ['application/kml', KMLParser.parse], ['application/gpx', GpxParser.parse], ['application/x-protobuf;type=mapbox-vector', VectorTileParser.parse], ['application/gtx', GTXParser.parse], ['application/isg', ISGParser.parse], ['application/gdf', GDFParser.parse]]);
|
|
21
13
|
const noCache = {
|
|
22
14
|
getByArray: () => {},
|
|
23
15
|
setByArray: a => a,
|
|
@@ -42,7 +34,7 @@ class InformationsData {
|
|
|
42
34
|
options.crs = options.crs || options.projection;
|
|
43
35
|
}
|
|
44
36
|
if (options.crs) {
|
|
45
|
-
|
|
37
|
+
CRS.isValid(options.crs);
|
|
46
38
|
}
|
|
47
39
|
this.crs = options.crs;
|
|
48
40
|
}
|
|
@@ -116,7 +108,7 @@ class Source extends InformationsData {
|
|
|
116
108
|
this.uid = uid++;
|
|
117
109
|
this.url = source.url;
|
|
118
110
|
this.format = source.format;
|
|
119
|
-
this.fetcher = source.fetcher ||
|
|
111
|
+
this.fetcher = source.fetcher || Fetcher.get(source.format);
|
|
120
112
|
this.parser = source.parser || supportedParsers.get(source.format) || ((d, opt) => {
|
|
121
113
|
d.extent = opt.extent;
|
|
122
114
|
return d;
|
|
@@ -129,7 +121,7 @@ class Source extends InformationsData {
|
|
|
129
121
|
this.whenReady = Promise.resolve();
|
|
130
122
|
this._featuresCaches = {};
|
|
131
123
|
if (source.extent && !source.extent.isExtent) {
|
|
132
|
-
this.extent = new
|
|
124
|
+
this.extent = new Extent(this.crs, source.extent);
|
|
133
125
|
} else {
|
|
134
126
|
this.extent = source.extent;
|
|
135
127
|
}
|
|
@@ -197,7 +189,7 @@ class Source extends InformationsData {
|
|
|
197
189
|
// Cache feature only if it's vector data, the feature are cached in source.
|
|
198
190
|
// It's not necessary to cache raster in Source,
|
|
199
191
|
// because it's already cached on layer.
|
|
200
|
-
this._featuresCaches[options.out.crs] = this.isVectorSource ? new
|
|
192
|
+
this._featuresCaches[options.out.crs] = this.isVectorSource ? new Cache() : noCache;
|
|
201
193
|
}
|
|
202
194
|
}
|
|
203
195
|
|
|
@@ -227,5 +219,4 @@ class Source extends InformationsData {
|
|
|
227
219
|
throw new Error('In extented Source, you have to implement the method extentInsideLimit!');
|
|
228
220
|
}
|
|
229
221
|
}
|
|
230
|
-
|
|
231
|
-
exports.default = _default;
|
|
222
|
+
export default Source;
|
package/lib/Source/TMSSource.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Source = _interopRequireDefault(require("./Source"));
|
|
9
|
-
var _URLBuilder = _interopRequireDefault(require("../Provider/URLBuilder"));
|
|
10
|
-
var _Extent = _interopRequireWildcard(require("../Core/Geographic/Extent"));
|
|
11
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
const extent = new _Extent.default(_Crs.default.tms_4326, 0, 0, 0);
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import URLBuilder from "../Provider/URLBuilder.js";
|
|
3
|
+
import Extent, { globalExtentTMS } from "../Core/Geographic/Extent.js";
|
|
4
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
5
|
+
const extent = new Extent(CRS.tms_4326, 0, 0, 0);
|
|
15
6
|
|
|
16
7
|
/**
|
|
17
8
|
* @classdesc
|
|
@@ -78,7 +69,7 @@ const extent = new _Extent.default(_Crs.default.tms_4326, 0, 0, 0);
|
|
|
78
69
|
* // Add the layer to the view
|
|
79
70
|
* view.addLayer(imageryLayer);
|
|
80
71
|
*/
|
|
81
|
-
class TMSSource extends
|
|
72
|
+
class TMSSource extends Source {
|
|
82
73
|
/**
|
|
83
74
|
* @param {Object} source - An object that can contain all properties of a
|
|
84
75
|
* TMSSource and {@link Source}. Only `url` is mandatory.
|
|
@@ -94,11 +85,11 @@ class TMSSource extends _Source.default {
|
|
|
94
85
|
this.isTMSSource = true;
|
|
95
86
|
if (!source.extent) {
|
|
96
87
|
// default to the global extent
|
|
97
|
-
this.extent =
|
|
88
|
+
this.extent = globalExtentTMS.get(source.crs);
|
|
98
89
|
}
|
|
99
90
|
this.zoom = source.zoom;
|
|
100
91
|
this.isInverted = source.isInverted || false;
|
|
101
|
-
this.crs =
|
|
92
|
+
this.crs = CRS.formatToTms(source.crs);
|
|
102
93
|
this.tileMatrixSetLimits = source.tileMatrixSetLimits;
|
|
103
94
|
this.extentSetlimits = {};
|
|
104
95
|
this.tileMatrixCallback = source.tileMatrixCallback || (zoomLevel => zoomLevel);
|
|
@@ -120,7 +111,7 @@ class TMSSource extends _Source.default {
|
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
113
|
urlFromExtent(extent) {
|
|
123
|
-
return
|
|
114
|
+
return URLBuilder.xyz(extent, this);
|
|
124
115
|
}
|
|
125
116
|
onLayerAdded(options) {
|
|
126
117
|
super.onLayerAdded(options);
|
|
@@ -141,7 +132,7 @@ class TMSSource extends _Source.default {
|
|
|
141
132
|
east,
|
|
142
133
|
south
|
|
143
134
|
} = extent.set(i, tmsl.maxTileRow, tmsl.maxTileCol).as(crs);
|
|
144
|
-
this.extentSetlimits[crs][i] = new
|
|
135
|
+
this.extentSetlimits[crs][i] = new Extent(crs, west, east, south, north);
|
|
145
136
|
}
|
|
146
137
|
}
|
|
147
138
|
}
|
|
@@ -152,5 +143,4 @@ class TMSSource extends _Source.default {
|
|
|
152
143
|
return zoom >= this.zoom.min && zoom <= this.zoom.max && (this.extentSetlimits[extent.crs] == undefined || this.extentSetlimits[extent.crs][zoom].intersectsExtent(extent));
|
|
153
144
|
}
|
|
154
145
|
}
|
|
155
|
-
|
|
156
|
-
exports.default = _default;
|
|
146
|
+
export default TMSSource;
|