itowns 2.42.1-next.11 → 2.42.1-next.12

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.
@@ -273,7 +273,7 @@
273
273
  var wfsCartoSource = new itowns.WFSSource({
274
274
  url: 'https://data.geopf.fr/wfs/ows?',
275
275
  version: '2.0.0',
276
- typeName: 'BDCARTO_BDD_WLD_WGS84G:zone_habitat_mairie',
276
+ typeName: 'BDCARTO_V5:zone_d_habitation',
277
277
  crs: 'EPSG:3946',
278
278
  ipr: 'IGN',
279
279
  format: 'application/json',
@@ -284,24 +284,24 @@
284
284
  text: {
285
285
  field: '{toponyme}',
286
286
  color: (p) => {
287
- switch (p.importance) {
288
- case 'Quartier de ville':
289
- return 'Cornsilk';
290
- case 'Hameau':
287
+ switch (p.nature) {
288
+ case 'Quartier':
291
289
  return 'WhiteSmoke';
292
- case 'Chef-lieu de commune':
290
+ case 'Château':
291
+ return 'Cornsilk';
292
+ case 'Lieu-dit habité':
293
293
  default:
294
294
  return 'white';
295
295
  }
296
296
  },
297
297
  transform: 'uppercase',
298
298
  size: (p) => {
299
- switch (p.importance) {
300
- case 'Quartier de ville':
301
- return 11;
302
- case 'Hameau':
299
+ switch (p.nature) {
300
+ case 'Quartier':
303
301
  return 13;
304
- case 'Chef-lieu de commune':
302
+ case 'Château':
303
+ return 11;
304
+ case 'Lieu-dit habité':
305
305
  default:
306
306
  return 18;
307
307
  }
@@ -175,7 +175,7 @@
175
175
  view.addFrameRequester(itowns.MAIN_LOOP_EVENTS.BEFORE_RENDER, scaler);
176
176
 
177
177
  var wfsBuildingSource = new itowns.WFSSource({
178
- url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
178
+ url: 'https://data.geopf.fr/wfs/ows?',
179
179
  version: '2.0.0',
180
180
  typeName: 'BDTOPO_V3:batiment',
181
181
  crs: 'EPSG:4326',
@@ -98,9 +98,9 @@
98
98
  view.addLayer(wmsElevationLayer);
99
99
 
100
100
  var wfsCartoSource = new itowns.WFSSource({
101
- url: 'https://wxs.ign.fr/cartovecto/geoportail/wfs?',
101
+ url: 'https://data.geopf.fr/wfs/ows?',
102
102
  version: '2.0.0',
103
- typeName: 'BDCARTO_BDD_WLD_WGS84G:zone_habitat_mairie',
103
+ typeName: 'BDCARTO_V5:zone_d_habitation',
104
104
  crs: 'EPSG:3946',
105
105
  ipr: 'IGN',
106
106
  format: 'application/json',
@@ -110,8 +110,8 @@
110
110
  // Define options for geocoding service that should be used by the searchbar.
111
111
  const geocodingOptions = {
112
112
  url: new URL(
113
- 'https://wxs.ign.fr/ayxvok72rcocdyn8xyvy32og/ols/apis/completion?text=&type=StreetAddress,' +
114
- 'PositionOfInterest',
113
+ 'https://data.geopf.fr/geocodage/completion?' +
114
+ 'text=&type=StreetAddress,PositionOfInterest',
115
115
  ),
116
116
  parser: (response) => {
117
117
  const map = new Map();
@@ -109,8 +109,8 @@
109
109
  // Define options for geocoding service that should be used by the searchbar.
110
110
  const geocodingOptions = {
111
111
  url: new URL(
112
- 'https://wxs.ign.fr/ayxvok72rcocdyn8xyvy32og/ols/apis/completion?text=&type=StreetAddress,' +
113
- 'PositionOfInterest',
112
+ 'https://data.geopf.fr/geocodage/completion?' +
113
+ 'text=&type=StreetAddress,PositionOfInterest',
114
114
  ),
115
115
  parser: (response) => {
116
116
  const map = new Map();
@@ -117,7 +117,7 @@
117
117
  view.addLayer(olayer, view.tileLayer).then(function addWfsLayer(orientedImageLayer) {
118
118
  // prepare WFS source for the buildings
119
119
  var wfsBuildingSource = new itowns.WFSSource({
120
- url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
120
+ url: 'https://data.geopf.fr/wfs/ows?',
121
121
  version: '2.0.0',
122
122
  typeName: 'BDTOPO_V3:batiment',
123
123
  crs: 'EPSG:4326',
@@ -88,8 +88,8 @@
88
88
  // Define options for geocoding service that should be used by the searchbar.
89
89
  const geocodingOptions = {
90
90
  url: new URL(
91
- 'https://wxs.ign.fr/ayxvok72rcocdyn8xyvy32og/ols/apis/completion?text=&type=StreetAddress,' +
92
- 'PositionOfInterest',
91
+ 'https://data.geopf.fr/geocodage/completion?' +
92
+ 'text=&type=StreetAddress,PositionOfInterest',
93
93
  ),
94
94
  // As precised in the doc (http://www.itowns-project.org/itowns/docs/#api/Widgets/Searchbar), the parser
95
95
  // method must parse the geocoding service response into a Map object. For each item of this Map, the
@@ -55,6 +55,7 @@ class EntwinePointTileLayer extends _PointCloudLayer.default {
55
55
  constructor(id, config) {
56
56
  super(id, config);
57
57
  this.isEntwinePointTileLayer = true;
58
+ this.scale = new THREE.Vector3(1, 1, 1);
58
59
  const resolve = this.addInitializationStep();
59
60
  this.whenReady = this.source.whenReady.then(() => {
60
61
  this.root = new _EntwinePointTileNode.default(0, 0, 0, 0, this, -1);
@@ -67,13 +67,16 @@ class LASLoader {
67
67
  The copc.js library does the degree convertion and stores it as a `Float32`.
68
68
  */
69
69
  const scanAngles = new Float32Array(view.pointCount);
70
+
71
+ // For precision we take the first point that will be use as origin for a local referentiel.
72
+ const origin = getPosition.map(f => f(0)).map(val => Math.floor(val));
70
73
  for (let i = 0; i < view.pointCount; i++) {
71
74
  // `getPosition` apply scale and offset transform to the X, Y, Z
72
75
  // values. See https://github.com/connormanning/copc.js/blob/master/src/las/extractor.ts.
73
76
  const [x, y, z] = getPosition.map(f => f(i));
74
- positions[i * 3] = x;
75
- positions[i * 3 + 1] = y;
76
- positions[i * 3 + 2] = z;
77
+ positions[i * 3] = x - origin[0];
78
+ positions[i * 3 + 1] = y - origin[1];
79
+ positions[i * 3 + 2] = z - origin[2];
77
80
  intensities[i] = getIntensity(i);
78
81
  returnNumbers[i] = getReturnNumber(i);
79
82
  numberOfReturns[i] = getNumberOfReturns(i);
@@ -104,7 +107,8 @@ class LASLoader {
104
107
  classification: classifications,
105
108
  pointSourceID: pointSourceIDs,
106
109
  color: colors,
107
- scanAngle: scanAngles
110
+ scanAngle: scanAngles,
111
+ origin
108
112
  };
109
113
  }
110
114
 
@@ -75,6 +75,7 @@ var _default = {
75
75
  const scanAngle = new THREE.BufferAttribute(attributes.scanAngle, 1);
76
76
  geometry.setAttribute('scanAngle', scanAngle);
77
77
  geometry.computeBoundingBox();
78
+ geometry.userData.origin = new THREE.Vector3().fromArray(attributes.origin);
78
79
  return geometry;
79
80
  });
80
81
  }
@@ -9,7 +9,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
9
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
10
  // See the different constants holding ordinal, name, numElements, byteSize in PointAttributes.cpp in PotreeConverter
11
11
  // elementByteSize is byteSize / numElements
12
- const POINT_ATTTRIBUTES = {
12
+ const POINT_ATTRIBUTES = {
13
13
  POSITION_CARTESIAN: {
14
14
  numElements: 3,
15
15
  arrayType: Float32Array,
@@ -55,8 +55,8 @@ const POINT_ATTTRIBUTES = {
55
55
  attributeName: 'normal'
56
56
  }
57
57
  };
58
- for (const potreeName of Object.keys(POINT_ATTTRIBUTES)) {
59
- const attr = POINT_ATTTRIBUTES[potreeName];
58
+ for (const potreeName of Object.keys(POINT_ATTRIBUTES)) {
59
+ const attr = POINT_ATTRIBUTES[potreeName];
60
60
  attr.potreeName = potreeName;
61
61
  attr.numByte = attr.numByte || attr.arrayType.BYTES_PER_ELEMENT;
62
62
  attr.byteSize = attr.numElements * attr.numByte;
@@ -87,14 +87,14 @@ var _default = {
87
87
  // Format: X1,Y1,Z1,R1,G1,B1,A1,[...],XN,YN,ZN,RN,GN,BN,AN
88
88
  let pointByteSize = 0;
89
89
  for (const potreeName of options.in.pointAttributes) {
90
- pointByteSize += POINT_ATTTRIBUTES[potreeName].byteSize;
90
+ pointByteSize += POINT_ATTRIBUTES[potreeName].byteSize;
91
91
  }
92
92
  const numPoints = Math.floor(buffer.byteLength / pointByteSize);
93
93
  const geometry = new THREE.BufferGeometry();
94
94
  let elemOffset = 0;
95
95
  let attrOffset = 0;
96
96
  for (const potreeName of options.in.pointAttributes) {
97
- const attr = POINT_ATTTRIBUTES[potreeName];
97
+ const attr = POINT_ATTRIBUTES[potreeName];
98
98
  const arrayLength = attr.numElements * numPoints;
99
99
  const array = new attr.arrayType(arrayLength);
100
100
  for (let arrayOffset = 0; arrayOffset < arrayLength; arrayOffset += attr.numElements) {
@@ -41,10 +41,8 @@ var _default = {
41
41
  addPickingAttribute(points);
42
42
  points.frustumCulled = false;
43
43
  points.matrixAutoUpdate = false;
44
- if (!layer.isEntwinePointTileLayer) {
45
- points.position.copy(node.bbox.min);
46
- points.scale.copy(layer.scale);
47
- }
44
+ points.position.copy(geometry.userData.origin || node.bbox.min);
45
+ points.scale.copy(layer.scale);
48
46
  points.updateMatrix();
49
47
  points.tightbbox = geometry.boundingBox.applyMatrix4(points.matrix);
50
48
  points.layer = layer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.42.1-next.11",
3
+ "version": "2.42.1-next.12",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "main": "lib/Main.js",
6
6
  "exports": {