itowns 2.36.2 → 2.38.1

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.
Files changed (122) hide show
  1. package/CONTRIBUTING.md +30 -17
  2. package/README.md +12 -1
  3. package/changelog.md +138 -0
  4. package/dist/debug.js +1 -1
  5. package/dist/debug.js.LICENSE.txt +2 -2
  6. package/dist/debug.js.map +1 -1
  7. package/dist/itowns.js +1 -1
  8. package/dist/itowns.js.LICENSE.txt +2 -2
  9. package/dist/itowns.js.map +1 -1
  10. package/dist/itowns_widgets.js +2 -0
  11. package/dist/itowns_widgets.js.map +1 -0
  12. package/examples/config.json +28 -6
  13. package/examples/css/example.css +21 -1
  14. package/examples/css/widgets.css +360 -0
  15. package/examples/geoid_geoidLayer.html +102 -0
  16. package/examples/images/code-logo.svg +43 -0
  17. package/examples/index.html +5 -5
  18. package/examples/itowns-potree.html +252 -0
  19. package/examples/js/GUI/GuiTools.js +17 -0
  20. package/examples/mars.html +0 -1
  21. package/examples/misc_orthographic_camera.html +7 -19
  22. package/examples/source_file_from_fetched_data.html +90 -0
  23. package/examples/source_file_from_format.html +85 -0
  24. package/examples/source_file_from_methods.html +87 -0
  25. package/examples/source_file_from_parsed_data.html +104 -0
  26. package/examples/source_file_geojson_raster.html +21 -45
  27. package/examples/source_file_gpx_raster.html +28 -36
  28. package/examples/source_file_kml_raster.html +1 -4
  29. package/examples/source_file_shapefile.html +39 -34
  30. package/examples/source_stream_wfs_25d.html +21 -13
  31. package/examples/source_stream_wfs_3d.html +21 -12
  32. package/examples/source_stream_wfs_raster.html +20 -20
  33. package/examples/vector_tile_3d_mesh.html +155 -0
  34. package/examples/vector_tile_raster_3d.html +0 -5
  35. package/examples/view_25d_map.html +6 -19
  36. package/examples/view_2d_map.html +6 -19
  37. package/examples/view_3d_map.html +106 -81
  38. package/examples/view_immersive.html +13 -14
  39. package/examples/widgets_minimap.html +124 -0
  40. package/examples/widgets_navigation.html +124 -0
  41. package/examples/widgets_scale.html +96 -0
  42. package/examples/widgets_searchbar.html +124 -0
  43. package/lib/Controls/GlobeControls.js +13 -0
  44. package/lib/Controls/PlanarControls.js +11 -43
  45. package/lib/Converter/Feature2Mesh.js +203 -45
  46. package/lib/Converter/convertToTile.js +13 -4
  47. package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
  48. package/lib/Core/Deprecated/Undeprecator.js +1 -1
  49. package/lib/Core/Feature.js +60 -34
  50. package/lib/Core/Geographic/Extent.js +1 -1
  51. package/lib/Core/Geographic/GeoidGrid.js +143 -0
  52. package/lib/Core/MainLoop.js +137 -63
  53. package/lib/Core/Math/Ellipsoid.js +1 -1
  54. package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
  55. package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
  56. package/lib/Core/Style.js +1 -1
  57. package/lib/Core/TileGeometry.js +3 -1
  58. package/lib/Core/TileMesh.js +32 -22
  59. package/lib/Core/View.js +81 -15
  60. package/lib/Layer/ElevationLayer.js +6 -2
  61. package/lib/Layer/FeatureGeometryLayer.js +36 -7
  62. package/lib/Layer/GeoidLayer.js +142 -0
  63. package/lib/Layer/GeometryLayer.js +6 -54
  64. package/lib/Layer/InfoLayer.js +1 -1
  65. package/lib/Layer/Layer.js +1 -1
  66. package/lib/Layer/LayerUpdateStrategy.js +1 -1
  67. package/lib/Layer/OrientedImageLayer.js +1 -0
  68. package/lib/Layer/PotreeLayer.js +3 -1
  69. package/lib/Layer/RasterLayer.js +3 -1
  70. package/lib/Layer/ReferencingLayerProperties.js +50 -0
  71. package/lib/Layer/TiledGeometryLayer.js +3 -1
  72. package/lib/Main.js +214 -174
  73. package/lib/MainBundle.js +1 -1
  74. package/lib/Parser/B3dmParser.js +5 -3
  75. package/lib/Parser/GDFParser.js +118 -0
  76. package/lib/Parser/GTXParser.js +92 -0
  77. package/lib/Parser/GeoJsonParser.js +29 -7
  78. package/lib/Parser/ISGParser.js +121 -0
  79. package/lib/Parser/LASParser.js +3 -1
  80. package/lib/Parser/VectorTileParser.js +4 -3
  81. package/lib/Parser/XbilParser.js +1 -1
  82. package/lib/Parser/deprecated/LegacyGLTFLoader.js +1 -1
  83. package/lib/Process/3dTilesProcessing.js +2 -2
  84. package/lib/Process/FeatureProcessing.js +38 -86
  85. package/lib/Process/LayeredMaterialNodeProcessing.js +16 -7
  86. package/lib/Process/ObjectRemovalHelper.js +4 -0
  87. package/lib/Provider/3dTilesProvider.js +2 -7
  88. package/lib/Provider/Fetcher.js +4 -1
  89. package/lib/Provider/TileProvider.js +18 -2
  90. package/lib/Provider/URLBuilder.js +1 -1
  91. package/lib/Renderer/Camera.js +33 -12
  92. package/lib/Renderer/ColorLayersOrdering.js +3 -1
  93. package/lib/Renderer/LayeredMaterial.js +34 -9
  94. package/lib/Renderer/OBB.js +22 -25
  95. package/lib/Renderer/OrientedImageMaterial.js +8 -5
  96. package/lib/Renderer/PointsMaterial.js +6 -6
  97. package/lib/Renderer/RasterTile.js +1 -1
  98. package/lib/Renderer/RenderMode.js +3 -1
  99. package/lib/Renderer/Shader/ShaderChunk.js +5 -1
  100. package/lib/Renderer/Shader/ShaderUtils.js +4 -2
  101. package/lib/Renderer/c3DEngine.js +9 -6
  102. package/lib/Source/C3DTilesSource.js +3 -1
  103. package/lib/Source/EntwinePointTileSource.js +3 -1
  104. package/lib/Source/FileSource.js +8 -1
  105. package/lib/Source/PotreeSource.js +3 -1
  106. package/lib/Source/Source.js +15 -10
  107. package/lib/Source/VectorTilesSource.js +5 -0
  108. package/lib/Source/WFSSource.js +9 -3
  109. package/lib/Source/WMTSSource.js +3 -1
  110. package/lib/ThreeExtended/{WebGL.js → capabilities/WebGL.js} +8 -7
  111. package/lib/ThreeExtended/loaders/GLTFLoader.js +88 -39
  112. package/lib/Utils/CameraUtils.js +11 -1
  113. package/lib/Utils/DEMUtils.js +4 -2
  114. package/lib/Utils/FeaturesUtils.js +8 -4
  115. package/lib/Utils/gui/Main.js +39 -0
  116. package/lib/Utils/gui/Minimap.js +197 -0
  117. package/lib/Utils/gui/Navigation.js +322 -0
  118. package/lib/Utils/gui/Scale.js +154 -0
  119. package/lib/Utils/gui/Searchbar.js +299 -0
  120. package/lib/Utils/gui/Widget.js +119 -0
  121. package/package.json +32 -27
  122. package/examples/js/Scale.js +0 -40
