itowns 2.36.2 → 2.37.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/CONTRIBUTING.md +30 -17
- package/changelog.md +52 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +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 +2 -0
- package/dist/itowns_widgets.js.map +1 -0
- package/examples/config.json +25 -6
- package/examples/css/widgets.css +248 -0
- package/examples/geoid_geoidLayer.html +102 -0
- package/examples/images/compass.svg +60 -0
- package/examples/images/widget-logo.svg +66 -0
- package/examples/itowns-potree.html +252 -0
- package/examples/js/GUI/GuiTools.js +17 -0
- package/examples/js/Scale.js +1 -0
- package/examples/source_file_from_fetched_data.html +90 -0
- package/examples/source_file_from_format.html +85 -0
- package/examples/source_file_from_methods.html +87 -0
- package/examples/source_file_from_parsed_data.html +104 -0
- package/examples/source_file_geojson_raster.html +21 -45
- package/examples/source_file_gpx_raster.html +28 -36
- package/examples/source_file_kml_raster.html +1 -4
- package/examples/source_file_shapefile.html +39 -34
- package/examples/source_stream_wfs_25d.html +21 -13
- package/examples/source_stream_wfs_3d.html +21 -12
- package/examples/source_stream_wfs_raster.html +20 -20
- package/examples/view_immersive.html +13 -14
- package/examples/widgets_minimap.html +122 -0
- package/examples/widgets_navigation.html +119 -0
- package/lib/Controls/GlobeControls.js +13 -0
- package/lib/Controls/PlanarControls.js +1 -1
- package/lib/Converter/convertToTile.js +5 -1
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
- package/lib/Core/Deprecated/Undeprecator.js +1 -1
- package/lib/Core/Feature.js +3 -4
- package/lib/Core/Geographic/Extent.js +1 -1
- package/lib/Core/Geographic/GeoidGrid.js +143 -0
- package/lib/Core/MainLoop.js +1 -1
- package/lib/Core/Math/Ellipsoid.js +1 -1
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
- package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
- package/lib/Core/Style.js +1 -1
- package/lib/Core/TileGeometry.js +3 -1
- package/lib/Core/TileMesh.js +11 -17
- package/lib/Core/View.js +40 -2
- package/lib/Layer/ElevationLayer.js +6 -2
- package/lib/Layer/FeatureGeometryLayer.js +3 -1
- package/lib/Layer/GeoidLayer.js +131 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/Layer.js +1 -1
- package/lib/Layer/LayerUpdateStrategy.js +1 -1
- package/lib/Layer/PotreeLayer.js +3 -1
- package/lib/Layer/TiledGeometryLayer.js +3 -1
- package/lib/Main.js +214 -174
- package/lib/MainBundle.js +1 -1
- package/lib/Parser/B3dmParser.js +2 -1
- package/lib/Parser/GDFParser.js +118 -0
- package/lib/Parser/GTXParser.js +92 -0
- package/lib/Parser/ISGParser.js +121 -0
- package/lib/Parser/LASParser.js +3 -1
- package/lib/Parser/XbilParser.js +1 -1
- package/lib/Process/3dTilesProcessing.js +2 -2
- package/lib/Process/FeatureProcessing.js +3 -1
- package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
- package/lib/Provider/URLBuilder.js +1 -1
- package/lib/Renderer/LayeredMaterial.js +2 -2
- package/lib/Renderer/OBB.js +18 -25
- package/lib/Renderer/PointsMaterial.js +5 -6
- package/lib/Renderer/RasterTile.js +1 -1
- package/lib/Renderer/Shader/ShaderUtils.js +4 -2
- package/lib/Source/C3DTilesSource.js +3 -1
- package/lib/Source/EntwinePointTileSource.js +3 -1
- package/lib/Source/PotreeSource.js +3 -1
- package/lib/Source/Source.js +15 -10
- package/lib/Source/WMTSSource.js +3 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +85 -35
- package/lib/Utils/CameraUtils.js +11 -1
- package/lib/Utils/DEMUtils.js +1 -1
- package/lib/Utils/FeaturesUtils.js +8 -4
- package/package.json +25 -25
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - Navigation widget</title>
|
|
4
|
+
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
10
|
+
|
|
11
|
+
<!-- Import stylesheet for itowns Widgets plugin -->
|
|
12
|
+
<link rel="stylesheet" type="text/css" href="css/widgets.css">
|
|
13
|
+
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="viewerDiv"></div>
|
|
18
|
+
|
|
19
|
+
<!-- Import iTowns source code -->
|
|
20
|
+
<script src="../dist/itowns.js"></script>
|
|
21
|
+
<script src="../dist/debug.js"></script>
|
|
22
|
+
<!-- Import iTowns Widgets plugin -->
|
|
23
|
+
<script src="../dist/itowns_widgets.js"></script>
|
|
24
|
+
<!-- Import iTowns LoadingScreen and GuiTools plugins -->
|
|
25
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
26
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<script type="text/javascript">
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// ---------- CREATE A GlobeView FOR SUPPORTING DATA VISUALIZATION : ----------
|
|
34
|
+
|
|
35
|
+
// Define camera initial position
|
|
36
|
+
const placement = {
|
|
37
|
+
coord: new itowns.Coordinates('EPSG:4326', 2.351323, 48.856712),
|
|
38
|
+
range: 6000,
|
|
39
|
+
tilt: 50,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// `viewerDiv` contains iTowns' rendering area (`<canvas>`)
|
|
43
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
44
|
+
|
|
45
|
+
// Create a GlobeView
|
|
46
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
47
|
+
|
|
48
|
+
// Setup loading screen and debug menu
|
|
49
|
+
setupLoadingScreen(viewerDiv, view);
|
|
50
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
55
|
+
|
|
56
|
+
// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
|
|
57
|
+
// defined as a plain js object. See `Layer` documentation for more info.
|
|
58
|
+
itowns.Fetcher.json('layers/JSONLayers/Ortho.json').then((config) => {
|
|
59
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
60
|
+
view.addLayer(
|
|
61
|
+
new itowns.ColorLayer(config.id, config),
|
|
62
|
+
).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Add two elevation layers, each with a different level of detail. Here again, each layer's properties are
|
|
66
|
+
// defined in a json file.
|
|
67
|
+
function addElevationLayerFromConfig(config) {
|
|
68
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
69
|
+
view.addLayer(
|
|
70
|
+
new itowns.ElevationLayer(config.id, config),
|
|
71
|
+
).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
72
|
+
}
|
|
73
|
+
itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
|
|
74
|
+
itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// ---------- ADD NAVIGATION WIDGET : ----------
|
|
79
|
+
|
|
80
|
+
const widgets = new itowns_widgets.Navigation(view);
|
|
81
|
+
|
|
82
|
+
// Example on how to add a new button to the widgets menu
|
|
83
|
+
widgets.addButton(
|
|
84
|
+
'rotate-up',
|
|
85
|
+
'<p style="font-size: 20px">↓</p>',
|
|
86
|
+
() => {
|
|
87
|
+
view.controls.lookAtCoordinate({
|
|
88
|
+
tilt: view.controls.getTilt() - 10,
|
|
89
|
+
time: 500,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
'button-bar-rotation',
|
|
93
|
+
);
|
|
94
|
+
widgets.addButton(
|
|
95
|
+
'rotate-down',
|
|
96
|
+
'<p style="font-size: 20px">↑</p>',
|
|
97
|
+
() => {
|
|
98
|
+
view.controls.lookAtCoordinate({
|
|
99
|
+
tilt: view.controls.getTilt() + 10,
|
|
100
|
+
time: 500,
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
'button-bar-rotation',
|
|
104
|
+
);
|
|
105
|
+
widgets.addButton(
|
|
106
|
+
'reset-position',
|
|
107
|
+
'↺',
|
|
108
|
+
() => { view.controls.lookAtCoordinate(placement) },
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
// ---------- DEBUG TOOLS : ----------
|
|
114
|
+
|
|
115
|
+
debug.createTileDebugUI(debugMenu.gui, view);
|
|
116
|
+
|
|
117
|
+
</script>
|
|
118
|
+
</body>
|
|
119
|
+
</html>
|
|
@@ -33,6 +33,8 @@ var _CameraUtils = _interopRequireDefault(require("../Utils/CameraUtils"));
|
|
|
33
33
|
|
|
34
34
|
var _StateControl = _interopRequireDefault(require("./StateControl"));
|
|
35
35
|
|
|
36
|
+
var _View = require("../Core/View");
|
|
37
|
+
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
38
40
|
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; }
|
|
@@ -75,6 +77,7 @@ var dollyScale; // Globe move
|
|
|
75
77
|
|
|
76
78
|
var moveAroundGlobe = new THREE.Quaternion();
|
|
77
79
|
var cameraTarget = new THREE.Object3D();
|
|
80
|
+
var coordCameraTarget = new _Coordinates["default"]('EPSG:4978');
|
|
78
81
|
cameraTarget.matrixWorldInverse = new THREE.Matrix4();
|
|
79
82
|
var xyz = new _Coordinates["default"]('EPSG:4978', 0, 0, 0);
|
|
80
83
|
var c = new _Coordinates["default"]('EPSG:4326', 0, 0, 0); // Position object on globe
|
|
@@ -342,6 +345,7 @@ var GlobeControls = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
342
345
|
|
|
343
346
|
_this.lookAtCoordinate(placement, false);
|
|
344
347
|
|
|
348
|
+
coordCameraTarget.crs = _this.view.referenceCrs;
|
|
345
349
|
return _this;
|
|
346
350
|
}
|
|
347
351
|
|
|
@@ -610,6 +614,14 @@ var GlobeControls = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
610
614
|
});
|
|
611
615
|
this.player.playLater(durationDampingOrbital, 2);
|
|
612
616
|
}
|
|
617
|
+
|
|
618
|
+
this.view.dispatchEvent({
|
|
619
|
+
type: _View.VIEW_EVENTS.CAMERA_MOVED,
|
|
620
|
+
coord: coordCameraTarget.setFromVector3(cameraTarget.position),
|
|
621
|
+
range: spherical.radius,
|
|
622
|
+
heading: -THREE.MathUtils.radToDeg(spherical.theta),
|
|
623
|
+
tilt: 90 - THREE.MathUtils.radToDeg(spherical.phi)
|
|
624
|
+
});
|
|
613
625
|
}
|
|
614
626
|
}, {
|
|
615
627
|
key: "onStateChange",
|
|
@@ -1300,6 +1312,7 @@ var GlobeControls = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
1300
1312
|
|
|
1301
1313
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1302
1314
|
var isAnimated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.isAnimationEnabled();
|
|
1315
|
+
this.player.stop();
|
|
1303
1316
|
|
|
1304
1317
|
if (!params.isExtent) {
|
|
1305
1318
|
if (params.zoom) {
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = exports.
|
|
10
|
+
exports.keys = exports["default"] = exports.STATE = exports.PLANAR_CONTROL_EVENT = void 0;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -86,7 +86,11 @@ var _default = {
|
|
|
86
86
|
setTileFromTiledLayer(tile, layer);
|
|
87
87
|
|
|
88
88
|
if (parent) {
|
|
89
|
-
tile.setBBoxZ(
|
|
89
|
+
tile.setBBoxZ({
|
|
90
|
+
min: parent.obb.z.min,
|
|
91
|
+
max: parent.obb.z.max
|
|
92
|
+
});
|
|
93
|
+
tile.geoidHeight = parent.geoidHeight;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
return tile;
|
|
@@ -74,7 +74,10 @@ var C3DTBoundingVolume = /*#__PURE__*/function () {
|
|
|
74
74
|
extent.set(THREE.MathUtils.radToDeg(region[0]), THREE.MathUtils.radToDeg(region[2]), THREE.MathUtils.radToDeg(region[1]), THREE.MathUtils.radToDeg(region[3]));
|
|
75
75
|
var regionBox = new _OBB["default"]();
|
|
76
76
|
regionBox.setFromExtent(extent);
|
|
77
|
-
regionBox.updateZ(
|
|
77
|
+
regionBox.updateZ({
|
|
78
|
+
min: region[4],
|
|
79
|
+
max: region[5]
|
|
80
|
+
}); // at this point box.matrix = box.epsg4978_from_local, so
|
|
78
81
|
// we transform it in parent_from_local by using parent's
|
|
79
82
|
// epsg4978_from_local which from our point of view is
|
|
80
83
|
// epsg4978_from_parent. box.matrix = (epsg4978_from_parent ^ -1) *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.deprecatedParsingOptionsToNewOne = exports.deprecatedFeature2MeshOptions = exports.deprecatedColorLayerOptions = exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _LayeredMaterial = require("../../Renderer/LayeredMaterial");
|
|
9
9
|
|
package/lib/Core/Feature.js
CHANGED
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports
|
|
10
|
+
exports["default"] = exports.FeatureGeometry = exports.FeatureCollection = exports.FeatureBuildingOptions = exports.FEATURE_TYPES = void 0;
|
|
11
11
|
|
|
12
12
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
13
|
|
|
@@ -98,9 +98,9 @@ var typeToStyleProperty = ['point', 'stroke', 'fill'];
|
|
|
98
98
|
*
|
|
99
99
|
*/
|
|
100
100
|
|
|
101
|
-
var FeatureBuildingOptions = function FeatureBuildingOptions() {
|
|
101
|
+
var FeatureBuildingOptions = /*#__PURE__*/(0, _createClass2["default"])(function FeatureBuildingOptions() {
|
|
102
102
|
(0, _classCallCheck2["default"])(this, FeatureBuildingOptions);
|
|
103
|
-
};
|
|
103
|
+
});
|
|
104
104
|
/**
|
|
105
105
|
* @property {Extent} extent - The 2D extent containing all the points
|
|
106
106
|
* composing the geometry.
|
|
@@ -112,7 +112,6 @@ var FeatureBuildingOptions = function FeatureBuildingOptions() {
|
|
|
112
112
|
* anything specified in the GeoJSON under the `properties` property.
|
|
113
113
|
*/
|
|
114
114
|
|
|
115
|
-
|
|
116
115
|
exports.FeatureBuildingOptions = FeatureBuildingOptions;
|
|
117
116
|
|
|
118
117
|
var FeatureGeometry = /*#__PURE__*/function () {
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports
|
|
10
|
+
exports.schemeTiles = exports.globalExtentTMS = exports["default"] = void 0;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
17
|
+
|
|
18
|
+
var _Coordinates = _interopRequireDefault(require("./Coordinates"));
|
|
19
|
+
|
|
20
|
+
var _Crs = _interopRequireDefault(require("./Crs"));
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
var coord = new _Coordinates["default"]('EPSG:4326');
|
|
27
|
+
var indexes = new THREE.Vector2();
|
|
28
|
+
|
|
29
|
+
function biLinearInterpolation(indexes, getData) {
|
|
30
|
+
var j = Math.floor(indexes.x);
|
|
31
|
+
var i = Math.floor(indexes.y);
|
|
32
|
+
var u = indexes.x - j;
|
|
33
|
+
var v = indexes.y - i;
|
|
34
|
+
return (1 - u) * ((1 - v) * getData(i, j) + v * getData(i + 1, j)) + u * ((1 - v) * getData(i, j + 1) + v * getData(i + 1, j + 1));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* An instance of `GeoidGrid` allows accessing some geoid height grid data from geographic instances (like some
|
|
38
|
+
* `{@link Coordinates}`). The geoid height grid data must contain geoid height values for a set of geographic points
|
|
39
|
+
* regularly dispatched on a planar surface.
|
|
40
|
+
*
|
|
41
|
+
* @property {Extent} extent The geographic extent of the geoid height grid data.
|
|
42
|
+
* @property {THREE.Vector2} step The distance between two consecutive points of the geoid height grid. The
|
|
43
|
+
* `x` value stands for the distance along the West-East direction, and the
|
|
44
|
+
* `y` value stands for the distance along the South-North direction.
|
|
45
|
+
* @property {THREE.Vector2} dimensions The planar dimensions of the geoid height grid data extent.
|
|
46
|
+
* @property {THREE.Vector2} dataSize The number of values in the gridded data along the West-East direction (`x`
|
|
47
|
+
* axis) and the South-North direction (`y` axis).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Create a set of gridded data.
|
|
51
|
+
* const data = [
|
|
52
|
+
* [1, 2, 3],
|
|
53
|
+
* [2, 3, 4],
|
|
54
|
+
* [3, 4, 5],
|
|
55
|
+
* ];
|
|
56
|
+
* // This set of data presents the following spatial distribution of geoid heights values :
|
|
57
|
+
* //
|
|
58
|
+
* // Latitudes ^
|
|
59
|
+
* // |
|
|
60
|
+
* // 41.0 | 3 4 5
|
|
61
|
+
* // 40.5 | 2 3 4
|
|
62
|
+
* // 40.0 | 1 2 3
|
|
63
|
+
* // |------------->
|
|
64
|
+
* // 1 2 3 Longitudes
|
|
65
|
+
*
|
|
66
|
+
* // Create a GeoidGrid allowing to access the gridded data.
|
|
67
|
+
* const geoidGrid = new GeoidGrid(
|
|
68
|
+
* new Extent('EPSG:4326', 1, 3, 40, 41),
|
|
69
|
+
* new THREE.Vector2(1, 0.5),
|
|
70
|
+
* (verticalIndex, horizontalIndex) => data[verticalIndex][horizontalIndex],
|
|
71
|
+
* );
|
|
72
|
+
*
|
|
73
|
+
* // Access a value of geoid height at some geographic coordinates.
|
|
74
|
+
* // The value is interpolated from the gridded data.
|
|
75
|
+
* const value = geoidGrid.getHeightAtCoordinates(
|
|
76
|
+
* new Coordinates('EPSG:4326', 1.5, 40.25)
|
|
77
|
+
* );
|
|
78
|
+
* // This should return 2.0, which is the result from the bi-linear
|
|
79
|
+
* // interpolation at the center of the `[[1, 2], [2, 3]]` subsection
|
|
80
|
+
* // of the grid data.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var GeoidGrid = /*#__PURE__*/function () {
|
|
85
|
+
/**
|
|
86
|
+
* @param {Extent} extent The geographic extent of the geoid height grid data.
|
|
87
|
+
* @param {THREE.Vector2} step The distance between two consecutive points of the geoid height grid. The
|
|
88
|
+
* `x` value stands for the distance along the West-East direction, and the
|
|
89
|
+
* `y` value stands for the distance along the South-North direction.
|
|
90
|
+
* @param {function} getData A method that allows reading a value in the geoid height grid from its
|
|
91
|
+
* vertical and horizontal indexes. The lower an index, the lower the
|
|
92
|
+
* coordinate on the corresponding axis - 0 being the index of the minimal
|
|
93
|
+
* coordinate of the gridded data on a given axis. In other words :
|
|
94
|
+
* - `getData(0, 0)` must return the geoid height value at the SOUTH-WEST
|
|
95
|
+
* corner of your data extent.
|
|
96
|
+
* - `getData(0, j)` must return a geoid height on the southern limit of your
|
|
97
|
+
* data extent.
|
|
98
|
+
* - `getData(i, 0)` must return a geoid height on the western limit of your
|
|
99
|
+
* data extent.
|
|
100
|
+
* - if your gridded data has dimensions (rowNumber, colNumber),
|
|
101
|
+
* `getData(rowNumber - 1, colNumber - 1)` must return the geoid height at
|
|
102
|
+
* the NORTH-EAST corner of your data extent.
|
|
103
|
+
*/
|
|
104
|
+
function GeoidGrid(extent, step, getData) {
|
|
105
|
+
(0, _classCallCheck2["default"])(this, GeoidGrid);
|
|
106
|
+
|
|
107
|
+
_Crs["default"].isGeographic(extent.crs);
|
|
108
|
+
|
|
109
|
+
this.extent = extent;
|
|
110
|
+
this.step = new THREE.Vector2(step.x, step.y || step.x);
|
|
111
|
+
this.dimensions = this.extent.planarDimensions();
|
|
112
|
+
this.dataSize = new THREE.Vector2().addVectors(this.step, this.dimensions).divide(this.step).round();
|
|
113
|
+
this.getData = getData;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get the value of the geoid height at given geographic `{@link Coordinates}`. The geoid height value is
|
|
117
|
+
* bi-linearly interpolated from the gridded data accessed by the `GeoidGrid` instance.
|
|
118
|
+
*
|
|
119
|
+
* @param {Coordinates} coordinates Geographic coordinates to get the geoid height value at.
|
|
120
|
+
*
|
|
121
|
+
* @returns {number} The geoid height value at the given `{@link Coordinates}`, bi-interpolated from the gridded
|
|
122
|
+
* data accessed by the `GeoidGrid` instance.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
(0, _createClass2["default"])(GeoidGrid, [{
|
|
127
|
+
key: "getHeightAtCoordinates",
|
|
128
|
+
value: function getHeightAtCoordinates(coordinates) {
|
|
129
|
+
coordinates.as(this.extent.crs, coord);
|
|
130
|
+
indexes.set((this.dataSize.x - 1) * (coord.x - this.extent.west) / this.dimensions.x, (this.dataSize.y - 1) * (coord.y - this.extent.south) / this.dimensions.y); // TODO : add management for global GeoidGrid.
|
|
131
|
+
|
|
132
|
+
if (indexes.x < 0 || indexes.x >= this.dataSize.x - 1 || indexes.y < 0 || indexes.y >= this.dataSize.y - 1) {
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return biLinearInterpolation(indexes, this.getData);
|
|
137
|
+
}
|
|
138
|
+
}]);
|
|
139
|
+
return GeoidGrid;
|
|
140
|
+
}();
|
|
141
|
+
|
|
142
|
+
var _default = GeoidGrid;
|
|
143
|
+
exports["default"] = _default;
|
package/lib/Core/MainLoop.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.
|
|
6
|
+
exports["default"] = exports.RENDERING_SCHEDULED = exports.RENDERING_PAUSED = exports.MAIN_LOOP_EVENTS = void 0;
|
|
7
7
|
|
|
8
8
|
var _three = require("three");
|
|
9
9
|
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] =
|
|
10
|
+
exports.ellipsoidSizes = exports["default"] = void 0;
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -87,7 +89,7 @@ var Sky = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
87
89
|
return _super.call(this, skyGeo, skyMat);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
return Sky;
|
|
92
|
+
return (0, _createClass2["default"])(Sky);
|
|
91
93
|
}(THREE.Mesh);
|
|
92
94
|
|
|
93
95
|
var _default = Sky;
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -96,7 +98,7 @@ var PlanarLayer = /*#__PURE__*/function (_TiledGeometryLayer) {
|
|
|
96
98
|
return _this;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
return PlanarLayer;
|
|
101
|
+
return (0, _createClass2["default"])(PlanarLayer);
|
|
100
102
|
}(_TiledGeometryLayer2["default"]);
|
|
101
103
|
|
|
102
104
|
var _default = PlanarLayer;
|
package/lib/Core/Style.js
CHANGED
|
@@ -7,8 +7,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.readExpression = readExpression;
|
|
11
10
|
exports["default"] = exports.cacheStyle = void 0;
|
|
11
|
+
exports.readExpression = readExpression;
|
|
12
12
|
|
|
13
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
14
|
|
package/lib/Core/TileGeometry.js
CHANGED
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -75,7 +77,7 @@ var TileGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
|
|
|
75
77
|
return _this;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
return TileGeometry;
|
|
80
|
+
return (0, _createClass2["default"])(TileGeometry);
|
|
79
81
|
}(THREE.BufferGeometry);
|
|
80
82
|
|
|
81
83
|
var _default = TileGeometry;
|
package/lib/Core/TileMesh.js
CHANGED
|
@@ -96,36 +96,30 @@ var TileMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
96
96
|
_this.layerUpdateState = {};
|
|
97
97
|
_this.isTileMesh = true;
|
|
98
98
|
_this.domElements = {};
|
|
99
|
+
_this.geoidHeight = 0;
|
|
99
100
|
return _this;
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
102
103
|
* If specified, update the min and max elevation of the OBB
|
|
103
104
|
* and updates accordingly the bounding sphere and the geometric error
|
|
104
105
|
*
|
|
105
|
-
* @param {
|
|
106
|
-
* @param {
|
|
107
|
-
* @param {
|
|
106
|
+
* @param {Object} elevation
|
|
107
|
+
* @param {number} [elevation.min]
|
|
108
|
+
* @param {number} [elevation.max]
|
|
109
|
+
* @param {number} [elevation.scale]
|
|
108
110
|
*/
|
|
109
111
|
|
|
110
112
|
|
|
111
113
|
(0, _createClass2["default"])(TileMesh, [{
|
|
112
114
|
key: "setBBoxZ",
|
|
113
|
-
value: function setBBoxZ(
|
|
114
|
-
|
|
115
|
-
return;
|
|
116
|
-
} // update bbox if min or max have changed by at least one decimal
|
|
117
|
-
// or if scale changed
|
|
115
|
+
value: function setBBoxZ(elevation) {
|
|
116
|
+
this.obb.updateZ(elevation);
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.obb.updateZ(min, max, scale);
|
|
122
|
-
|
|
123
|
-
if (this.horizonCullingPointElevationScaled) {
|
|
124
|
-
this.horizonCullingPointElevationScaled.setLength(this.obb.z.delta + this.horizonCullingPoint.length());
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
118
|
+
if (this.horizonCullingPointElevationScaled) {
|
|
119
|
+
this.horizonCullingPointElevationScaled.setLength(this.obb.z.delta + this.horizonCullingPoint.length());
|
|
128
120
|
}
|
|
121
|
+
|
|
122
|
+
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
129
123
|
}
|
|
130
124
|
}, {
|
|
131
125
|
key: "getExtentsByProjection",
|
package/lib/Core/View.js
CHANGED
|
@@ -80,7 +80,8 @@ var VIEW_EVENTS = {
|
|
|
80
80
|
LAYER_REMOVED: 'layer-removed',
|
|
81
81
|
LAYER_ADDED: 'layer-added',
|
|
82
82
|
INITIALIZED: 'initialized',
|
|
83
|
-
COLOR_LAYERS_ORDER_CHANGED: _ColorLayersOrdering.COLOR_LAYERS_ORDER_CHANGED
|
|
83
|
+
COLOR_LAYERS_ORDER_CHANGED: _ColorLayersOrdering.COLOR_LAYERS_ORDER_CHANGED,
|
|
84
|
+
CAMERA_MOVED: 'camera-moved'
|
|
84
85
|
};
|
|
85
86
|
/**
|
|
86
87
|
* Fired on current view's domElement when double right-clicking it. Copies all properties of the second right-click
|
|
@@ -243,7 +244,6 @@ var View = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
243
244
|
_this = _super.call(this);
|
|
244
245
|
_this.domElement = viewerDiv;
|
|
245
246
|
_this.referenceCrs = crs;
|
|
246
|
-
coordinates.crs = crs;
|
|
247
247
|
var engine; // options.renderer can be 2 separate things:
|
|
248
248
|
// - an actual renderer (in this case we don't use viewerDiv)
|
|
249
249
|
// - options for the renderer to be created
|
|
@@ -1030,6 +1030,11 @@ var View = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
1030
1030
|
key: "getScale",
|
|
1031
1031
|
value: function getScale() {
|
|
1032
1032
|
var pitch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.28;
|
|
1033
|
+
|
|
1034
|
+
if (this.camera.camera3D.isOrthographicCamera) {
|
|
1035
|
+
return pitch * 1E-3 / this.getPixelsToMeters();
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1033
1038
|
return this.getScaleFromDistance(pitch, this.getDistanceFromCamera());
|
|
1034
1039
|
}
|
|
1035
1040
|
}, {
|
|
@@ -1192,6 +1197,7 @@ var View = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
1192
1197
|
}
|
|
1193
1198
|
|
|
1194
1199
|
this.getPickingPositionFromDepth(mouse, positionVector);
|
|
1200
|
+
coordinates.crs = this.referenceCrs;
|
|
1195
1201
|
coordinates.setFromVector3(positionVector); // Get the correct precision; the position variable will be set in this
|
|
1196
1202
|
// function.
|
|
1197
1203
|
|
|
@@ -1394,6 +1400,38 @@ var View = /*#__PURE__*/function (_THREE$EventDispatche) {
|
|
|
1394
1400
|
|
|
1395
1401
|
return target;
|
|
1396
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Returns the world {@link Coordinates} at given view coordinates.
|
|
1405
|
+
*
|
|
1406
|
+
* @param {THREE.Vector2|event} [mouse] The view coordinates at which the world coordinates must be
|
|
1407
|
+
* returned. This parameter can also be set to a mouse event from
|
|
1408
|
+
* which the view coordinates will be deducted. If not specified, it
|
|
1409
|
+
* will be defaulted to the view's center coordinates.
|
|
1410
|
+
* @param {Coordinates} [target] The result will be copied into this {@link Coordinates}. If not
|
|
1411
|
+
* specified, a new {@link Coordinates} instance will be created.
|
|
1412
|
+
*
|
|
1413
|
+
* @returns {Coordinates} The world {@link Coordinates} at the given view coordinates.
|
|
1414
|
+
*/
|
|
1415
|
+
|
|
1416
|
+
}, {
|
|
1417
|
+
key: "pickCoordinates",
|
|
1418
|
+
value: function pickCoordinates(mouse) {
|
|
1419
|
+
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _Coordinates["default"](this.tileLayer.extent.crs);
|
|
1420
|
+
|
|
1421
|
+
if (mouse instanceof Event) {
|
|
1422
|
+
this.eventToViewCoords(mouse);
|
|
1423
|
+
} else if (mouse.x !== undefined && mouse.y !== undefined) {
|
|
1424
|
+
_eventCoords.copy(mouse);
|
|
1425
|
+
} else {
|
|
1426
|
+
_eventCoords.set(this.mainLoop.gfxEngine.width / 2, this.mainLoop.gfxEngine.height / 2);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
this.getPickingPositionFromDepth(_eventCoords, positionVector);
|
|
1430
|
+
coordinates.crs = this.referenceCrs;
|
|
1431
|
+
coordinates.setFromVector3(positionVector);
|
|
1432
|
+
coordinates.as(target.crs, target);
|
|
1433
|
+
return target;
|
|
1434
|
+
}
|
|
1397
1435
|
/**
|
|
1398
1436
|
* Resize the viewer.
|
|
1399
1437
|
*
|
|
@@ -71,7 +71,7 @@ var ElevationLayer = /*#__PURE__*/function (_RasterLayer) {
|
|
|
71
71
|
* // Create an ElevationLayer
|
|
72
72
|
* const elevation = new ElevationLayer('IGN_MNT', {
|
|
73
73
|
* source: new WMTSSource({
|
|
74
|
-
* "url": "https://wxs.ign.fr/
|
|
74
|
+
* "url": "https://wxs.ign.fr/altimetrie/geoportail/wmts",
|
|
75
75
|
* "crs": "EPSG:4326",
|
|
76
76
|
* "format": "image/x-bil;bits=32",
|
|
77
77
|
* "name": "ELEVATION.ELEVATIONGRIDCOVERAGE",
|
|
@@ -112,7 +112,11 @@ var ElevationLayer = /*#__PURE__*/function (_RasterLayer) {
|
|
|
112
112
|
node.material.setSequenceElevation(this.id); // bounding box initialisation
|
|
113
113
|
|
|
114
114
|
var updateBBox = function () {
|
|
115
|
-
return node.setBBoxZ(
|
|
115
|
+
return node.setBBoxZ({
|
|
116
|
+
min: rasterElevationNode.min,
|
|
117
|
+
max: rasterElevationNode.max,
|
|
118
|
+
scale: _this2.scale
|
|
119
|
+
});
|
|
116
120
|
};
|
|
117
121
|
|
|
118
122
|
updateBBox(); // listen elevation updating
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -71,7 +73,7 @@ var FeatureGeometryLayer = /*#__PURE__*/function (_GeometryLayer) {
|
|
|
71
73
|
return _this;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
return FeatureGeometryLayer;
|
|
76
|
+
return (0, _createClass2["default"])(FeatureGeometryLayer);
|
|
75
77
|
}(_GeometryLayer2["default"]);
|
|
76
78
|
|
|
77
79
|
var _default = FeatureGeometryLayer;
|