landxml 0.4.1 → 0.4.2
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 +6 -0
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -281,11 +281,14 @@ var linesToPolyLines = (lineSegments) => {
|
|
|
281
281
|
return polylines;
|
|
282
282
|
};
|
|
283
283
|
var contourElevations = (minElevation, maxElevation, interval) => {
|
|
284
|
-
if (maxElevation
|
|
284
|
+
if (!Number.isFinite(minElevation) || !Number.isFinite(maxElevation) || !Number.isFinite(interval)) {
|
|
285
285
|
throw new Error("Contour elevations have to be finite numbers");
|
|
286
286
|
}
|
|
287
|
+
if (minElevation + interval > maxElevation) {
|
|
288
|
+
throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
|
|
289
|
+
}
|
|
287
290
|
const elevations = [];
|
|
288
|
-
let elevation = Math.ceil(minElevation
|
|
291
|
+
let elevation = Math.ceil(minElevation / interval) * interval;
|
|
289
292
|
while (elevation < maxElevation) {
|
|
290
293
|
elevations.push(elevation);
|
|
291
294
|
elevation += interval;
|
package/dist/index.mjs
CHANGED
|
@@ -246,11 +246,14 @@ var linesToPolyLines = (lineSegments) => {
|
|
|
246
246
|
return polylines;
|
|
247
247
|
};
|
|
248
248
|
var contourElevations = (minElevation, maxElevation, interval) => {
|
|
249
|
-
if (maxElevation
|
|
249
|
+
if (!Number.isFinite(minElevation) || !Number.isFinite(maxElevation) || !Number.isFinite(interval)) {
|
|
250
250
|
throw new Error("Contour elevations have to be finite numbers");
|
|
251
251
|
}
|
|
252
|
+
if (minElevation + interval > maxElevation) {
|
|
253
|
+
throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
|
|
254
|
+
}
|
|
252
255
|
const elevations = [];
|
|
253
|
-
let elevation = Math.ceil(minElevation
|
|
256
|
+
let elevation = Math.ceil(minElevation / interval) * interval;
|
|
254
257
|
while (elevation < maxElevation) {
|
|
255
258
|
elevations.push(elevation);
|
|
256
259
|
elevation += interval;
|