@deck.gl/carto 9.1.8 → 9.1.10
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/api/fetch-map.d.ts.map +1 -1
- package/dist/api/fetch-map.js +1 -0
- package/dist/api/fetch-map.js.map +1 -1
- package/dist/api/parse-map.d.ts.map +1 -1
- package/dist/api/parse-map.js.map +1 -1
- package/dist/cartoPropertiesTile-worker.js +9 -1
- package/dist/cartoRasterTile-worker.js +9 -1
- package/dist/cartoSpatialTile-worker.js +9 -1
- package/dist/cartoVectorTile-worker.js +9 -1
- package/dist/dist.dev.js +475 -141
- package/dist/index.cjs +429 -142
- package/dist/index.cjs.map +4 -4
- package/dist/layers/cluster-tile-layer.d.ts.map +1 -1
- package/dist/layers/cluster-tile-layer.js +6 -5
- package/dist/layers/cluster-tile-layer.js.map +1 -1
- package/dist/layers/cluster-utils.d.ts.map +1 -1
- package/dist/layers/cluster-utils.js +3 -28
- package/dist/layers/cluster-utils.js.map +1 -1
- package/dist/layers/h3-tile-layer.d.ts.map +1 -1
- package/dist/layers/h3-tile-layer.js +5 -5
- package/dist/layers/h3-tile-layer.js.map +1 -1
- package/dist/layers/heatmap-tile-layer.d.ts.map +1 -1
- package/dist/layers/heatmap-tile-layer.js +5 -1
- package/dist/layers/heatmap-tile-layer.js.map +1 -1
- package/dist/layers/label-utils.d.ts +7 -0
- package/dist/layers/label-utils.d.ts.map +1 -0
- package/dist/layers/label-utils.js +218 -0
- package/dist/layers/label-utils.js.map +1 -0
- package/dist/layers/point-label-layer.d.ts +6 -0
- package/dist/layers/point-label-layer.d.ts.map +1 -1
- package/dist/layers/point-label-layer.js +13 -1
- package/dist/layers/point-label-layer.js.map +1 -1
- package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/dist/layers/quadbin-tile-layer.js +5 -5
- package/dist/layers/quadbin-tile-layer.js.map +1 -1
- package/dist/layers/raster-tile-layer.d.ts.map +1 -1
- package/dist/layers/raster-tile-layer.js +7 -6
- package/dist/layers/raster-tile-layer.js.map +1 -1
- package/dist/layers/schema/carto-properties-tile-loader.js +1 -1
- package/dist/layers/schema/carto-properties-tile-loader.js.map +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.js.map +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js.map +1 -1
- package/dist/layers/schema/carto-tile.d.ts +3 -1
- package/dist/layers/schema/carto-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-tile.js.map +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js.map +1 -1
- package/dist/layers/schema/spatialjson-utils.d.ts +4 -7
- package/dist/layers/schema/spatialjson-utils.d.ts.map +1 -1
- package/dist/layers/schema/spatialjson-utils.js.map +1 -1
- package/dist/layers/utils.d.ts +3 -2
- package/dist/layers/utils.d.ts.map +1 -1
- package/dist/layers/utils.js +28 -7
- package/dist/layers/utils.js.map +1 -1
- package/dist/layers/vector-tile-layer.d.ts +12 -4
- package/dist/layers/vector-tile-layer.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.js +76 -35
- package/dist/layers/vector-tile-layer.js.map +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +53 -0
- package/dist/utils.js.map +1 -1
- package/dist.min.js +12 -12
- package/package.json +2 -2
- package/src/api/fetch-map.ts +2 -0
- package/src/api/parse-map.ts +2 -0
- package/src/layers/cluster-tile-layer.ts +7 -5
- package/src/layers/cluster-utils.ts +3 -29
- package/src/layers/h3-tile-layer.ts +6 -6
- package/src/layers/heatmap-tile-layer.ts +9 -1
- package/src/layers/label-utils.ts +304 -0
- package/src/layers/point-label-layer.ts +18 -1
- package/src/layers/quadbin-tile-layer.ts +6 -6
- package/src/layers/raster-tile-layer.ts +7 -6
- package/src/layers/schema/carto-tile.ts +3 -1
- package/src/layers/schema/spatialjson-utils.ts +4 -3
- package/src/layers/utils.ts +31 -7
- package/src/layers/vector-tile-layer.ts +100 -42
- package/src/utils.ts +79 -0
package/dist/index.cjs
CHANGED
|
@@ -80,7 +80,110 @@ var import_core6 = require("@deck.gl/core");
|
|
|
80
80
|
|
|
81
81
|
// dist/layers/cluster-utils.js
|
|
82
82
|
var import_quadbin = require("quadbin");
|
|
83
|
+
var import_core2 = require("@deck.gl/core");
|
|
84
|
+
|
|
85
|
+
// dist/utils.js
|
|
83
86
|
var import_core = require("@deck.gl/core");
|
|
87
|
+
function assert(condition, message) {
|
|
88
|
+
import_core.log.assert(condition, message);
|
|
89
|
+
}
|
|
90
|
+
function createBinaryProxy(data, index) {
|
|
91
|
+
const { properties, numericProps } = data;
|
|
92
|
+
return new Proxy(properties[index] || {}, {
|
|
93
|
+
get(target, property) {
|
|
94
|
+
if (property in numericProps) {
|
|
95
|
+
return numericProps[property].value[index];
|
|
96
|
+
}
|
|
97
|
+
return target[property];
|
|
98
|
+
},
|
|
99
|
+
has(target, property) {
|
|
100
|
+
return property in numericProps || property in target;
|
|
101
|
+
},
|
|
102
|
+
ownKeys(target) {
|
|
103
|
+
return [...Object.keys(numericProps), ...Reflect.ownKeys(target)];
|
|
104
|
+
},
|
|
105
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
106
|
+
return { enumerable: true, configurable: true };
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function getWorkerUrl(id5, version) {
|
|
111
|
+
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id5}-worker.js`;
|
|
112
|
+
}
|
|
113
|
+
function scaleIdentity() {
|
|
114
|
+
let unknown;
|
|
115
|
+
function scale(x) {
|
|
116
|
+
return x === null ? unknown : x;
|
|
117
|
+
}
|
|
118
|
+
scale.invert = scale;
|
|
119
|
+
scale.domain = scale.range = (d) => d;
|
|
120
|
+
scale.unknown = (u) => {
|
|
121
|
+
if (u) {
|
|
122
|
+
unknown = u;
|
|
123
|
+
}
|
|
124
|
+
return unknown;
|
|
125
|
+
};
|
|
126
|
+
scale.copy = () => {
|
|
127
|
+
const scaleCopy = scaleIdentity();
|
|
128
|
+
scaleCopy.unknown(unknown);
|
|
129
|
+
return scaleCopy;
|
|
130
|
+
};
|
|
131
|
+
return scale;
|
|
132
|
+
}
|
|
133
|
+
var EMPTY_UINT16ARRAY = new Uint16Array();
|
|
134
|
+
var EMPTY_BINARY_PROPS = {
|
|
135
|
+
positions: { value: new Float32Array(), size: 2 },
|
|
136
|
+
properties: [],
|
|
137
|
+
numericProps: {},
|
|
138
|
+
featureIds: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
139
|
+
globalFeatureIds: { value: EMPTY_UINT16ARRAY, size: 1 }
|
|
140
|
+
};
|
|
141
|
+
function createEmptyBinary() {
|
|
142
|
+
return {
|
|
143
|
+
shape: "binary-feature-collection",
|
|
144
|
+
points: {
|
|
145
|
+
type: "Point",
|
|
146
|
+
...EMPTY_BINARY_PROPS
|
|
147
|
+
},
|
|
148
|
+
lines: {
|
|
149
|
+
type: "LineString",
|
|
150
|
+
pathIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
151
|
+
...EMPTY_BINARY_PROPS
|
|
152
|
+
},
|
|
153
|
+
polygons: {
|
|
154
|
+
type: "Polygon",
|
|
155
|
+
polygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
156
|
+
primitivePolygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
157
|
+
...EMPTY_BINARY_PROPS
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function createBinaryPointFeature(positions, featureIds, globalFeatureIds, numericProps, properties, size = 2) {
|
|
162
|
+
return {
|
|
163
|
+
type: "Point",
|
|
164
|
+
positions: { value: new Float32Array(positions), size },
|
|
165
|
+
featureIds: { value: new Uint16Array(featureIds), size: 1 },
|
|
166
|
+
globalFeatureIds: { value: new Uint32Array(globalFeatureIds), size: 1 },
|
|
167
|
+
numericProps,
|
|
168
|
+
properties
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function initializeNumericProps(numPoints, sourceProps) {
|
|
172
|
+
const numericProps = {};
|
|
173
|
+
if (sourceProps) {
|
|
174
|
+
Object.keys(sourceProps).forEach((prop) => {
|
|
175
|
+
numericProps[prop] = { value: new Float32Array(numPoints), size: 1 };
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return numericProps;
|
|
179
|
+
}
|
|
180
|
+
function copyNumericProps(sourceProps, targetProps, sourceIndex, targetIndex) {
|
|
181
|
+
Object.keys(sourceProps).forEach((prop) => {
|
|
182
|
+
targetProps[prop].value[targetIndex] = sourceProps[prop].value[sourceIndex];
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// dist/layers/cluster-utils.js
|
|
84
187
|
function aggregateTile(tile, tileAggregationCache, aggregationLevels, properties = [], getPosition, getWeight) {
|
|
85
188
|
var _a;
|
|
86
189
|
if (!tile.content)
|
|
@@ -141,7 +244,7 @@ function extractAggregationProperties(tile) {
|
|
|
141
244
|
for (const name of Object.keys(tile.content[0].properties)) {
|
|
142
245
|
let aggregation = name.split("_").pop().toLowerCase();
|
|
143
246
|
if (!validAggregations.includes(aggregation)) {
|
|
144
|
-
|
|
247
|
+
import_core2.log.warn(`No valid aggregation present in ${name} property`)();
|
|
145
248
|
aggregation = "any";
|
|
146
249
|
}
|
|
147
250
|
properties.push({ name, aggregation });
|
|
@@ -161,14 +264,6 @@ function computeAggregationStats(data, properties) {
|
|
|
161
264
|
}
|
|
162
265
|
return stats;
|
|
163
266
|
}
|
|
164
|
-
var EMPTY_UINT16ARRAY = new Uint16Array();
|
|
165
|
-
var EMPTY_BINARY_PROPS = {
|
|
166
|
-
positions: { value: new Float32Array(), size: 2 },
|
|
167
|
-
properties: [],
|
|
168
|
-
numericProps: {},
|
|
169
|
-
featureIds: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
170
|
-
globalFeatureIds: { value: EMPTY_UINT16ARRAY, size: 1 }
|
|
171
|
-
};
|
|
172
267
|
function clustersToBinary(data) {
|
|
173
268
|
const positions = new Float32Array(data.length * 2);
|
|
174
269
|
const featureIds = new Uint16Array(data.length);
|
|
@@ -177,26 +272,8 @@ function clustersToBinary(data) {
|
|
|
177
272
|
featureIds[i] = i;
|
|
178
273
|
}
|
|
179
274
|
return {
|
|
180
|
-
|
|
181
|
-
points: {
|
|
182
|
-
type: "Point",
|
|
183
|
-
positions: { value: positions, size: 2 },
|
|
184
|
-
properties: data,
|
|
185
|
-
numericProps: {},
|
|
186
|
-
featureIds: { value: featureIds, size: 1 },
|
|
187
|
-
globalFeatureIds: { value: featureIds, size: 1 }
|
|
188
|
-
},
|
|
189
|
-
lines: {
|
|
190
|
-
type: "LineString",
|
|
191
|
-
pathIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
192
|
-
...EMPTY_BINARY_PROPS
|
|
193
|
-
},
|
|
194
|
-
polygons: {
|
|
195
|
-
type: "Polygon",
|
|
196
|
-
polygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
197
|
-
primitivePolygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
198
|
-
...EMPTY_BINARY_PROPS
|
|
199
|
-
}
|
|
275
|
+
...createEmptyBinary(),
|
|
276
|
+
points: createBinaryPointFeature(positions, featureIds, featureIds, {}, data)
|
|
200
277
|
};
|
|
201
278
|
}
|
|
202
279
|
|
|
@@ -496,55 +573,6 @@ function parsePbf(buffer, TileReader5) {
|
|
|
496
573
|
return tile;
|
|
497
574
|
}
|
|
498
575
|
|
|
499
|
-
// dist/utils.js
|
|
500
|
-
var import_core2 = require("@deck.gl/core");
|
|
501
|
-
function assert(condition, message) {
|
|
502
|
-
import_core2.log.assert(condition, message);
|
|
503
|
-
}
|
|
504
|
-
function createBinaryProxy(data, index) {
|
|
505
|
-
const { properties, numericProps } = data;
|
|
506
|
-
return new Proxy(properties[index] || {}, {
|
|
507
|
-
get(target, property) {
|
|
508
|
-
if (property in numericProps) {
|
|
509
|
-
return numericProps[property].value[index];
|
|
510
|
-
}
|
|
511
|
-
return target[property];
|
|
512
|
-
},
|
|
513
|
-
has(target, property) {
|
|
514
|
-
return property in numericProps || property in target;
|
|
515
|
-
},
|
|
516
|
-
ownKeys(target) {
|
|
517
|
-
return [...Object.keys(numericProps), ...Reflect.ownKeys(target)];
|
|
518
|
-
},
|
|
519
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
520
|
-
return { enumerable: true, configurable: true };
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
function getWorkerUrl(id5, version) {
|
|
525
|
-
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id5}-worker.js`;
|
|
526
|
-
}
|
|
527
|
-
function scaleIdentity() {
|
|
528
|
-
let unknown;
|
|
529
|
-
function scale(x) {
|
|
530
|
-
return x === null ? unknown : x;
|
|
531
|
-
}
|
|
532
|
-
scale.invert = scale;
|
|
533
|
-
scale.domain = scale.range = (d) => d;
|
|
534
|
-
scale.unknown = (u) => {
|
|
535
|
-
if (u) {
|
|
536
|
-
unknown = u;
|
|
537
|
-
}
|
|
538
|
-
return unknown;
|
|
539
|
-
};
|
|
540
|
-
scale.copy = () => {
|
|
541
|
-
const scaleCopy = scaleIdentity();
|
|
542
|
-
scaleCopy.unknown(unknown);
|
|
543
|
-
return scaleCopy;
|
|
544
|
-
};
|
|
545
|
-
return scale;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
576
|
// dist/layers/schema/spatialjson-utils.js
|
|
549
577
|
var import_quadbin4 = require("quadbin");
|
|
550
578
|
function binaryToSpatialjson(binary) {
|
|
@@ -563,7 +591,7 @@ function binaryToSpatialjson(binary) {
|
|
|
563
591
|
}
|
|
564
592
|
|
|
565
593
|
// dist/layers/schema/carto-spatial-tile-loader.js
|
|
566
|
-
var VERSION = true ? "9.1.
|
|
594
|
+
var VERSION = true ? "9.1.10" : "latest";
|
|
567
595
|
var id = "cartoSpatialTile";
|
|
568
596
|
var DEFAULT_OPTIONS = {
|
|
569
597
|
cartoSpatialTile: {
|
|
@@ -599,14 +627,29 @@ var carto_spatial_tile_loader_default = CartoSpatialTileLoader;
|
|
|
599
627
|
// dist/layers/utils.js
|
|
600
628
|
var import_core3 = require("@deck.gl/core");
|
|
601
629
|
var import_core4 = require("@deck.gl/core");
|
|
602
|
-
function
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
630
|
+
function mergeLoadOptions(loadOptions, additionalOptions, depth = 0) {
|
|
631
|
+
if (!loadOptions) {
|
|
632
|
+
return additionalOptions;
|
|
633
|
+
}
|
|
634
|
+
if (!additionalOptions) {
|
|
635
|
+
return loadOptions;
|
|
636
|
+
}
|
|
637
|
+
if (depth > 10) {
|
|
638
|
+
return additionalOptions;
|
|
639
|
+
}
|
|
640
|
+
const result = { ...loadOptions };
|
|
641
|
+
for (const key in additionalOptions) {
|
|
642
|
+
const value = additionalOptions[key];
|
|
643
|
+
if (value === loadOptions || value === additionalOptions) {
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (typeof value === "object" && value !== null) {
|
|
647
|
+
result[key] = mergeLoadOptions(loadOptions[key], value, depth + 1);
|
|
648
|
+
} else {
|
|
649
|
+
result[key] = value;
|
|
650
|
+
}
|
|
609
651
|
}
|
|
652
|
+
return result;
|
|
610
653
|
}
|
|
611
654
|
function mergeBoundaryData(geometry, properties) {
|
|
612
655
|
const mapping = {};
|
|
@@ -754,11 +797,11 @@ ClusterGeoJsonLayer.layerName = "ClusterGeoJsonLayer";
|
|
|
754
797
|
ClusterGeoJsonLayer.defaultProps = defaultProps;
|
|
755
798
|
var ClusterTileLayer = class extends import_core6.CompositeLayer {
|
|
756
799
|
getLoadOptions() {
|
|
757
|
-
const loadOptions = super.getLoadOptions() || {};
|
|
758
800
|
const tileJSON = this.props.data;
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
801
|
+
return mergeLoadOptions(super.getLoadOptions(), {
|
|
802
|
+
fetch: { headers: { Authorization: `Bearer ${tileJSON.accessToken}` } },
|
|
803
|
+
cartoSpatialTile: { scheme: "quadbin" }
|
|
804
|
+
});
|
|
762
805
|
}
|
|
763
806
|
renderLayers() {
|
|
764
807
|
const tileJSON = this.props.data;
|
|
@@ -976,11 +1019,11 @@ var H3TileLayer = class extends import_core8.CompositeLayer {
|
|
|
976
1019
|
import_geo_layers5.H3HexagonLayer._checkH3Lib();
|
|
977
1020
|
}
|
|
978
1021
|
getLoadOptions() {
|
|
979
|
-
const loadOptions = super.getLoadOptions() || {};
|
|
980
1022
|
const tileJSON = this.props.data;
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1023
|
+
return mergeLoadOptions(super.getLoadOptions(), {
|
|
1024
|
+
fetch: { headers: { Authorization: `Bearer ${tileJSON.accessToken}` } },
|
|
1025
|
+
cartoSpatialTile: { scheme: "h3" }
|
|
1026
|
+
});
|
|
984
1027
|
}
|
|
985
1028
|
renderLayers() {
|
|
986
1029
|
const tileJSON = this.props.data;
|
|
@@ -1316,11 +1359,11 @@ var defaultProps5 = {
|
|
|
1316
1359
|
};
|
|
1317
1360
|
var QuadbinTileLayer = class extends import_core10.CompositeLayer {
|
|
1318
1361
|
getLoadOptions() {
|
|
1319
|
-
const loadOptions = super.getLoadOptions() || {};
|
|
1320
1362
|
const tileJSON = this.props.data;
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1363
|
+
return mergeLoadOptions(super.getLoadOptions(), {
|
|
1364
|
+
fetch: { headers: { Authorization: `Bearer ${tileJSON.accessToken}` } },
|
|
1365
|
+
cartoSpatialTile: { scheme: "quadbin" }
|
|
1366
|
+
});
|
|
1324
1367
|
}
|
|
1325
1368
|
renderLayers() {
|
|
1326
1369
|
const tileJSON = this.props.data;
|
|
@@ -1476,7 +1519,9 @@ var HeatmapTileLayer = class extends import_core11.CompositeLayer {
|
|
|
1476
1519
|
};
|
|
1477
1520
|
let tileZ = 0;
|
|
1478
1521
|
let maxDensity = 0;
|
|
1479
|
-
const
|
|
1522
|
+
const loadedTiles = [...this.state.tiles].filter((t) => t.content);
|
|
1523
|
+
const visibleTiles = loadedTiles.filter((t) => t.isVisible);
|
|
1524
|
+
const tiles = visibleTiles.length ? visibleTiles : loadedTiles;
|
|
1480
1525
|
for (const tile of tiles) {
|
|
1481
1526
|
const cell = tile.content[0];
|
|
1482
1527
|
const unitDensity = unitDensityForCell(cell.id);
|
|
@@ -1638,7 +1683,12 @@ var PointLabelLayer = class extends import_core12.CompositeLayer {
|
|
|
1638
1683
|
return backgroundPadding;
|
|
1639
1684
|
}
|
|
1640
1685
|
renderTextLayer(id5, { updateTriggers: updateTriggersOverride = {}, ...props }) {
|
|
1686
|
+
var _a, _b;
|
|
1641
1687
|
const { data, characterSet, fontFamily, fontSettings, fontWeight, outlineColor, outlineWidth, sizeScale, radiusScale, getAlignmentBaseline, getColor, getPosition, getTextAnchor, updateTriggers } = this.props;
|
|
1688
|
+
if (sizeScale < 2) {
|
|
1689
|
+
const propName = ((_b = (_a = this.parent) == null ? void 0 : _a.props) == null ? void 0 : _b.textSizeScale) ? "textSizeScale" : "sizeScale";
|
|
1690
|
+
import_core12.log.warn(`${propName} has small value (${sizeScale}). Note getTextSize is not supported on PointLabelLayer`)();
|
|
1691
|
+
}
|
|
1642
1692
|
return new EnhancedTextLayer(this.getSubLayerProps({
|
|
1643
1693
|
id: id5,
|
|
1644
1694
|
data,
|
|
@@ -1952,7 +2002,7 @@ var TileReader3 = class {
|
|
|
1952
2002
|
};
|
|
1953
2003
|
|
|
1954
2004
|
// dist/layers/schema/carto-raster-tile-loader.js
|
|
1955
|
-
var VERSION2 = true ? "9.1.
|
|
2005
|
+
var VERSION2 = true ? "9.1.10" : "latest";
|
|
1956
2006
|
var id2 = "cartoRasterTile";
|
|
1957
2007
|
var DEFAULT_OPTIONS2 = {
|
|
1958
2008
|
cartoRasterTile: {
|
|
@@ -2014,10 +2064,10 @@ var PostProcessTileLayer = class extends PostProcessModifier(import_geo_layers7.
|
|
|
2014
2064
|
};
|
|
2015
2065
|
var RasterTileLayer = class extends import_core14.CompositeLayer {
|
|
2016
2066
|
getLoadOptions() {
|
|
2017
|
-
const loadOptions = super.getLoadOptions() || {};
|
|
2018
2067
|
const tileJSON = this.props.data;
|
|
2019
|
-
|
|
2020
|
-
|
|
2068
|
+
return mergeLoadOptions(super.getLoadOptions(), {
|
|
2069
|
+
fetch: { headers: { Authorization: `Bearer ${tileJSON.accessToken}` } }
|
|
2070
|
+
});
|
|
2021
2071
|
}
|
|
2022
2072
|
renderLayers() {
|
|
2023
2073
|
const tileJSON = this.props.data;
|
|
@@ -2025,6 +2075,7 @@ var RasterTileLayer = class extends import_core14.CompositeLayer {
|
|
|
2025
2075
|
return null;
|
|
2026
2076
|
const { tiles: data, minzoom: minZoom, maxzoom: maxZoom, raster_metadata: metadata } = tileJSON;
|
|
2027
2077
|
const SubLayerClass = this.getSubLayerClass("tile", PostProcessTileLayer);
|
|
2078
|
+
const loadOptions = this.getLoadOptions();
|
|
2028
2079
|
return new SubLayerClass(this.props, {
|
|
2029
2080
|
id: `raster-tile-layer-${this.props.id}`,
|
|
2030
2081
|
data,
|
|
@@ -2034,8 +2085,8 @@ var RasterTileLayer = class extends import_core14.CompositeLayer {
|
|
|
2034
2085
|
minZoom,
|
|
2035
2086
|
maxZoom,
|
|
2036
2087
|
loadOptions: {
|
|
2037
|
-
|
|
2038
|
-
...
|
|
2088
|
+
...loadOptions,
|
|
2089
|
+
cartoRasterTile: { ...loadOptions == null ? void 0 : loadOptions.cartoRasterTile, metadata }
|
|
2039
2090
|
}
|
|
2040
2091
|
});
|
|
2041
2092
|
}
|
|
@@ -2063,7 +2114,7 @@ var TileReader4 = class {
|
|
|
2063
2114
|
};
|
|
2064
2115
|
|
|
2065
2116
|
// dist/layers/schema/carto-properties-tile-loader.js
|
|
2066
|
-
var VERSION3 = true ? "9.1.
|
|
2117
|
+
var VERSION3 = true ? "9.1.10" : "latest";
|
|
2067
2118
|
var id3 = "cartoPropertiesTile";
|
|
2068
2119
|
var DEFAULT_OPTIONS3 = {
|
|
2069
2120
|
cartoPropertiesTile: {
|
|
@@ -2092,7 +2143,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
|
|
|
2092
2143
|
|
|
2093
2144
|
// dist/layers/schema/carto-vector-tile-loader.js
|
|
2094
2145
|
var import_earcut = __toESM(require("earcut"), 1);
|
|
2095
|
-
var VERSION4 = true ? "9.1.
|
|
2146
|
+
var VERSION4 = true ? "9.1.10" : "latest";
|
|
2096
2147
|
var id4 = "cartoVectorTile";
|
|
2097
2148
|
var DEFAULT_OPTIONS4 = {
|
|
2098
2149
|
cartoVectorTile: {
|
|
@@ -2152,9 +2203,209 @@ var carto_vector_tile_loader_default = CartoVectorTileLoader;
|
|
|
2152
2203
|
var import_extensions = require("@deck.gl/extensions");
|
|
2153
2204
|
var import_geo_layers8 = require("@deck.gl/geo-layers");
|
|
2154
2205
|
var import_layers5 = require("@deck.gl/layers");
|
|
2206
|
+
|
|
2207
|
+
// dist/layers/label-utils.js
|
|
2208
|
+
function createPointsFromLines(lines, uniqueIdProperty) {
|
|
2209
|
+
const hasNumericUniqueId = uniqueIdProperty ? uniqueIdProperty in lines.numericProps : false;
|
|
2210
|
+
const idToLineInfo = /* @__PURE__ */ new Map();
|
|
2211
|
+
for (let i = 0; i < lines.pathIndices.value.length - 1; i++) {
|
|
2212
|
+
const pathIndex = lines.pathIndices.value[i];
|
|
2213
|
+
const featureId = lines.featureIds.value[pathIndex];
|
|
2214
|
+
let uniqueId;
|
|
2215
|
+
if (uniqueIdProperty === void 0) {
|
|
2216
|
+
uniqueId = featureId;
|
|
2217
|
+
} else if (hasNumericUniqueId) {
|
|
2218
|
+
uniqueId = lines.numericProps[uniqueIdProperty].value[pathIndex];
|
|
2219
|
+
} else if (lines.properties[featureId] && uniqueIdProperty in lines.properties[featureId]) {
|
|
2220
|
+
uniqueId = lines.properties[featureId][uniqueIdProperty];
|
|
2221
|
+
} else {
|
|
2222
|
+
uniqueId = void 0;
|
|
2223
|
+
}
|
|
2224
|
+
const length = getLineLength(lines, i);
|
|
2225
|
+
if (!idToLineInfo.has(uniqueId) || length > idToLineInfo.get(uniqueId).length) {
|
|
2226
|
+
idToLineInfo.set(uniqueId, { index: i, length });
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
const positions = [];
|
|
2230
|
+
const properties = [];
|
|
2231
|
+
const featureIds = [];
|
|
2232
|
+
const globalFeatureIds = [];
|
|
2233
|
+
const numericProps = initializeNumericProps(idToLineInfo.size, lines.numericProps);
|
|
2234
|
+
let pointIndex = 0;
|
|
2235
|
+
for (const [_, { index }] of idToLineInfo) {
|
|
2236
|
+
const midpoint = getLineMidpoint(lines, index);
|
|
2237
|
+
positions.push(...midpoint);
|
|
2238
|
+
const pathIndex = lines.pathIndices.value[index];
|
|
2239
|
+
const featureId = lines.featureIds.value[pathIndex];
|
|
2240
|
+
featureIds.push(pointIndex);
|
|
2241
|
+
properties.push(lines.properties[featureId]);
|
|
2242
|
+
globalFeatureIds.push(lines.globalFeatureIds.value[pathIndex]);
|
|
2243
|
+
copyNumericProps(lines.numericProps, numericProps, pathIndex, pointIndex);
|
|
2244
|
+
pointIndex++;
|
|
2245
|
+
}
|
|
2246
|
+
return createBinaryPointFeature(positions, featureIds, globalFeatureIds, numericProps, properties);
|
|
2247
|
+
}
|
|
2248
|
+
function createPointsFromPolygons(polygons, tileBbox, props) {
|
|
2249
|
+
const { west, south, east, north } = tileBbox;
|
|
2250
|
+
const tileArea = (east - west) * (north - south);
|
|
2251
|
+
const minPolygonArea = tileArea * 1e-4;
|
|
2252
|
+
const positions = [];
|
|
2253
|
+
const properties = [];
|
|
2254
|
+
const featureIds = [];
|
|
2255
|
+
const globalFeatureIds = [];
|
|
2256
|
+
const numericProps = initializeNumericProps(polygons.polygonIndices.value.length - 1, polygons.numericProps);
|
|
2257
|
+
let pointIndex = 0;
|
|
2258
|
+
let triangleIndex = 0;
|
|
2259
|
+
const { extruded } = props;
|
|
2260
|
+
for (let i = 0; i < polygons.polygonIndices.value.length - 1; i++) {
|
|
2261
|
+
const startIndex = polygons.polygonIndices.value[i];
|
|
2262
|
+
const endIndex = polygons.polygonIndices.value[i + 1];
|
|
2263
|
+
if (getPolygonArea(polygons, i) < minPolygonArea) {
|
|
2264
|
+
continue;
|
|
2265
|
+
}
|
|
2266
|
+
const centroid = getPolygonCentroid(polygons, i);
|
|
2267
|
+
let maxArea = -1;
|
|
2268
|
+
let largestTriangleCenter = [0, 0];
|
|
2269
|
+
let centroidIsInside = false;
|
|
2270
|
+
while (triangleIndex < polygons.triangles.value.length) {
|
|
2271
|
+
const i1 = polygons.triangles.value[triangleIndex];
|
|
2272
|
+
if (i1 >= endIndex) {
|
|
2273
|
+
break;
|
|
2274
|
+
}
|
|
2275
|
+
if (centroidIsInside) {
|
|
2276
|
+
triangleIndex += 3;
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2279
|
+
const i2 = polygons.triangles.value[triangleIndex + 1];
|
|
2280
|
+
const i3 = polygons.triangles.value[triangleIndex + 2];
|
|
2281
|
+
const v1 = polygons.positions.value.subarray(i1 * polygons.positions.size, i1 * polygons.positions.size + polygons.positions.size);
|
|
2282
|
+
const v2 = polygons.positions.value.subarray(i2 * polygons.positions.size, i2 * polygons.positions.size + polygons.positions.size);
|
|
2283
|
+
const v3 = polygons.positions.value.subarray(i3 * polygons.positions.size, i3 * polygons.positions.size + polygons.positions.size);
|
|
2284
|
+
if (isPointInTriangle(centroid, v1, v2, v3)) {
|
|
2285
|
+
centroidIsInside = true;
|
|
2286
|
+
} else {
|
|
2287
|
+
const area = getTriangleArea(v1, v2, v3);
|
|
2288
|
+
if (area > maxArea) {
|
|
2289
|
+
maxArea = area;
|
|
2290
|
+
largestTriangleCenter = [(v1[0] + v2[0] + v3[0]) / 3, (v1[1] + v2[1] + v3[1]) / 3];
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
triangleIndex += 3;
|
|
2294
|
+
}
|
|
2295
|
+
const labelPoint = centroidIsInside ? centroid : largestTriangleCenter;
|
|
2296
|
+
if (isPointInBounds(labelPoint, tileBbox)) {
|
|
2297
|
+
positions.push(...labelPoint);
|
|
2298
|
+
const featureId = polygons.featureIds.value[startIndex];
|
|
2299
|
+
if (extruded) {
|
|
2300
|
+
const elevation = props.getElevation(void 0, {
|
|
2301
|
+
data: polygons,
|
|
2302
|
+
index: featureId
|
|
2303
|
+
});
|
|
2304
|
+
positions.push(elevation * props.elevationScale);
|
|
2305
|
+
}
|
|
2306
|
+
properties.push(polygons.properties[featureId]);
|
|
2307
|
+
featureIds.push(pointIndex);
|
|
2308
|
+
globalFeatureIds.push(polygons.globalFeatureIds.value[startIndex]);
|
|
2309
|
+
copyNumericProps(polygons.numericProps, numericProps, startIndex, pointIndex);
|
|
2310
|
+
pointIndex++;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
if (polygons.numericProps) {
|
|
2314
|
+
Object.keys(numericProps).forEach((prop) => {
|
|
2315
|
+
numericProps[prop].value = numericProps[prop].value.slice(0, pointIndex);
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
return createBinaryPointFeature(positions, featureIds, globalFeatureIds, numericProps, properties, extruded ? 3 : 2);
|
|
2319
|
+
}
|
|
2320
|
+
function getPolygonArea(polygons, index) {
|
|
2321
|
+
const { positions: { value: positions, size }, polygonIndices: { value: indices }, triangles: { value: triangles } } = polygons;
|
|
2322
|
+
const startIndex = indices[index];
|
|
2323
|
+
const endIndex = indices[index + 1];
|
|
2324
|
+
let area = 0;
|
|
2325
|
+
let triangleIndex = 0;
|
|
2326
|
+
while (triangleIndex < triangles.length) {
|
|
2327
|
+
const i1 = triangles[triangleIndex];
|
|
2328
|
+
if (i1 >= startIndex)
|
|
2329
|
+
break;
|
|
2330
|
+
triangleIndex += 3;
|
|
2331
|
+
}
|
|
2332
|
+
while (triangleIndex < triangles.length) {
|
|
2333
|
+
const i1 = triangles[triangleIndex];
|
|
2334
|
+
if (i1 >= endIndex)
|
|
2335
|
+
break;
|
|
2336
|
+
const i2 = triangles[triangleIndex + 1];
|
|
2337
|
+
const i3 = triangles[triangleIndex + 2];
|
|
2338
|
+
const v1 = positions.subarray(i1 * size, i1 * size + size);
|
|
2339
|
+
const v2 = positions.subarray(i2 * size, i2 * size + size);
|
|
2340
|
+
const v3 = positions.subarray(i3 * size, i3 * size + size);
|
|
2341
|
+
area += getTriangleArea(v1, v2, v3);
|
|
2342
|
+
triangleIndex += 3;
|
|
2343
|
+
}
|
|
2344
|
+
return area;
|
|
2345
|
+
}
|
|
2346
|
+
function isPointInBounds([x, y], { west, east, south, north }) {
|
|
2347
|
+
return x >= west && x < east && y >= south && y < north;
|
|
2348
|
+
}
|
|
2349
|
+
function isPointInTriangle(p, v1, v2, v3) {
|
|
2350
|
+
const area = Math.abs((v2[0] - v1[0]) * (v3[1] - v1[1]) - (v3[0] - v1[0]) * (v2[1] - v1[1])) / 2;
|
|
2351
|
+
const area1 = Math.abs((v1[0] - p[0]) * (v2[1] - p[1]) - (v2[0] - p[0]) * (v1[1] - p[1])) / 2;
|
|
2352
|
+
const area2 = Math.abs((v2[0] - p[0]) * (v3[1] - p[1]) - (v3[0] - p[0]) * (v2[1] - p[1])) / 2;
|
|
2353
|
+
const area3 = Math.abs((v3[0] - p[0]) * (v1[1] - p[1]) - (v1[0] - p[0]) * (v3[1] - p[1])) / 2;
|
|
2354
|
+
return Math.abs(area - (area1 + area2 + area3)) < 1e-10;
|
|
2355
|
+
}
|
|
2356
|
+
function getTriangleArea([x1, y1], [x2, y2], [x3, y3]) {
|
|
2357
|
+
return Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2);
|
|
2358
|
+
}
|
|
2359
|
+
function getPolygonCentroid(polygons, index) {
|
|
2360
|
+
const { positions: { value: positions, size } } = polygons;
|
|
2361
|
+
const startIndex = size * polygons.polygonIndices.value[index];
|
|
2362
|
+
const endIndex = size * polygons.polygonIndices.value[index + 1];
|
|
2363
|
+
let minX = Infinity;
|
|
2364
|
+
let minY = Infinity;
|
|
2365
|
+
let maxX = -Infinity;
|
|
2366
|
+
let maxY = -Infinity;
|
|
2367
|
+
for (let i = startIndex; i < endIndex; i += size) {
|
|
2368
|
+
const [x, y] = positions.subarray(i, i + 2);
|
|
2369
|
+
minX = Math.min(minX, x);
|
|
2370
|
+
minY = Math.min(minY, y);
|
|
2371
|
+
maxX = Math.max(maxX, x);
|
|
2372
|
+
maxY = Math.max(maxY, y);
|
|
2373
|
+
}
|
|
2374
|
+
return [(minX + maxX) / 2, (minY + maxY) / 2];
|
|
2375
|
+
}
|
|
2376
|
+
function getSegmentLength(lines, index) {
|
|
2377
|
+
const { positions: { value } } = lines;
|
|
2378
|
+
const [x1, y1, x2, y2] = value.subarray(index, index + 4);
|
|
2379
|
+
return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
|
|
2380
|
+
}
|
|
2381
|
+
function getLineLength(lines, index) {
|
|
2382
|
+
const { positions: { size } } = lines;
|
|
2383
|
+
const startIndex = size * lines.pathIndices.value[index];
|
|
2384
|
+
const endIndex = size * lines.pathIndices.value[index + 1];
|
|
2385
|
+
let length = 0;
|
|
2386
|
+
for (let j = startIndex; j < endIndex; j += size) {
|
|
2387
|
+
length += getSegmentLength(lines, j);
|
|
2388
|
+
}
|
|
2389
|
+
return length;
|
|
2390
|
+
}
|
|
2391
|
+
function getLineMidpoint(lines, index) {
|
|
2392
|
+
const { positions: { value: positions }, pathIndices: { value: pathIndices } } = lines;
|
|
2393
|
+
const startIndex = pathIndices[index] * 2;
|
|
2394
|
+
const endIndex = pathIndices[index + 1] * 2;
|
|
2395
|
+
const numPoints = (endIndex - startIndex) / 2;
|
|
2396
|
+
if (numPoints === 2) {
|
|
2397
|
+
const [x1, y1, x2, y2] = positions.subarray(startIndex, startIndex + 4);
|
|
2398
|
+
return [(x1 + x2) / 2, (y1 + y2) / 2];
|
|
2399
|
+
}
|
|
2400
|
+
const midPointIndex = startIndex + Math.floor(numPoints / 2) * 2;
|
|
2401
|
+
return [positions[midPointIndex], positions[midPointIndex + 1]];
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
// dist/layers/vector-tile-layer.js
|
|
2155
2405
|
(0, import_core16.registerLoaders)([carto_properties_tile_loader_default, carto_vector_tile_loader_default]);
|
|
2156
2406
|
var defaultProps10 = {
|
|
2157
2407
|
...import_geo_layers8.MVTLayer.defaultProps,
|
|
2408
|
+
autoLabels: false,
|
|
2158
2409
|
data: TilejsonPropType,
|
|
2159
2410
|
dataComparator: TilejsonPropType.equal,
|
|
2160
2411
|
tileSize: DEFAULT_TILE_SIZE
|
|
@@ -2177,11 +2428,12 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2177
2428
|
}
|
|
2178
2429
|
}
|
|
2179
2430
|
getLoadOptions() {
|
|
2180
|
-
const loadOptions = super.getLoadOptions() || {};
|
|
2181
2431
|
const tileJSON = this.props.data;
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2432
|
+
return mergeLoadOptions(super.getLoadOptions(), {
|
|
2433
|
+
fetch: { headers: { Authorization: `Bearer ${tileJSON.accessToken}` } },
|
|
2434
|
+
gis: { format: "binary" }
|
|
2435
|
+
// Use binary for MVT loading
|
|
2436
|
+
});
|
|
2185
2437
|
}
|
|
2186
2438
|
/* eslint-disable camelcase */
|
|
2187
2439
|
async getTileData(tile) {
|
|
@@ -2219,25 +2471,8 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2219
2471
|
if (props.data === null) {
|
|
2220
2472
|
return null;
|
|
2221
2473
|
}
|
|
2222
|
-
if (this.state.mvt) {
|
|
2223
|
-
return super.renderSubLayers(props);
|
|
2224
|
-
}
|
|
2225
2474
|
const tileBbox = props.tile.bbox;
|
|
2226
|
-
const
|
|
2227
|
-
const extensions = [new import_extensions.ClipExtension(), ...props.extensions || []];
|
|
2228
|
-
const clipProps = {
|
|
2229
|
-
clipBounds: [west, south, east, north]
|
|
2230
|
-
};
|
|
2231
|
-
const applyClipExtensionToSublayerProps = (subLayerId) => {
|
|
2232
|
-
var _a2, _b2, _c2;
|
|
2233
|
-
return {
|
|
2234
|
-
[subLayerId]: {
|
|
2235
|
-
...clipProps,
|
|
2236
|
-
...(_a2 = props == null ? void 0 : props._subLayerProps) == null ? void 0 : _a2[subLayerId],
|
|
2237
|
-
extensions: [...extensions, ...((_c2 = (_b2 = props == null ? void 0 : props._subLayerProps) == null ? void 0 : _b2[subLayerId]) == null ? void 0 : _c2.extensions) || []]
|
|
2238
|
-
}
|
|
2239
|
-
};
|
|
2240
|
-
};
|
|
2475
|
+
const subLayers = [];
|
|
2241
2476
|
const defaultToPointLabelLayer = {
|
|
2242
2477
|
"points-text": {
|
|
2243
2478
|
type: point_label_layer_default,
|
|
@@ -2249,20 +2484,72 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2249
2484
|
]
|
|
2250
2485
|
}
|
|
2251
2486
|
};
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2487
|
+
if (this.state.mvt) {
|
|
2488
|
+
subLayers.push(super.renderSubLayers(props));
|
|
2489
|
+
} else {
|
|
2490
|
+
const { west, south, east, north } = tileBbox;
|
|
2491
|
+
const extensions = [new import_extensions.ClipExtension(), ...props.extensions || []];
|
|
2492
|
+
const clipProps = {
|
|
2493
|
+
clipBounds: [west, south, east, north]
|
|
2494
|
+
};
|
|
2495
|
+
const applyClipExtensionToSublayerProps = (subLayerId) => {
|
|
2496
|
+
var _a2, _b2, _c2;
|
|
2497
|
+
return {
|
|
2498
|
+
[subLayerId]: {
|
|
2499
|
+
...clipProps,
|
|
2500
|
+
...(_a2 = props == null ? void 0 : props._subLayerProps) == null ? void 0 : _a2[subLayerId],
|
|
2501
|
+
extensions: [...extensions, ...((_c2 = (_b2 = props == null ? void 0 : props._subLayerProps) == null ? void 0 : _b2[subLayerId]) == null ? void 0 : _c2.extensions) || []]
|
|
2502
|
+
}
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
const subLayerProps = {
|
|
2506
|
+
...props,
|
|
2507
|
+
data: { ...props.data, tileBbox },
|
|
2508
|
+
autoHighlight: false,
|
|
2509
|
+
// Do not perform clipping on points (#9059)
|
|
2510
|
+
_subLayerProps: {
|
|
2511
|
+
...props._subLayerProps,
|
|
2512
|
+
...defaultToPointLabelLayer,
|
|
2513
|
+
...applyClipExtensionToSublayerProps("polygons-fill"),
|
|
2514
|
+
...applyClipExtensionToSublayerProps("polygons-stroke"),
|
|
2515
|
+
...applyClipExtensionToSublayerProps("linestrings")
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
subLayers.push(new import_layers5.GeoJsonLayer(subLayerProps));
|
|
2519
|
+
}
|
|
2520
|
+
if (subLayers[0] && props.autoLabels) {
|
|
2521
|
+
const labelData = createEmptyBinary();
|
|
2522
|
+
if (props.data.lines && props.data.lines.positions.value.length > 0) {
|
|
2523
|
+
labelData.points = createPointsFromLines(props.data.lines, typeof props.autoLabels === "object" ? props.autoLabels.uniqueIdProperty : void 0);
|
|
2262
2524
|
}
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2525
|
+
if (props.data.polygons && props.data.polygons.positions.value.length > 0) {
|
|
2526
|
+
labelData.points = createPointsFromPolygons(props.data.polygons, tileBbox, props);
|
|
2527
|
+
}
|
|
2528
|
+
subLayers.push(subLayers[0].clone({
|
|
2529
|
+
id: `${props.id}-labels`,
|
|
2530
|
+
data: labelData,
|
|
2531
|
+
pickable: false,
|
|
2532
|
+
autoHighlight: false
|
|
2533
|
+
}));
|
|
2534
|
+
}
|
|
2535
|
+
return subLayers;
|
|
2536
|
+
}
|
|
2537
|
+
renderLayers() {
|
|
2538
|
+
const layers = super.renderLayers();
|
|
2539
|
+
if (!this.props.autoLabels) {
|
|
2540
|
+
return layers;
|
|
2541
|
+
}
|
|
2542
|
+
const validLayers = layers.flat().filter(Boolean);
|
|
2543
|
+
validLayers.sort((a, b) => {
|
|
2544
|
+
const aHasLabel = a.id.includes("labels");
|
|
2545
|
+
const bHasLabel = b.id.includes("labels");
|
|
2546
|
+
if (aHasLabel && !bHasLabel)
|
|
2547
|
+
return 1;
|
|
2548
|
+
if (!aHasLabel && bHasLabel)
|
|
2549
|
+
return -1;
|
|
2550
|
+
return 0;
|
|
2551
|
+
});
|
|
2552
|
+
return validLayers.map((l) => l.id.includes("labels") ? l.clone({ highlightedObjectIndex: -1 }) : l);
|
|
2266
2553
|
}
|
|
2267
2554
|
_isWGS84() {
|
|
2268
2555
|
if (this.state.mvt)
|