itowns 2.35.0 → 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/CONTRIBUTORS.md +1 -0
- package/changelog.md +146 -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/3dtiles_basic.html +2 -2
- 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/js/plugins/CSVnVRTParser.js +0 -1
- package/examples/layers/JSONLayers/Administrative.json +1 -1
- package/examples/layers/JSONLayers/Cada.json +1 -1
- package/examples/layers/JSONLayers/EtatMajor.json +1 -1
- package/examples/layers/JSONLayers/IGN_MNT.json +1 -1
- package/examples/layers/JSONLayers/IGN_MNT_HIGHRES.json +1 -1
- package/examples/layers/JSONLayers/WORLD_DTM.json +1 -1
- package/examples/misc_custom_label.html +0 -2
- package/examples/plugins_vrt.html +0 -1
- 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 -48
- 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 -35
- package/examples/source_stream_wfs_25d.html +29 -29
- package/examples/source_stream_wfs_3d.html +21 -12
- package/examples/source_stream_wfs_raster.html +20 -20
- package/examples/view_25d_map.html +28 -0
- package/examples/view_immersive.html +13 -14
- package/examples/view_multi_25d.html +1 -1
- package/examples/widgets_minimap.html +122 -0
- package/examples/widgets_navigation.html +119 -0
- package/lib/Controls/FirstPersonControls.js +10 -1
- package/lib/Controls/GlobeControls.js +26 -11
- package/lib/Controls/PlanarControls.js +1 -1
- package/lib/Converter/Feature2Mesh.js +1 -0
- package/lib/Converter/Feature2Texture.js +2 -2
- package/lib/Converter/convertToTile.js +6 -2
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
- package/lib/Core/Deprecated/Undeprecator.js +1 -1
- package/lib/Core/Feature.js +42 -42
- package/lib/Core/Geographic/Coordinates.js +56 -0
- package/lib/Core/Geographic/Crs.js +15 -0
- package/lib/Core/Geographic/Extent.js +100 -12
- package/lib/Core/Geographic/GeoidGrid.js +143 -0
- package/lib/Core/MainLoop.js +1 -1
- package/lib/Core/Math/Ellipsoid.js +27 -9
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +1 -1
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
- package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
- package/lib/Core/Prefab/PlanarView.js +1 -1
- package/lib/Core/Style.js +2 -1
- package/lib/Core/TileGeometry.js +3 -1
- package/lib/Core/TileMesh.js +11 -16
- package/lib/Core/View.js +43 -5
- package/lib/Layer/ElevationLayer.js +15 -18
- package/lib/Layer/FeatureGeometryLayer.js +3 -1
- package/lib/Layer/GeoidLayer.js +131 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.js +7 -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/ShapefileParser.js +0 -1
- package/lib/Parser/VectorTileParser.js +1 -1
- package/lib/Parser/XbilParser.js +1 -1
- package/lib/Process/3dTilesProcessing.js +10 -10
- package/lib/Process/FeatureProcessing.js +3 -1
- package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
- package/lib/Process/ObjectRemovalHelper.js +5 -2
- package/lib/Provider/URLBuilder.js +1 -1
- package/lib/Renderer/Label2DRenderer.js +14 -11
- package/lib/Renderer/LayeredMaterial.js +4 -3
- package/lib/Renderer/OBB.js +20 -27
- package/lib/Renderer/PointsMaterial.js +5 -6
- package/lib/Renderer/RasterTile.js +23 -5
- package/lib/Renderer/Shader/ShaderChunk.js +3 -3
- 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/FileSource.js +2 -7
- package/lib/Source/PotreeSource.js +3 -1
- package/lib/Source/Source.js +15 -10
- package/lib/Source/VectorTilesSource.js +19 -0
- package/lib/Source/WMTSSource.js +3 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +239 -98
- package/lib/Utils/CameraUtils.js +12 -2
- package/lib/Utils/DEMUtils.js +3 -3
- package/lib/Utils/FeaturesUtils.js +8 -4
- package/package.json +25 -25
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg version="1.2" width="79.01mm" height="158.01mm" viewBox="5500 2100 7901 15801" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
|
|
4
|
+
<defs class="EmbeddedBulletChars">
|
|
5
|
+
<g id="bullet-char-template-57356" transform="scale(0.00048828125,-0.00048828125)">
|
|
6
|
+
<path d="M 580,1141 L 1163,571 580,0 -4,571 580,1141 Z"/>
|
|
7
|
+
</g>
|
|
8
|
+
<g id="bullet-char-template-57354" transform="scale(0.00048828125,-0.00048828125)">
|
|
9
|
+
<path d="M 8,1128 L 1137,1128 1137,0 8,0 8,1128 Z"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g id="bullet-char-template-10146" transform="scale(0.00048828125,-0.00048828125)">
|
|
12
|
+
<path d="M 174,0 L 602,739 174,1481 1456,739 174,0 Z M 1358,739 L 309,1346 659,739 1358,739 Z"/>
|
|
13
|
+
</g>
|
|
14
|
+
<g id="bullet-char-template-10132" transform="scale(0.00048828125,-0.00048828125)">
|
|
15
|
+
<path d="M 2015,739 L 1276,0 717,0 1260,543 174,543 174,936 1260,936 717,1481 1274,1481 2015,739 Z"/>
|
|
16
|
+
</g>
|
|
17
|
+
<g id="bullet-char-template-10007" transform="scale(0.00048828125,-0.00048828125)">
|
|
18
|
+
<path d="M 0,-2 C -7,14 -16,27 -25,37 L 356,567 C 262,823 215,952 215,954 215,979 228,992 255,992 264,992 276,990 289,987 310,991 331,999 354,1012 L 381,999 492,748 772,1049 836,1024 860,1049 C 881,1039 901,1025 922,1006 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 C 774,196 753,168 711,139 L 727,119 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 C 142,-110 111,-127 72,-127 30,-127 9,-110 8,-76 1,-67 -2,-52 -2,-32 -2,-23 -1,-13 0,-2 Z"/>
|
|
19
|
+
</g>
|
|
20
|
+
<g id="bullet-char-template-10004" transform="scale(0.00048828125,-0.00048828125)">
|
|
21
|
+
<path d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 41,549 55,616 82,672 116,743 169,778 240,778 293,778 328,747 346,684 L 369,508 C 377,444 397,411 428,410 L 1163,1116 C 1174,1127 1196,1133 1229,1133 1271,1133 1292,1118 1292,1087 L 1292,965 C 1292,929 1282,901 1262,881 L 442,47 C 390,-6 338,-33 285,-33 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<g id="bullet-char-template-9679" transform="scale(0.00048828125,-0.00048828125)">
|
|
24
|
+
<path d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 223,773 276,916 383,1023 489,1130 632,1184 813,1184 992,1184 1136,1130 1245,1023 1353,916 1407,772 1407,592 1407,412 1353,268 1245,161 1136,54 992,0 813,0 Z"/>
|
|
25
|
+
</g>
|
|
26
|
+
<g id="bullet-char-template-8226" transform="scale(0.00048828125,-0.00048828125)">
|
|
27
|
+
<path d="M 346,457 C 273,457 209,483 155,535 101,586 74,649 74,723 74,796 101,859 155,911 209,963 273,989 346,989 419,989 480,963 531,910 582,859 608,796 608,723 608,648 583,586 532,535 482,483 420,457 346,457 Z"/>
|
|
28
|
+
</g>
|
|
29
|
+
<g id="bullet-char-template-8211" transform="scale(0.00048828125,-0.00048828125)">
|
|
30
|
+
<path d="M -4,459 L 1135,459 1135,606 -4,606 -4,459 Z"/>
|
|
31
|
+
</g>
|
|
32
|
+
<g id="bullet-char-template-61548" transform="scale(0.00048828125,-0.00048828125)">
|
|
33
|
+
<path d="M 173,740 C 173,903 231,1043 346,1159 462,1274 601,1332 765,1332 928,1332 1067,1274 1183,1159 1299,1043 1357,903 1357,740 1357,577 1299,437 1183,322 1067,206 928,148 765,148 601,148 462,206 346,322 231,437 173,577 173,740 Z"/>
|
|
34
|
+
</g>
|
|
35
|
+
</defs>
|
|
36
|
+
<g class="Page">
|
|
37
|
+
<g class="com.sun.star.drawing.CustomShape">
|
|
38
|
+
<g id="id3">
|
|
39
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="5899" y="5100" width="7103" height="1902"/>
|
|
40
|
+
<path fill="rgb(255,255,255)" stroke="none" d="M 6216,5100 L 6217,5100 C 6161,5100 6107,5115 6058,5142 6010,5170 5970,5210 5942,5258 5915,5307 5900,5361 5900,5417 L 5900,6684 5900,6684 C 5900,6740 5915,6794 5942,6843 5970,6891 6010,6931 6058,6959 6107,6986 6161,7001 6217,7001 L 12684,7001 12684,7001 C 12740,7001 12794,6986 12843,6959 12891,6931 12931,6891 12959,6843 12986,6794 13001,6740 13001,6684 L 13001,5416 13001,5417 13001,5417 C 13001,5361 12986,5307 12959,5258 12931,5210 12891,5170 12843,5142 12794,5115 12740,5100 12684,5100 L 6216,5100 Z"/>
|
|
41
|
+
</g>
|
|
42
|
+
</g>
|
|
43
|
+
<g class="com.sun.star.drawing.CustomShape">
|
|
44
|
+
<g id="id4">
|
|
45
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="5500" y="2100" width="7901" height="7901"/>
|
|
46
|
+
</g>
|
|
47
|
+
</g>
|
|
48
|
+
<g class="com.sun.star.drawing.CustomShape">
|
|
49
|
+
<g id="id5">
|
|
50
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="8499" y="2499" width="1903" height="7103"/>
|
|
51
|
+
<path fill="rgb(255,255,255)" stroke="none" d="M 8500,9285 L 8500,9284 C 8500,9340 8515,9394 8542,9443 8570,9491 8610,9531 8658,9559 8707,9586 8761,9601 8817,9601 L 10084,9601 10084,9601 C 10140,9601 10194,9586 10243,9559 10291,9531 10331,9491 10359,9443 10386,9394 10401,9340 10401,9284 L 10401,2817 10401,2817 C 10401,2761 10386,2707 10359,2658 10331,2610 10291,2570 10243,2542 10194,2515 10140,2500 10084,2500 L 8816,2500 8817,2500 8817,2500 C 8761,2500 8707,2515 8658,2542 8610,2570 8570,2610 8542,2658 8515,2707 8500,2761 8500,2817 L 8500,9285 Z"/>
|
|
52
|
+
</g>
|
|
53
|
+
</g>
|
|
54
|
+
<g class="com.sun.star.drawing.CustomShape">
|
|
55
|
+
<g id="id6">
|
|
56
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="5899" y="13000" width="7103" height="1902"/>
|
|
57
|
+
<path fill="rgb(255,255,255)" stroke="none" d="M 6216,13000 L 6217,13000 C 6161,13000 6107,13015 6058,13042 6010,13070 5970,13110 5942,13158 5915,13207 5900,13261 5900,13317 L 5900,14584 5900,14584 C 5900,14640 5915,14694 5942,14743 5970,14791 6010,14831 6058,14859 6107,14886 6161,14901 6217,14901 L 12684,14901 12684,14901 C 12740,14901 12794,14886 12843,14859 12891,14831 12931,14791 12959,14743 12986,14694 13001,14640 13001,14584 L 13001,13316 13001,13317 13001,13317 C 13001,13261 12986,13207 12959,13158 12931,13110 12891,13070 12843,13042 12794,13015 12740,13000 12684,13000 L 6216,13000 Z"/>
|
|
58
|
+
</g>
|
|
59
|
+
</g>
|
|
60
|
+
<g class="com.sun.star.drawing.CustomShape">
|
|
61
|
+
<g id="id7">
|
|
62
|
+
<rect class="BoundingBox" stroke="none" fill="none" x="5500" y="10000" width="7901" height="7901"/>
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
</g>
|
|
66
|
+
</svg>
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>iTowns - Potree</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
|
+
<link rel="stylesheet" type="text/css" href="../potree/build/potree/potree.css">
|
|
12
|
+
<link rel="stylesheet" type="text/css" href="../potree/libs/jquery-ui/jquery-ui.min.css">
|
|
13
|
+
<link rel="stylesheet" type="text/css" href="../potree/libs/spectrum/spectrum.css">
|
|
14
|
+
<link rel="stylesheet" type="text/css" href="../potree/libs/jstree/themes/mixed/style.css">
|
|
15
|
+
|
|
16
|
+
<style type="text/css">
|
|
17
|
+
tr { color: white; }
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
|
23
|
+
<div id="potree_render_area"></div>
|
|
24
|
+
<div id="potree_sidebar_container"></div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<!-- Import iTowns source code -->
|
|
28
|
+
<script src="../dist/itowns.js"></script>
|
|
29
|
+
<script src="../dist/debug.js"></script>
|
|
30
|
+
<!-- Import iTowns LoadingScreen pluggin -->
|
|
31
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
32
|
+
|
|
33
|
+
<!-- Define THREE and proj4 constants so that Potree may access them. Otherwise, we would need to access them
|
|
34
|
+
with `itowns.THREE` or `itowns.proj4`. -->
|
|
35
|
+
<script type="text/javascript">
|
|
36
|
+
const THREE = itowns.THREE;
|
|
37
|
+
THREE.Object3D.DefaultUp.set(0, 0, 1);
|
|
38
|
+
|
|
39
|
+
const proj4 = itowns.proj4;
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<!-- Import Potree source code -->
|
|
43
|
+
<script src="../potree/libs/jquery/jquery-3.1.1.min.js"></script>
|
|
44
|
+
<script src="../potree/libs/i18next/i18next.js"></script>
|
|
45
|
+
<script src="../potree/libs/jstree/jstree.min.js"></script>
|
|
46
|
+
<script src="../potree/libs/plasio/js/laslaz.js"></script>
|
|
47
|
+
<script src="../potree/build/potree/potree.js"></script>
|
|
48
|
+
|
|
49
|
+
<script type="text/javascript">
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// `viewerDiv` contains both iTowns and Potree rendering area (`<canvas>`)
|
|
54
|
+
const viewerDiv = document.getElementById('potree_render_area');
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// ---------- CREATE A POTREE VIEWER FOR SUPPORTING POINT CLOUD VISUALIZATION : ----------
|
|
59
|
+
|
|
60
|
+
const coordinates = new itowns.Coordinates('EPSG:4978');
|
|
61
|
+
|
|
62
|
+
// Define crs projection of the point cloud data (taken from https://epsg.io/2154, Proj4js section)
|
|
63
|
+
proj4.defs(
|
|
64
|
+
'EPSG:2154',
|
|
65
|
+
'+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80'
|
|
66
|
+
+ ' towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
|
|
67
|
+
);
|
|
68
|
+
const pointCloudCRS = 'EPSG:2154';
|
|
69
|
+
|
|
70
|
+
Potree.setTHREEShaderChunk(itowns.ShaderChunk.target);
|
|
71
|
+
|
|
72
|
+
// Create a Potree Viewer to support point cloud visualization
|
|
73
|
+
const potreeViewer = new Potree.Viewer(viewerDiv, {
|
|
74
|
+
dynamicNearFar: false,
|
|
75
|
+
isGeocentric: true,
|
|
76
|
+
crs: pointCloudCRS,
|
|
77
|
+
|
|
78
|
+
// Callback to transform coordinates displayed by Potree `Point measurement` in `EPSG:2154`
|
|
79
|
+
measureCoordinateCallback: (position) => {
|
|
80
|
+
return coordinates.setFromVector3(position).as(pointCloudCRS).toVector3();
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
potreeViewer.setEDLEnabled(true);
|
|
85
|
+
potreeViewer.setControls(null);
|
|
86
|
+
potreeViewer.setBackground('black');
|
|
87
|
+
potreeViewer.loadGUI();
|
|
88
|
+
|
|
89
|
+
// Override Potree area measure method. The original Potree method gives a planar area delimited from given
|
|
90
|
+
// points (summits of the area). The area returned by the method is computed from `x` and `y` components of
|
|
91
|
+
// the points coordinates.
|
|
92
|
+
//
|
|
93
|
+
// By default, the points coordinates passed to the method are in iTowns viewer CRS, which is geocentric.
|
|
94
|
+
// Therefore, computing an area over the `x` and `y` components of these coordinates is incorrect - it
|
|
95
|
+
// actualy computes its orthogonal projection on the equatorial plane.
|
|
96
|
+
//
|
|
97
|
+
// To fix this, we transform each coordinates of the area summits in the point cloud CRS, which is
|
|
98
|
+
// geographic. We store each transformed coordinates in an array. Finally we override Potree area measure
|
|
99
|
+
// method so that it computes area from this array.
|
|
100
|
+
potreeViewer.scene.addEventListener('measurement_added', (e) => {
|
|
101
|
+
const { measurement } = e;
|
|
102
|
+
|
|
103
|
+
if(measurement.name === "Area") {
|
|
104
|
+
// Array containing the geographic coordinates of each area summits
|
|
105
|
+
const areaPoints = [new itowns.Coordinates(pointCloudCRS)];
|
|
106
|
+
|
|
107
|
+
// Add a Coordinates to the array when an area summit is created.
|
|
108
|
+
measurement.addEventListener('marker_added', () => {
|
|
109
|
+
areaPoints.push(new itowns.Coordinates(pointCloudCRS));
|
|
110
|
+
}, false)
|
|
111
|
+
// Translate the area summit coordinates from itowns viewer CRS to geographic CRS when the summit is
|
|
112
|
+
// moved. It also happens when the summit is created.
|
|
113
|
+
measurement.addEventListener('marker_moved', (event) => {
|
|
114
|
+
coordinates.setFromVector3(event.position).as(pointCloudCRS, areaPoints[event.index]);
|
|
115
|
+
}, false);
|
|
116
|
+
// Clear the coordinates array when we remove an area summit.
|
|
117
|
+
measurement.addEventListener('marker_removed', () => {
|
|
118
|
+
areaPoints.splice(areaPoints.length - 1, 1);
|
|
119
|
+
}, false);
|
|
120
|
+
|
|
121
|
+
// Override potree `Measure.getArea` method to use projected coordinates to compute area
|
|
122
|
+
measurement.getArea = () => {
|
|
123
|
+
let area = 0;
|
|
124
|
+
let j = areaPoints.length - 1;
|
|
125
|
+
|
|
126
|
+
for (let i = 0; i < areaPoints.length; i++) {
|
|
127
|
+
let p1 = areaPoints[i];
|
|
128
|
+
let p2 = areaPoints[j];
|
|
129
|
+
area += (p2.x + p1.x) * (p1.y - p2.y);
|
|
130
|
+
j = i
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return Math.abs(area / 2);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
// ---------- CREATE A GlobeView FOR SUPPORTING ORTHO-PHOTOGRAPHIES AND DEM VISUALIZATION : ----------
|
|
141
|
+
|
|
142
|
+
// Define camera initial position.
|
|
143
|
+
const placement = {
|
|
144
|
+
heading: -35,
|
|
145
|
+
tilt: 30,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Create a GlobeView.
|
|
149
|
+
const itownsViewer = new itowns.GlobeView(viewerDiv, placement, {
|
|
150
|
+
renderer: potreeViewer.renderer,
|
|
151
|
+
scene3D: potreeViewer.scene.scene,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Setup loading screen.
|
|
155
|
+
setupLoadingScreen(viewerDiv, itownsViewer);
|
|
156
|
+
|
|
157
|
+
// Make atmosphere realistic.
|
|
158
|
+
itownsViewer.getLayerById('atmosphere').setRealisticOn(true);
|
|
159
|
+
|
|
160
|
+
// Controls and camera specific setting.
|
|
161
|
+
itownsViewer.controls.minDistanceCollision = 0.01;
|
|
162
|
+
itownsViewer.controls.minDistance = 20;
|
|
163
|
+
itownsViewer.camera.camera3D.near = 0.1;
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
// ---------- TWEAK ITOWNS VIEWER TO SUPPORT POTREE VISUALIZATION : ----------
|
|
168
|
+
|
|
169
|
+
itownsViewer.render = () => {};
|
|
170
|
+
|
|
171
|
+
// Force iTowns viewer to resize when changing #potree_render_area div size.
|
|
172
|
+
// This allows the viewer resizing when toggling potree menu.
|
|
173
|
+
new ResizeObserver(() => itownsViewer.resize()).observe(viewerDiv);
|
|
174
|
+
|
|
175
|
+
// Disable iTowns controls when hovering Potree tool (such as a vertex of a displayed polygon).
|
|
176
|
+
// This prevents iTowns camera from moving when we want to displace a Potree tool marker.
|
|
177
|
+
viewerDiv.addEventListener('mousemove', () => {
|
|
178
|
+
itownsViewer.controls.states.enabled = potreeViewer.inputHandler.hoveredElements.length === 0;
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
// Set Potree viewer camera as iTowns viewer camera.
|
|
182
|
+
const camera = itownsViewer.camera.camera3D;
|
|
183
|
+
camera.zoomTo = () => {};
|
|
184
|
+
potreeViewer.scene.cameraP = camera;
|
|
185
|
+
|
|
186
|
+
// TODO : should be moved to Label2DRenderer constructor
|
|
187
|
+
itownsViewer.mainLoop.gfxEngine.label2dRenderer.domElement.style.pointerEvents = 'none';
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
// ---------- DISPLAY CONTEXTUAL DATA USING ITOWNS : ----------
|
|
192
|
+
|
|
193
|
+
// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
|
|
194
|
+
// defined as a plain js object. See `Layer` documentation for more info.
|
|
195
|
+
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
|
|
196
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
197
|
+
config.source.zoom = { max: 19, min: 3 };
|
|
198
|
+
itownsViewer.addLayer(
|
|
199
|
+
new itowns.ColorLayer(config.id, config),
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// Add two elevaion layers, each with a different level of detail. Here again, each layer's properties are
|
|
204
|
+
// defined in a json file.
|
|
205
|
+
function addElevationLayerFromConfig(config) {
|
|
206
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
207
|
+
itownsViewer.addLayer(
|
|
208
|
+
new itowns.ElevationLayer(config.id, config),
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
|
|
212
|
+
itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
// ---------- DISPLAY POINT CLOUD DATA USING POTREE : ----------
|
|
217
|
+
|
|
218
|
+
const pointcloudUrl = `${location.protocol}//lidarhd.pocgpf.ovh/data/`;
|
|
219
|
+
|
|
220
|
+
itowns.Fetcher.json(
|
|
221
|
+
pointcloudUrl + 'metadata/pivotTHREE.json'
|
|
222
|
+
).then(
|
|
223
|
+
(pivot) => new THREE.ObjectLoader().parse(pivot)
|
|
224
|
+
).then(
|
|
225
|
+
(pivotTHREE) => {
|
|
226
|
+
Potree.loadPointCloud(pointcloudUrl + 'ept/ept.json', 'pointcloud', function(e) {
|
|
227
|
+
const pointcloud = e.pointcloud;
|
|
228
|
+
const material = pointcloud.material;
|
|
229
|
+
|
|
230
|
+
potreeViewer.scene.addPointCloud(pointcloud);
|
|
231
|
+
|
|
232
|
+
pointcloud.getAttribute('intensity').range = [0, 10000];
|
|
233
|
+
|
|
234
|
+
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
|
235
|
+
material.shape = Potree.PointShape.CIRCLE
|
|
236
|
+
|
|
237
|
+
pointcloud.position.copy(pivotTHREE.position);
|
|
238
|
+
pointcloud.quaternion.copy(pivotTHREE.quaternion);
|
|
239
|
+
pointcloud.updateMatrixWorld(true);
|
|
240
|
+
|
|
241
|
+
// Move itowns viewer camera to the center of the point cloud
|
|
242
|
+
itownsViewer.controls.lookAtCoordinate({
|
|
243
|
+
coord: new itowns.Coordinates('EPSG:4978').setFromVector3(pivotTHREE.position),
|
|
244
|
+
range: 1500
|
|
245
|
+
}, false);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
</script>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|
|
@@ -44,8 +44,10 @@ function GuiTools(domId, view, w) {
|
|
|
44
44
|
document.body.appendChild(element);
|
|
45
45
|
this.colorGui = this.gui.addFolder('Color Layers');
|
|
46
46
|
this.elevationGui = this.gui.addFolder('Elevation Layers');
|
|
47
|
+
this.geoidGui = this.gui.addFolder('Geoid Layers');
|
|
47
48
|
this.elevationGui.hide();
|
|
48
49
|
this.colorGui.hide();
|
|
50
|
+
this.geoidGui.hide();
|
|
49
51
|
this.view = view;
|
|
50
52
|
view.addEventListener('layers-order-changed', (function refreshColorGui() {
|
|
51
53
|
var i;
|
|
@@ -64,6 +66,8 @@ GuiTools.prototype.addLayerGUI = function fnAddLayerGUI(layer) {
|
|
|
64
66
|
this.addImageryLayerGUI(layer);
|
|
65
67
|
} else if (layer.isElevationLayer) {
|
|
66
68
|
this.addElevationLayerGUI(layer);
|
|
69
|
+
} else if (layer.isGeoidLayer) {
|
|
70
|
+
this.addGeoidLayerGUI(layer);
|
|
67
71
|
}
|
|
68
72
|
};
|
|
69
73
|
|
|
@@ -107,6 +111,19 @@ GuiTools.prototype.addElevationLayerGUI = function addElevationLayerGUI(layer) {
|
|
|
107
111
|
}).bind(this));
|
|
108
112
|
};
|
|
109
113
|
|
|
114
|
+
GuiTools.prototype.addGeoidLayerGUI = function addGeoidLayerGUI(layer) {
|
|
115
|
+
if (this.geoidGui.hasFolder(layer.id)) { return; }
|
|
116
|
+
this.geoidGui.show();
|
|
117
|
+
var folder = this.geoidGui.addFolder(layer.id);
|
|
118
|
+
folder.add({ frozen: layer.frozen }, 'frozen').onChange(function refreshFrozenGui(value) {
|
|
119
|
+
layer.frozen = value;
|
|
120
|
+
});
|
|
121
|
+
folder.add({ visible: layer.visible }, 'visible').onChange((function updateVisibility(value) {
|
|
122
|
+
layer.visible = value;
|
|
123
|
+
this.view.notifyChange(layer);
|
|
124
|
+
}).bind(this));
|
|
125
|
+
};
|
|
126
|
+
|
|
110
127
|
GuiTools.prototype.addImageryLayersGUI = function addImageryLayersGUI(layers) {
|
|
111
128
|
var i;
|
|
112
129
|
var seq = itowns.ImageryLayers.getColorLayersIdOrderedBySequence(layers);
|
package/examples/js/Scale.js
CHANGED
|
@@ -13,6 +13,7 @@ function roundPixelsFromMeters(view, pixelSize) {
|
|
|
13
13
|
|
|
14
14
|
// Round the metric distance :
|
|
15
15
|
distanceMeters = Math.floor(distanceMeters);
|
|
16
|
+
// eslint-disable-next-line prefer-exponentiation-operator
|
|
16
17
|
var digit = Math.pow(10, distanceMeters.toString().length - 1);
|
|
17
18
|
distanceMeters = Math.round(distanceMeters / digit) * digit;
|
|
18
19
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"transparent": true,
|
|
7
7
|
"source": {
|
|
8
8
|
"crs": "EPSG:3857",
|
|
9
|
-
"url": "https://wxs.ign.fr/
|
|
9
|
+
"url": "https://wxs.ign.fr/administratif/geoportail/wmts",
|
|
10
10
|
"format": "image/png",
|
|
11
11
|
"name": "LIMITES_ADMINISTRATIVES_EXPRESS.LATEST",
|
|
12
12
|
"style": "normal",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"source": {
|
|
12
12
|
"format": "image/x-bil;bits=32",
|
|
13
13
|
"crs": "EPSG:4326",
|
|
14
|
-
"url": "https://wxs.ign.fr/
|
|
14
|
+
"url": "https://wxs.ign.fr/altimetrie/geoportail/wmts",
|
|
15
15
|
"name": "ELEVATION.ELEVATIONGRIDCOVERAGE.SRTM3",
|
|
16
16
|
"tileMatrixSet": "WGS84G",
|
|
17
17
|
"tileMatrixSetLimits": {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - FileSource - Handle fetching step</title>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="viewerDiv" class="viewer"></div>
|
|
13
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
14
|
+
<script src="../dist/itowns.js"></script>
|
|
15
|
+
<script src="../dist/debug.js"></script>
|
|
16
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
17
|
+
<script src="js/plugins/FeatureToolTip.js"></script>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
/* global itowns, setupLoadingScreen, GuiTools, ToolTip */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// ---------- CREATE A GlobeView : ----------
|
|
24
|
+
|
|
25
|
+
// Define camera initial position
|
|
26
|
+
const placement = {
|
|
27
|
+
coord: new itowns.Coordinates('EPSG:4326', 3.05, 48.95),
|
|
28
|
+
range: 70000,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
|
|
32
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
33
|
+
|
|
34
|
+
// Instantiate iTowns GlobeView
|
|
35
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
36
|
+
|
|
37
|
+
// Setup loading screen and debug menu
|
|
38
|
+
setupLoadingScreen(viewerDiv, view);
|
|
39
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
44
|
+
|
|
45
|
+
// Add one imagery layer to the scene
|
|
46
|
+
// This layer is defined in a json file but it could be defined as a plain js
|
|
47
|
+
// object. See Layer* for more info.
|
|
48
|
+
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
|
|
49
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
50
|
+
var layer = new itowns.ColorLayer('Ortho', config);
|
|
51
|
+
view.addLayer(layer).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// ---------- DEFINE DATA SOURCE FROM FETCHED DATA : ----------
|
|
57
|
+
|
|
58
|
+
// Handle fetching step.
|
|
59
|
+
// Should you implement a custom fetcher, it would need to be called here.
|
|
60
|
+
itowns.Fetcher.json(
|
|
61
|
+
'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/lyon-roads.geojson',
|
|
62
|
+
).then((fetched) => {
|
|
63
|
+
// Then, create a FileSource, passing it the data just fetched. We also need to specify the `format` or the
|
|
64
|
+
// `parser` parameter so that iTowns knows which parser it can use.
|
|
65
|
+
const sourceFromFetchedData = new itowns.FileSource({
|
|
66
|
+
fetchedData: fetched,
|
|
67
|
+
crs: 'EPSG:4326',
|
|
68
|
+
format: 'application/json',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
view.addLayer(new itowns.ColorLayer('Roads', {
|
|
72
|
+
source: sourceFromFetchedData,
|
|
73
|
+
style: new itowns.Style({
|
|
74
|
+
stroke: { color: 'yellow' },
|
|
75
|
+
}),
|
|
76
|
+
})).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function () {
|
|
82
|
+
// Organize the order with which layers are superposing.
|
|
83
|
+
itowns.ColorLayersOrdering.moveLayerToIndex(view, 'Ortho', 0);
|
|
84
|
+
// Move the camera to visualize all data.
|
|
85
|
+
view.controls.lookAtCoordinate(view.getLayerById('Roads').source.extent, false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
</script>
|
|
89
|
+
</body>
|
|
90
|
+
</html>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - Source - format</title>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="viewerDiv" class="viewer"></div>
|
|
13
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
14
|
+
<script src="../dist/itowns.js"></script>
|
|
15
|
+
<script src="../dist/debug.js"></script>
|
|
16
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
17
|
+
<script src="js/plugins/FeatureToolTip.js"></script>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
/* global itowns, setupLoadingScreen, GuiTools, ToolTip */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// ---------- CREATE A GlobeView : ----------
|
|
24
|
+
|
|
25
|
+
// Define camera initial position
|
|
26
|
+
const placement = {
|
|
27
|
+
coord: new itowns.Coordinates('EPSG:4326', 3.05, 48.95),
|
|
28
|
+
range: 70000,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
|
|
32
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
33
|
+
|
|
34
|
+
// Instantiate iTowns GlobeView
|
|
35
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
36
|
+
|
|
37
|
+
// Setup loading screen and debug menu
|
|
38
|
+
setupLoadingScreen(viewerDiv, view);
|
|
39
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
44
|
+
|
|
45
|
+
// Add one imagery layer to the scene
|
|
46
|
+
// This layer is defined in a json file but it could be defined as a plain js
|
|
47
|
+
// object. See Layer* for more info.
|
|
48
|
+
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
|
|
49
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
50
|
+
var layer = new itowns.ColorLayer('Ortho', config);
|
|
51
|
+
view.addLayer(layer).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// ---------- DEFINE DATA SOURCE SPECIFYING ITS FORMAT : ----------
|
|
57
|
+
|
|
58
|
+
const sourceFromFormat = new itowns.FileSource({
|
|
59
|
+
url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/lyon-ZU.geojson',
|
|
60
|
+
crs: 'EPSG:4326',
|
|
61
|
+
format: 'application/json',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
view.addLayer(new itowns.ColorLayer('Urban Area', {
|
|
65
|
+
source: sourceFromFormat,
|
|
66
|
+
style: new itowns.Style({
|
|
67
|
+
fill: { color: 'red', opacity: 0.5 },
|
|
68
|
+
stroke: { color: 'red' },
|
|
69
|
+
}),
|
|
70
|
+
})).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// ---------- REORDER ColorLayers AND MOVE CAMERA : ----------
|
|
75
|
+
|
|
76
|
+
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function () {
|
|
77
|
+
// Organize the order with which layers are superposing.
|
|
78
|
+
itowns.ColorLayersOrdering.moveLayerToIndex(view, 'Ortho', 0);
|
|
79
|
+
// Move the camera to visualize all data.
|
|
80
|
+
view.controls.lookAtCoordinate(sourceFromFormat.extent, false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
</script>
|
|
84
|
+
</body>
|
|
85
|
+
</html>
|