itowns 2.42.1-next.8 → 2.43.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/changelog.md +90 -0
- 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/examples/effects_stereo.html +2 -2
- package/examples/misc_collada.html +2 -2
- package/examples/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +2 -2
- package/examples/view_3d_map_webxr.html +1 -1
- package/examples/view_3d_mns_map.html +2 -2
- package/examples/view_immersive.html +1 -1
- package/examples/view_multi_25d.html +2 -2
- package/examples/widgets_searchbar.html +2 -2
- 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 +16 -26
- 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 +9 -20
- 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 -45
- 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 -25
- package/lib/Core/Prefab/TileBuilder.js +13 -22
- package/lib/Core/Prefab/computeBufferTileGeometry.js +12 -16
- 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 +24 -38
- package/lib/Core/System/Capabilities.js +2 -13
- package/lib/Core/TileGeometry.js +13 -15
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -58
- package/lib/Layer/C3DTilesLayer.js +29 -41
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +9 -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 +37 -33
- package/lib/Main.js +87 -708
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +80 -131
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +88 -0
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +14 -22
- 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 +20 -21
- package/lib/Parser/LASParser.js +6 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +8 -16
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +23 -31
- 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 +32 -29
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +40 -22
- package/lib/Provider/PointCloudProvider.js +7 -19
- 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 +33 -53
- package/lib/Renderer/OBB.js +12 -21
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +17 -35
- package/lib/Renderer/PointsMaterial.js +37 -60
- package/lib/Renderer/RasterTile.js +16 -29
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +5 -23
- 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 +20 -53
- package/lib/Source/C3DTilesGoogleSource.js +76 -0
- 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 -14
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +26 -39
- package/lib/Source/TMSSource.js +11 -22
- package/lib/Source/VectorTilesSource.js +75 -34
- 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 +13 -8
|
@@ -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
|
-
|
|
17
|
+
deprecatedC3DEngineWebGLOptions(options);
|
|
18
|
+
|
|
28
19
|
// pick sensible default options
|
|
29
20
|
if (options.antialias === undefined) {
|
|
30
21
|
options.antialias = true;
|
|
@@ -33,10 +24,7 @@ class c3DEngine {
|
|
|
33
24
|
options.alpha = true;
|
|
34
25
|
}
|
|
35
26
|
if (options.logarithmicDepthBuffer === undefined) {
|
|
36
|
-
options.logarithmicDepthBuffer =
|
|
37
|
-
}
|
|
38
|
-
if (options.isWebGL2 === undefined) {
|
|
39
|
-
options.isWebGL2 = true;
|
|
27
|
+
options.logarithmicDepthBuffer = true;
|
|
40
28
|
}
|
|
41
29
|
|
|
42
30
|
// If rendererOrDiv parameter is a domElement, we use it as support to display data.
|
|
@@ -84,10 +72,10 @@ class c3DEngine {
|
|
|
84
72
|
|
|
85
73
|
// Create renderer
|
|
86
74
|
try {
|
|
87
|
-
this.label2dRenderer = new
|
|
75
|
+
this.label2dRenderer = new Label2DRenderer();
|
|
88
76
|
this.label2dRenderer.setSize(this.width, this.height);
|
|
89
77
|
viewerDiv.appendChild(this.label2dRenderer.domElement);
|
|
90
|
-
this.renderer = renderer || new
|
|
78
|
+
this.renderer = renderer || new THREE.WebGLRenderer({
|
|
91
79
|
canvas: document.createElement('canvas'),
|
|
92
80
|
antialias: options.antialias,
|
|
93
81
|
alpha: options.alpha,
|
|
@@ -97,30 +85,10 @@ class c3DEngine {
|
|
|
97
85
|
this.renderer.domElement.style.zIndex = 0;
|
|
98
86
|
this.renderer.domElement.style.top = 0;
|
|
99
87
|
} catch (ex) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.renderer = null;
|
|
103
|
-
}
|
|
104
|
-
if (!this.renderer) {
|
|
105
|
-
if (!_WebGL.default.isWebGLAvailable()) {
|
|
106
|
-
viewerDiv.appendChild(_WebGL.default.getErrorMessage(1));
|
|
107
|
-
} else if (!_WebGL.default.isWebGL2Available()) {
|
|
108
|
-
viewerDiv.appendChild(_WebGL.default.getErrorMessage(2));
|
|
109
|
-
}
|
|
110
|
-
throw new Error('WebGL unsupported');
|
|
111
|
-
}
|
|
112
|
-
if (!renderer && options.logarithmicDepthBuffer) {
|
|
113
|
-
// We don't support logarithmicDepthBuffer when EXT_frag_depth is missing.
|
|
114
|
-
// So recreated a renderer if needed.
|
|
115
|
-
if (!this.renderer.capabilities.isWebGL2 && !this.renderer.extensions.get('EXT_frag_depth')) {
|
|
116
|
-
this.renderer.dispose();
|
|
117
|
-
this.renderer = new (options.isWebGL2 ? THREE.WebGLRenderer : THREE.WebGL1Renderer)({
|
|
118
|
-
canvas: document.createElement('canvas'),
|
|
119
|
-
antialias: options.antialias,
|
|
120
|
-
alpha: options.alpha,
|
|
121
|
-
logarithmicDepthBuffer: false
|
|
122
|
-
});
|
|
88
|
+
if (!WEBGL.isWebGL2Available()) {
|
|
89
|
+
viewerDiv.appendChild(WEBGL.getErrorMessage(2));
|
|
123
90
|
}
|
|
91
|
+
throw ex;
|
|
124
92
|
}
|
|
125
93
|
|
|
126
94
|
// Let's allow our canvas to take focus
|
|
@@ -131,7 +99,7 @@ class c3DEngine {
|
|
|
131
99
|
if (this.renderer.domElement.tabIndex === -1) {
|
|
132
100
|
this.renderer.domElement.tabIndex = -1;
|
|
133
101
|
}
|
|
134
|
-
|
|
102
|
+
Capabilities.updateCapabilities(this.renderer);
|
|
135
103
|
this.renderer.setClearColor(0x030508);
|
|
136
104
|
this.renderer.autoClear = false;
|
|
137
105
|
this.renderer.sortObjects = true;
|
|
@@ -148,7 +116,7 @@ class c3DEngine {
|
|
|
148
116
|
|
|
149
117
|
/**
|
|
150
118
|
* return renderer THREE.js
|
|
151
|
-
* @returns {
|
|
119
|
+
* @returns {THREE.WebGLRenderer}
|
|
152
120
|
*/
|
|
153
121
|
getRenderer() {
|
|
154
122
|
return this.renderer;
|
|
@@ -231,17 +199,16 @@ class c3DEngine {
|
|
|
231
199
|
}
|
|
232
200
|
depthBufferRGBAValueToOrthoZ(depthBufferRGBA, camera) {
|
|
233
201
|
depthRGBA.fromArray(depthBufferRGBA).divideScalar(255.0);
|
|
234
|
-
if (
|
|
235
|
-
const gl_FragDepthEXT =
|
|
202
|
+
if (Capabilities.isLogDepthBufferSupported() && camera.type == 'PerspectiveCamera') {
|
|
203
|
+
const gl_FragDepthEXT = unpack1K(depthRGBA);
|
|
236
204
|
const logDepthBufFC = 2.0 / (Math.log(camera.far + 1.0) / Math.LN2);
|
|
237
205
|
// invert function : gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
|
|
238
206
|
return 2 ** (2 * gl_FragDepthEXT / logDepthBufFC);
|
|
239
207
|
} else {
|
|
240
|
-
let gl_FragCoord_Z =
|
|
208
|
+
let gl_FragCoord_Z = unpack1K(depthRGBA);
|
|
241
209
|
gl_FragCoord_Z = gl_FragCoord_Z * 2.0 - 1.0;
|
|
242
210
|
return gl_FragCoord_Z;
|
|
243
211
|
}
|
|
244
212
|
}
|
|
245
213
|
}
|
|
246
|
-
|
|
247
|
-
exports.default = _default;
|
|
214
|
+
export default c3DEngine;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
2
|
+
import C3DTilesSource from "./C3DTilesSource.js";
|
|
3
|
+
function findSessionId(tile) {
|
|
4
|
+
if (!tile) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
if (tile.content && tile.content.uri) {
|
|
8
|
+
const searchParams = new URLSearchParams(tile.content.uri.slice(tile.content.uri.indexOf('?') + 1));
|
|
9
|
+
return searchParams.get('session');
|
|
10
|
+
} else if (tile.children && tile.children.length > 0) {
|
|
11
|
+
for (const c of tile.children) {
|
|
12
|
+
const sessionId = findSessionId(c);
|
|
13
|
+
if (sessionId) {
|
|
14
|
+
return sessionId;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @classdesc
|
|
23
|
+
* An object defining the source connection to a 3DTiles asset from a [Google api](https://tile.googleapis.com).
|
|
24
|
+
*
|
|
25
|
+
* @extends C3DTilesSource
|
|
26
|
+
*
|
|
27
|
+
* @property {boolean} isC3DTilesGoogleSource - Used to checkout whether this source is a C3DTilesGoogleSource. Default is
|
|
28
|
+
* true. You should not change this, as it is used internally for optimisation.
|
|
29
|
+
* @property {string} url - The URL to the tileset json.
|
|
30
|
+
* @property {string} baseUrl - The base URL to access tiles.
|
|
31
|
+
*/
|
|
32
|
+
class C3DTilesGoogleSource extends C3DTilesSource {
|
|
33
|
+
/**
|
|
34
|
+
* Create a new Source for 3D Tiles data from Google api (experimental).
|
|
35
|
+
*
|
|
36
|
+
* @constructor
|
|
37
|
+
* @extends C3DTilesSource
|
|
38
|
+
*
|
|
39
|
+
* @property {boolean} isC3DTilesGoogleSource - Used to checkout whether this source is a C3DTilesGoogleSource. Default is
|
|
40
|
+
* true. You should not change this, as it is used internally for optimisation.
|
|
41
|
+
* @param {Object} source An object that can contain all properties of a C3DTilesGoogleSource and {@link Source}.
|
|
42
|
+
* @param {String} source.key Your google tiles map API access key
|
|
43
|
+
*/
|
|
44
|
+
constructor(source) {
|
|
45
|
+
if (!source.key) {
|
|
46
|
+
throw new Error('[C3DTilesGoogleSource]: A API key for the google map tiles API is required');
|
|
47
|
+
}
|
|
48
|
+
// URL to the root tileset
|
|
49
|
+
source.url = `https://tile.googleapis.com/v1/3dtiles/root.json?key=${source.key}`;
|
|
50
|
+
super(source);
|
|
51
|
+
this.isC3DTilesGoogleSource = true;
|
|
52
|
+
this.baseUrl = 'https://tile.googleapis.com';
|
|
53
|
+
this.key = source.key;
|
|
54
|
+
this.whenReady = Fetcher.json(source.url, this.networkOptions).then(json => {
|
|
55
|
+
if (json && json.root) {
|
|
56
|
+
this.sessionId = findSessionId(json.root);
|
|
57
|
+
if (this.sessionId === null) {
|
|
58
|
+
throw new Error('[C3DTilesGoogleSource]: Cannot find sessionId from the tileset while it is mandatory to request tiles.');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return json;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Adds the key and session to the tile url (non-standard behaviour, that is specific to Google 3D tiles),
|
|
67
|
+
* see https://github.com/CesiumGS/3d-tiles/issues/746
|
|
68
|
+
* @param {String} url the tile url
|
|
69
|
+
* @returns {String} the tile url with Google map tiles api key and session parameters added at the end of the url
|
|
70
|
+
*/
|
|
71
|
+
getTileUrl(url) {
|
|
72
|
+
const extraParameters = `key=${this.key}&session=${this.sessionId}`;
|
|
73
|
+
return /\?/.test(url) ? `${url}&${extraParameters}` : `${url}?${extraParameters}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
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
|
|
@@ -23,14 +17,13 @@ class OrientedImageSource extends _Source.default {
|
|
|
23
17
|
* to find the good texture for each camera for each panoramic.
|
|
24
18
|
*/
|
|
25
19
|
constructor(source) {
|
|
26
|
-
source.format = source.format || 'json';
|
|
27
20
|
super(source);
|
|
28
21
|
this.isOrientedImageSource = true;
|
|
29
22
|
|
|
30
23
|
// Fetch the two files
|
|
31
24
|
const promises = [];
|
|
32
|
-
promises.push(source.orientationsUrl ?
|
|
33
|
-
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());
|
|
34
27
|
this.whenReady = Promise.all(promises).then(data => ({
|
|
35
28
|
orientation: data[0],
|
|
36
29
|
calibration: data[1]
|
|
@@ -63,5 +56,4 @@ class OrientedImageSource extends _Source.default {
|
|
|
63
56
|
return this.url.replace('{cameraId}', cameraId).replace('{panoId}', panoId);
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
|
-
|
|
67
|
-
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,25 +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 supportedFetchers = new Map([['image/x-bil;bits=32', _Fetcher.default.textureFloat], ['geojson', _Fetcher.default.json], ['application/json', _Fetcher.default.json], ['application/kml', _Fetcher.default.xml], ['application/gpx', _Fetcher.default.xml], ['application/x-protobuf;type=mapbox-vector', _Fetcher.default.arrayBuffer], ['application/gtx', _Fetcher.default.arrayBuffer], ['application/isg', _Fetcher.default.text], ['application/gdf', _Fetcher.default.text]]);
|
|
20
|
-
exports.supportedFetchers = supportedFetchers;
|
|
21
|
-
const supportedParsers = new Map([['geojson', _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]]);
|
|
22
|
-
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]]);
|
|
23
13
|
const noCache = {
|
|
24
14
|
getByArray: () => {},
|
|
25
15
|
setByArray: a => a,
|
|
@@ -44,7 +34,7 @@ class InformationsData {
|
|
|
44
34
|
options.crs = options.crs || options.projection;
|
|
45
35
|
}
|
|
46
36
|
if (options.crs) {
|
|
47
|
-
|
|
37
|
+
CRS.isValid(options.crs);
|
|
48
38
|
}
|
|
49
39
|
this.crs = options.crs;
|
|
50
40
|
}
|
|
@@ -56,13 +46,6 @@ class InformationsData {
|
|
|
56
46
|
*/
|
|
57
47
|
// eslint-disable-next-line
|
|
58
48
|
class /* istanbul ignore next */ParsingOptions {}
|
|
59
|
-
function fetchSourceData(source, extent) {
|
|
60
|
-
const url = source.urlFromExtent(extent);
|
|
61
|
-
return source.fetcher(url, source.networkOptions).then(f => {
|
|
62
|
-
f.extent = extent;
|
|
63
|
-
return f;
|
|
64
|
-
}, err => source.handlingError(err));
|
|
65
|
-
}
|
|
66
49
|
let uid = 0;
|
|
67
50
|
|
|
68
51
|
/**
|
|
@@ -125,8 +108,11 @@ class Source extends InformationsData {
|
|
|
125
108
|
this.uid = uid++;
|
|
126
109
|
this.url = source.url;
|
|
127
110
|
this.format = source.format;
|
|
128
|
-
this.fetcher = source.fetcher ||
|
|
129
|
-
this.parser = source.parser || supportedParsers.get(source.format) || (d =>
|
|
111
|
+
this.fetcher = source.fetcher || Fetcher.get(source.format);
|
|
112
|
+
this.parser = source.parser || supportedParsers.get(source.format) || ((d, opt) => {
|
|
113
|
+
d.extent = opt.extent;
|
|
114
|
+
return d;
|
|
115
|
+
});
|
|
130
116
|
this.isVectorSource = (source.parser || supportedParsers.get(source.format)) != undefined;
|
|
131
117
|
this.networkOptions = source.networkOptions || {
|
|
132
118
|
crossOrigin: 'anonymous'
|
|
@@ -135,7 +121,7 @@ class Source extends InformationsData {
|
|
|
135
121
|
this.whenReady = Promise.resolve();
|
|
136
122
|
this._featuresCaches = {};
|
|
137
123
|
if (source.extent && !source.extent.isExtent) {
|
|
138
|
-
this.extent = new
|
|
124
|
+
this.extent = new Extent(this.crs, source.extent);
|
|
139
125
|
} else {
|
|
140
126
|
this.extent = source.extent;
|
|
141
127
|
}
|
|
@@ -174,10 +160,12 @@ class Source extends InformationsData {
|
|
|
174
160
|
let features = cache.getByArray(key);
|
|
175
161
|
if (!features) {
|
|
176
162
|
// otherwise fetch/parse the data
|
|
177
|
-
features = cache.setByArray(
|
|
163
|
+
features = cache.setByArray(this.fetcher(this.urlFromExtent(extent), this.networkOptions).then(file => this.parser(file, {
|
|
178
164
|
out,
|
|
179
|
-
in: this
|
|
180
|
-
|
|
165
|
+
in: this,
|
|
166
|
+
extent
|
|
167
|
+
})).catch(err => this.handlingError(err)), key);
|
|
168
|
+
|
|
181
169
|
/* istanbul ignore next */
|
|
182
170
|
if (this.onParsedFile) {
|
|
183
171
|
features.then(feat => {
|
|
@@ -201,7 +189,7 @@ class Source extends InformationsData {
|
|
|
201
189
|
// Cache feature only if it's vector data, the feature are cached in source.
|
|
202
190
|
// It's not necessary to cache raster in Source,
|
|
203
191
|
// because it's already cached on layer.
|
|
204
|
-
this._featuresCaches[options.out.crs] = this.isVectorSource ? new
|
|
192
|
+
this._featuresCaches[options.out.crs] = this.isVectorSource ? new Cache() : noCache;
|
|
205
193
|
}
|
|
206
194
|
}
|
|
207
195
|
|
|
@@ -231,5 +219,4 @@ class Source extends InformationsData {
|
|
|
231
219
|
throw new Error('In extented Source, you have to implement the method extentInsideLimit!');
|
|
232
220
|
}
|
|
233
221
|
}
|
|
234
|
-
|
|
235
|
-
exports.default = _default;
|
|
222
|
+
export default Source;
|