maplibre-gl-lidar 0.8.2 → 0.9.0
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/{LidarLayerAdapter-C0rGIs_X.js → LidarLayerAdapter-DRPnT64H.js} +34 -13
- package/dist/{LidarLayerAdapter-C0rGIs_X.js.map → LidarLayerAdapter-DRPnT64H.js.map} +1 -1
- package/dist/{LidarLayerAdapter-BLZfG-we.cjs → LidarLayerAdapter-nVPsBo8n.cjs} +34 -13
- package/dist/{LidarLayerAdapter-BLZfG-we.cjs.map → LidarLayerAdapter-nVPsBo8n.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +2 -2
- package/dist/types/lib/core/LidarControl.d.ts +1 -0
- package/dist/types/lib/core/LidarControl.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -40929,6 +40929,8 @@ class LidarControl {
|
|
|
40929
40929
|
__publicField(this, "_viewportManagers", /* @__PURE__ */ new Map());
|
|
40930
40930
|
__publicField(this, "_eptViewportRequestIds", /* @__PURE__ */ new Map());
|
|
40931
40931
|
__publicField(this, "_eptLastViewport", /* @__PURE__ */ new Map());
|
|
40932
|
+
// Track whether the user has explicitly set zOffset (to skip autoZOffset)
|
|
40933
|
+
__publicField(this, "_manualZOffset", false);
|
|
40932
40934
|
// Metadata and cross-section components
|
|
40933
40935
|
__publicField(this, "_metadataPanel");
|
|
40934
40936
|
__publicField(this, "_fullMetadata", /* @__PURE__ */ new Map());
|
|
@@ -40967,6 +40969,9 @@ class LidarControl {
|
|
|
40967
40969
|
terrainEnabled: this._options.terrainEnabled ?? false
|
|
40968
40970
|
};
|
|
40969
40971
|
this._loader = new PointCloudLoader();
|
|
40972
|
+
if ((options == null ? void 0 : options.zOffset) !== void 0 || (options == null ? void 0 : options.zOffsetEnabled) !== void 0) {
|
|
40973
|
+
this._manualZOffset = true;
|
|
40974
|
+
}
|
|
40970
40975
|
}
|
|
40971
40976
|
/**
|
|
40972
40977
|
* Called when the control is added to the map.
|
|
@@ -41148,7 +41153,7 @@ class LidarControl {
|
|
|
41148
41153
|
* @returns Promise resolving to the point cloud info
|
|
41149
41154
|
*/
|
|
41150
41155
|
async loadPointCloud(source, options) {
|
|
41151
|
-
var _a, _b, _c, _d;
|
|
41156
|
+
var _a, _b, _c, _d, _e;
|
|
41152
41157
|
const isEptUrl = typeof source === "string" && (source.endsWith("/ept.json") || source.includes("/ept.json?"));
|
|
41153
41158
|
if (isEptUrl) {
|
|
41154
41159
|
return this.loadPointCloudEptStreaming(source);
|
|
@@ -41182,7 +41187,7 @@ class LidarControl {
|
|
|
41182
41187
|
let zOffsetBase;
|
|
41183
41188
|
let zOffset;
|
|
41184
41189
|
let zOffsetEnabled = this._state.zOffsetEnabled;
|
|
41185
|
-
if (this._options.autoZOffset && data.positions && data.pointCount > 0) {
|
|
41190
|
+
if (this._options.autoZOffset && !this._manualZOffset && data.positions && data.pointCount > 0) {
|
|
41186
41191
|
const zValues = new Float32Array(data.pointCount);
|
|
41187
41192
|
for (let i = 0; i < data.pointCount; i++) {
|
|
41188
41193
|
zValues[i] = data.positions[i * 3 + 2] ?? 0;
|
|
@@ -41193,6 +41198,11 @@ class LidarControl {
|
|
|
41193
41198
|
zOffsetEnabled = true;
|
|
41194
41199
|
(_b = this._pointCloudManager) == null ? void 0 : _b.setZOffset(zOffset);
|
|
41195
41200
|
console.log(`Auto Z offset applied: zOffsetBase=${zOffsetBase.toFixed(1)}, zOffset=${zOffset.toFixed(1)}, enabled=${zOffsetEnabled}`);
|
|
41201
|
+
} else if (this._manualZOffset) {
|
|
41202
|
+
(_c = this._pointCloudManager) == null ? void 0 : _c.setZOffset(this._state.zOffset);
|
|
41203
|
+
zOffset = this._state.zOffset;
|
|
41204
|
+
zOffsetEnabled = this._state.zOffsetEnabled;
|
|
41205
|
+
console.log(`Manual Z offset applied: zOffset=${zOffset}, enabled=${zOffsetEnabled}`);
|
|
41196
41206
|
} else {
|
|
41197
41207
|
console.log("Auto Z offset skipped - conditions not met");
|
|
41198
41208
|
}
|
|
@@ -41224,7 +41234,7 @@ class LidarControl {
|
|
|
41224
41234
|
zOffsetEnabled
|
|
41225
41235
|
});
|
|
41226
41236
|
this._updateComputedColorBounds();
|
|
41227
|
-
(
|
|
41237
|
+
(_d = this._panelBuilder) == null ? void 0 : _d.updateState(this._state);
|
|
41228
41238
|
this._emitWithData("load", { pointCloud: info2 });
|
|
41229
41239
|
if (this._options.autoZoom) {
|
|
41230
41240
|
this.flyToPointCloud(id);
|
|
@@ -41238,7 +41248,7 @@ class LidarControl {
|
|
|
41238
41248
|
console.warn(
|
|
41239
41249
|
`CORS error detected for ${source}. Falling back to download mode...`
|
|
41240
41250
|
);
|
|
41241
|
-
(
|
|
41251
|
+
(_e = this._panelBuilder) == null ? void 0 : _e.updateLoadingProgress(5, "CORS blocked - downloading file...");
|
|
41242
41252
|
return this._loadPointCloudFullDownload(source);
|
|
41243
41253
|
}
|
|
41244
41254
|
this.setState({
|
|
@@ -41322,9 +41332,9 @@ class LidarControl {
|
|
|
41322
41332
|
(_b = this._panelBuilder) == null ? void 0 : _b.updateLoadingProgress(20, "Setting up streaming...");
|
|
41323
41333
|
let autoZOffsetApplied = false;
|
|
41324
41334
|
streamingLoader.setOnPointsLoaded((data) => {
|
|
41325
|
-
var _a2, _b2;
|
|
41335
|
+
var _a2, _b2, _c2;
|
|
41326
41336
|
(_a2 = this._pointCloudManager) == null ? void 0 : _a2.updatePointCloud(id, data);
|
|
41327
|
-
if (this._options.autoZOffset && !autoZOffsetApplied && data.bounds) {
|
|
41337
|
+
if (this._options.autoZOffset && !this._manualZOffset && !autoZOffsetApplied && data.bounds) {
|
|
41328
41338
|
const zOffsetBase = data.bounds.minZ;
|
|
41329
41339
|
const zOffset = -zOffsetBase;
|
|
41330
41340
|
(_b2 = this._pointCloudManager) == null ? void 0 : _b2.setZOffset(zOffset);
|
|
@@ -41335,6 +41345,9 @@ class LidarControl {
|
|
|
41335
41345
|
zOffsetEnabled: true
|
|
41336
41346
|
});
|
|
41337
41347
|
autoZOffsetApplied = true;
|
|
41348
|
+
} else if (this._manualZOffset && !autoZOffsetApplied) {
|
|
41349
|
+
(_c2 = this._pointCloudManager) == null ? void 0 : _c2.setZOffset(this._state.zOffset);
|
|
41350
|
+
autoZOffsetApplied = true;
|
|
41338
41351
|
}
|
|
41339
41352
|
const newClassifications = getAvailableClassifications(data);
|
|
41340
41353
|
if (newClassifications.size > 0) {
|
|
@@ -41488,9 +41501,9 @@ class LidarControl {
|
|
|
41488
41501
|
(_b = this._panelBuilder) == null ? void 0 : _b.updateLoadingProgress(20, "Setting up streaming...");
|
|
41489
41502
|
let autoZOffsetApplied = false;
|
|
41490
41503
|
eptLoader.setOnPointsLoaded((data) => {
|
|
41491
|
-
var _a2, _b2;
|
|
41504
|
+
var _a2, _b2, _c2;
|
|
41492
41505
|
(_a2 = this._pointCloudManager) == null ? void 0 : _a2.updatePointCloud(id, data);
|
|
41493
|
-
if (this._options.autoZOffset && !autoZOffsetApplied && data.bounds) {
|
|
41506
|
+
if (this._options.autoZOffset && !this._manualZOffset && !autoZOffsetApplied && data.bounds) {
|
|
41494
41507
|
const zOffsetBase = data.bounds.minZ;
|
|
41495
41508
|
const zOffset = -zOffsetBase;
|
|
41496
41509
|
(_b2 = this._pointCloudManager) == null ? void 0 : _b2.setZOffset(zOffset);
|
|
@@ -41501,6 +41514,9 @@ class LidarControl {
|
|
|
41501
41514
|
zOffsetEnabled: true
|
|
41502
41515
|
});
|
|
41503
41516
|
autoZOffsetApplied = true;
|
|
41517
|
+
} else if (this._manualZOffset && !autoZOffsetApplied) {
|
|
41518
|
+
(_c2 = this._pointCloudManager) == null ? void 0 : _c2.setZOffset(this._state.zOffset);
|
|
41519
|
+
autoZOffsetApplied = true;
|
|
41504
41520
|
}
|
|
41505
41521
|
const newClassifications = getAvailableClassifications(data);
|
|
41506
41522
|
if (newClassifications.size > 0) {
|
|
@@ -41701,7 +41717,7 @@ class LidarControl {
|
|
|
41701
41717
|
* Used as fallback when streaming fails due to CORS.
|
|
41702
41718
|
*/
|
|
41703
41719
|
async _loadPointCloudFullDownload(url) {
|
|
41704
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
41720
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
41705
41721
|
const id = generateId("pc");
|
|
41706
41722
|
const name = getFilename(url);
|
|
41707
41723
|
try {
|
|
@@ -41749,7 +41765,7 @@ class LidarControl {
|
|
|
41749
41765
|
let zOffsetBase;
|
|
41750
41766
|
let zOffset;
|
|
41751
41767
|
let zOffsetEnabled = this._state.zOffsetEnabled;
|
|
41752
|
-
if (this._options.autoZOffset && data.positions && data.pointCount > 0) {
|
|
41768
|
+
if (this._options.autoZOffset && !this._manualZOffset && data.positions && data.pointCount > 0) {
|
|
41753
41769
|
const zValues = new Float32Array(data.pointCount);
|
|
41754
41770
|
for (let i = 0; i < data.pointCount; i++) {
|
|
41755
41771
|
zValues[i] = data.positions[i * 3 + 2] ?? 0;
|
|
@@ -41760,8 +41776,12 @@ class LidarControl {
|
|
|
41760
41776
|
zOffsetEnabled = true;
|
|
41761
41777
|
(_g = this._pointCloudManager) == null ? void 0 : _g.setZOffset(zOffset);
|
|
41762
41778
|
console.log(`Auto Z offset applied (download): ${zOffset.toFixed(1)}m (ground level: ${zOffsetBase.toFixed(1)}m)`);
|
|
41779
|
+
} else if (this._manualZOffset) {
|
|
41780
|
+
(_h = this._pointCloudManager) == null ? void 0 : _h.setZOffset(this._state.zOffset);
|
|
41781
|
+
zOffset = this._state.zOffset;
|
|
41782
|
+
zOffsetEnabled = this._state.zOffsetEnabled;
|
|
41763
41783
|
}
|
|
41764
|
-
(
|
|
41784
|
+
(_i = this._panelBuilder) == null ? void 0 : _i.updateLoadingProgress(100, "Complete!");
|
|
41765
41785
|
const info2 = {
|
|
41766
41786
|
id,
|
|
41767
41787
|
name,
|
|
@@ -41789,7 +41809,7 @@ class LidarControl {
|
|
|
41789
41809
|
zOffsetEnabled
|
|
41790
41810
|
});
|
|
41791
41811
|
this._updateComputedColorBounds();
|
|
41792
|
-
(
|
|
41812
|
+
(_j = this._panelBuilder) == null ? void 0 : _j.updateState(this._state);
|
|
41793
41813
|
this._emitWithData("load", { pointCloud: info2 });
|
|
41794
41814
|
if (this._options.autoZoom) {
|
|
41795
41815
|
this.flyToPointCloud(id);
|
|
@@ -42123,6 +42143,7 @@ class LidarControl {
|
|
|
42123
42143
|
*/
|
|
42124
42144
|
setZOffset(offset) {
|
|
42125
42145
|
var _a;
|
|
42146
|
+
this._manualZOffset = true;
|
|
42126
42147
|
this._state.zOffset = offset;
|
|
42127
42148
|
(_a = this._pointCloudManager) == null ? void 0 : _a.setZOffset(offset);
|
|
42128
42149
|
this._emit("stylechange");
|
|
@@ -43104,4 +43125,4 @@ export {
|
|
|
43104
43125
|
throttle as t,
|
|
43105
43126
|
getFilename as u
|
|
43106
43127
|
};
|
|
43107
|
-
//# sourceMappingURL=LidarLayerAdapter-
|
|
43128
|
+
//# sourceMappingURL=LidarLayerAdapter-DRPnT64H.js.map
|