@loaders.gl/mvt 4.0.0-alpha.16 → 4.0.0-alpha.18

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, length2) {
829
838
  for (const numericPropName in object.numericProps) {
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _parseMvt = _interopRequireDefault(require("./lib/parse-mvt"));
12
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- var VERSION = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : 'latest';
14
+ var VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
15
15
  var DEFAULT_MVT_LOADER_OPTIONS = {
16
16
  mvt: {
17
17
  shape: 'geojson',
@@ -1,5 +1,5 @@
1
1
  import parseMVT from './lib/parse-mvt';
2
- const VERSION = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : 'latest';
2
+ const VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
3
3
  const DEFAULT_MVT_LOADER_OPTIONS = {
4
4
  mvt: {
5
5
  shape: 'geojson',
@@ -1253,7 +1253,8 @@
1253
1253
  ...geometryInfo
1254
1254
  }, {
1255
1255
  numericPropKeys: options && options.numericPropKeys || numericPropKeys,
1256
- PositionDataType: options ? options.PositionDataType : Float32Array
1256
+ PositionDataType: options ? options.PositionDataType : Float32Array,
1257
+ triangulate: options ? options.triangulate : true
1257
1258
  });
1258
1259
  }
1259
1260
  function extractNumericPropTypes(features) {
@@ -1282,7 +1283,7 @@
1282
1283
  propArrayTypes,
1283
1284
  coordLength
1284
1285
  } = geometryInfo;
1285
- const { numericPropKeys = [], PositionDataType = Float32Array } = options;
1286
+ const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
1286
1287
  const hasGlobalId = features[0] && "id" in features[0];
1287
1288
  const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
1288
1289
  const points = {
@@ -1309,13 +1310,15 @@
1309
1310
  polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
1310
1311
  primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
1311
1312
  positions: new PositionDataType(polygonPositionsCount * coordLength),
1312
- triangles: [],
1313
1313
  globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
1314
1314
  featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
1315
1315
  numericProps: {},
1316
1316
  properties: [],
1317
1317
  fields: []
1318
1318
  };
1319
+ if (triangulate) {
1320
+ polygons.triangles = [];
1321
+ }
1319
1322
  for (const object of [points, lines, polygons]) {
1320
1323
  for (const propName of numericPropKeys) {
1321
1324
  const T = propArrayTypes[propName];
@@ -1420,6 +1423,9 @@
1420
1423
  endPosition,
1421
1424
  coordLength
1422
1425
  }) {
1426
+ if (!polygons.triangles) {
1427
+ return;
1428
+ }
1423
1429
  const start = startPosition * coordLength;
1424
1430
  const end = endPosition * coordLength;
1425
1431
  const polygonPositions = polygons.positions.subarray(start, end);
@@ -1438,7 +1444,7 @@
1438
1444
  return returnObj;
1439
1445
  }
1440
1446
  function makeAccessorObjects(points, lines, polygons, coordLength) {
1441
- return {
1447
+ const binaryFeatures = {
1442
1448
  points: {
1443
1449
  ...points,
1444
1450
  positions: { value: points.positions, size: coordLength },
@@ -1459,12 +1465,15 @@
1459
1465
  positions: { value: polygons.positions, size: coordLength },
1460
1466
  polygonIndices: { value: polygons.polygonIndices, size: 1 },
1461
1467
  primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
1462
- triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
1463
1468
  globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
1464
1469
  featureIds: { value: polygons.featureIds, size: 1 },
1465
1470
  numericProps: wrapProps(polygons.numericProps, 1)
1466
1471
  }
1467
1472
  };
1473
+ if (polygons.triangles) {
1474
+ binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
1475
+ }
1476
+ return binaryFeatures;
1468
1477
  }
1469
1478
  function fillNumericProperties(object, properties, index, length2) {
1470
1479
  for (const numericPropName in object.numericProps) {
@@ -2145,7 +2154,7 @@
2145
2154
  }
2146
2155
 
2147
2156
  // src/mvt-loader.ts
2148
- var VERSION = true ? "4.0.0-alpha.16" : "latest";
2157
+ var VERSION = true ? "4.0.0-alpha.18" : "latest";
2149
2158
  var DEFAULT_MVT_LOADER_OPTIONS = {
2150
2159
  mvt: {
2151
2160
  shape: "geojson",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/mvt",
3
3
  "description": "Loader for Mapbox Vector Tiles",
4
- "version": "4.0.0-alpha.16",
4
+ "version": "4.0.0-alpha.18",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -32,14 +32,14 @@
32
32
  "build-worker": "esbuild src/workers/mvt-worker.ts --bundle --outfile=dist/mvt-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "4.0.0-alpha.16",
36
- "@loaders.gl/loader-utils": "4.0.0-alpha.16",
37
- "@loaders.gl/schema": "4.0.0-alpha.16",
35
+ "@loaders.gl/gis": "4.0.0-alpha.18",
36
+ "@loaders.gl/loader-utils": "4.0.0-alpha.18",
37
+ "@loaders.gl/schema": "4.0.0-alpha.18",
38
38
  "@math.gl/polygon": "^3.5.1",
39
39
  "pbf": "^3.2.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/pbf": "^3.0.2"
43
43
  },
44
- "gitHead": "87e9714165c3ce143a04ac45bbd9d922006f1b63"
44
+ "gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce"
45
45
  }