itowns 2.42.1-next.2 → 2.42.1-next.21
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/examples/effects_stereo.html +2 -2
- package/examples/entwine_simple_loader.html +24 -8
- package/examples/misc_collada.html +2 -2
- package/examples/misc_instancing.html +1 -1
- package/examples/source_file_gpx_3d.html +2 -2
- package/examples/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/vector_tile_3d_mesh.html +2 -2
- package/examples/vector_tile_raster_2d.html +1 -1
- package/examples/vector_tile_raster_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +3 -3
- package/examples/view_3d_map_webxr.html +1 -1
- package/examples/view_3d_mns_map.html +3 -3
- package/examples/view_immersive.html +1 -1
- package/examples/view_multi_25d.html +2 -2
- package/examples/widgets_minimap.html +1 -1
- 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 +77 -70
- 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 +26 -40
- 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 +11 -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 +27 -24
- 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 +86 -707
- 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 +31 -21
- package/lib/Parser/LASParser.js +10 -17
- 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 +19 -28
- 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 +224 -94
- package/lib/Renderer/RasterTile.js +18 -30
- 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 +16 -0
- 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,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
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
|
-
function computeBuffers(params) {
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export function getBufferIndexSize(segments, noSkirt) {
|
|
3
|
+
const triangles = segments * segments * 2 + (noSkirt ? 0 : 4 * segments * 2);
|
|
4
|
+
return triangles * 3;
|
|
5
|
+
}
|
|
6
|
+
export default function computeBuffers(params) {
|
|
11
7
|
// Create output buffers.
|
|
12
8
|
const outBuffers = {
|
|
13
9
|
index: null,
|
|
14
10
|
position: null,
|
|
15
11
|
normal: null,
|
|
16
|
-
// 2 UV set per tile: wgs84 (
|
|
12
|
+
// 2 UV set per tile: wgs84 (uv[0]) and pm (uv[1])
|
|
17
13
|
// - wgs84: 1 texture per tile because tiles are using wgs84 projection
|
|
18
14
|
// - pm: use multiple textures per tile.
|
|
19
15
|
// +-------------------------+
|
|
@@ -32,7 +28,7 @@ function computeBuffers(params) {
|
|
|
32
28
|
};
|
|
33
29
|
const computeUvs = [];
|
|
34
30
|
const builder = params.builder;
|
|
35
|
-
const nSeg = params.
|
|
31
|
+
const nSeg = params.segments;
|
|
36
32
|
// segments count :
|
|
37
33
|
// Tile : (nSeg + 1) * (nSeg + 1)
|
|
38
34
|
// Skirt : 8 * (nSeg - 1)
|
|
@@ -40,7 +36,6 @@ function computeBuffers(params) {
|
|
|
40
36
|
if (nVertex > 2 ** 32) {
|
|
41
37
|
throw new Error('Tile segments count is too big');
|
|
42
38
|
}
|
|
43
|
-
const triangles = nSeg * nSeg * 2 + (params.disableSkirt ? 0 : 4 * nSeg * 2);
|
|
44
39
|
outBuffers.position = new Float32Array(nVertex * 3);
|
|
45
40
|
outBuffers.normal = new Float32Array(nVertex * 3);
|
|
46
41
|
const uvCount = params.builder.uvCount;
|
|
@@ -48,13 +43,14 @@ function computeBuffers(params) {
|
|
|
48
43
|
outBuffers.uvs[1] = new Float32Array(nVertex);
|
|
49
44
|
}
|
|
50
45
|
computeUvs[0] = () => {};
|
|
46
|
+
const bufferIndexSize = getBufferIndexSize(nSeg, params.disableSkirt);
|
|
51
47
|
if (params.buildIndexAndUv_0) {
|
|
52
48
|
if (nVertex < 2 ** 8) {
|
|
53
|
-
outBuffers.index = new Uint8Array(
|
|
49
|
+
outBuffers.index = new Uint8Array(bufferIndexSize);
|
|
54
50
|
} else if (nVertex < 2 ** 16) {
|
|
55
|
-
outBuffers.index = new Uint16Array(
|
|
51
|
+
outBuffers.index = new Uint16Array(bufferIndexSize);
|
|
56
52
|
} else if (nVertex < 2 ** 32) {
|
|
57
|
-
outBuffers.index = new Uint32Array(
|
|
53
|
+
outBuffers.index = new Uint32Array(bufferIndexSize);
|
|
58
54
|
}
|
|
59
55
|
outBuffers.uvs[0] = new Float32Array(nVertex * 2);
|
|
60
56
|
computeUvs[0] = (id, u, v) => {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.CACHE_POLICIES = void 0;
|
|
7
1
|
let entry;
|
|
8
2
|
|
|
9
3
|
/**
|
|
@@ -18,7 +12,7 @@ let entry;
|
|
|
18
12
|
* @property {number} GEOMETRY - Shortcut for geometry resources. Time is 15 minutes.
|
|
19
13
|
* minutes.
|
|
20
14
|
*/
|
|
21
|
-
const CACHE_POLICIES = {
|
|
15
|
+
export const CACHE_POLICIES = {
|
|
22
16
|
INFINITE: Infinity,
|
|
23
17
|
TEXTURE: 900000,
|
|
24
18
|
GEOMETRY: 900000
|
|
@@ -43,7 +37,6 @@ const CACHE_POLICIES = {
|
|
|
43
37
|
*
|
|
44
38
|
* cache.flush();
|
|
45
39
|
*/
|
|
46
|
-
exports.CACHE_POLICIES = CACHE_POLICIES;
|
|
47
40
|
class Cache {
|
|
48
41
|
/**
|
|
49
42
|
* @param {number} [lifetime=CACHE_POLICIES.INFINITE] The cache expiration time for all values.
|
|
@@ -260,5 +253,4 @@ class Cache {
|
|
|
260
253
|
}
|
|
261
254
|
}
|
|
262
255
|
}
|
|
263
|
-
|
|
264
|
-
exports.default = _default;
|
|
256
|
+
export default Cache;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* Custom error thrown when cancelling commands. Allows the caller to act differently if needed.
|
|
9
3
|
* @class
|
|
@@ -18,5 +12,4 @@ class CancelledCommandException {
|
|
|
18
12
|
return `Cancelled command ${this.command.requester.id}/${this.command.layer.id}`;
|
|
19
13
|
}
|
|
20
14
|
}
|
|
21
|
-
|
|
22
|
-
exports.default = _default;
|
|
15
|
+
export default CancelledCommandException;
|
|
@@ -1,23 +1,16 @@
|
|
|
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 _jsPriorityQueue = _interopRequireDefault(require("js-priority-queue"));
|
|
9
|
-
var _DataSourceProvider = _interopRequireDefault(require("../../Provider/DataSourceProvider"));
|
|
10
|
-
var _TileProvider = _interopRequireDefault(require("../../Provider/TileProvider"));
|
|
11
|
-
var _dTilesProvider = _interopRequireDefault(require("../../Provider/3dTilesProvider"));
|
|
12
|
-
var _PointCloudProvider = _interopRequireDefault(require("../../Provider/PointCloudProvider"));
|
|
13
|
-
var _URLBuilder = _interopRequireDefault(require("../../Provider/URLBuilder"));
|
|
14
|
-
var _CancelledCommandException = _interopRequireDefault(require("./CancelledCommandException"));
|
|
15
1
|
/**
|
|
16
2
|
* Generated On: 2015-10-5
|
|
17
3
|
* Class: Scheduler
|
|
18
4
|
* Description: Cette classe singleton gère les requetes/Commandes de la scène. Ces commandes peuvent etre synchrone ou asynchrone. Elle permet d'executer, de prioriser et d'annuler les commandes de la pile. Les commandes executées sont placées dans une autre file d'attente.
|
|
19
5
|
*/
|
|
20
6
|
|
|
7
|
+
import PriorityQueue from 'js-priority-queue';
|
|
8
|
+
import DataSourceProvider from "../../Provider/DataSourceProvider.js";
|
|
9
|
+
import TileProvider from "../../Provider/TileProvider.js";
|
|
10
|
+
import $3dTilesProvider from "../../Provider/3dTilesProvider.js";
|
|
11
|
+
import PointCloudProvider from "../../Provider/PointCloudProvider.js";
|
|
12
|
+
import URLBuilder from "../../Provider/URLBuilder.js";
|
|
13
|
+
import CancelledCommandException from "./CancelledCommandException.js";
|
|
21
14
|
function queueOrdering(a, b) {
|
|
22
15
|
const cmp = b.priority - a.priority;
|
|
23
16
|
// Prioritize recent commands
|
|
@@ -56,7 +49,7 @@ function _instanciateQueue() {
|
|
|
56
49
|
let st = this.storages.get(layer.id);
|
|
57
50
|
if (!st) {
|
|
58
51
|
st = {
|
|
59
|
-
q: new
|
|
52
|
+
q: new PriorityQueue({
|
|
60
53
|
comparator: queueOrdering
|
|
61
54
|
}),
|
|
62
55
|
priority: 1,
|
|
@@ -120,9 +113,9 @@ function Scheduler() {
|
|
|
120
113
|
Scheduler.prototype.constructor = Scheduler;
|
|
121
114
|
Scheduler.prototype.initDefaultProviders = function () {
|
|
122
115
|
// Register all providers
|
|
123
|
-
this.addProtocolProvider('tile',
|
|
124
|
-
this.addProtocolProvider('3d-tiles',
|
|
125
|
-
this.addProtocolProvider('pointcloud',
|
|
116
|
+
this.addProtocolProvider('tile', TileProvider);
|
|
117
|
+
this.addProtocolProvider('3d-tiles', $3dTilesProvider);
|
|
118
|
+
this.addProtocolProvider('pointcloud', PointCloudProvider);
|
|
126
119
|
};
|
|
127
120
|
Scheduler.prototype.runCommand = function (command, queue, executingCounterUpToDate) {
|
|
128
121
|
const provider = this.getProtocolProvider(command.layer.protocol);
|
|
@@ -147,7 +140,7 @@ Scheduler.prototype.execute = function (command) {
|
|
|
147
140
|
|
|
148
141
|
// parse host
|
|
149
142
|
const layer = command.layer;
|
|
150
|
-
const host = layer.source && layer.source.url ? new URL(
|
|
143
|
+
const host = layer.source && layer.source.url ? new URL(URLBuilder.subDomains(layer.source.url), document.location).host : undefined;
|
|
151
144
|
command.promise = new Promise((resolve, reject) => {
|
|
152
145
|
command.resolve = resolve;
|
|
153
146
|
command.reject = reject;
|
|
@@ -259,7 +252,7 @@ Scheduler.prototype.addProtocolProvider = function (protocol, provider) {
|
|
|
259
252
|
* @return {Provider}
|
|
260
253
|
*/
|
|
261
254
|
Scheduler.prototype.getProtocolProvider = function (protocol) {
|
|
262
|
-
return this.providers[protocol] ||
|
|
255
|
+
return this.providers[protocol] || DataSourceProvider;
|
|
263
256
|
};
|
|
264
257
|
Scheduler.prototype.commandsWaitingExecutionCount = function () {
|
|
265
258
|
let sum = this.defaultQueue.counters.pending + this.defaultQueue.counters.executing;
|
|
@@ -291,12 +284,11 @@ Scheduler.prototype.deQueue = function (queue) {
|
|
|
291
284
|
if (cmd.earlyDropFunction && cmd.earlyDropFunction(cmd)) {
|
|
292
285
|
queue.counters.pending--;
|
|
293
286
|
queue.counters.cancelled++;
|
|
294
|
-
cmd.reject(new
|
|
287
|
+
cmd.reject(new CancelledCommandException(cmd));
|
|
295
288
|
} else {
|
|
296
289
|
return cmd;
|
|
297
290
|
}
|
|
298
291
|
}
|
|
299
292
|
return undefined;
|
|
300
293
|
};
|
|
301
|
-
|
|
302
|
-
exports.default = _default;
|
|
294
|
+
export default Scheduler;
|
package/lib/Core/Style.js
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
exports.readExpression = readExpression;
|
|
9
|
-
var _Feature = require("./Feature");
|
|
10
|
-
var _Cache = _interopRequireDefault(require("./Scheduler/Cache"));
|
|
11
|
-
var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
|
|
12
|
-
var mapbox = _interopRequireWildcard(require("@mapbox/mapbox-gl-style-spec"));
|
|
13
|
-
var _three = require("three");
|
|
14
|
-
var _Color = require("../Renderer/Color");
|
|
15
|
-
var _Coordinates = _interopRequireDefault(require("./Geographic/Coordinates"));
|
|
16
|
-
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); }
|
|
17
|
-
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 { FEATURE_TYPES } from "./Feature.js";
|
|
2
|
+
import Cache from "./Scheduler/Cache.js";
|
|
3
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
4
|
+
import * as mapbox from '@mapbox/mapbox-gl-style-spec';
|
|
5
|
+
import { Color } from 'three';
|
|
6
|
+
import { deltaE } from "../Renderer/Color.js";
|
|
7
|
+
import Coordinates from "./Geographic/Coordinates.js";
|
|
18
8
|
/* babel-plugin-inline-import './StyleChunk/itowns_stroke_single_before.css' */
|
|
19
9
|
const itowns_stroke_single_before = ".itowns-stroke-single:before {\n display: var(--text_stroke_display);\n content: attr(data-before);\n opacity: 1;\n position: absolute;\n -webkit-text-stroke-width: var(--text_stroke_width);\n -webkit-text-stroke-color: var(--text_stroke_color);\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n z-index: -1;\n white-space: inherit;\n overflow-wrap: inherit;\n letter-spacing: inherit;\n text-align: inherit;\n padding: inherit;\n font-family: inherit;\n text-transform: inherit;\n max-width: inherit;\n font-size: inherit;\n}\n";
|
|
20
|
-
const cacheStyle = new
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const matrix = svg.createSVGMatrix();
|
|
10
|
+
export const cacheStyle = new Cache();
|
|
11
|
+
const matrix = document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGMatrix();
|
|
12
|
+
const canvas = document.createElement('canvas');
|
|
24
13
|
const inv255 = 1 / 255;
|
|
25
|
-
const canvas = typeof document !== 'undefined' ? document.createElement('canvas') : {};
|
|
26
14
|
function baseAltitudeDefault(properties, ctx) {
|
|
27
|
-
var _ctx$coordinates
|
|
28
|
-
return (ctx === null || ctx === void 0 ? void 0 : (_ctx$coordinates = ctx.coordinates) === null || _ctx$coordinates === void 0 ? void 0 : _ctx$coordinates.z) ||
|
|
15
|
+
var _ctx$coordinates;
|
|
16
|
+
return (ctx === null || ctx === void 0 ? void 0 : (_ctx$coordinates = ctx.coordinates) === null || _ctx$coordinates === void 0 ? void 0 : _ctx$coordinates.z) || 0;
|
|
29
17
|
}
|
|
30
|
-
function readExpression(property, ctx) {
|
|
18
|
+
export function readExpression(property, ctx) {
|
|
31
19
|
if (property != undefined) {
|
|
32
20
|
if (property.expression) {
|
|
33
21
|
return property.expression.evaluate(ctx);
|
|
@@ -95,7 +83,7 @@ function readVectorProperty(property, options) {
|
|
|
95
83
|
async function loadImage(source) {
|
|
96
84
|
let promise = cacheStyle.get(source, 'null');
|
|
97
85
|
if (!promise) {
|
|
98
|
-
promise =
|
|
86
|
+
promise = Fetcher.texture(source, {
|
|
99
87
|
crossOrigin: 'anonymous'
|
|
100
88
|
});
|
|
101
89
|
cacheStyle.set(promise, source, 'null');
|
|
@@ -122,10 +110,10 @@ function replaceWhitePxl(imgd, color, id) {
|
|
|
122
110
|
const imgdColored = cacheStyle.get(id, color);
|
|
123
111
|
if (!imgdColored) {
|
|
124
112
|
const pix = imgd.data;
|
|
125
|
-
const newColor = new
|
|
126
|
-
const colorToChange = new
|
|
113
|
+
const newColor = new Color(color);
|
|
114
|
+
const colorToChange = new Color('white');
|
|
127
115
|
for (let i = 0, n = pix.length; i < n; i += 4) {
|
|
128
|
-
const d =
|
|
116
|
+
const d = deltaE(pix.slice(i, i + 3), colorToChange) / 100;
|
|
129
117
|
pix[i] = pix[i] * d + newColor.r * 255 * (1 - d);
|
|
130
118
|
pix[i + 1] = pix[i + 1] * d + newColor.g * 255 * (1 - d);
|
|
131
119
|
pix[i + 2] = pix[i + 2] * d + newColor.b * 255 * (1 - d);
|
|
@@ -211,9 +199,9 @@ function defineStyleProperty(style, category, parameter, userValue, defaultValue
|
|
|
211
199
|
* @property {Feature} feature @private The itowns feature of interest.
|
|
212
200
|
* @property {FeatureGeometry} geometry @private The FeatureGeometry to compute the style.
|
|
213
201
|
*/
|
|
214
|
-
class StyleContext {
|
|
215
|
-
#worldCoord = new
|
|
216
|
-
#localCoordinates = new
|
|
202
|
+
export class StyleContext {
|
|
203
|
+
#worldCoord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
204
|
+
#localCoordinates = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
217
205
|
#worldCoordsComputed = true;
|
|
218
206
|
#feature = {};
|
|
219
207
|
#geometry = {};
|
|
@@ -258,7 +246,6 @@ class StyleContext {
|
|
|
258
246
|
return this.#worldCoord;
|
|
259
247
|
}
|
|
260
248
|
}
|
|
261
|
-
exports.StyleContext = StyleContext;
|
|
262
249
|
function _addIcon(icon, domElement, opt) {
|
|
263
250
|
const cIcon = icon.cloneNode();
|
|
264
251
|
cIcon.setAttribute('class', 'itowns-icon');
|
|
@@ -459,7 +446,7 @@ function _addIcon(icon, domElement, opt) {
|
|
|
459
446
|
* Used for the instanciation of a {@link Style}.
|
|
460
447
|
* @hideconstructor
|
|
461
448
|
*/
|
|
462
|
-
class StyleOptions {}
|
|
449
|
+
export class StyleOptions {}
|
|
463
450
|
|
|
464
451
|
/**
|
|
465
452
|
* @class
|
|
@@ -629,7 +616,7 @@ class StyleOptions {}
|
|
|
629
616
|
*
|
|
630
617
|
* view.addLayer(layer);
|
|
631
618
|
*/
|
|
632
|
-
|
|
619
|
+
|
|
633
620
|
class Style {
|
|
634
621
|
/**
|
|
635
622
|
* @param {StyleOptions} [params={}] An object that contain any properties
|
|
@@ -746,7 +733,7 @@ class Style {
|
|
|
746
733
|
static setFromProperties(properties, featCtx) {
|
|
747
734
|
const type = featCtx.type;
|
|
748
735
|
const style = {};
|
|
749
|
-
if (type ===
|
|
736
|
+
if (type === FEATURE_TYPES.POINT) {
|
|
750
737
|
const point = {
|
|
751
738
|
...(properties.fill !== undefined && {
|
|
752
739
|
color: properties.fill
|
|
@@ -810,7 +797,7 @@ class Style {
|
|
|
810
797
|
if (Object.keys(stroke).length) {
|
|
811
798
|
style.stroke = stroke;
|
|
812
799
|
}
|
|
813
|
-
if (type !==
|
|
800
|
+
if (type !== FEATURE_TYPES.LINE) {
|
|
814
801
|
const fill = {
|
|
815
802
|
...(properties.fill !== undefined && {
|
|
816
803
|
color: properties.fill
|
|
@@ -1131,7 +1118,7 @@ class Style {
|
|
|
1131
1118
|
const CustomStyle = {
|
|
1132
1119
|
itowns_stroke_single_before
|
|
1133
1120
|
};
|
|
1134
|
-
const customStyleSheet =
|
|
1121
|
+
const customStyleSheet = document.createElement('style');
|
|
1135
1122
|
customStyleSheet.type = 'text/css';
|
|
1136
1123
|
Object.keys(CustomStyle).forEach(key => {
|
|
1137
1124
|
customStyleSheet.innerHTML += `${CustomStyle[key]}\n\n`;
|
|
@@ -1139,5 +1126,4 @@ Object.keys(CustomStyle).forEach(key => {
|
|
|
1139
1126
|
if (typeof document !== 'undefined') {
|
|
1140
1127
|
document.getElementsByTagName('head')[0].appendChild(customStyleSheet);
|
|
1141
1128
|
}
|
|
1142
|
-
|
|
1143
|
-
exports.default = _default;
|
|
1129
|
+
export default Style;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
/* babel-plugin-inline-import '../../Renderer/Shader/SampleTestFS.glsl' */
|
|
8
2
|
const SampleTestFS = "uniform sampler2D uni[SAMPLE];\nvoid main() {\n gl_FragColor += texture2D(uni[SAMPLE-1], vec2(0));\n}";
|
|
9
3
|
/* babel-plugin-inline-import '../../Renderer/Shader/SampleTestVS.glsl' */
|
|
@@ -21,15 +15,11 @@ function _WebGLShader(renderer, type, string) {
|
|
|
21
15
|
function isFirefox() {
|
|
22
16
|
return navigator && navigator.userAgent && navigator.userAgent.toLowerCase().includes('firefox');
|
|
23
17
|
}
|
|
24
|
-
|
|
18
|
+
export default {
|
|
25
19
|
isLogDepthBufferSupported() {
|
|
26
20
|
return logDepthBufferSupported;
|
|
27
21
|
},
|
|
28
22
|
isFirefox,
|
|
29
|
-
isInternetExplorer() {
|
|
30
|
-
const internetExplorer = false || !!document.documentMode;
|
|
31
|
-
return internetExplorer;
|
|
32
|
-
},
|
|
33
23
|
getMaxTextureUnitsCount() {
|
|
34
24
|
return maxTexturesUnits;
|
|
35
25
|
},
|
|
@@ -70,5 +60,4 @@ var _default = {
|
|
|
70
60
|
gl.deleteShader(glFragmentShader);
|
|
71
61
|
logDepthBufferSupported = renderer.capabilities.logarithmicDepthBuffer;
|
|
72
62
|
}
|
|
73
|
-
};
|
|
74
|
-
exports.default = _default;
|
|
63
|
+
};
|
package/lib/Core/TileGeometry.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
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 THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _computeBufferTileGeometry = _interopRequireDefault(require("./Prefab/computeBufferTileGeometry"));
|
|
10
|
-
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); }
|
|
11
|
-
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';
|
|
2
|
+
import computeBuffers, { getBufferIndexSize } from "./Prefab/computeBufferTileGeometry.js";
|
|
12
3
|
function defaultBuffers(params) {
|
|
13
4
|
params.buildIndexAndUv_0 = true;
|
|
14
5
|
params.center = params.builder.center(params.extent).clone();
|
|
15
|
-
const buffers = (
|
|
6
|
+
const buffers = computeBuffers(params);
|
|
16
7
|
buffers.index = new THREE.BufferAttribute(buffers.index, 1);
|
|
17
8
|
buffers.uvs[0] = new THREE.BufferAttribute(buffers.uvs[0], 2);
|
|
18
9
|
buffers.position = new THREE.BufferAttribute(buffers.position, 3);
|
|
@@ -28,15 +19,22 @@ class TileGeometry extends THREE.BufferGeometry {
|
|
|
28
19
|
super();
|
|
29
20
|
this.center = params.center;
|
|
30
21
|
this.extent = params.extent;
|
|
22
|
+
this.segments = params.segments;
|
|
31
23
|
this.setIndex(buffers.index);
|
|
32
24
|
this.setAttribute('position', buffers.position);
|
|
33
25
|
this.setAttribute('normal', buffers.normal);
|
|
34
|
-
|
|
26
|
+
this.setAttribute('uv', buffers.uvs[0]);
|
|
27
|
+
for (let i = 1; i < buffers.uvs.length; i++) {
|
|
35
28
|
this.setAttribute(`uv_${i}`, buffers.uvs[i]);
|
|
36
29
|
}
|
|
37
30
|
this.computeBoundingBox();
|
|
38
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));
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
exports.default = _default;
|
|
40
|
+
export default TileGeometry;
|
package/lib/Core/TileMesh.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import CRS from "./Geographic/Crs.js";
|
|
3
|
+
import { geoidLayerIsVisible } from "../Layer/GeoidLayer.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 THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Crs = _interopRequireDefault(require("./Geographic/Crs"));
|
|
10
|
-
var _GeoidLayer = require("../Layer/GeoidLayer");
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
5
|
/**
|
|
14
6
|
* A TileMesh is a THREE.Mesh with a geometricError and an OBB
|
|
15
7
|
* The objectId property of the material is the with the id of the TileMesh
|
|
@@ -71,7 +63,7 @@ class TileMesh extends THREE.Mesh {
|
|
|
71
63
|
* @param {number} [elevation.scale]
|
|
72
64
|
*/
|
|
73
65
|
setBBoxZ(elevation) {
|
|
74
|
-
elevation.geoidHeight =
|
|
66
|
+
elevation.geoidHeight = geoidLayerIsVisible(this.layer) ? this.geoidHeight : 0;
|
|
75
67
|
this.obb.updateZ(elevation);
|
|
76
68
|
if (this.horizonCullingPointElevationScaled) {
|
|
77
69
|
this.horizonCullingPointElevationScaled.setLength(this.obb.z.delta + this.horizonCullingPoint.length());
|
|
@@ -79,7 +71,7 @@ class TileMesh extends THREE.Mesh {
|
|
|
79
71
|
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
80
72
|
}
|
|
81
73
|
getExtentsByProjection(crs) {
|
|
82
|
-
return this.#_tms.get(
|
|
74
|
+
return this.#_tms.get(CRS.formatToTms(crs));
|
|
83
75
|
}
|
|
84
76
|
|
|
85
77
|
/**
|
|
@@ -114,5 +106,4 @@ class TileMesh extends THREE.Mesh {
|
|
|
114
106
|
}
|
|
115
107
|
}
|
|
116
108
|
}
|
|
117
|
-
|
|
118
|
-
exports.default = _default;
|
|
109
|
+
export default TileMesh;
|