landxml 0.4.0 → 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 +12 -0
- package/dist/index.js +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# landxml
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fbd9682: Contour elevations from surface min/max elevations and increment are now calculated correctly (bugfix).
|
|
8
|
+
|
|
9
|
+
## 0.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4edb0de: Contour elevations from surface min/max elevations and increment are now calculated correctly.
|
|
14
|
+
|
|
3
15
|
## 0.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -280,12 +280,18 @@ var linesToPolyLines = (lineSegments) => {
|
|
|
280
280
|
}
|
|
281
281
|
return polylines;
|
|
282
282
|
};
|
|
283
|
-
var contourElevations = (minElevation, maxElevation,
|
|
283
|
+
var contourElevations = (minElevation, maxElevation, interval) => {
|
|
284
|
+
if (!Number.isFinite(minElevation) || !Number.isFinite(maxElevation) || !Number.isFinite(interval)) {
|
|
285
|
+
throw new Error("Contour elevations have to be finite numbers");
|
|
286
|
+
}
|
|
287
|
+
if (minElevation + interval > maxElevation) {
|
|
288
|
+
throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
|
|
289
|
+
}
|
|
284
290
|
const elevations = [];
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
for (let elevation = start; elevation <= end; elevation += increment) {
|
|
291
|
+
let elevation = Math.ceil(minElevation / interval) * interval;
|
|
292
|
+
while (elevation < maxElevation) {
|
|
288
293
|
elevations.push(elevation);
|
|
294
|
+
elevation += interval;
|
|
289
295
|
}
|
|
290
296
|
return elevations;
|
|
291
297
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -245,12 +245,18 @@ var linesToPolyLines = (lineSegments) => {
|
|
|
245
245
|
}
|
|
246
246
|
return polylines;
|
|
247
247
|
};
|
|
248
|
-
var contourElevations = (minElevation, maxElevation,
|
|
248
|
+
var contourElevations = (minElevation, maxElevation, interval) => {
|
|
249
|
+
if (!Number.isFinite(minElevation) || !Number.isFinite(maxElevation) || !Number.isFinite(interval)) {
|
|
250
|
+
throw new Error("Contour elevations have to be finite numbers");
|
|
251
|
+
}
|
|
252
|
+
if (minElevation + interval > maxElevation) {
|
|
253
|
+
throw new Error(`No contour lines at interval: ${interval} between elevation ${minElevation} and ${maxElevation}`);
|
|
254
|
+
}
|
|
249
255
|
const elevations = [];
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
for (let elevation = start; elevation <= end; elevation += increment) {
|
|
256
|
+
let elevation = Math.ceil(minElevation / interval) * interval;
|
|
257
|
+
while (elevation < maxElevation) {
|
|
253
258
|
elevations.push(elevation);
|
|
259
|
+
elevation += interval;
|
|
254
260
|
}
|
|
255
261
|
return elevations;
|
|
256
262
|
};
|