vue-openlayers-plugin 1.0.74 → 1.0.77
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/lib/{index-e0d64ecc.mjs → index-90630e7e.mjs} +419 -349
- package/lib/{index.es-4f33fe12.mjs → index.es-79bf29b7.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +418 -348
- package/package.json +1 -1
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts +36 -0
- package/types/src/components/CustomOpenlayer/components/dialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/types/index.d.ts +10 -0
- package/types/src/components/CustomOpenlayer/types/index.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/LayerManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/featureHighlightManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/geoJsonLocationTool.d.ts +13 -1
- package/types/src/components/CustomOpenlayer/utils/geoJsonLocationTool.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/GeoJSONLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/ImageVectorLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/layers/VectorTileLayerHandler.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/mapManager.d.ts +5 -1
- package/types/src/components/CustomOpenlayer/utils/mapManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/styles/StyleFactory.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/styles/StyleManager.d.ts.map +1 -1
- package/types/src/components/CustomOpenlayer/utils/styles/interfaces.d.ts +2 -0
- package/types/src/components/CustomOpenlayer/utils/styles/interfaces.d.ts.map +1 -1
|
@@ -81121,12 +81121,308 @@ class MapOperationTool {
|
|
|
81121
81121
|
this.locateToGeoJSON(featureCollection2, options);
|
|
81122
81122
|
}
|
|
81123
81123
|
}
|
|
81124
|
+
const DEFAULT_HIGHLIGHT_STYLE = {
|
|
81125
|
+
fill: {
|
|
81126
|
+
color: "rgba(255, 255, 0, 0.3)",
|
|
81127
|
+
// 黄色半透明填充
|
|
81128
|
+
opacity: 0.3
|
|
81129
|
+
},
|
|
81130
|
+
stroke: {
|
|
81131
|
+
color: "#ffff00",
|
|
81132
|
+
// 黄色描边
|
|
81133
|
+
width: 3,
|
|
81134
|
+
lineDash: [5, 5]
|
|
81135
|
+
// 虚线
|
|
81136
|
+
},
|
|
81137
|
+
circle: {
|
|
81138
|
+
radius: 8,
|
|
81139
|
+
fill: {
|
|
81140
|
+
color: "rgba(255, 255, 0, 0.6)",
|
|
81141
|
+
opacity: 0.6
|
|
81142
|
+
},
|
|
81143
|
+
stroke: {
|
|
81144
|
+
color: "#ffff00",
|
|
81145
|
+
width: 3
|
|
81146
|
+
}
|
|
81147
|
+
},
|
|
81148
|
+
text: {
|
|
81149
|
+
font: "12px Arial",
|
|
81150
|
+
fill: {
|
|
81151
|
+
color: "#000000"
|
|
81152
|
+
},
|
|
81153
|
+
stroke: {
|
|
81154
|
+
color: "#ffffff",
|
|
81155
|
+
width: 2
|
|
81156
|
+
},
|
|
81157
|
+
offsetY: -15,
|
|
81158
|
+
scale: 1.2
|
|
81159
|
+
}
|
|
81160
|
+
};
|
|
81161
|
+
class FeatureHighlightManager {
|
|
81162
|
+
constructor(map2, styleConfig) {
|
|
81163
|
+
__publicField(this, "map");
|
|
81164
|
+
__publicField(this, "highlightLayer");
|
|
81165
|
+
__publicField(this, "highlightedFeatures", /* @__PURE__ */ new Map());
|
|
81166
|
+
__publicField(this, "styleConfig");
|
|
81167
|
+
__publicField(this, "featureIdCounter", 0);
|
|
81168
|
+
this.map = map2;
|
|
81169
|
+
this.styleConfig = { ...DEFAULT_HIGHLIGHT_STYLE, ...styleConfig };
|
|
81170
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81171
|
+
this.highlightLayer = new VectorLayer$3({
|
|
81172
|
+
source: new VectorSource$2(),
|
|
81173
|
+
style: this.createHighlightStyle.bind(this),
|
|
81174
|
+
zIndex: 9999
|
|
81175
|
+
// 确保高亮图层在最上层
|
|
81176
|
+
});
|
|
81177
|
+
this.map.addLayer(this.highlightLayer);
|
|
81178
|
+
}
|
|
81179
|
+
/**
|
|
81180
|
+
* 确保 highlightedFeatures 是有效的 Map 实例
|
|
81181
|
+
*/
|
|
81182
|
+
ensureHighlightedFeaturesMap() {
|
|
81183
|
+
if (!this.highlightedFeatures || !(this.highlightedFeatures instanceof Map)) {
|
|
81184
|
+
console.warn("FeatureHighlightManager: highlightedFeatures corrupted, reinitializing...");
|
|
81185
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81186
|
+
}
|
|
81187
|
+
}
|
|
81188
|
+
/**
|
|
81189
|
+
* 创建高亮样式
|
|
81190
|
+
*/
|
|
81191
|
+
createHighlightStyle(feature2) {
|
|
81192
|
+
var _a3, _b3, _c2, _d, _e2, _f;
|
|
81193
|
+
const geometry2 = feature2.getGeometry();
|
|
81194
|
+
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
81195
|
+
const styleOptions = {};
|
|
81196
|
+
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
81197
|
+
if (this.styleConfig.circle) {
|
|
81198
|
+
styleOptions.image = new Circle$8({
|
|
81199
|
+
radius: this.styleConfig.circle.radius || 8,
|
|
81200
|
+
fill: new Fill$2({
|
|
81201
|
+
color: ((_a3 = this.styleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
81202
|
+
}),
|
|
81203
|
+
stroke: new Stroke$2({
|
|
81204
|
+
color: ((_b3 = this.styleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
81205
|
+
width: ((_c2 = this.styleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
81206
|
+
})
|
|
81207
|
+
});
|
|
81208
|
+
}
|
|
81209
|
+
} else {
|
|
81210
|
+
if (this.styleConfig.fill) {
|
|
81211
|
+
styleOptions.fill = new Fill$2({
|
|
81212
|
+
color: this.styleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
81213
|
+
});
|
|
81214
|
+
}
|
|
81215
|
+
if (this.styleConfig.stroke) {
|
|
81216
|
+
styleOptions.stroke = new Stroke$2({
|
|
81217
|
+
color: this.styleConfig.stroke.color || "#ffff00",
|
|
81218
|
+
width: this.styleConfig.stroke.width || 3,
|
|
81219
|
+
lineDash: this.styleConfig.stroke.lineDash || [5, 5]
|
|
81220
|
+
});
|
|
81221
|
+
}
|
|
81222
|
+
}
|
|
81223
|
+
if (this.styleConfig.text) {
|
|
81224
|
+
const properties = feature2.getProperties();
|
|
81225
|
+
const labelText = properties.name || properties.label || "高亮要素";
|
|
81226
|
+
styleOptions.text = new Text$5({
|
|
81227
|
+
text: labelText,
|
|
81228
|
+
font: this.styleConfig.text.font || "12px Arial",
|
|
81229
|
+
fill: new Fill$2({
|
|
81230
|
+
color: ((_d = this.styleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
81231
|
+
}),
|
|
81232
|
+
stroke: new Stroke$2({
|
|
81233
|
+
color: ((_e2 = this.styleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
81234
|
+
width: ((_f = this.styleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
81235
|
+
}),
|
|
81236
|
+
offsetY: this.styleConfig.text.offsetY || -15,
|
|
81237
|
+
scale: this.styleConfig.text.scale || 1.2
|
|
81238
|
+
});
|
|
81239
|
+
}
|
|
81240
|
+
return new Style$3(styleOptions);
|
|
81241
|
+
}
|
|
81242
|
+
/**
|
|
81243
|
+
* 根据图层配置创建自定义高亮样式
|
|
81244
|
+
*/
|
|
81245
|
+
createCustomHighlightStyle(feature2, customStyleConfig) {
|
|
81246
|
+
var _a3, _b3, _c2, _d, _e2, _f, _g, _h, _i2, _j;
|
|
81247
|
+
const geometry2 = feature2.getGeometry();
|
|
81248
|
+
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
81249
|
+
const styleOptions = {};
|
|
81250
|
+
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
81251
|
+
if (customStyleConfig == null ? void 0 : customStyleConfig.circle) {
|
|
81252
|
+
styleOptions.image = new Circle$8({
|
|
81253
|
+
radius: customStyleConfig.circle.radius || 8,
|
|
81254
|
+
fill: new Fill$2({
|
|
81255
|
+
color: ((_a3 = customStyleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
81256
|
+
}),
|
|
81257
|
+
stroke: new Stroke$2({
|
|
81258
|
+
color: ((_b3 = customStyleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
81259
|
+
width: ((_c2 = customStyleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
81260
|
+
})
|
|
81261
|
+
});
|
|
81262
|
+
}
|
|
81263
|
+
} else {
|
|
81264
|
+
if ((customStyleConfig == null ? void 0 : customStyleConfig.fill) || (customStyleConfig == null ? void 0 : customStyleConfig.fillColor)) {
|
|
81265
|
+
const color2 = ((_d = customStyleConfig == null ? void 0 : customStyleConfig.fill) == null ? void 0 : _d.color) || (customStyleConfig == null ? void 0 : customStyleConfig.fillColor) || "rgba(255, 255, 0, 0.3)";
|
|
81266
|
+
styleOptions.fill = new Fill$2({
|
|
81267
|
+
color: color2
|
|
81268
|
+
});
|
|
81269
|
+
}
|
|
81270
|
+
if ((customStyleConfig == null ? void 0 : customStyleConfig.stroke) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeColor)) {
|
|
81271
|
+
const color2 = ((_e2 = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _e2.color) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeColor) || "#ffff00";
|
|
81272
|
+
const width = ((_f = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _f.width) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeWidth) || 3;
|
|
81273
|
+
const lineDash = ((_g = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _g.lineDash) || (customStyleConfig == null ? void 0 : customStyleConfig.lineDash) || [5, 5];
|
|
81274
|
+
styleOptions.stroke = new Stroke$2({
|
|
81275
|
+
color: color2,
|
|
81276
|
+
width,
|
|
81277
|
+
lineDash
|
|
81278
|
+
});
|
|
81279
|
+
}
|
|
81280
|
+
}
|
|
81281
|
+
if (customStyleConfig == null ? void 0 : customStyleConfig.text) {
|
|
81282
|
+
const properties = feature2.getProperties();
|
|
81283
|
+
const labelText = properties.name || properties.label || "高亮要素";
|
|
81284
|
+
styleOptions.text = new Text$5({
|
|
81285
|
+
text: labelText,
|
|
81286
|
+
font: customStyleConfig.text.font || "12px Arial",
|
|
81287
|
+
fill: new Fill$2({
|
|
81288
|
+
color: ((_h = customStyleConfig.text.fill) == null ? void 0 : _h.color) || "#000000"
|
|
81289
|
+
}),
|
|
81290
|
+
stroke: new Stroke$2({
|
|
81291
|
+
color: ((_i2 = customStyleConfig.text.stroke) == null ? void 0 : _i2.color) || "#ffffff",
|
|
81292
|
+
width: ((_j = customStyleConfig.text.stroke) == null ? void 0 : _j.width) || 2
|
|
81293
|
+
}),
|
|
81294
|
+
offsetX: customStyleConfig.text.offsetX || 0,
|
|
81295
|
+
offsetY: customStyleConfig.text.offsetY || -15,
|
|
81296
|
+
scale: customStyleConfig.text.scale || 1.2
|
|
81297
|
+
});
|
|
81298
|
+
}
|
|
81299
|
+
return new Style$3(styleOptions);
|
|
81300
|
+
}
|
|
81301
|
+
/**
|
|
81302
|
+
* 高亮要素
|
|
81303
|
+
*/
|
|
81304
|
+
highlightFeature(feature2, layerId, layerHighlightConfig) {
|
|
81305
|
+
var _a3;
|
|
81306
|
+
this.ensureHighlightedFeaturesMap();
|
|
81307
|
+
const existingId = this.isFeatureHighlighted(feature2);
|
|
81308
|
+
if (existingId) {
|
|
81309
|
+
return existingId;
|
|
81310
|
+
}
|
|
81311
|
+
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.clearOthersOnHighlight) {
|
|
81312
|
+
this.clearAllHighlights();
|
|
81313
|
+
}
|
|
81314
|
+
const featureId2 = `highlight_${++this.featureIdCounter}_${Date.now()}`;
|
|
81315
|
+
const highlightFeature = feature2.clone();
|
|
81316
|
+
highlightFeature.setId(featureId2);
|
|
81317
|
+
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.style) {
|
|
81318
|
+
const customStyle = this.createCustomHighlightStyle(highlightFeature, layerHighlightConfig.style);
|
|
81319
|
+
highlightFeature.setStyle(customStyle);
|
|
81320
|
+
}
|
|
81321
|
+
const originalStyle = feature2.getStyle();
|
|
81322
|
+
const highlightInfo = {
|
|
81323
|
+
originalFeature: feature2,
|
|
81324
|
+
highlightFeature,
|
|
81325
|
+
originalStyle,
|
|
81326
|
+
layerId
|
|
81327
|
+
};
|
|
81328
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.addFeature(highlightFeature);
|
|
81329
|
+
this.highlightedFeatures.set(featureId2, highlightInfo);
|
|
81330
|
+
return featureId2;
|
|
81331
|
+
}
|
|
81332
|
+
/**
|
|
81333
|
+
* 取消高亮要素
|
|
81334
|
+
*/
|
|
81335
|
+
unhighlightFeature(featureId2) {
|
|
81336
|
+
var _a3;
|
|
81337
|
+
this.ensureHighlightedFeaturesMap();
|
|
81338
|
+
const highlightInfo = this.highlightedFeatures.get(featureId2);
|
|
81339
|
+
if (!highlightInfo) {
|
|
81340
|
+
return false;
|
|
81341
|
+
}
|
|
81342
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.removeFeature(highlightInfo.highlightFeature);
|
|
81343
|
+
this.highlightedFeatures.delete(featureId2);
|
|
81344
|
+
return true;
|
|
81345
|
+
}
|
|
81346
|
+
/**
|
|
81347
|
+
* 清除所有高亮
|
|
81348
|
+
*/
|
|
81349
|
+
clearAllHighlights() {
|
|
81350
|
+
var _a3;
|
|
81351
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.clear();
|
|
81352
|
+
this.ensureHighlightedFeaturesMap();
|
|
81353
|
+
this.highlightedFeatures.clear();
|
|
81354
|
+
}
|
|
81355
|
+
/**
|
|
81356
|
+
* 获取当前高亮的要素数量
|
|
81357
|
+
*/
|
|
81358
|
+
getHighlightedCount() {
|
|
81359
|
+
this.ensureHighlightedFeaturesMap();
|
|
81360
|
+
return this.highlightedFeatures.size;
|
|
81361
|
+
}
|
|
81362
|
+
/**
|
|
81363
|
+
* 获取所有高亮要素的ID
|
|
81364
|
+
*/
|
|
81365
|
+
getHighlightedFeatureIds() {
|
|
81366
|
+
this.ensureHighlightedFeaturesMap();
|
|
81367
|
+
return Array.from(this.highlightedFeatures.keys());
|
|
81368
|
+
}
|
|
81369
|
+
/**
|
|
81370
|
+
* 检查要素是否已高亮
|
|
81371
|
+
*/
|
|
81372
|
+
isFeatureHighlighted(feature2) {
|
|
81373
|
+
this.ensureHighlightedFeaturesMap();
|
|
81374
|
+
if (!this.highlightedFeatures || typeof this.highlightedFeatures[Symbol.iterator] !== "function") {
|
|
81375
|
+
console.warn("FeatureHighlightManager: highlightedFeatures lost iterator, reinitializing...");
|
|
81376
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81377
|
+
return null;
|
|
81378
|
+
}
|
|
81379
|
+
try {
|
|
81380
|
+
const entries = Array.from(this.highlightedFeatures.entries());
|
|
81381
|
+
for (const [id, info] of entries) {
|
|
81382
|
+
if (info && info.originalFeature === feature2) {
|
|
81383
|
+
return id;
|
|
81384
|
+
}
|
|
81385
|
+
}
|
|
81386
|
+
} catch (error2) {
|
|
81387
|
+
console.error("Error iterating highlightedFeatures:", error2);
|
|
81388
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81389
|
+
return null;
|
|
81390
|
+
}
|
|
81391
|
+
return null;
|
|
81392
|
+
}
|
|
81393
|
+
/**
|
|
81394
|
+
* 更新高亮样式配置
|
|
81395
|
+
*/
|
|
81396
|
+
updateStyleConfig(newConfig) {
|
|
81397
|
+
var _a3;
|
|
81398
|
+
this.styleConfig = { ...this.styleConfig, ...newConfig };
|
|
81399
|
+
this.ensureHighlightedFeaturesMap();
|
|
81400
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.getFeatures().forEach((feature2) => {
|
|
81401
|
+
feature2.changed();
|
|
81402
|
+
});
|
|
81403
|
+
}
|
|
81404
|
+
/**
|
|
81405
|
+
* 获取当前样式配置
|
|
81406
|
+
*/
|
|
81407
|
+
getStyleConfig() {
|
|
81408
|
+
return { ...this.styleConfig };
|
|
81409
|
+
}
|
|
81410
|
+
/**
|
|
81411
|
+
* 销毁管理器
|
|
81412
|
+
*/
|
|
81413
|
+
destroy() {
|
|
81414
|
+
this.clearAllHighlights();
|
|
81415
|
+
this.map.removeLayer(this.highlightLayer);
|
|
81416
|
+
}
|
|
81417
|
+
}
|
|
81124
81418
|
class GeoJSONLocationTool {
|
|
81125
|
-
constructor(map2) {
|
|
81419
|
+
constructor(map2, featureHighlightManager) {
|
|
81126
81420
|
__publicField(this, "map");
|
|
81127
81421
|
__publicField(this, "format");
|
|
81422
|
+
__publicField(this, "featureHighlightManager");
|
|
81128
81423
|
this.map = map2;
|
|
81129
81424
|
this.format = new GeoJSON$4();
|
|
81425
|
+
this.featureHighlightManager = featureHighlightManager;
|
|
81130
81426
|
}
|
|
81131
81427
|
/**
|
|
81132
81428
|
* 定位到 GeoJSON 数据
|
|
@@ -81198,6 +81494,18 @@ class GeoJSONLocationTool {
|
|
|
81198
81494
|
duration: fitOptions.duration,
|
|
81199
81495
|
minZoom: fitOptions.minZoom
|
|
81200
81496
|
});
|
|
81497
|
+
if ((fitOptions.highlight || fitOptions.style) && this.featureHighlightManager) {
|
|
81498
|
+
if (fitOptions.clearPrevious !== false) {
|
|
81499
|
+
this.featureHighlightManager.clearAllHighlights();
|
|
81500
|
+
}
|
|
81501
|
+
const highlightConfig = {
|
|
81502
|
+
style: fitOptions.style,
|
|
81503
|
+
clearOthersOnHighlight: false
|
|
81504
|
+
};
|
|
81505
|
+
features2.forEach((feature2) => {
|
|
81506
|
+
this.featureHighlightManager.highlightFeature(feature2, "location_highlight", highlightConfig);
|
|
81507
|
+
});
|
|
81508
|
+
}
|
|
81201
81509
|
if (fitOptions.showMessage) {
|
|
81202
81510
|
}
|
|
81203
81511
|
return true;
|
|
@@ -81246,6 +81554,16 @@ class GeoJSONLocationTool {
|
|
|
81246
81554
|
zoom: targetZoom,
|
|
81247
81555
|
duration: (options == null ? void 0 : options.duration) || 1e3
|
|
81248
81556
|
});
|
|
81557
|
+
if (((options == null ? void 0 : options.highlight) || (options == null ? void 0 : options.style)) && this.featureHighlightManager) {
|
|
81558
|
+
if (options.clearPrevious !== false) {
|
|
81559
|
+
this.featureHighlightManager.clearAllHighlights();
|
|
81560
|
+
}
|
|
81561
|
+
const highlightConfig = {
|
|
81562
|
+
style: options.style,
|
|
81563
|
+
clearOthersOnHighlight: false
|
|
81564
|
+
};
|
|
81565
|
+
this.featureHighlightManager.highlightFeature(feature2, "location_center_highlight", highlightConfig);
|
|
81566
|
+
}
|
|
81249
81567
|
if ((options == null ? void 0 : options.showMessage) !== false) {
|
|
81250
81568
|
}
|
|
81251
81569
|
return true;
|
|
@@ -82876,7 +83194,8 @@ class StyleFactory {
|
|
|
82876
83194
|
rotation: config.rotation,
|
|
82877
83195
|
backgroundFill: this.createFill(config.backgroundFill),
|
|
82878
83196
|
backgroundStroke: this.createStroke(config.backgroundStroke),
|
|
82879
|
-
padding: config.padding
|
|
83197
|
+
padding: config.padding,
|
|
83198
|
+
overflow: config.overflow
|
|
82880
83199
|
});
|
|
82881
83200
|
return textStyle;
|
|
82882
83201
|
}
|
|
@@ -83184,8 +83503,12 @@ const _StyleManager = class _StyleManager {
|
|
|
83184
83503
|
var _a3;
|
|
83185
83504
|
const geometryType = StyleFactory.getFeatureGeometryType(feature2);
|
|
83186
83505
|
const defaultConfig = this.getDefaultStyle(geometryType);
|
|
83187
|
-
const
|
|
83188
|
-
|
|
83506
|
+
const layerConfig = styleConfig == null ? void 0 : styleConfig[geometryType];
|
|
83507
|
+
let finalConfig = this.mergeStyleConfig(defaultConfig, layerConfig);
|
|
83508
|
+
const featureStyle = feature2.get("style");
|
|
83509
|
+
if (featureStyle) {
|
|
83510
|
+
finalConfig = this.mergeStyleConfig(finalConfig, featureStyle);
|
|
83511
|
+
}
|
|
83189
83512
|
if (finalConfig && finalConfig.text) {
|
|
83190
83513
|
const textCfg = { ...finalConfig.text };
|
|
83191
83514
|
let content2 = textCfg.text;
|
|
@@ -83338,6 +83661,20 @@ class GeoJSONLayerHandler extends BaseLayer$2 {
|
|
|
83338
83661
|
* 创建样式函数
|
|
83339
83662
|
*/
|
|
83340
83663
|
createStyleFunction() {
|
|
83664
|
+
if (this.config.styleFunction) {
|
|
83665
|
+
const userFn = this.config.styleFunction;
|
|
83666
|
+
return (feature2, resolution) => {
|
|
83667
|
+
const result = userFn(feature2, resolution || 0);
|
|
83668
|
+
if (result instanceof Style$3 || Array.isArray(result) && result[0] instanceof Style$3) {
|
|
83669
|
+
return result;
|
|
83670
|
+
}
|
|
83671
|
+
if (result && typeof result === "object") {
|
|
83672
|
+
const geometryType = StyleFactory.getFeatureGeometryType(feature2);
|
|
83673
|
+
return StyleFactory.createStyleByGeometryType(geometryType, result);
|
|
83674
|
+
}
|
|
83675
|
+
return [];
|
|
83676
|
+
};
|
|
83677
|
+
}
|
|
83341
83678
|
this.parseStyleConfig();
|
|
83342
83679
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
83343
83680
|
}
|
|
@@ -85627,6 +85964,9 @@ class ImageVectorLayerHandler extends BaseLayer$2 {
|
|
|
85627
85964
|
* 创建样式函数
|
|
85628
85965
|
*/
|
|
85629
85966
|
createStyleFunction() {
|
|
85967
|
+
if (this.config.styleFunction) {
|
|
85968
|
+
return this.config.styleFunction;
|
|
85969
|
+
}
|
|
85630
85970
|
this.parseStyleConfig();
|
|
85631
85971
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
85632
85972
|
}
|
|
@@ -465983,6 +466323,9 @@ class VectorTileLayerHandler extends BaseLayer$2 {
|
|
|
465983
466323
|
* 创建样式函数
|
|
465984
466324
|
*/
|
|
465985
466325
|
createStyleFunction() {
|
|
466326
|
+
if (this.config.styleFunction) {
|
|
466327
|
+
return this.config.styleFunction;
|
|
466328
|
+
}
|
|
465986
466329
|
if (this.styleConfig) {
|
|
465987
466330
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
465988
466331
|
}
|
|
@@ -467470,63 +467813,58 @@ class LayerManager {
|
|
|
467470
467813
|
* 根据坐标获取图层要素信息(用于tooltip)
|
|
467471
467814
|
*/
|
|
467472
467815
|
async getFeatureInfoAtCoordinate(coordinate, options) {
|
|
467816
|
+
var _a3;
|
|
467473
467817
|
try {
|
|
467474
467818
|
const results = [];
|
|
467475
|
-
const
|
|
467476
|
-
|
|
467477
|
-
|
|
467478
|
-
|
|
467479
|
-
|
|
467819
|
+
const allLayerIds = (options == null ? void 0 : options.layers) || Array.from(this.layerHandlers.keys());
|
|
467820
|
+
const sortedLayers = allLayerIds.map((id) => ({
|
|
467821
|
+
id,
|
|
467822
|
+
config: this.layerConfigs.get(id),
|
|
467823
|
+
handler: this.layerHandlers.get(id)
|
|
467824
|
+
})).filter((item) => {
|
|
467825
|
+
if (!item.config || !item.handler || item.config.visible === false)
|
|
467826
|
+
return false;
|
|
467827
|
+
if (!item.config.popup)
|
|
467828
|
+
return false;
|
|
467829
|
+
return true;
|
|
467830
|
+
}).sort((a3, b10) => {
|
|
467831
|
+
return (b10.config.zIndex || 0) - (a3.config.zIndex || 0);
|
|
467832
|
+
});
|
|
467833
|
+
for (const item of sortedLayers) {
|
|
467834
|
+
const { id: layerId, config, handler } = item;
|
|
467835
|
+
if (!config || !handler)
|
|
467480
467836
|
continue;
|
|
467481
|
-
}
|
|
467482
|
-
debugger;
|
|
467483
467837
|
try {
|
|
467838
|
+
let features2 = [];
|
|
467484
467839
|
if (config.type === "TileSuperMapRest" || config.type === "tilesupermaprest" || config.type === "TILESUPERMAPREST") {
|
|
467485
467840
|
if ("getFeatureInfoAtCoordinate" in handler) {
|
|
467486
|
-
|
|
467841
|
+
features2 = await handler.getFeatureInfoAtCoordinate(
|
|
467487
467842
|
coordinate,
|
|
467488
467843
|
{
|
|
467489
|
-
bufferDistance:
|
|
467490
|
-
// 默认5米缓冲区
|
|
467844
|
+
bufferDistance: ((_a3 = config.supermapConfig) == null ? void 0 : _a3.bufferDistance) || 0,
|
|
467491
467845
|
maxFeatures: (options == null ? void 0 : options.featureCount) || 10,
|
|
467492
467846
|
returnContent: true
|
|
467493
467847
|
}
|
|
467494
467848
|
);
|
|
467495
|
-
if (features2 && features2.length > 0) {
|
|
467496
|
-
results.push({
|
|
467497
|
-
layerId,
|
|
467498
|
-
layerName: config.name,
|
|
467499
|
-
layerType: config.type,
|
|
467500
|
-
features: features2
|
|
467501
|
-
});
|
|
467502
|
-
}
|
|
467503
467849
|
}
|
|
467504
467850
|
} else if (config.type === "wms" || config.type === "WMS") {
|
|
467505
467851
|
if ("getFeatureInfoAtCoordinate" in handler) {
|
|
467506
|
-
|
|
467852
|
+
features2 = await handler.getFeatureInfoAtCoordinate(
|
|
467507
467853
|
coordinate,
|
|
467508
467854
|
{
|
|
467509
467855
|
infoFormat: (options == null ? void 0 : options.infoFormat) || "application/json",
|
|
467510
467856
|
featureCount: (options == null ? void 0 : options.featureCount) || 10
|
|
467511
467857
|
}
|
|
467512
467858
|
);
|
|
467513
|
-
if (features2 && features2.length > 0) {
|
|
467514
|
-
results.push({
|
|
467515
|
-
layerId,
|
|
467516
|
-
layerName: config.name,
|
|
467517
|
-
layerType: config.type,
|
|
467518
|
-
features: features2
|
|
467519
|
-
});
|
|
467520
|
-
}
|
|
467521
467859
|
}
|
|
467522
467860
|
} else if (config.type === "vector" || config.type === "geojson") {
|
|
467523
467861
|
const layer2 = handler.getLayer();
|
|
467524
467862
|
if (layer2 && "getSource" in layer2) {
|
|
467525
467863
|
const source = layer2.getSource();
|
|
467526
467864
|
if (source && "getFeaturesAtCoordinate" in source) {
|
|
467527
|
-
const
|
|
467528
|
-
if (
|
|
467529
|
-
|
|
467865
|
+
const sourceFeatures = source.getFeaturesAtCoordinate(coordinate);
|
|
467866
|
+
if (sourceFeatures && sourceFeatures.length > 0) {
|
|
467867
|
+
features2 = sourceFeatures.slice(0, (options == null ? void 0 : options.featureCount) || 10).map((feature2) => {
|
|
467530
467868
|
const properties = feature2.getProperties ? feature2.getProperties() : {};
|
|
467531
467869
|
const enhancedProperties = {
|
|
467532
467870
|
...properties,
|
|
@@ -467539,16 +467877,19 @@ class LayerManager {
|
|
|
467539
467877
|
}
|
|
467540
467878
|
return feature2;
|
|
467541
467879
|
});
|
|
467542
|
-
results.push({
|
|
467543
|
-
layerId,
|
|
467544
|
-
layerName: config.name,
|
|
467545
|
-
layerType: config.type,
|
|
467546
|
-
features: processedFeatures
|
|
467547
|
-
});
|
|
467548
467880
|
}
|
|
467549
467881
|
}
|
|
467550
467882
|
}
|
|
467551
467883
|
}
|
|
467884
|
+
if (features2 && features2.length > 0) {
|
|
467885
|
+
results.push({
|
|
467886
|
+
layerId,
|
|
467887
|
+
layerName: config.name,
|
|
467888
|
+
layerType: config.type,
|
|
467889
|
+
features: features2
|
|
467890
|
+
});
|
|
467891
|
+
break;
|
|
467892
|
+
}
|
|
467552
467893
|
} catch (error2) {
|
|
467553
467894
|
console.warn(`图层 ${layerId} 要素查询失败:`, error2);
|
|
467554
467895
|
}
|
|
@@ -467574,296 +467915,6 @@ class LayerManager {
|
|
|
467574
467915
|
this.layerConfigs.clear();
|
|
467575
467916
|
}
|
|
467576
467917
|
}
|
|
467577
|
-
const DEFAULT_HIGHLIGHT_STYLE = {
|
|
467578
|
-
fill: {
|
|
467579
|
-
color: "rgba(255, 255, 0, 0.3)",
|
|
467580
|
-
// 黄色半透明填充
|
|
467581
|
-
opacity: 0.3
|
|
467582
|
-
},
|
|
467583
|
-
stroke: {
|
|
467584
|
-
color: "#ffff00",
|
|
467585
|
-
// 黄色描边
|
|
467586
|
-
width: 3,
|
|
467587
|
-
lineDash: [5, 5]
|
|
467588
|
-
// 虚线
|
|
467589
|
-
},
|
|
467590
|
-
circle: {
|
|
467591
|
-
radius: 8,
|
|
467592
|
-
fill: {
|
|
467593
|
-
color: "rgba(255, 255, 0, 0.6)",
|
|
467594
|
-
opacity: 0.6
|
|
467595
|
-
},
|
|
467596
|
-
stroke: {
|
|
467597
|
-
color: "#ffff00",
|
|
467598
|
-
width: 3
|
|
467599
|
-
}
|
|
467600
|
-
},
|
|
467601
|
-
text: {
|
|
467602
|
-
font: "12px Arial",
|
|
467603
|
-
fill: {
|
|
467604
|
-
color: "#000000"
|
|
467605
|
-
},
|
|
467606
|
-
stroke: {
|
|
467607
|
-
color: "#ffffff",
|
|
467608
|
-
width: 2
|
|
467609
|
-
},
|
|
467610
|
-
offsetY: -15,
|
|
467611
|
-
scale: 1.2
|
|
467612
|
-
}
|
|
467613
|
-
};
|
|
467614
|
-
class FeatureHighlightManager {
|
|
467615
|
-
constructor(map2, styleConfig) {
|
|
467616
|
-
__publicField(this, "map");
|
|
467617
|
-
__publicField(this, "highlightLayer");
|
|
467618
|
-
__publicField(this, "highlightedFeatures", /* @__PURE__ */ new Map());
|
|
467619
|
-
__publicField(this, "styleConfig");
|
|
467620
|
-
__publicField(this, "featureIdCounter", 0);
|
|
467621
|
-
this.map = map2;
|
|
467622
|
-
this.styleConfig = { ...DEFAULT_HIGHLIGHT_STYLE, ...styleConfig };
|
|
467623
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
467624
|
-
this.highlightLayer = new VectorLayer$3({
|
|
467625
|
-
source: new VectorSource$2(),
|
|
467626
|
-
style: this.createHighlightStyle.bind(this),
|
|
467627
|
-
zIndex: 9999
|
|
467628
|
-
// 确保高亮图层在最上层
|
|
467629
|
-
});
|
|
467630
|
-
this.map.addLayer(this.highlightLayer);
|
|
467631
|
-
}
|
|
467632
|
-
/**
|
|
467633
|
-
* 确保 highlightedFeatures 是有效的 Map 实例
|
|
467634
|
-
*/
|
|
467635
|
-
ensureHighlightedFeaturesMap() {
|
|
467636
|
-
if (!this.highlightedFeatures || !(this.highlightedFeatures instanceof Map)) {
|
|
467637
|
-
console.warn("FeatureHighlightManager: highlightedFeatures corrupted, reinitializing...");
|
|
467638
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
467639
|
-
}
|
|
467640
|
-
}
|
|
467641
|
-
/**
|
|
467642
|
-
* 创建高亮样式
|
|
467643
|
-
*/
|
|
467644
|
-
createHighlightStyle(feature2) {
|
|
467645
|
-
var _a3, _b3, _c2, _d, _e2, _f;
|
|
467646
|
-
const geometry2 = feature2.getGeometry();
|
|
467647
|
-
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
467648
|
-
const styleOptions = {};
|
|
467649
|
-
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
467650
|
-
if (this.styleConfig.circle) {
|
|
467651
|
-
styleOptions.image = new Circle$8({
|
|
467652
|
-
radius: this.styleConfig.circle.radius || 8,
|
|
467653
|
-
fill: new Fill$2({
|
|
467654
|
-
color: ((_a3 = this.styleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
467655
|
-
}),
|
|
467656
|
-
stroke: new Stroke$2({
|
|
467657
|
-
color: ((_b3 = this.styleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
467658
|
-
width: ((_c2 = this.styleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
467659
|
-
})
|
|
467660
|
-
});
|
|
467661
|
-
}
|
|
467662
|
-
} else {
|
|
467663
|
-
if (this.styleConfig.fill) {
|
|
467664
|
-
styleOptions.fill = new Fill$2({
|
|
467665
|
-
color: this.styleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
467666
|
-
});
|
|
467667
|
-
}
|
|
467668
|
-
if (this.styleConfig.stroke) {
|
|
467669
|
-
styleOptions.stroke = new Stroke$2({
|
|
467670
|
-
color: this.styleConfig.stroke.color || "#ffff00",
|
|
467671
|
-
width: this.styleConfig.stroke.width || 3,
|
|
467672
|
-
lineDash: this.styleConfig.stroke.lineDash || [5, 5]
|
|
467673
|
-
});
|
|
467674
|
-
}
|
|
467675
|
-
}
|
|
467676
|
-
if (this.styleConfig.text) {
|
|
467677
|
-
const properties = feature2.getProperties();
|
|
467678
|
-
const labelText = properties.name || properties.label || "高亮要素";
|
|
467679
|
-
styleOptions.text = new Text$5({
|
|
467680
|
-
text: labelText,
|
|
467681
|
-
font: this.styleConfig.text.font || "12px Arial",
|
|
467682
|
-
fill: new Fill$2({
|
|
467683
|
-
color: ((_d = this.styleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
467684
|
-
}),
|
|
467685
|
-
stroke: new Stroke$2({
|
|
467686
|
-
color: ((_e2 = this.styleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
467687
|
-
width: ((_f = this.styleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
467688
|
-
}),
|
|
467689
|
-
offsetY: this.styleConfig.text.offsetY || -15,
|
|
467690
|
-
scale: this.styleConfig.text.scale || 1.2
|
|
467691
|
-
});
|
|
467692
|
-
}
|
|
467693
|
-
return new Style$3(styleOptions);
|
|
467694
|
-
}
|
|
467695
|
-
/**
|
|
467696
|
-
* 根据图层配置创建自定义高亮样式
|
|
467697
|
-
*/
|
|
467698
|
-
createCustomHighlightStyle(feature2, customStyleConfig) {
|
|
467699
|
-
var _a3, _b3, _c2, _d, _e2, _f;
|
|
467700
|
-
const geometry2 = feature2.getGeometry();
|
|
467701
|
-
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
467702
|
-
const styleOptions = {};
|
|
467703
|
-
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
467704
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.circle) {
|
|
467705
|
-
styleOptions.image = new Circle$8({
|
|
467706
|
-
radius: customStyleConfig.circle.radius || 8,
|
|
467707
|
-
fill: new Fill$2({
|
|
467708
|
-
color: ((_a3 = customStyleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
467709
|
-
}),
|
|
467710
|
-
stroke: new Stroke$2({
|
|
467711
|
-
color: ((_b3 = customStyleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
467712
|
-
width: ((_c2 = customStyleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
467713
|
-
})
|
|
467714
|
-
});
|
|
467715
|
-
}
|
|
467716
|
-
} else {
|
|
467717
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.fill) {
|
|
467718
|
-
styleOptions.fill = new Fill$2({
|
|
467719
|
-
color: customStyleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
467720
|
-
});
|
|
467721
|
-
}
|
|
467722
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.stroke) {
|
|
467723
|
-
styleOptions.stroke = new Stroke$2({
|
|
467724
|
-
color: customStyleConfig.stroke.color || "#ffff00",
|
|
467725
|
-
width: customStyleConfig.stroke.width || 3,
|
|
467726
|
-
lineDash: customStyleConfig.stroke.lineDash || [5, 5]
|
|
467727
|
-
});
|
|
467728
|
-
}
|
|
467729
|
-
}
|
|
467730
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.text) {
|
|
467731
|
-
const properties = feature2.getProperties();
|
|
467732
|
-
const labelText = properties.name || properties.label || "高亮要素";
|
|
467733
|
-
styleOptions.text = new Text$5({
|
|
467734
|
-
text: labelText,
|
|
467735
|
-
font: customStyleConfig.text.font || "12px Arial",
|
|
467736
|
-
fill: new Fill$2({
|
|
467737
|
-
color: ((_d = customStyleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
467738
|
-
}),
|
|
467739
|
-
stroke: new Stroke$2({
|
|
467740
|
-
color: ((_e2 = customStyleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
467741
|
-
width: ((_f = customStyleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
467742
|
-
}),
|
|
467743
|
-
offsetX: customStyleConfig.text.offsetX || 0,
|
|
467744
|
-
offsetY: customStyleConfig.text.offsetY || -15,
|
|
467745
|
-
scale: customStyleConfig.text.scale || 1.2
|
|
467746
|
-
});
|
|
467747
|
-
}
|
|
467748
|
-
return new Style$3(styleOptions);
|
|
467749
|
-
}
|
|
467750
|
-
/**
|
|
467751
|
-
* 高亮要素
|
|
467752
|
-
*/
|
|
467753
|
-
highlightFeature(feature2, layerId, layerHighlightConfig) {
|
|
467754
|
-
var _a3;
|
|
467755
|
-
this.ensureHighlightedFeaturesMap();
|
|
467756
|
-
const existingId = this.isFeatureHighlighted(feature2);
|
|
467757
|
-
if (existingId) {
|
|
467758
|
-
return existingId;
|
|
467759
|
-
}
|
|
467760
|
-
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.clearOthersOnHighlight) {
|
|
467761
|
-
this.clearAllHighlights();
|
|
467762
|
-
}
|
|
467763
|
-
const featureId2 = `highlight_${++this.featureIdCounter}_${Date.now()}`;
|
|
467764
|
-
const highlightFeature = feature2.clone();
|
|
467765
|
-
highlightFeature.setId(featureId2);
|
|
467766
|
-
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.style) {
|
|
467767
|
-
const customStyle = this.createCustomHighlightStyle(highlightFeature, layerHighlightConfig.style);
|
|
467768
|
-
highlightFeature.setStyle(customStyle);
|
|
467769
|
-
}
|
|
467770
|
-
const originalStyle = feature2.getStyle();
|
|
467771
|
-
const highlightInfo = {
|
|
467772
|
-
originalFeature: feature2,
|
|
467773
|
-
highlightFeature,
|
|
467774
|
-
originalStyle,
|
|
467775
|
-
layerId
|
|
467776
|
-
};
|
|
467777
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.addFeature(highlightFeature);
|
|
467778
|
-
this.highlightedFeatures.set(featureId2, highlightInfo);
|
|
467779
|
-
return featureId2;
|
|
467780
|
-
}
|
|
467781
|
-
/**
|
|
467782
|
-
* 取消高亮要素
|
|
467783
|
-
*/
|
|
467784
|
-
unhighlightFeature(featureId2) {
|
|
467785
|
-
var _a3;
|
|
467786
|
-
this.ensureHighlightedFeaturesMap();
|
|
467787
|
-
const highlightInfo = this.highlightedFeatures.get(featureId2);
|
|
467788
|
-
if (!highlightInfo) {
|
|
467789
|
-
return false;
|
|
467790
|
-
}
|
|
467791
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.removeFeature(highlightInfo.highlightFeature);
|
|
467792
|
-
this.highlightedFeatures.delete(featureId2);
|
|
467793
|
-
return true;
|
|
467794
|
-
}
|
|
467795
|
-
/**
|
|
467796
|
-
* 清除所有高亮
|
|
467797
|
-
*/
|
|
467798
|
-
clearAllHighlights() {
|
|
467799
|
-
var _a3;
|
|
467800
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.clear();
|
|
467801
|
-
this.ensureHighlightedFeaturesMap();
|
|
467802
|
-
this.highlightedFeatures.clear();
|
|
467803
|
-
}
|
|
467804
|
-
/**
|
|
467805
|
-
* 获取当前高亮的要素数量
|
|
467806
|
-
*/
|
|
467807
|
-
getHighlightedCount() {
|
|
467808
|
-
this.ensureHighlightedFeaturesMap();
|
|
467809
|
-
return this.highlightedFeatures.size;
|
|
467810
|
-
}
|
|
467811
|
-
/**
|
|
467812
|
-
* 获取所有高亮要素的ID
|
|
467813
|
-
*/
|
|
467814
|
-
getHighlightedFeatureIds() {
|
|
467815
|
-
this.ensureHighlightedFeaturesMap();
|
|
467816
|
-
return Array.from(this.highlightedFeatures.keys());
|
|
467817
|
-
}
|
|
467818
|
-
/**
|
|
467819
|
-
* 检查要素是否已高亮
|
|
467820
|
-
*/
|
|
467821
|
-
isFeatureHighlighted(feature2) {
|
|
467822
|
-
this.ensureHighlightedFeaturesMap();
|
|
467823
|
-
if (!this.highlightedFeatures || typeof this.highlightedFeatures[Symbol.iterator] !== "function") {
|
|
467824
|
-
console.warn("FeatureHighlightManager: highlightedFeatures lost iterator, reinitializing...");
|
|
467825
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
467826
|
-
return null;
|
|
467827
|
-
}
|
|
467828
|
-
try {
|
|
467829
|
-
const entries = Array.from(this.highlightedFeatures.entries());
|
|
467830
|
-
for (const [id, info] of entries) {
|
|
467831
|
-
if (info && info.originalFeature === feature2) {
|
|
467832
|
-
return id;
|
|
467833
|
-
}
|
|
467834
|
-
}
|
|
467835
|
-
} catch (error2) {
|
|
467836
|
-
console.error("Error iterating highlightedFeatures:", error2);
|
|
467837
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
467838
|
-
return null;
|
|
467839
|
-
}
|
|
467840
|
-
return null;
|
|
467841
|
-
}
|
|
467842
|
-
/**
|
|
467843
|
-
* 更新高亮样式配置
|
|
467844
|
-
*/
|
|
467845
|
-
updateStyleConfig(newConfig) {
|
|
467846
|
-
var _a3;
|
|
467847
|
-
this.styleConfig = { ...this.styleConfig, ...newConfig };
|
|
467848
|
-
this.ensureHighlightedFeaturesMap();
|
|
467849
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.getFeatures().forEach((feature2) => {
|
|
467850
|
-
feature2.changed();
|
|
467851
|
-
});
|
|
467852
|
-
}
|
|
467853
|
-
/**
|
|
467854
|
-
* 获取当前样式配置
|
|
467855
|
-
*/
|
|
467856
|
-
getStyleConfig() {
|
|
467857
|
-
return { ...this.styleConfig };
|
|
467858
|
-
}
|
|
467859
|
-
/**
|
|
467860
|
-
* 销毁管理器
|
|
467861
|
-
*/
|
|
467862
|
-
destroy() {
|
|
467863
|
-
this.clearAllHighlights();
|
|
467864
|
-
this.map.removeLayer(this.highlightLayer);
|
|
467865
|
-
}
|
|
467866
|
-
}
|
|
467867
467918
|
const _hoisted_1$q = ["id"];
|
|
467868
467919
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
467869
467920
|
__name: "BasePopup",
|
|
@@ -469384,28 +469435,47 @@ class MapManager {
|
|
|
469384
469435
|
}
|
|
469385
469436
|
}
|
|
469386
469437
|
/**
|
|
469387
|
-
*
|
|
469438
|
+
* 查找匹配的图层配置(支持递归查找子图层)
|
|
469388
469439
|
*/
|
|
469389
469440
|
findMatchingLayer(layer2, allLayers) {
|
|
469390
|
-
|
|
469391
|
-
|
|
469392
|
-
|
|
469393
|
-
return true;
|
|
469394
|
-
}
|
|
469395
|
-
if (layer2.layerId && l2.id === layer2.layerId) {
|
|
469396
|
-
return true;
|
|
469397
|
-
}
|
|
469398
|
-
if (layer2.layerName && l2.name === layer2.layerName) {
|
|
469399
|
-
return true;
|
|
469441
|
+
for (const config of allLayers) {
|
|
469442
|
+
if (this.isLayerMatch(layer2, config)) {
|
|
469443
|
+
return config;
|
|
469400
469444
|
}
|
|
469401
|
-
if (
|
|
469402
|
-
|
|
469445
|
+
if (config.children && config.children.length > 0) {
|
|
469446
|
+
const match2 = this.findMatchingLayer(layer2, config.children);
|
|
469447
|
+
if (match2)
|
|
469448
|
+
return match2;
|
|
469403
469449
|
}
|
|
469404
|
-
if (
|
|
469405
|
-
|
|
469450
|
+
if (config.layers && config.layers.length > 0) {
|
|
469451
|
+
const match2 = this.findMatchingLayer(layer2, config.layers);
|
|
469452
|
+
if (match2)
|
|
469453
|
+
return match2;
|
|
469406
469454
|
}
|
|
469407
|
-
|
|
469408
|
-
|
|
469455
|
+
}
|
|
469456
|
+
return void 0;
|
|
469457
|
+
}
|
|
469458
|
+
/**
|
|
469459
|
+
* 检查图层实例是否匹配配置
|
|
469460
|
+
*/
|
|
469461
|
+
isLayerMatch(layer2, config) {
|
|
469462
|
+
var _a3;
|
|
469463
|
+
if (((_a3 = layer2.values_) == null ? void 0 : _a3.layerId) && config.id === layer2.values_.layerId) {
|
|
469464
|
+
return true;
|
|
469465
|
+
}
|
|
469466
|
+
if (layer2.layerId && config.id === layer2.layerId) {
|
|
469467
|
+
return true;
|
|
469468
|
+
}
|
|
469469
|
+
if (layer2.layerName && config.name === layer2.layerName) {
|
|
469470
|
+
return true;
|
|
469471
|
+
}
|
|
469472
|
+
if (layer2.get && layer2.get("id") === config.id) {
|
|
469473
|
+
return true;
|
|
469474
|
+
}
|
|
469475
|
+
if (layer2.get && layer2.get("name") === config.name) {
|
|
469476
|
+
return true;
|
|
469477
|
+
}
|
|
469478
|
+
return false;
|
|
469409
469479
|
}
|
|
469410
469480
|
/**
|
|
469411
469481
|
* 初始化地图
|
|
@@ -469524,7 +469594,7 @@ class MapManager {
|
|
|
469524
469594
|
const initialCenter = this.config.center || [116.404, 39.915];
|
|
469525
469595
|
const initialZoom = this.config.zoom || 10;
|
|
469526
469596
|
this.mapOperationTool = new MapOperationTool(this.map, initialCenter, initialZoom);
|
|
469527
|
-
this.geoJsonLocationTool = new GeoJSONLocationTool(this.map);
|
|
469597
|
+
this.geoJsonLocationTool = new GeoJSONLocationTool(this.map, this.featureHighlightManager);
|
|
469528
469598
|
const popupConfig = this.config.popupConfig || {};
|
|
469529
469599
|
this.popupManager = new PopupManager(this.map, popupConfig);
|
|
469530
469600
|
this.bindEventManagerEvents();
|
|
@@ -491968,7 +492038,7 @@ function(t3) {
|
|
|
491968
492038
|
*/
|
|
491969
492039
|
function(t3) {
|
|
491970
492040
|
function e8() {
|
|
491971
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
492041
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-79bf29b7.mjs")).catch(function(t4) {
|
|
491972
492042
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
491973
492043
|
}).then(function(t4) {
|
|
491974
492044
|
return t4.default ? t4.default : t4;
|