landxml 0.8.0 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # landxml
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e886c37: Return empty geojson and console.warn rather than throwing error when generating contours.
8
+
3
9
  ## 0.8.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -448,7 +448,8 @@ var contourElevations = (minElevation, maxElevation, interval) => {
448
448
  throw new Error("Contour elevations have to be finite numbers");
449
449
  }
450
450
  if (minElevation + interval > maxElevation) {
451
- throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
451
+ console.warn(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
452
+ return [];
452
453
  }
453
454
  const elevations = [];
454
455
  const firstStep = Math.ceil(minElevation / interval);
@@ -501,6 +502,7 @@ var bucketTrianglesByElevation = (triangles, elevations, interval) => {
501
502
  var getContours = (data, interval = 2, precomputed) => __async(null, null, function* () {
502
503
  const { triangles, minElevation, maxElevation } = precomputed != null ? precomputed : precomputeSurfaceData(data);
503
504
  const elevations = contourElevations(minElevation, maxElevation, interval);
505
+ if (elevations.length === 0) return constructGeojson([]);
504
506
  const trianglesByElevation = bucketTrianglesByElevation(triangles, elevations, interval);
505
507
  const elevationPolylines = yield Promise.all(
506
508
  elevations.map(
package/dist/index.mjs CHANGED
@@ -411,7 +411,8 @@ var contourElevations = (minElevation, maxElevation, interval) => {
411
411
  throw new Error("Contour elevations have to be finite numbers");
412
412
  }
413
413
  if (minElevation + interval > maxElevation) {
414
- throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
414
+ console.warn(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
415
+ return [];
415
416
  }
416
417
  const elevations = [];
417
418
  const firstStep = Math.ceil(minElevation / interval);
@@ -464,6 +465,7 @@ var bucketTrianglesByElevation = (triangles, elevations, interval) => {
464
465
  var getContours = (data, interval = 2, precomputed) => __async(null, null, function* () {
465
466
  const { triangles, minElevation, maxElevation } = precomputed != null ? precomputed : precomputeSurfaceData(data);
466
467
  const elevations = contourElevations(minElevation, maxElevation, interval);
468
+ if (elevations.length === 0) return constructGeojson([]);
467
469
  const trianglesByElevation = bucketTrianglesByElevation(triangles, elevations, interval);
468
470
  const elevationPolylines = yield Promise.all(
469
471
  elevations.map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "landxml",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Parse LandXML surfaces on the modern web.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",