@@ -9,14 +9,42 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
27
+
28
+ var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
29
+
12
30
  var THREE = _interopRequireWildcard(require("three"));
13
31
 
14
32
  var _earcut = _interopRequireDefault(require("earcut"));
15
33
 
16
34
  var _Feature = require("../Core/Feature");
17
35
 
36
+ var _ReferencingLayerProperties = _interopRequireDefault(require("../Layer/ReferencingLayerProperties"));
37
+
18
38
  var _Undeprecator = require("../Core/Deprecated/Undeprecator");
19
39
 
40
+ var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
41
+
42
+ var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
43
+
44
+ var _OrientationUtils = _interopRequireDefault(require("../Utils/OrientationUtils"));
45
+
46
+ var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
47
+
20
48
  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); }
21
49
 
22
50
  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; }
@@ -27,11 +55,129 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
27
55
 
28
56
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
29
57
 
58
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
59
+
60
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
61
+
62
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
63
+
64
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
65
+
66
+ var coord = new _Coordinates["default"]('EPSG:4326', 0, 0, 0);
67
+ var dim_ref = new THREE.Vector2();
68
+ var dim = new THREE.Vector2();
69
+ var extent = new _Extent["default"]('EPSG:4326', 0, 0, 0, 0);
70
+
30
71
  var _color = new THREE.Color();
