landxml 0.6.0 → 0.6.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.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6c547e2: deploy options fix
8
+
3
9
  ## 0.6.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -1,7 +1,12 @@
1
+ "use strict";
2
+ var __create = Object.create;
1
3
  var __defProp = Object.defineProperty;
2
4
  var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
6
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
5
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -29,6 +34,27 @@ var __objRest = (source, exclude) => {
29
34
  }
30
35
  return target;
31
36
  };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
58
  var __async = (__this, __arguments, generator) => {
33
59
  return new Promise((resolve, reject) => {
34
60
  var fulfilled = (value) => {
@@ -50,6 +76,15 @@ var __async = (__this, __arguments, generator) => {
50
76
  });
51
77
  };
52
78
 
79
+ // src/index.ts
80
+ var src_exports = {};
81
+ __export(src_exports, {
82
+ reprojectGeoJson: () => reproject_geojson_default,
83
+ toGeojsonContours: () => to_geojson_contours_default,
84
+ toGlb: () => to_glb_default
85
+ });
86
+ module.exports = __toCommonJS(src_exports);
87
+
53
88
  // src/private/filter-by-surfaceId.ts
54
89
  var filterBySurfaceId = (parsedSurfaces, surfaceId) => {
55
90
  let filtered = [...parsedSurfaces];
@@ -68,7 +103,7 @@ var filterBySurfaceId = (parsedSurfaces, surfaceId) => {
68
103
  var filter_by_surfaceId_default = filterBySurfaceId;
69
104
 
70
105
  // src/private/get-glb.ts
71
- import { Document, WebIO } from "@gltf-transform/core";
106
+ var import_core = require("@gltf-transform/core");
72
107
  var findXYAxisMedians = (vertices) => {
73
108
  var _a, _b;
74
109
  vertices = vertices.slice().filter(Boolean);
@@ -83,7 +118,7 @@ var getGlb = (data, customCenter) => __async(void 0, null, function* () {
83
118
  return [x - center[0], z, -(y - center[1])];
84
119
  }).reduce((prev, curr) => prev.concat(curr), []);
85
120
  const triangles = data.surfaceDefinition.faces.reduce((prev, curr) => prev.concat(curr), []);
86
- const doc = new Document();
121
+ const doc = new import_core.Document();
87
122
  const buffer = doc.createBuffer();
88
123
  const position = doc.createAccessor().setType("VEC3").setArray(new Float32Array(vertices)).setBuffer(buffer);
89
124
  const indices = doc.createAccessor().setType("SCALAR").setArray(new Uint32Array(triangles)).setBuffer(buffer);
@@ -91,7 +126,7 @@ var getGlb = (data, customCenter) => __async(void 0, null, function* () {
91
126
  const mesh = doc.createMesh().addPrimitive(prim);
92
127
  const node = doc.createNode().setMesh(mesh);
93
128
  const scene = doc.createScene().addChild(node);
94
- const glb = yield new WebIO().writeBinary(doc);
129
+ const glb = yield new import_core.WebIO().writeBinary(doc);
95
130
  return { glb, center };
96
131
  });
97
132
  var get_glb_default = getGlb;
@@ -110,9 +145,9 @@ var downloadGlb = (glbData, fileName) => {
110
145
  var download_glb_default = downloadGlb;
111
146
 
112
147
  // src/private/parse-xml.ts
113
- import { createEasyWebWorker } from "easy-web-worker";
114
- import convert from "xml-js";
115
- var surfaceDefWorker = createEasyWebWorker(
148
+ var import_easy_web_worker = require("easy-web-worker");
149
+ var import_xml_js = __toESM(require("xml-js"));
150
+ var surfaceDefWorker = (0, import_easy_web_worker.createEasyWebWorker)(
116
151
  ({ onMessage }) => {
117
152
  onMessage((message) => {
118
153
  const { isPoint, arr, idMap } = message.payload;
@@ -139,7 +174,7 @@ var surfaceDefWorker = createEasyWebWorker(
139
174
  var parseXML = (xmlString) => __async(void 0, null, function* () {
140
175
  return new Promise((resolve, reject) => __async(void 0, null, function* () {
141
176
  var _a, _b, _c, _d, _e;
142
- const parsed = convert.xml2js(xmlString, {
177
+ const parsed = import_xml_js.default.xml2js(xmlString, {
143
178
  compact: true,
144
179
  attributesKey: "attr",
145
180
  textKey: "content"
@@ -244,8 +279,8 @@ var toGlb = (landXmlString, center = "auto", surfaceId = -1) => __async(void 0,
244
279
  var to_glb_default = toGlb;
245
280
 
246
281
  // src/private/get-contours.ts
247
- import { createEasyWebWorker as createEasyWebWorker2 } from "easy-web-worker";
248
- var contoursWorker = createEasyWebWorker2(
282
+ var import_easy_web_worker2 = require("easy-web-worker");
283
+ var contoursWorker = (0, import_easy_web_worker2.createEasyWebWorker)(
249
284
  ({ onMessage }) => {
250
285
  const contourLineOnFace = (face, z) => {
251
286
  let vertsAtElevation = 0;
@@ -508,7 +543,7 @@ var toGeojsonContours = (landXmlString, contourInterval = 2, generateOutline = t
508
543
  var to_geojson_contours_default = toGeojsonContours;
509
544
 
510
545
  // src/public/reproject-geojson.ts
511
- import proj4 from "proj4";
546
+ var import_proj4 = __toESM(require("proj4"));
512
547
  var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", keepOriginalGeometryAsFeatureProperty = true) => {
513
548
  const transformCoordinates = (coordinates, sourceProjection2, targetProjection2) => {
514
549
  if (Array.isArray(coordinates[0])) {
@@ -516,7 +551,7 @@ var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", k
516
551
  (subCoordinates) => transformCoordinates(subCoordinates, sourceProjection2, targetProjection2)
517
552
  );
518
553
  } else {
519
- coordinates = proj4(sourceProjection2, targetProjection2, coordinates);
554
+ coordinates = (0, import_proj4.default)(sourceProjection2, targetProjection2, coordinates);
520
555
  }
521
556
  return coordinates;
522
557
  };
@@ -541,8 +576,9 @@ var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", k
541
576
  return geojson;
542
577
  };
543
578
  var reproject_geojson_default = reprojectGeoJson;
544
- export {
545
- reproject_geojson_default as reprojectGeoJson,
546
- to_geojson_contours_default as toGeojsonContours,
547
- to_glb_default as toGlb
548
- };
579
+ // Annotate the CommonJS export names for ESM import in node:
580
+ 0 && (module.exports = {
581
+ reprojectGeoJson,
582
+ toGeojsonContours,
583
+ toGlb
584
+ });
@@ -1,12 +1,7 @@
1
- "use strict";
2
- var __create = Object.create;
3
1
  var __defProp = Object.defineProperty;
4
2
  var __defProps = Object.defineProperties;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -34,27 +29,6 @@ var __objRest = (source, exclude) => {
34
29
  }
35
30
  return target;
36
31
  };
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, { get: all[name], enumerable: true });
40
- };
41
- var __copyProps = (to, from, except, desc) => {
42
- if (from && typeof from === "object" || typeof from === "function") {
43
- for (let key of __getOwnPropNames(from))
44
- if (!__hasOwnProp.call(to, key) && key !== except)
45
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
- }
47
- return to;
48
- };
49
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
- // If the importer is in node compatibility mode or this is not an ESM
51
- // file that has been converted to a CommonJS file using a Babel-
52
- // compatible transform (i.e. "__esModule" has not been set), then set
53
- // "default" to the CommonJS "module.exports" for node compatibility.
54
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
- mod
56
- ));
57
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
32
  var __async = (__this, __arguments, generator) => {
59
33
  return new Promise((resolve, reject) => {
60
34
  var fulfilled = (value) => {
@@ -76,15 +50,6 @@ var __async = (__this, __arguments, generator) => {
76
50
  });
77
51
  };
78
52
 
79
- // src/index.ts
80
- var src_exports = {};
81
- __export(src_exports, {
82
- reprojectGeoJson: () => reproject_geojson_default,
83
- toGeojsonContours: () => to_geojson_contours_default,
84
- toGlb: () => to_glb_default
85
- });
86
- module.exports = __toCommonJS(src_exports);
87
-
88
53
  // src/private/filter-by-surfaceId.ts
89
54
  var filterBySurfaceId = (parsedSurfaces, surfaceId) => {
90
55
  let filtered = [...parsedSurfaces];
@@ -103,7 +68,7 @@ var filterBySurfaceId = (parsedSurfaces, surfaceId) => {
103
68
  var filter_by_surfaceId_default = filterBySurfaceId;
104
69
 
105
70
  // src/private/get-glb.ts
106
- var import_core = require("@gltf-transform/core");
71
+ import { Document, WebIO } from "@gltf-transform/core";
107
72
  var findXYAxisMedians = (vertices) => {
108
73
  var _a, _b;
109
74
  vertices = vertices.slice().filter(Boolean);
@@ -118,7 +83,7 @@ var getGlb = (data, customCenter) => __async(void 0, null, function* () {
118
83
  return [x - center[0], z, -(y - center[1])];
119
84
  }).reduce((prev, curr) => prev.concat(curr), []);
120
85
  const triangles = data.surfaceDefinition.faces.reduce((prev, curr) => prev.concat(curr), []);
121
- const doc = new import_core.Document();
86
+ const doc = new Document();
122
87
  const buffer = doc.createBuffer();
123
88
  const position = doc.createAccessor().setType("VEC3").setArray(new Float32Array(vertices)).setBuffer(buffer);
124
89
  const indices = doc.createAccessor().setType("SCALAR").setArray(new Uint32Array(triangles)).setBuffer(buffer);
@@ -126,7 +91,7 @@ var getGlb = (data, customCenter) => __async(void 0, null, function* () {
126
91
  const mesh = doc.createMesh().addPrimitive(prim);
127
92
  const node = doc.createNode().setMesh(mesh);
128
93
  const scene = doc.createScene().addChild(node);
129
- const glb = yield new import_core.WebIO().writeBinary(doc);
94
+ const glb = yield new WebIO().writeBinary(doc);
130
95
  return { glb, center };
131
96
  });
132
97
  var get_glb_default = getGlb;
@@ -145,9 +110,9 @@ var downloadGlb = (glbData, fileName) => {
145
110
  var download_glb_default = downloadGlb;
146
111
 
147
112
  // src/private/parse-xml.ts
148
- var import_easy_web_worker = require("easy-web-worker");
149
- var import_xml_js = __toESM(require("xml-js"), 1);
150
- var surfaceDefWorker = (0, import_easy_web_worker.createEasyWebWorker)(
113
+ import { createEasyWebWorker } from "easy-web-worker";
114
+ import convert from "xml-js";
115
+ var surfaceDefWorker = createEasyWebWorker(
151
116
  ({ onMessage }) => {
152
117
  onMessage((message) => {
153
118
  const { isPoint, arr, idMap } = message.payload;
@@ -174,7 +139,7 @@ var surfaceDefWorker = (0, import_easy_web_worker.createEasyWebWorker)(
174
139
  var parseXML = (xmlString) => __async(void 0, null, function* () {
175
140
  return new Promise((resolve, reject) => __async(void 0, null, function* () {
176
141
  var _a, _b, _c, _d, _e;
177
- const parsed = import_xml_js.default.xml2js(xmlString, {
142
+ const parsed = convert.xml2js(xmlString, {
178
143
  compact: true,
179
144
  attributesKey: "attr",
180
145
  textKey: "content"
@@ -279,8 +244,8 @@ var toGlb = (landXmlString, center = "auto", surfaceId = -1) => __async(void 0,
279
244
  var to_glb_default = toGlb;
280
245
 
281
246
  // src/private/get-contours.ts
282
- var import_easy_web_worker2 = require("easy-web-worker");
283
- var contoursWorker = (0, import_easy_web_worker2.createEasyWebWorker)(
247
+ import { createEasyWebWorker as createEasyWebWorker2 } from "easy-web-worker";
248
+ var contoursWorker = createEasyWebWorker2(
284
249
  ({ onMessage }) => {
285
250
  const contourLineOnFace = (face, z) => {
286
251
  let vertsAtElevation = 0;
@@ -543,7 +508,7 @@ var toGeojsonContours = (landXmlString, contourInterval = 2, generateOutline = t
543
508
  var to_geojson_contours_default = toGeojsonContours;
544
509
 
545
510
  // src/public/reproject-geojson.ts
546
- var import_proj4 = __toESM(require("proj4"), 1);
511
+ import proj4 from "proj4";
547
512
  var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", keepOriginalGeometryAsFeatureProperty = true) => {
548
513
  const transformCoordinates = (coordinates, sourceProjection2, targetProjection2) => {
549
514
  if (Array.isArray(coordinates[0])) {
@@ -551,7 +516,7 @@ var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", k
551
516
  (subCoordinates) => transformCoordinates(subCoordinates, sourceProjection2, targetProjection2)
552
517
  );
553
518
  } else {
554
- coordinates = (0, import_proj4.default)(sourceProjection2, targetProjection2, coordinates);
519
+ coordinates = proj4(sourceProjection2, targetProjection2, coordinates);
555
520
  }
556
521
  return coordinates;
557
522
  };
@@ -576,9 +541,8 @@ var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", k
576
541
  return geojson;
577
542
  };
578
543
  var reproject_geojson_default = reprojectGeoJson;
579
- // Annotate the CommonJS export names for ESM import in node:
580
- 0 && (module.exports = {
581
- reprojectGeoJson,
582
- toGeojsonContours,
583
- toGlb
584
- });
544
+ export {
545
+ reproject_geojson_default as reprojectGeoJson,
546
+ to_geojson_contours_default as toGeojsonContours,
547
+ to_glb_default as toGlb
548
+ };
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "landxml",
3
- "type": "module",
4
- "version": "0.6.0",
3
+ "version": "0.6.1",
5
4
  "description": "Parse LandXML surfaces on the modern web.",
6
5
  "main": "dist/index.js",
7
6
  "module": "dist/index.mjs",
File without changes