@loaders.gl/kml 4.0.0-alpha.15 → 4.0.0-alpha.17

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/dist/dist.min.js CHANGED
@@ -612,7 +612,8 @@
612
612
  ...geometryInfo
613
613
  }, {
614
614
  numericPropKeys: options && options.numericPropKeys || numericPropKeys,
615
- PositionDataType: options ? options.PositionDataType : Float32Array
615
+ PositionDataType: options ? options.PositionDataType : Float32Array,
616
+ triangulate: options ? options.triangulate : true
616
617
  });
617
618
  }
618
619
  function extractNumericPropTypes(features) {
@@ -641,7 +642,7 @@
641
642
  propArrayTypes,
642
643
  coordLength
643
644
  } = geometryInfo;
644
- const { numericPropKeys = [], PositionDataType = Float32Array } = options;
645
+ const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
645
646
  const hasGlobalId = features[0] && "id" in features[0];
646
647
  const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
647
648
  const points = {
@@ -668,13 +669,15 @@
668
669
  polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
669
670
  primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
670
671
  positions: new PositionDataType(polygonPositionsCount * coordLength),
671
- triangles: [],
672
672
  globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
673
673
  featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
674
674
  numericProps: {},
675
675
  properties: [],
676
676
  fields: []
677
677
  };
678
+ if (triangulate) {
679
+ polygons.triangles = [];
680
+ }
678
681
  for (const object of [points, lines, polygons]) {
679
682
  for (const propName of numericPropKeys) {
680
683
  const T = propArrayTypes[propName];
@@ -779,6 +782,9 @@
779
782
  endPosition,
780
783
  coordLength
781
784
  }) {
785
+ if (!polygons.triangles) {
786
+ return;
787
+ }
782
788
  const start = startPosition * coordLength;
783
789
  const end = endPosition * coordLength;
784
790
  const polygonPositions = polygons.positions.subarray(start, end);
@@ -797,7 +803,7 @@
797
803
  return returnObj;
798
804
  }
799
805
  function makeAccessorObjects(points, lines, polygons, coordLength) {
800
- return {
806
+ const binaryFeatures = {
801
807
  points: {
802
808
  ...points,
803
809
  positions: { value: points.positions, size: coordLength },
@@ -818,12 +824,15 @@
818
824
  positions: { value: polygons.positions, size: coordLength },
819
825
  polygonIndices: { value: polygons.polygonIndices, size: 1 },
820
826
  primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
821
- triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
822
827
  globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
823
828
  featureIds: { value: polygons.featureIds, size: 1 },
824
829
  numericProps: wrapProps(polygons.numericProps, 1)
825
830
  }
826
831
  };
832
+ if (polygons.triangles) {
833
+ binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
834
+ }
835
+ return binaryFeatures;
827
836
  }
828
837
  function fillNumericProperties(object, properties, index, length) {
829
838
  for (const numericPropName in object.numericProps) {
@@ -1032,14 +1041,15 @@
1032
1041
  });
1033
1042
 
1034
1043
  // ../gis/src/lib/geojson-to-binary.ts
1035
- function geojsonToBinary(features, options = { fixRingWinding: true }) {
1044
+ function geojsonToBinary(features, options = { fixRingWinding: true, triangulate: true }) {
1036
1045
  const geometryInfo = extractGeometryInfo(features);
1037
1046
  const coordLength = geometryInfo.coordLength;
1038
1047
  const { fixRingWinding } = options;
1039
1048
  const flatFeatures = geojsonToFlatGeojson(features, { coordLength, fixRingWinding });
1040
1049
  return flatGeojsonToBinary(flatFeatures, geometryInfo, {
1041
1050
  numericPropKeys: options.numericPropKeys,
1042
- PositionDataType: options.PositionDataType || Float32Array
1051
+ PositionDataType: options.PositionDataType || Float32Array,
1052
+ triangulate: options.triangulate
1043
1053
  });
1044
1054
  }
1045
1055
  var init_geojson_to_binary = __esm({
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _gis = require("@loaders.gl/gis");
11
11
  var _togeojson = require("@tmcw/togeojson");
12
12
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
13
+ var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
14
14
  var GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
15
15
  var GPXLoader = {
16
16
  name: 'GPX (GPS exchange format)',
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _gis = require("@loaders.gl/gis");
11
11
  var _togeojson = require("@tmcw/togeojson");
12
12
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
13
+ var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
14
14
  var KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
15
15
  var KMLLoader = {
16
16
  name: 'KML (Keyhole Markup Language)',
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _gis = require("@loaders.gl/gis");
11
11
  var _togeojson = require("@tmcw/togeojson");
12
12
  var _xmldom = require("@xmldom/xmldom");
13
- var VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
13
+ var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
14
14
  var TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
15
15
  var TCXLoader = {
16
16
  name: 'TCX (Training Center XML)',
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { gpx } from '@tmcw/togeojson';
3
3
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
5
5
  const GPX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx";
6
6
  export const GPXLoader = {
7
7
  name: 'GPX (GPS exchange format)',
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { kml } from '@tmcw/togeojson';
3
3
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
5
5
  const KML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\">";
6
6
  export const KMLLoader = {
7
7
  name: 'KML (Keyhole Markup Language)',
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { tcx } from '@tmcw/togeojson';
3
3
  import { DOMParser } from '@xmldom/xmldom';
4
- const VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
5
5
  const TCX_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<TrainingCenterDatabase";
6
6
  export const TCXLoader = {
7
7
  name: 'TCX (Training Center XML)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/kml",
3
- "version": "4.0.0-alpha.15",
3
+ "version": "4.0.0-alpha.17",
4
4
  "description": "Framework-independent loader for the KML format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -32,11 +32,11 @@
32
32
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "4.0.0-alpha.15",
36
- "@loaders.gl/loader-utils": "4.0.0-alpha.15",
37
- "@loaders.gl/schema": "4.0.0-alpha.15",
35
+ "@loaders.gl/gis": "4.0.0-alpha.17",
36
+ "@loaders.gl/loader-utils": "4.0.0-alpha.17",
37
+ "@loaders.gl/schema": "4.0.0-alpha.17",
38
38
  "@tmcw/togeojson": "^4.5.0",
39
39
  "@xmldom/xmldom": "^0.7.5"
40
40
  },
41
- "gitHead": "47467ab23c65917e4642730e99b5d005af333c76"
41
+ "gitHead": "68a743e2460cc89bf89edabfd08b395380d7d10c"
42
42
  }