31
72
 
32
73
  var maxValueUint8 = Math.pow(2, 8) - 1;
33
74
  var maxValueUint16 = Math.pow(2, 16) - 1;
34
75
  var maxValueUint32 = Math.pow(2, 32) - 1;
76
+ var crsWGS84 = 'EPSG:4326';
77
+
78
+ var _currentCrs = /*#__PURE__*/new WeakMap();
79
+
80
+ var _originalCrs = /*#__PURE__*/new WeakMap();
81
+
82
+ var _collection = /*#__PURE__*/new WeakMap();
83
+
84
+ var _place = /*#__PURE__*/new WeakMap();
85
+
86
+ var FeatureMesh = /*#__PURE__*/function (_THREE$Group) {
87
+ (0, _inherits2["default"])(FeatureMesh, _THREE$Group);
88
+
89
+ var _super = _createSuper(FeatureMesh);
90
+
91
+ function FeatureMesh(meshes, collection) {
92
+ var _THREE$Group2;
93
+
94
+ var _this;
95
+
96
+ (0, _classCallCheck2["default"])(this, FeatureMesh);
97
+ _this = _super.call(this);
98
+
99
+ _classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _currentCrs, {
100
+ writable: true,
101
+ value: void 0
102
+ });
103
+
104
+ _classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _originalCrs, {
105
+ writable: true,
106
+ value: void 0
107
+ });
108
+
109
+ _classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _collection, {
110
+ writable: true,
111
+ value: new THREE.Group()
112
+ });
113
+
114
+ _classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _place, {
115
+ writable: true,
116
+ value: new THREE.Group()
117
+ });
118
+
119
+ _this.meshes = (_THREE$Group2 = new THREE.Group()).add.apply(_THREE$Group2, (0, _toConsumableArray2["default"])(meshes));
120
+ (0, _classPrivateFieldSet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection, new THREE.Group().add(_this.meshes));
121
+ (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection).quaternion.copy(collection.quaternion);
122
+ (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection).position.copy(collection.position);
123
+ (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection).scale.copy(collection.scale);
124
+ (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection).updateMatrix();
125
+ (0, _classPrivateFieldSet2["default"])((0, _assertThisInitialized2["default"])(_this), _originalCrs, collection.crs);
126
+ (0, _classPrivateFieldSet2["default"])((0, _assertThisInitialized2["default"])(_this), _currentCrs, (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _originalCrs));
127
+ _this.extent = collection.extent;
128
+
129
+ _this.add((0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _place).add((0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _collection)));
130
+
131
+ return _this;
132
+ }
133
+
134
+ (0, _createClass2["default"])(FeatureMesh, [{
135
+ key: "as",
136
+ value: function as(crs) {
137
+ if ((0, _classPrivateFieldGet2["default"])(this, _currentCrs) !== crs) {
138
+ (0, _classPrivateFieldSet2["default"])(this, _currentCrs, crs);
139
+
140
+ if (crs == (0, _classPrivateFieldGet2["default"])(this, _originalCrs)) {
141
+ // reset transformation
142
+ this.place.position.set(0, 0, 0);
143
+ this.position.set(0, 0, 0);
144
+ this.scale.set(1, 1, 1);
145
+ this.quaternion.identity();
146
+ } else {
147
+ // calculate the scale transformation to transform the feature.extent
148
+ // to feature.extent.as(crs)
149
+ coord.crs = _Crs["default"].formatToEPSG((0, _classPrivateFieldGet2["default"])(this, _originalCrs));
150
+ extent.copy(this.extent).applyMatrix4((0, _classPrivateFieldGet2["default"])(this, _collection).matrix);
151
+ extent.as(coord.crs, extent);
152
+ extent.spatialEuclideanDimensions(dim_ref);
153
+ extent.planarDimensions(dim);
154
+
155
+ if (dim.x && dim.y) {
156
+ this.scale.copy(dim_ref).divide(dim).setZ(1);
157
+ } // Position and orientation
158
+ // remove original position
159
+
160
+
161
+ (0, _classPrivateFieldGet2["default"])(this, _place).position.copy((0, _classPrivateFieldGet2["default"])(this, _collection).position).negate(); // get mesh coordinate
162
+
163
+ coord.setFromVector3((0, _classPrivateFieldGet2["default"])(this, _collection).position); // get method to calculate orientation
164
+
165
+ var crsInput = (0, _classPrivateFieldGet2["default"])(this, _originalCrs) == 'EPSG:3857' ? crsWGS84 : (0, _classPrivateFieldGet2["default"])(this, _originalCrs);
166
+
167
+ var crs2crs = _OrientationUtils["default"].quaternionFromCRSToCRS(crsInput, crs); // calculate orientation to crs
168
+
169
+
170
+ crs2crs(coord.as(crsWGS84), this.quaternion); // transform position to crs
171
+
172
+ coord.as(crs, coord).toVector3(this.position);
173
+ }
174
+ }
175
+
176
+ return this;
177
+ }
178
+ }]);
179
+ return FeatureMesh;
180
+ }(THREE.Group);
35
181
 
36
182
  function toColor(color) {
37
183
  if (color) {
@@ -94,12 +240,21 @@ function coordinatesToVertices(ptsIn, normals, target, zTranslation) {
94
240
  offsetOut *= 3;
95
241
  var endIn = startIn + countIn;
96
242
 
97
- for (var i = startIn, j = offsetOut; i < endIn; i += 3, j += 3) {
98
- // move the vertex following the normal, to put the point on the good altitude
99
- // fill the vertices array at the offset position
100
- target[j] = ptsIn[i] + normals[i] * zTranslation;
101
- target[j + 1] = ptsIn[i + 1] + normals[i + 1] * zTranslation;
102
- target[j + 2] = ptsIn[i + 2] + normals[i + 2] * zTranslation;
243
+ if (normals) {
244
+ for (var i = startIn, j = offsetOut; i < endIn; i += 3, j += 3) {
245
+ // move the vertex following the normal, to put the point on the good altitude
246
+ // fill the vertices array at the offset position
247
+ target[j] = ptsIn[i] + normals[i] * zTranslation;
248
+ target[j + 1] = ptsIn[i + 1] + normals[i + 1] * zTranslation;
249
+ target[j + 2] = ptsIn[i + 2] + normals[i + 2] * zTranslation;
250
+ }
251
+ } else {
252
+ for (var _i = startIn, _j = offsetOut; _i < endIn; _i += 3, _j += 3) {
253
+ // move the vertex following the z axe
254
+ target[_j] = ptsIn[_i];
255
+ target[_j + 1] = ptsIn[_i + 1];
256
+ target[_j + 2] = ptsIn[_i + 2] + zTranslation;
257
+ }
103
258
  }
104
259
  }
105
260
  /*
@@ -148,8 +303,6 @@ function addExtrudedPolygonSideFaces(indices, length, offset, count, isClockWise
148
303
  }
149
304
  }
150
305
 
151
- var pointMaterial = new THREE.PointsMaterial();
152
-
153
306
  function featureToPoint(feature, options) {
154
307
  var ptsIn = feature.vertices;
155
308
  var normals = feature.normals;
@@ -210,12 +363,10 @@ function featureToPoint(feature, options) {
210
363
  geom.setAttribute('batchId', new THREE.BufferAttribute(batchIds, 1));
211
364
  }
212
365
 
213
- pointMaterial.size = feature.style.point.radius;
214
- return new THREE.Points(geom, pointMaterial);
366
+ options.pointMaterial.size = feature.style.point.radius;
367
+ return new THREE.Points(geom, options.pointMaterial);
215
368
  }
216
369
 
217
- var lineMaterial = new THREE.LineBasicMaterial();
218
-
219
370
  function featureToLine(feature, options) {
220
371
  var ptsIn = feature.vertices;
221
372
  var normals = feature.normals;
@@ -237,7 +388,7 @@ function featureToLine(feature, options) {
237
388
  geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
238
389
  var lines; // TODO CREATE material for each feature
239
390
 
240
- lineMaterial.linewidth = feature.style.stroke.width;
391
+ options.lineMaterial.linewidth = feature.style.stroke.width;
241
392
  var globals = {
242
393
  stroke: true
243
394
  };
@@ -304,7 +455,7 @@ function featureToLine(feature, options) {
304
455
  }
305
456
 
306
457
  geom.setIndex(new THREE.BufferAttribute(indices, 1));
307
- lines = new THREE.LineSegments(geom, lineMaterial);
458
+ lines = new THREE.LineSegments(geom, options.lineMaterial);
308
459
  } else {
309
460
  var style = feature.style.drawingStylefromContext({
310
461
  globals: globals,
@@ -321,14 +472,12 @@ function featureToLine(feature, options) {
321
472
  geom.setAttribute('batchId', new THREE.BufferAttribute(batchIds, 1));
322
473
  }
323
474
 
324
- lines = new THREE.Line(geom, lineMaterial);
475
+ lines = new THREE.Line(geom, options.lineMaterial);
325
476
  }
326
477
 
327
478
  return lines;
328
479
  }
329
480
 
330
- var material = new THREE.MeshBasicMaterial();
331
-
332
481
  function featureToPolygon(feature, options) {
333
482
  var ptsIn = feature.vertices;
334
483
  var normals = feature.normals;
@@ -411,15 +560,15 @@ function featureToPolygon(feature, options) {
411
560
  }
412
561
 
413
562
  geom.setIndex(new THREE.BufferAttribute(getIntArrayFromSize(indices, vertices.length / 3), 1));
414
- return new THREE.Mesh(geom, material);
563
+ return new THREE.Mesh(geom, options.polygonMaterial);
415
564
  }
416
565
 
417
566
  function area(contour, offset, count) {
418
567
  offset *= 3;
419
- var n = count * 3;
568
+ var n = offset + count * 3;
420
569
  var a = 0.0;
421
570
 
422
- for (var p = n + offset - 3, q = offset; q < n; p = q, q += 3) {
571
+ for (var p = n - 3, q = offset; q < n; p = q, q += 3) {
423
572
  a += contour[p] * contour[q + 1] - contour[q] * contour[p + 1];
424
573
  }
425
574
 
@@ -430,9 +579,6 @@ var bottomColor = new THREE.Color();
430
579
 
431
580
  function featureToExtrudedPolygon(feature, options) {
432
581
  var ptsIn = feature.vertices;
433
- var offset = feature.geometries[0].indices[0].offset;
434
- var count = feature.geometries[0].indices[0].count;
435
- var isClockWise = area(ptsIn, offset, count) < 0;
436
582
  var normals = feature.normals;
437
583
  var vertices = new Float32Array(ptsIn.length * 2);
438
584
  var colors = new Uint8Array(ptsIn.length * 2);
@@ -450,6 +596,8 @@ function featureToExtrudedPolygon(feature, options) {
450
596
 
451
597
  try {
452
598
  var _loop4 = function () {
599
+ var _geometry$indices$0$c;
600
+
453
601
  var geometry = _step4.value;
454
602
  var style = feature.style.drawingStylefromContext({
455
603
  globals: globals,
@@ -466,6 +614,7 @@ function featureToExtrudedPolygon(feature, options) {
466
614
  var lastIndice = geometry.indices.slice(-1)[0];
467
615
  var end = lastIndice.offset + lastIndice.count;
468
616
  var count = end - start;
617
+ var isClockWise = (_geometry$indices$0$c = geometry.indices[0].ccw) !== null && _geometry$indices$0$c !== void 0 ? _geometry$indices$0$c : area(ptsIn, start, count) < 0;
469
618
  coordinatesToVertices(ptsIn, normals, vertices, z, start, count);
470
619
  fillColorArray(colors, count, bottomColor, start);
471
620
  var startTop = start + totalVertices;
@@ -482,20 +631,16 @@ function featureToExtrudedPolygon(feature, options) {
482
631
 
483
632
  for (var i = 0; i < triangles.length; i++) {
484
633
  indices[startIndice + i] = triangles[i] + startTop;
485
- }
634
+ } // add extruded contour
486
635
 
487
- var _iterator5 = _createForOfIteratorHelper(geometry.indices),
488
- _step5;
489
636
 
490
- try {
491
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
492
- var indice = _step5.value;
493
- addExtrudedPolygonSideFaces(indices, totalVertices, indice.offset, indice.count, isClockWise);
494
- }
495
- } catch (err) {
496
- _iterator5.e(err);
497
- } finally {
498
- _iterator5.f();
637
+ addExtrudedPolygonSideFaces(indices, totalVertices, geometry.indices[0].offset, geometry.indices[0].count, isClockWise); // add extruded holes
638
+
639
+ for (var _i2 = 1; _i2 < geometry.indices.length; _i2++) {
640
+ var _indice$ccw;
641
+
642
+ var indice = geometry.indices[_i2];
643
+ addExtrudedPolygonSideFaces(indices, totalVertices, indice.offset, indice.count, !((_indice$ccw = indice.ccw) !== null && _indice$ccw !== void 0 ? _indice$ccw : isClockWise));
499
644
  }
500
645
 
501
646
  if (batchIds) {
@@ -524,8 +669,7 @@ function featureToExtrudedPolygon(feature, options) {
524
669
  }
525
670
 
526
671
  geom.setIndex(new THREE.BufferAttribute(getIntArrayFromSize(indices, vertices.length / 3), 1));
527
- var mesh = new THREE.Mesh(geom, material);
528
- return mesh;
672
+ return new THREE.Mesh(geom, options.polygonMaterial);
529
673
  }
530
674
  /**
531
675
  * Convert a [Feature]{@link Feature} to a Mesh
@@ -569,6 +713,12 @@ function featureToMesh(feature, options) {
569
713
  mesh.material.color = new THREE.Color(0xffffff);
570
714
  mesh.feature = feature;
571
715
  mesh.position.z = feature.altitude.min - options.GlobalZTrans;
716
+
717
+ if (options.layer) {
718
+ mesh.layer = options.layer;
719
+ mesh.layers.set(options.layer.threejsLayer);
720
+ }
721
+
572
722
  return mesh;
573
723
  }
574
724
  /**
@@ -582,7 +732,9 @@ var _default = {
582
732
  * a THREE.Group.
583
733
  *
584
734
  * @param {Object} options - options controlling the conversion
585
- * @param {function} [options.batchId] - optional function to create batchId attribute. It is passed the feature property and the feature index. As the batchId is using an unsigned int structure on 32 bits, the batchId could be between 0 and 4,294,967,295.
735
+ * @param {function} [options.batchId] - optional function to create batchId attribute.
736
+ * It is passed the feature property and the feature index. As the batchId is using an unsigned int structure on 32 bits,
737
+ * the batchId could be between 0 and 4,294,967,295.
586
738
  * @return {function}
587
739
  * @example <caption>Example usage of batchId with featureId.</caption>
588
740
  * view.addLayer({
@@ -616,21 +768,27 @@ var _default = {
616
768
  return;
617
769
  }
618
770
 
771
+ if (!options.pointMaterial) {
772
+ // Opacity and wireframe refered with layer properties
773
+ // TODO :next step is move these properties to Style
774
+ options.pointMaterial = (0, _ReferencingLayerProperties["default"])(new THREE.PointsMaterial(), this);
775
+ options.lineMaterial = (0, _ReferencingLayerProperties["default"])(new THREE.LineBasicMaterial(), this);
776
+ options.polygonMaterial = (0, _ReferencingLayerProperties["default"])(new THREE.MeshBasicMaterial(), this);
777
+ options.layer = this;
778
+ }
779
+
619
780
  var features = collection.features;
620
781
 
621
782
  if (!features || features.length == 0) {
622
783
  return;
623
784
  }
624
785
 
625
- var group = new THREE.Group();
626
786
  options.GlobalZTrans = collection.center.z;
627
- features.forEach(function (feature) {
628
- return group.add(featureToMesh(feature, options));
787
+ var meshes = features.map(function (feature) {
788
+ return featureToMesh(feature, options);
629
789
  });
630
- group.quaternion.copy(collection.quaternion);
631
- group.position.copy(collection.position);
632
- group.scale.copy(collection.scale);
633
- return group;
790
+ var featureNode = new FeatureMesh(meshes, collection);
791
+ return featureNode;
634
792
  };
635
793
  }
636
794
  };
@@ -17,6 +17,10 @@ var _LayeredMaterial = _interopRequireDefault(require("../Renderer/LayeredMateri
17
17
 
18
18
  var _TileBuilder = _interopRequireDefault(require("../Core/Prefab/TileBuilder"));
19
19
 
20
+ var _ReferencingLayerProperties = _interopRequireDefault(require("../Layer/ReferencingLayerProperties"));
21
+
22
+ var _GeoidLayer = require("../Layer/GeoidLayer");
23
+
20
24
  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); }
21
25
 
22
26
  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; }
@@ -29,9 +33,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
29
33
  var dimensions = new THREE.Vector2();
30
34
 
31
35
  function setTileFromTiledLayer(tile, tileLayer) {
32
- tile.material.transparent = tileLayer.opacity < 1.0;
33
- tile.material.opacity = tileLayer.opacity;
34
-
35
36
  if (tileLayer.diffuse) {
36
37
  tile.material.diffuse = tileLayer.diffuse;
37
38
  }
@@ -66,6 +67,7 @@ var _default = {
66
67
  result.geometry._count++;
67
68
  var crsCount = layer.tileMatrixSets.length;
68
69
  var material = new _LayeredMaterial["default"](layer.materialOptions, crsCount);
70
+ (0, _ReferencingLayerProperties["default"])(material, layer);
69
71
  var tile = new _TileMesh["default"](result.geometry, material, layer, extent, level); // Commented because layer.threejsLayer is undefined;
70
72
  // Fix me: conflict with object3d added in view.scene;
71
73
  // tile.layers.set(layer.threejsLayer);
@@ -86,7 +88,14 @@ var _default = {
86
88
  setTileFromTiledLayer(tile, layer);
87
89
 
88
90
  if (parent) {
89
- tile.setBBoxZ(parent.obb.z.min, parent.obb.z.max);
91
+ tile.geoidHeight = parent.geoidHeight;
92
+ var geoidHeight = (0, _GeoidLayer.geoidLayerIsVisible)(layer) ? tile.geoidHeight : 0;
93
+ tile.setBBoxZ({
94
+ min: parent.obb.z.min,
95
+ max: parent.obb.z.max,
96
+ geoidHeight: geoidHeight
97
+ });
98
+ tile.material.geoidHeight = geoidHeight;
90
99
  }
91
100
 
92
101
  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(region[4], region[5]); // at this point box.matrix = box.epsg4978_from_local, so
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["default"] = exports.deprecatedFeature2MeshOptions = exports.deprecatedParsingOptionsToNewOne = exports.deprecatedColorLayerOptions = void 0;
6
+ exports.deprecatedParsingOptionsToNewOne = exports.deprecatedFeature2MeshOptions = exports.deprecatedColorLayerOptions = exports["default"] = void 0;
7
7
 
8
8
  var _LayeredMaterial = require("../../Renderer/LayeredMaterial");
9
9