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
package/lib/index.umd.js
CHANGED
|
@@ -81630,12 +81630,308 @@ ${this.attributes_.map(
|
|
|
81630
81630
|
this.locateToGeoJSON(featureCollection2, options);
|
|
81631
81631
|
}
|
|
81632
81632
|
}
|
|
81633
|
+
const DEFAULT_HIGHLIGHT_STYLE = {
|
|
81634
|
+
fill: {
|
|
81635
|
+
color: "rgba(255, 255, 0, 0.3)",
|
|
81636
|
+
// 黄色半透明填充
|
|
81637
|
+
opacity: 0.3
|
|
81638
|
+
},
|
|
81639
|
+
stroke: {
|
|
81640
|
+
color: "#ffff00",
|
|
81641
|
+
// 黄色描边
|
|
81642
|
+
width: 3,
|
|
81643
|
+
lineDash: [5, 5]
|
|
81644
|
+
// 虚线
|
|
81645
|
+
},
|
|
81646
|
+
circle: {
|
|
81647
|
+
radius: 8,
|
|
81648
|
+
fill: {
|
|
81649
|
+
color: "rgba(255, 255, 0, 0.6)",
|
|
81650
|
+
opacity: 0.6
|
|
81651
|
+
},
|
|
81652
|
+
stroke: {
|
|
81653
|
+
color: "#ffff00",
|
|
81654
|
+
width: 3
|
|
81655
|
+
}
|
|
81656
|
+
},
|
|
81657
|
+
text: {
|
|
81658
|
+
font: "12px Arial",
|
|
81659
|
+
fill: {
|
|
81660
|
+
color: "#000000"
|
|
81661
|
+
},
|
|
81662
|
+
stroke: {
|
|
81663
|
+
color: "#ffffff",
|
|
81664
|
+
width: 2
|
|
81665
|
+
},
|
|
81666
|
+
offsetY: -15,
|
|
81667
|
+
scale: 1.2
|
|
81668
|
+
}
|
|
81669
|
+
};
|
|
81670
|
+
class FeatureHighlightManager {
|
|
81671
|
+
constructor(map2, styleConfig) {
|
|
81672
|
+
__publicField(this, "map");
|
|
81673
|
+
__publicField(this, "highlightLayer");
|
|
81674
|
+
__publicField(this, "highlightedFeatures", /* @__PURE__ */ new Map());
|
|
81675
|
+
__publicField(this, "styleConfig");
|
|
81676
|
+
__publicField(this, "featureIdCounter", 0);
|
|
81677
|
+
this.map = map2;
|
|
81678
|
+
this.styleConfig = { ...DEFAULT_HIGHLIGHT_STYLE, ...styleConfig };
|
|
81679
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81680
|
+
this.highlightLayer = new VectorLayer$3({
|
|
81681
|
+
source: new VectorSource$2(),
|
|
81682
|
+
style: this.createHighlightStyle.bind(this),
|
|
81683
|
+
zIndex: 9999
|
|
81684
|
+
// 确保高亮图层在最上层
|
|
81685
|
+
});
|
|
81686
|
+
this.map.addLayer(this.highlightLayer);
|
|
81687
|
+
}
|
|
81688
|
+
/**
|
|
81689
|
+
* 确保 highlightedFeatures 是有效的 Map 实例
|
|
81690
|
+
*/
|
|
81691
|
+
ensureHighlightedFeaturesMap() {
|
|
81692
|
+
if (!this.highlightedFeatures || !(this.highlightedFeatures instanceof Map)) {
|
|
81693
|
+
console.warn("FeatureHighlightManager: highlightedFeatures corrupted, reinitializing...");
|
|
81694
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81695
|
+
}
|
|
81696
|
+
}
|
|
81697
|
+
/**
|
|
81698
|
+
* 创建高亮样式
|
|
81699
|
+
*/
|
|
81700
|
+
createHighlightStyle(feature2) {
|
|
81701
|
+
var _a3, _b3, _c2, _d, _e2, _f;
|
|
81702
|
+
const geometry2 = feature2.getGeometry();
|
|
81703
|
+
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
81704
|
+
const styleOptions = {};
|
|
81705
|
+
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
81706
|
+
if (this.styleConfig.circle) {
|
|
81707
|
+
styleOptions.image = new Circle$8({
|
|
81708
|
+
radius: this.styleConfig.circle.radius || 8,
|
|
81709
|
+
fill: new Fill$2({
|
|
81710
|
+
color: ((_a3 = this.styleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
81711
|
+
}),
|
|
81712
|
+
stroke: new Stroke$2({
|
|
81713
|
+
color: ((_b3 = this.styleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
81714
|
+
width: ((_c2 = this.styleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
81715
|
+
})
|
|
81716
|
+
});
|
|
81717
|
+
}
|
|
81718
|
+
} else {
|
|
81719
|
+
if (this.styleConfig.fill) {
|
|
81720
|
+
styleOptions.fill = new Fill$2({
|
|
81721
|
+
color: this.styleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
81722
|
+
});
|
|
81723
|
+
}
|
|
81724
|
+
if (this.styleConfig.stroke) {
|
|
81725
|
+
styleOptions.stroke = new Stroke$2({
|
|
81726
|
+
color: this.styleConfig.stroke.color || "#ffff00",
|
|
81727
|
+
width: this.styleConfig.stroke.width || 3,
|
|
81728
|
+
lineDash: this.styleConfig.stroke.lineDash || [5, 5]
|
|
81729
|
+
});
|
|
81730
|
+
}
|
|
81731
|
+
}
|
|
81732
|
+
if (this.styleConfig.text) {
|
|
81733
|
+
const properties = feature2.getProperties();
|
|
81734
|
+
const labelText = properties.name || properties.label || "高亮要素";
|
|
81735
|
+
styleOptions.text = new Text$5({
|
|
81736
|
+
text: labelText,
|
|
81737
|
+
font: this.styleConfig.text.font || "12px Arial",
|
|
81738
|
+
fill: new Fill$2({
|
|
81739
|
+
color: ((_d = this.styleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
81740
|
+
}),
|
|
81741
|
+
stroke: new Stroke$2({
|
|
81742
|
+
color: ((_e2 = this.styleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
81743
|
+
width: ((_f = this.styleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
81744
|
+
}),
|
|
81745
|
+
offsetY: this.styleConfig.text.offsetY || -15,
|
|
81746
|
+
scale: this.styleConfig.text.scale || 1.2
|
|
81747
|
+
});
|
|
81748
|
+
}
|
|
81749
|
+
return new Style$3(styleOptions);
|
|
81750
|
+
}
|
|
81751
|
+
/**
|
|
81752
|
+
* 根据图层配置创建自定义高亮样式
|
|
81753
|
+
*/
|
|
81754
|
+
createCustomHighlightStyle(feature2, customStyleConfig) {
|
|
81755
|
+
var _a3, _b3, _c2, _d, _e2, _f, _g, _h, _i2, _j;
|
|
81756
|
+
const geometry2 = feature2.getGeometry();
|
|
81757
|
+
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
81758
|
+
const styleOptions = {};
|
|
81759
|
+
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
81760
|
+
if (customStyleConfig == null ? void 0 : customStyleConfig.circle) {
|
|
81761
|
+
styleOptions.image = new Circle$8({
|
|
81762
|
+
radius: customStyleConfig.circle.radius || 8,
|
|
81763
|
+
fill: new Fill$2({
|
|
81764
|
+
color: ((_a3 = customStyleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
81765
|
+
}),
|
|
81766
|
+
stroke: new Stroke$2({
|
|
81767
|
+
color: ((_b3 = customStyleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
81768
|
+
width: ((_c2 = customStyleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
81769
|
+
})
|
|
81770
|
+
});
|
|
81771
|
+
}
|
|
81772
|
+
} else {
|
|
81773
|
+
if ((customStyleConfig == null ? void 0 : customStyleConfig.fill) || (customStyleConfig == null ? void 0 : customStyleConfig.fillColor)) {
|
|
81774
|
+
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)";
|
|
81775
|
+
styleOptions.fill = new Fill$2({
|
|
81776
|
+
color: color2
|
|
81777
|
+
});
|
|
81778
|
+
}
|
|
81779
|
+
if ((customStyleConfig == null ? void 0 : customStyleConfig.stroke) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeColor)) {
|
|
81780
|
+
const color2 = ((_e2 = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _e2.color) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeColor) || "#ffff00";
|
|
81781
|
+
const width = ((_f = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _f.width) || (customStyleConfig == null ? void 0 : customStyleConfig.strokeWidth) || 3;
|
|
81782
|
+
const lineDash = ((_g = customStyleConfig == null ? void 0 : customStyleConfig.stroke) == null ? void 0 : _g.lineDash) || (customStyleConfig == null ? void 0 : customStyleConfig.lineDash) || [5, 5];
|
|
81783
|
+
styleOptions.stroke = new Stroke$2({
|
|
81784
|
+
color: color2,
|
|
81785
|
+
width,
|
|
81786
|
+
lineDash
|
|
81787
|
+
});
|
|
81788
|
+
}
|
|
81789
|
+
}
|
|
81790
|
+
if (customStyleConfig == null ? void 0 : customStyleConfig.text) {
|
|
81791
|
+
const properties = feature2.getProperties();
|
|
81792
|
+
const labelText = properties.name || properties.label || "高亮要素";
|
|
81793
|
+
styleOptions.text = new Text$5({
|
|
81794
|
+
text: labelText,
|
|
81795
|
+
font: customStyleConfig.text.font || "12px Arial",
|
|
81796
|
+
fill: new Fill$2({
|
|
81797
|
+
color: ((_h = customStyleConfig.text.fill) == null ? void 0 : _h.color) || "#000000"
|
|
81798
|
+
}),
|
|
81799
|
+
stroke: new Stroke$2({
|
|
81800
|
+
color: ((_i2 = customStyleConfig.text.stroke) == null ? void 0 : _i2.color) || "#ffffff",
|
|
81801
|
+
width: ((_j = customStyleConfig.text.stroke) == null ? void 0 : _j.width) || 2
|
|
81802
|
+
}),
|
|
81803
|
+
offsetX: customStyleConfig.text.offsetX || 0,
|
|
81804
|
+
offsetY: customStyleConfig.text.offsetY || -15,
|
|
81805
|
+
scale: customStyleConfig.text.scale || 1.2
|
|
81806
|
+
});
|
|
81807
|
+
}
|
|
81808
|
+
return new Style$3(styleOptions);
|
|
81809
|
+
}
|
|
81810
|
+
/**
|
|
81811
|
+
* 高亮要素
|
|
81812
|
+
*/
|
|
81813
|
+
highlightFeature(feature2, layerId, layerHighlightConfig) {
|
|
81814
|
+
var _a3;
|
|
81815
|
+
this.ensureHighlightedFeaturesMap();
|
|
81816
|
+
const existingId = this.isFeatureHighlighted(feature2);
|
|
81817
|
+
if (existingId) {
|
|
81818
|
+
return existingId;
|
|
81819
|
+
}
|
|
81820
|
+
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.clearOthersOnHighlight) {
|
|
81821
|
+
this.clearAllHighlights();
|
|
81822
|
+
}
|
|
81823
|
+
const featureId2 = `highlight_${++this.featureIdCounter}_${Date.now()}`;
|
|
81824
|
+
const highlightFeature = feature2.clone();
|
|
81825
|
+
highlightFeature.setId(featureId2);
|
|
81826
|
+
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.style) {
|
|
81827
|
+
const customStyle = this.createCustomHighlightStyle(highlightFeature, layerHighlightConfig.style);
|
|
81828
|
+
highlightFeature.setStyle(customStyle);
|
|
81829
|
+
}
|
|
81830
|
+
const originalStyle = feature2.getStyle();
|
|
81831
|
+
const highlightInfo = {
|
|
81832
|
+
originalFeature: feature2,
|
|
81833
|
+
highlightFeature,
|
|
81834
|
+
originalStyle,
|
|
81835
|
+
layerId
|
|
81836
|
+
};
|
|
81837
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.addFeature(highlightFeature);
|
|
81838
|
+
this.highlightedFeatures.set(featureId2, highlightInfo);
|
|
81839
|
+
return featureId2;
|
|
81840
|
+
}
|
|
81841
|
+
/**
|
|
81842
|
+
* 取消高亮要素
|
|
81843
|
+
*/
|
|
81844
|
+
unhighlightFeature(featureId2) {
|
|
81845
|
+
var _a3;
|
|
81846
|
+
this.ensureHighlightedFeaturesMap();
|
|
81847
|
+
const highlightInfo = this.highlightedFeatures.get(featureId2);
|
|
81848
|
+
if (!highlightInfo) {
|
|
81849
|
+
return false;
|
|
81850
|
+
}
|
|
81851
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.removeFeature(highlightInfo.highlightFeature);
|
|
81852
|
+
this.highlightedFeatures.delete(featureId2);
|
|
81853
|
+
return true;
|
|
81854
|
+
}
|
|
81855
|
+
/**
|
|
81856
|
+
* 清除所有高亮
|
|
81857
|
+
*/
|
|
81858
|
+
clearAllHighlights() {
|
|
81859
|
+
var _a3;
|
|
81860
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.clear();
|
|
81861
|
+
this.ensureHighlightedFeaturesMap();
|
|
81862
|
+
this.highlightedFeatures.clear();
|
|
81863
|
+
}
|
|
81864
|
+
/**
|
|
81865
|
+
* 获取当前高亮的要素数量
|
|
81866
|
+
*/
|
|
81867
|
+
getHighlightedCount() {
|
|
81868
|
+
this.ensureHighlightedFeaturesMap();
|
|
81869
|
+
return this.highlightedFeatures.size;
|
|
81870
|
+
}
|
|
81871
|
+
/**
|
|
81872
|
+
* 获取所有高亮要素的ID
|
|
81873
|
+
*/
|
|
81874
|
+
getHighlightedFeatureIds() {
|
|
81875
|
+
this.ensureHighlightedFeaturesMap();
|
|
81876
|
+
return Array.from(this.highlightedFeatures.keys());
|
|
81877
|
+
}
|
|
81878
|
+
/**
|
|
81879
|
+
* 检查要素是否已高亮
|
|
81880
|
+
*/
|
|
81881
|
+
isFeatureHighlighted(feature2) {
|
|
81882
|
+
this.ensureHighlightedFeaturesMap();
|
|
81883
|
+
if (!this.highlightedFeatures || typeof this.highlightedFeatures[Symbol.iterator] !== "function") {
|
|
81884
|
+
console.warn("FeatureHighlightManager: highlightedFeatures lost iterator, reinitializing...");
|
|
81885
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81886
|
+
return null;
|
|
81887
|
+
}
|
|
81888
|
+
try {
|
|
81889
|
+
const entries = Array.from(this.highlightedFeatures.entries());
|
|
81890
|
+
for (const [id2, info] of entries) {
|
|
81891
|
+
if (info && info.originalFeature === feature2) {
|
|
81892
|
+
return id2;
|
|
81893
|
+
}
|
|
81894
|
+
}
|
|
81895
|
+
} catch (error2) {
|
|
81896
|
+
console.error("Error iterating highlightedFeatures:", error2);
|
|
81897
|
+
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
81898
|
+
return null;
|
|
81899
|
+
}
|
|
81900
|
+
return null;
|
|
81901
|
+
}
|
|
81902
|
+
/**
|
|
81903
|
+
* 更新高亮样式配置
|
|
81904
|
+
*/
|
|
81905
|
+
updateStyleConfig(newConfig) {
|
|
81906
|
+
var _a3;
|
|
81907
|
+
this.styleConfig = { ...this.styleConfig, ...newConfig };
|
|
81908
|
+
this.ensureHighlightedFeaturesMap();
|
|
81909
|
+
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.getFeatures().forEach((feature2) => {
|
|
81910
|
+
feature2.changed();
|
|
81911
|
+
});
|
|
81912
|
+
}
|
|
81913
|
+
/**
|
|
81914
|
+
* 获取当前样式配置
|
|
81915
|
+
*/
|
|
81916
|
+
getStyleConfig() {
|
|
81917
|
+
return { ...this.styleConfig };
|
|
81918
|
+
}
|
|
81919
|
+
/**
|
|
81920
|
+
* 销毁管理器
|
|
81921
|
+
*/
|
|
81922
|
+
destroy() {
|
|
81923
|
+
this.clearAllHighlights();
|
|
81924
|
+
this.map.removeLayer(this.highlightLayer);
|
|
81925
|
+
}
|
|
81926
|
+
}
|
|
81633
81927
|
class GeoJSONLocationTool {
|
|
81634
|
-
constructor(map2) {
|
|
81928
|
+
constructor(map2, featureHighlightManager) {
|
|
81635
81929
|
__publicField(this, "map");
|
|
81636
81930
|
__publicField(this, "format");
|
|
81931
|
+
__publicField(this, "featureHighlightManager");
|
|
81637
81932
|
this.map = map2;
|
|
81638
81933
|
this.format = new GeoJSON$4();
|
|
81934
|
+
this.featureHighlightManager = featureHighlightManager;
|
|
81639
81935
|
}
|
|
81640
81936
|
/**
|
|
81641
81937
|
* 定位到 GeoJSON 数据
|
|
@@ -81707,6 +82003,18 @@ ${this.attributes_.map(
|
|
|
81707
82003
|
duration: fitOptions.duration,
|
|
81708
82004
|
minZoom: fitOptions.minZoom
|
|
81709
82005
|
});
|
|
82006
|
+
if ((fitOptions.highlight || fitOptions.style) && this.featureHighlightManager) {
|
|
82007
|
+
if (fitOptions.clearPrevious !== false) {
|
|
82008
|
+
this.featureHighlightManager.clearAllHighlights();
|
|
82009
|
+
}
|
|
82010
|
+
const highlightConfig = {
|
|
82011
|
+
style: fitOptions.style,
|
|
82012
|
+
clearOthersOnHighlight: false
|
|
82013
|
+
};
|
|
82014
|
+
features2.forEach((feature2) => {
|
|
82015
|
+
this.featureHighlightManager.highlightFeature(feature2, "location_highlight", highlightConfig);
|
|
82016
|
+
});
|
|
82017
|
+
}
|
|
81710
82018
|
if (fitOptions.showMessage) {
|
|
81711
82019
|
}
|
|
81712
82020
|
return true;
|
|
@@ -81755,6 +82063,16 @@ ${this.attributes_.map(
|
|
|
81755
82063
|
zoom: targetZoom,
|
|
81756
82064
|
duration: (options == null ? void 0 : options.duration) || 1e3
|
|
81757
82065
|
});
|
|
82066
|
+
if (((options == null ? void 0 : options.highlight) || (options == null ? void 0 : options.style)) && this.featureHighlightManager) {
|
|
82067
|
+
if (options.clearPrevious !== false) {
|
|
82068
|
+
this.featureHighlightManager.clearAllHighlights();
|
|
82069
|
+
}
|
|
82070
|
+
const highlightConfig = {
|
|
82071
|
+
style: options.style,
|
|
82072
|
+
clearOthersOnHighlight: false
|
|
82073
|
+
};
|
|
82074
|
+
this.featureHighlightManager.highlightFeature(feature2, "location_center_highlight", highlightConfig);
|
|
82075
|
+
}
|
|
81758
82076
|
if ((options == null ? void 0 : options.showMessage) !== false) {
|
|
81759
82077
|
}
|
|
81760
82078
|
return true;
|
|
@@ -83385,7 +83703,8 @@ ${this.attributes_.map(
|
|
|
83385
83703
|
rotation: config.rotation,
|
|
83386
83704
|
backgroundFill: this.createFill(config.backgroundFill),
|
|
83387
83705
|
backgroundStroke: this.createStroke(config.backgroundStroke),
|
|
83388
|
-
padding: config.padding
|
|
83706
|
+
padding: config.padding,
|
|
83707
|
+
overflow: config.overflow
|
|
83389
83708
|
});
|
|
83390
83709
|
return textStyle;
|
|
83391
83710
|
}
|
|
@@ -83693,8 +84012,12 @@ ${this.attributes_.map(
|
|
|
83693
84012
|
var _a3;
|
|
83694
84013
|
const geometryType = StyleFactory.getFeatureGeometryType(feature2);
|
|
83695
84014
|
const defaultConfig = this.getDefaultStyle(geometryType);
|
|
83696
|
-
const
|
|
83697
|
-
|
|
84015
|
+
const layerConfig = styleConfig == null ? void 0 : styleConfig[geometryType];
|
|
84016
|
+
let finalConfig = this.mergeStyleConfig(defaultConfig, layerConfig);
|
|
84017
|
+
const featureStyle = feature2.get("style");
|
|
84018
|
+
if (featureStyle) {
|
|
84019
|
+
finalConfig = this.mergeStyleConfig(finalConfig, featureStyle);
|
|
84020
|
+
}
|
|
83698
84021
|
if (finalConfig && finalConfig.text) {
|
|
83699
84022
|
const textCfg = { ...finalConfig.text };
|
|
83700
84023
|
let content2 = textCfg.text;
|
|
@@ -83847,6 +84170,20 @@ ${this.attributes_.map(
|
|
|
83847
84170
|
* 创建样式函数
|
|
83848
84171
|
*/
|
|
83849
84172
|
createStyleFunction() {
|
|
84173
|
+
if (this.config.styleFunction) {
|
|
84174
|
+
const userFn = this.config.styleFunction;
|
|
84175
|
+
return (feature2, resolution) => {
|
|
84176
|
+
const result = userFn(feature2, resolution || 0);
|
|
84177
|
+
if (result instanceof Style$3 || Array.isArray(result) && result[0] instanceof Style$3) {
|
|
84178
|
+
return result;
|
|
84179
|
+
}
|
|
84180
|
+
if (result && typeof result === "object") {
|
|
84181
|
+
const geometryType = StyleFactory.getFeatureGeometryType(feature2);
|
|
84182
|
+
return StyleFactory.createStyleByGeometryType(geometryType, result);
|
|
84183
|
+
}
|
|
84184
|
+
return [];
|
|
84185
|
+
};
|
|
84186
|
+
}
|
|
83850
84187
|
this.parseStyleConfig();
|
|
83851
84188
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
83852
84189
|
}
|
|
@@ -86136,6 +86473,9 @@ ${this.attributes_.map(
|
|
|
86136
86473
|
* 创建样式函数
|
|
86137
86474
|
*/
|
|
86138
86475
|
createStyleFunction() {
|
|
86476
|
+
if (this.config.styleFunction) {
|
|
86477
|
+
return this.config.styleFunction;
|
|
86478
|
+
}
|
|
86139
86479
|
this.parseStyleConfig();
|
|
86140
86480
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
86141
86481
|
}
|
|
@@ -466759,6 +467099,9 @@ ${this.attributes_.map(
|
|
|
466759
467099
|
* 创建样式函数
|
|
466760
467100
|
*/
|
|
466761
467101
|
createStyleFunction() {
|
|
467102
|
+
if (this.config.styleFunction) {
|
|
467103
|
+
return this.config.styleFunction;
|
|
467104
|
+
}
|
|
466762
467105
|
if (this.styleConfig) {
|
|
466763
467106
|
return styleManager.createStyleFunction(this.styleConfig);
|
|
466764
467107
|
}
|
|
@@ -468246,63 +468589,58 @@ ${this.attributes_.map(
|
|
|
468246
468589
|
* 根据坐标获取图层要素信息(用于tooltip)
|
|
468247
468590
|
*/
|
|
468248
468591
|
async getFeatureInfoAtCoordinate(coordinate, options) {
|
|
468592
|
+
var _a3;
|
|
468249
468593
|
try {
|
|
468250
468594
|
const results = [];
|
|
468251
|
-
const
|
|
468252
|
-
|
|
468253
|
-
|
|
468254
|
-
|
|
468255
|
-
|
|
468595
|
+
const allLayerIds = (options == null ? void 0 : options.layers) || Array.from(this.layerHandlers.keys());
|
|
468596
|
+
const sortedLayers = allLayerIds.map((id2) => ({
|
|
468597
|
+
id: id2,
|
|
468598
|
+
config: this.layerConfigs.get(id2),
|
|
468599
|
+
handler: this.layerHandlers.get(id2)
|
|
468600
|
+
})).filter((item) => {
|
|
468601
|
+
if (!item.config || !item.handler || item.config.visible === false)
|
|
468602
|
+
return false;
|
|
468603
|
+
if (!item.config.popup)
|
|
468604
|
+
return false;
|
|
468605
|
+
return true;
|
|
468606
|
+
}).sort((a3, b10) => {
|
|
468607
|
+
return (b10.config.zIndex || 0) - (a3.config.zIndex || 0);
|
|
468608
|
+
});
|
|
468609
|
+
for (const item of sortedLayers) {
|
|
468610
|
+
const { id: layerId, config, handler } = item;
|
|
468611
|
+
if (!config || !handler)
|
|
468256
468612
|
continue;
|
|
468257
|
-
}
|
|
468258
|
-
debugger;
|
|
468259
468613
|
try {
|
|
468614
|
+
let features2 = [];
|
|
468260
468615
|
if (config.type === "TileSuperMapRest" || config.type === "tilesupermaprest" || config.type === "TILESUPERMAPREST") {
|
|
468261
468616
|
if ("getFeatureInfoAtCoordinate" in handler) {
|
|
468262
|
-
|
|
468617
|
+
features2 = await handler.getFeatureInfoAtCoordinate(
|
|
468263
468618
|
coordinate,
|
|
468264
468619
|
{
|
|
468265
|
-
bufferDistance:
|
|
468266
|
-
// 默认5米缓冲区
|
|
468620
|
+
bufferDistance: ((_a3 = config.supermapConfig) == null ? void 0 : _a3.bufferDistance) || 0,
|
|
468267
468621
|
maxFeatures: (options == null ? void 0 : options.featureCount) || 10,
|
|
468268
468622
|
returnContent: true
|
|
468269
468623
|
}
|
|
468270
468624
|
);
|
|
468271
|
-
if (features2 && features2.length > 0) {
|
|
468272
|
-
results.push({
|
|
468273
|
-
layerId,
|
|
468274
|
-
layerName: config.name,
|
|
468275
|
-
layerType: config.type,
|
|
468276
|
-
features: features2
|
|
468277
|
-
});
|
|
468278
|
-
}
|
|
468279
468625
|
}
|
|
468280
468626
|
} else if (config.type === "wms" || config.type === "WMS") {
|
|
468281
468627
|
if ("getFeatureInfoAtCoordinate" in handler) {
|
|
468282
|
-
|
|
468628
|
+
features2 = await handler.getFeatureInfoAtCoordinate(
|
|
468283
468629
|
coordinate,
|
|
468284
468630
|
{
|
|
468285
468631
|
infoFormat: (options == null ? void 0 : options.infoFormat) || "application/json",
|
|
468286
468632
|
featureCount: (options == null ? void 0 : options.featureCount) || 10
|
|
468287
468633
|
}
|
|
468288
468634
|
);
|
|
468289
|
-
if (features2 && features2.length > 0) {
|
|
468290
|
-
results.push({
|
|
468291
|
-
layerId,
|
|
468292
|
-
layerName: config.name,
|
|
468293
|
-
layerType: config.type,
|
|
468294
|
-
features: features2
|
|
468295
|
-
});
|
|
468296
|
-
}
|
|
468297
468635
|
}
|
|
468298
468636
|
} else if (config.type === "vector" || config.type === "geojson") {
|
|
468299
468637
|
const layer2 = handler.getLayer();
|
|
468300
468638
|
if (layer2 && "getSource" in layer2) {
|
|
468301
468639
|
const source = layer2.getSource();
|
|
468302
468640
|
if (source && "getFeaturesAtCoordinate" in source) {
|
|
468303
|
-
const
|
|
468304
|
-
if (
|
|
468305
|
-
|
|
468641
|
+
const sourceFeatures = source.getFeaturesAtCoordinate(coordinate);
|
|
468642
|
+
if (sourceFeatures && sourceFeatures.length > 0) {
|
|
468643
|
+
features2 = sourceFeatures.slice(0, (options == null ? void 0 : options.featureCount) || 10).map((feature2) => {
|
|
468306
468644
|
const properties = feature2.getProperties ? feature2.getProperties() : {};
|
|
468307
468645
|
const enhancedProperties = {
|
|
468308
468646
|
...properties,
|
|
@@ -468315,16 +468653,19 @@ ${this.attributes_.map(
|
|
|
468315
468653
|
}
|
|
468316
468654
|
return feature2;
|
|
468317
468655
|
});
|
|
468318
|
-
results.push({
|
|
468319
|
-
layerId,
|
|
468320
|
-
layerName: config.name,
|
|
468321
|
-
layerType: config.type,
|
|
468322
|
-
features: processedFeatures
|
|
468323
|
-
});
|
|
468324
468656
|
}
|
|
468325
468657
|
}
|
|
468326
468658
|
}
|
|
468327
468659
|
}
|
|
468660
|
+
if (features2 && features2.length > 0) {
|
|
468661
|
+
results.push({
|
|
468662
|
+
layerId,
|
|
468663
|
+
layerName: config.name,
|
|
468664
|
+
layerType: config.type,
|
|
468665
|
+
features: features2
|
|
468666
|
+
});
|
|
468667
|
+
break;
|
|
468668
|
+
}
|
|
468328
468669
|
} catch (error2) {
|
|
468329
468670
|
console.warn(`图层 ${layerId} 要素查询失败:`, error2);
|
|
468330
468671
|
}
|
|
@@ -468350,296 +468691,6 @@ ${this.attributes_.map(
|
|
|
468350
468691
|
this.layerConfigs.clear();
|
|
468351
468692
|
}
|
|
468352
468693
|
}
|
|
468353
|
-
const DEFAULT_HIGHLIGHT_STYLE = {
|
|
468354
|
-
fill: {
|
|
468355
|
-
color: "rgba(255, 255, 0, 0.3)",
|
|
468356
|
-
// 黄色半透明填充
|
|
468357
|
-
opacity: 0.3
|
|
468358
|
-
},
|
|
468359
|
-
stroke: {
|
|
468360
|
-
color: "#ffff00",
|
|
468361
|
-
// 黄色描边
|
|
468362
|
-
width: 3,
|
|
468363
|
-
lineDash: [5, 5]
|
|
468364
|
-
// 虚线
|
|
468365
|
-
},
|
|
468366
|
-
circle: {
|
|
468367
|
-
radius: 8,
|
|
468368
|
-
fill: {
|
|
468369
|
-
color: "rgba(255, 255, 0, 0.6)",
|
|
468370
|
-
opacity: 0.6
|
|
468371
|
-
},
|
|
468372
|
-
stroke: {
|
|
468373
|
-
color: "#ffff00",
|
|
468374
|
-
width: 3
|
|
468375
|
-
}
|
|
468376
|
-
},
|
|
468377
|
-
text: {
|
|
468378
|
-
font: "12px Arial",
|
|
468379
|
-
fill: {
|
|
468380
|
-
color: "#000000"
|
|
468381
|
-
},
|
|
468382
|
-
stroke: {
|
|
468383
|
-
color: "#ffffff",
|
|
468384
|
-
width: 2
|
|
468385
|
-
},
|
|
468386
|
-
offsetY: -15,
|
|
468387
|
-
scale: 1.2
|
|
468388
|
-
}
|
|
468389
|
-
};
|
|
468390
|
-
class FeatureHighlightManager {
|
|
468391
|
-
constructor(map2, styleConfig) {
|
|
468392
|
-
__publicField(this, "map");
|
|
468393
|
-
__publicField(this, "highlightLayer");
|
|
468394
|
-
__publicField(this, "highlightedFeatures", /* @__PURE__ */ new Map());
|
|
468395
|
-
__publicField(this, "styleConfig");
|
|
468396
|
-
__publicField(this, "featureIdCounter", 0);
|
|
468397
|
-
this.map = map2;
|
|
468398
|
-
this.styleConfig = { ...DEFAULT_HIGHLIGHT_STYLE, ...styleConfig };
|
|
468399
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
468400
|
-
this.highlightLayer = new VectorLayer$3({
|
|
468401
|
-
source: new VectorSource$2(),
|
|
468402
|
-
style: this.createHighlightStyle.bind(this),
|
|
468403
|
-
zIndex: 9999
|
|
468404
|
-
// 确保高亮图层在最上层
|
|
468405
|
-
});
|
|
468406
|
-
this.map.addLayer(this.highlightLayer);
|
|
468407
|
-
}
|
|
468408
|
-
/**
|
|
468409
|
-
* 确保 highlightedFeatures 是有效的 Map 实例
|
|
468410
|
-
*/
|
|
468411
|
-
ensureHighlightedFeaturesMap() {
|
|
468412
|
-
if (!this.highlightedFeatures || !(this.highlightedFeatures instanceof Map)) {
|
|
468413
|
-
console.warn("FeatureHighlightManager: highlightedFeatures corrupted, reinitializing...");
|
|
468414
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
468415
|
-
}
|
|
468416
|
-
}
|
|
468417
|
-
/**
|
|
468418
|
-
* 创建高亮样式
|
|
468419
|
-
*/
|
|
468420
|
-
createHighlightStyle(feature2) {
|
|
468421
|
-
var _a3, _b3, _c2, _d, _e2, _f;
|
|
468422
|
-
const geometry2 = feature2.getGeometry();
|
|
468423
|
-
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
468424
|
-
const styleOptions = {};
|
|
468425
|
-
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
468426
|
-
if (this.styleConfig.circle) {
|
|
468427
|
-
styleOptions.image = new Circle$8({
|
|
468428
|
-
radius: this.styleConfig.circle.radius || 8,
|
|
468429
|
-
fill: new Fill$2({
|
|
468430
|
-
color: ((_a3 = this.styleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
468431
|
-
}),
|
|
468432
|
-
stroke: new Stroke$2({
|
|
468433
|
-
color: ((_b3 = this.styleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
468434
|
-
width: ((_c2 = this.styleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
468435
|
-
})
|
|
468436
|
-
});
|
|
468437
|
-
}
|
|
468438
|
-
} else {
|
|
468439
|
-
if (this.styleConfig.fill) {
|
|
468440
|
-
styleOptions.fill = new Fill$2({
|
|
468441
|
-
color: this.styleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
468442
|
-
});
|
|
468443
|
-
}
|
|
468444
|
-
if (this.styleConfig.stroke) {
|
|
468445
|
-
styleOptions.stroke = new Stroke$2({
|
|
468446
|
-
color: this.styleConfig.stroke.color || "#ffff00",
|
|
468447
|
-
width: this.styleConfig.stroke.width || 3,
|
|
468448
|
-
lineDash: this.styleConfig.stroke.lineDash || [5, 5]
|
|
468449
|
-
});
|
|
468450
|
-
}
|
|
468451
|
-
}
|
|
468452
|
-
if (this.styleConfig.text) {
|
|
468453
|
-
const properties = feature2.getProperties();
|
|
468454
|
-
const labelText = properties.name || properties.label || "高亮要素";
|
|
468455
|
-
styleOptions.text = new Text$5({
|
|
468456
|
-
text: labelText,
|
|
468457
|
-
font: this.styleConfig.text.font || "12px Arial",
|
|
468458
|
-
fill: new Fill$2({
|
|
468459
|
-
color: ((_d = this.styleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
468460
|
-
}),
|
|
468461
|
-
stroke: new Stroke$2({
|
|
468462
|
-
color: ((_e2 = this.styleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
468463
|
-
width: ((_f = this.styleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
468464
|
-
}),
|
|
468465
|
-
offsetY: this.styleConfig.text.offsetY || -15,
|
|
468466
|
-
scale: this.styleConfig.text.scale || 1.2
|
|
468467
|
-
});
|
|
468468
|
-
}
|
|
468469
|
-
return new Style$3(styleOptions);
|
|
468470
|
-
}
|
|
468471
|
-
/**
|
|
468472
|
-
* 根据图层配置创建自定义高亮样式
|
|
468473
|
-
*/
|
|
468474
|
-
createCustomHighlightStyle(feature2, customStyleConfig) {
|
|
468475
|
-
var _a3, _b3, _c2, _d, _e2, _f;
|
|
468476
|
-
const geometry2 = feature2.getGeometry();
|
|
468477
|
-
const geometryType = geometry2 == null ? void 0 : geometry2.getType();
|
|
468478
|
-
const styleOptions = {};
|
|
468479
|
-
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
468480
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.circle) {
|
|
468481
|
-
styleOptions.image = new Circle$8({
|
|
468482
|
-
radius: customStyleConfig.circle.radius || 8,
|
|
468483
|
-
fill: new Fill$2({
|
|
468484
|
-
color: ((_a3 = customStyleConfig.circle.fill) == null ? void 0 : _a3.color) || "rgba(255, 255, 0, 0.6)"
|
|
468485
|
-
}),
|
|
468486
|
-
stroke: new Stroke$2({
|
|
468487
|
-
color: ((_b3 = customStyleConfig.circle.stroke) == null ? void 0 : _b3.color) || "#ffff00",
|
|
468488
|
-
width: ((_c2 = customStyleConfig.circle.stroke) == null ? void 0 : _c2.width) || 3
|
|
468489
|
-
})
|
|
468490
|
-
});
|
|
468491
|
-
}
|
|
468492
|
-
} else {
|
|
468493
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.fill) {
|
|
468494
|
-
styleOptions.fill = new Fill$2({
|
|
468495
|
-
color: customStyleConfig.fill.color || "rgba(255, 255, 0, 0.3)"
|
|
468496
|
-
});
|
|
468497
|
-
}
|
|
468498
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.stroke) {
|
|
468499
|
-
styleOptions.stroke = new Stroke$2({
|
|
468500
|
-
color: customStyleConfig.stroke.color || "#ffff00",
|
|
468501
|
-
width: customStyleConfig.stroke.width || 3,
|
|
468502
|
-
lineDash: customStyleConfig.stroke.lineDash || [5, 5]
|
|
468503
|
-
});
|
|
468504
|
-
}
|
|
468505
|
-
}
|
|
468506
|
-
if (customStyleConfig == null ? void 0 : customStyleConfig.text) {
|
|
468507
|
-
const properties = feature2.getProperties();
|
|
468508
|
-
const labelText = properties.name || properties.label || "高亮要素";
|
|
468509
|
-
styleOptions.text = new Text$5({
|
|
468510
|
-
text: labelText,
|
|
468511
|
-
font: customStyleConfig.text.font || "12px Arial",
|
|
468512
|
-
fill: new Fill$2({
|
|
468513
|
-
color: ((_d = customStyleConfig.text.fill) == null ? void 0 : _d.color) || "#000000"
|
|
468514
|
-
}),
|
|
468515
|
-
stroke: new Stroke$2({
|
|
468516
|
-
color: ((_e2 = customStyleConfig.text.stroke) == null ? void 0 : _e2.color) || "#ffffff",
|
|
468517
|
-
width: ((_f = customStyleConfig.text.stroke) == null ? void 0 : _f.width) || 2
|
|
468518
|
-
}),
|
|
468519
|
-
offsetX: customStyleConfig.text.offsetX || 0,
|
|
468520
|
-
offsetY: customStyleConfig.text.offsetY || -15,
|
|
468521
|
-
scale: customStyleConfig.text.scale || 1.2
|
|
468522
|
-
});
|
|
468523
|
-
}
|
|
468524
|
-
return new Style$3(styleOptions);
|
|
468525
|
-
}
|
|
468526
|
-
/**
|
|
468527
|
-
* 高亮要素
|
|
468528
|
-
*/
|
|
468529
|
-
highlightFeature(feature2, layerId, layerHighlightConfig) {
|
|
468530
|
-
var _a3;
|
|
468531
|
-
this.ensureHighlightedFeaturesMap();
|
|
468532
|
-
const existingId = this.isFeatureHighlighted(feature2);
|
|
468533
|
-
if (existingId) {
|
|
468534
|
-
return existingId;
|
|
468535
|
-
}
|
|
468536
|
-
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.clearOthersOnHighlight) {
|
|
468537
|
-
this.clearAllHighlights();
|
|
468538
|
-
}
|
|
468539
|
-
const featureId2 = `highlight_${++this.featureIdCounter}_${Date.now()}`;
|
|
468540
|
-
const highlightFeature = feature2.clone();
|
|
468541
|
-
highlightFeature.setId(featureId2);
|
|
468542
|
-
if (layerHighlightConfig == null ? void 0 : layerHighlightConfig.style) {
|
|
468543
|
-
const customStyle = this.createCustomHighlightStyle(highlightFeature, layerHighlightConfig.style);
|
|
468544
|
-
highlightFeature.setStyle(customStyle);
|
|
468545
|
-
}
|
|
468546
|
-
const originalStyle = feature2.getStyle();
|
|
468547
|
-
const highlightInfo = {
|
|
468548
|
-
originalFeature: feature2,
|
|
468549
|
-
highlightFeature,
|
|
468550
|
-
originalStyle,
|
|
468551
|
-
layerId
|
|
468552
|
-
};
|
|
468553
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.addFeature(highlightFeature);
|
|
468554
|
-
this.highlightedFeatures.set(featureId2, highlightInfo);
|
|
468555
|
-
return featureId2;
|
|
468556
|
-
}
|
|
468557
|
-
/**
|
|
468558
|
-
* 取消高亮要素
|
|
468559
|
-
*/
|
|
468560
|
-
unhighlightFeature(featureId2) {
|
|
468561
|
-
var _a3;
|
|
468562
|
-
this.ensureHighlightedFeaturesMap();
|
|
468563
|
-
const highlightInfo = this.highlightedFeatures.get(featureId2);
|
|
468564
|
-
if (!highlightInfo) {
|
|
468565
|
-
return false;
|
|
468566
|
-
}
|
|
468567
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.removeFeature(highlightInfo.highlightFeature);
|
|
468568
|
-
this.highlightedFeatures.delete(featureId2);
|
|
468569
|
-
return true;
|
|
468570
|
-
}
|
|
468571
|
-
/**
|
|
468572
|
-
* 清除所有高亮
|
|
468573
|
-
*/
|
|
468574
|
-
clearAllHighlights() {
|
|
468575
|
-
var _a3;
|
|
468576
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.clear();
|
|
468577
|
-
this.ensureHighlightedFeaturesMap();
|
|
468578
|
-
this.highlightedFeatures.clear();
|
|
468579
|
-
}
|
|
468580
|
-
/**
|
|
468581
|
-
* 获取当前高亮的要素数量
|
|
468582
|
-
*/
|
|
468583
|
-
getHighlightedCount() {
|
|
468584
|
-
this.ensureHighlightedFeaturesMap();
|
|
468585
|
-
return this.highlightedFeatures.size;
|
|
468586
|
-
}
|
|
468587
|
-
/**
|
|
468588
|
-
* 获取所有高亮要素的ID
|
|
468589
|
-
*/
|
|
468590
|
-
getHighlightedFeatureIds() {
|
|
468591
|
-
this.ensureHighlightedFeaturesMap();
|
|
468592
|
-
return Array.from(this.highlightedFeatures.keys());
|
|
468593
|
-
}
|
|
468594
|
-
/**
|
|
468595
|
-
* 检查要素是否已高亮
|
|
468596
|
-
*/
|
|
468597
|
-
isFeatureHighlighted(feature2) {
|
|
468598
|
-
this.ensureHighlightedFeaturesMap();
|
|
468599
|
-
if (!this.highlightedFeatures || typeof this.highlightedFeatures[Symbol.iterator] !== "function") {
|
|
468600
|
-
console.warn("FeatureHighlightManager: highlightedFeatures lost iterator, reinitializing...");
|
|
468601
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
468602
|
-
return null;
|
|
468603
|
-
}
|
|
468604
|
-
try {
|
|
468605
|
-
const entries = Array.from(this.highlightedFeatures.entries());
|
|
468606
|
-
for (const [id2, info] of entries) {
|
|
468607
|
-
if (info && info.originalFeature === feature2) {
|
|
468608
|
-
return id2;
|
|
468609
|
-
}
|
|
468610
|
-
}
|
|
468611
|
-
} catch (error2) {
|
|
468612
|
-
console.error("Error iterating highlightedFeatures:", error2);
|
|
468613
|
-
this.highlightedFeatures = /* @__PURE__ */ new Map();
|
|
468614
|
-
return null;
|
|
468615
|
-
}
|
|
468616
|
-
return null;
|
|
468617
|
-
}
|
|
468618
|
-
/**
|
|
468619
|
-
* 更新高亮样式配置
|
|
468620
|
-
*/
|
|
468621
|
-
updateStyleConfig(newConfig) {
|
|
468622
|
-
var _a3;
|
|
468623
|
-
this.styleConfig = { ...this.styleConfig, ...newConfig };
|
|
468624
|
-
this.ensureHighlightedFeaturesMap();
|
|
468625
|
-
(_a3 = this.highlightLayer.getSource()) == null ? void 0 : _a3.getFeatures().forEach((feature2) => {
|
|
468626
|
-
feature2.changed();
|
|
468627
|
-
});
|
|
468628
|
-
}
|
|
468629
|
-
/**
|
|
468630
|
-
* 获取当前样式配置
|
|
468631
|
-
*/
|
|
468632
|
-
getStyleConfig() {
|
|
468633
|
-
return { ...this.styleConfig };
|
|
468634
|
-
}
|
|
468635
|
-
/**
|
|
468636
|
-
* 销毁管理器
|
|
468637
|
-
*/
|
|
468638
|
-
destroy() {
|
|
468639
|
-
this.clearAllHighlights();
|
|
468640
|
-
this.map.removeLayer(this.highlightLayer);
|
|
468641
|
-
}
|
|
468642
|
-
}
|
|
468643
468694
|
const _hoisted_1$q = ["id"];
|
|
468644
468695
|
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
468645
468696
|
__name: "BasePopup",
|
|
@@ -470164,28 +470215,47 @@ ${this.attributes_.map(
|
|
|
470164
470215
|
}
|
|
470165
470216
|
}
|
|
470166
470217
|
/**
|
|
470167
|
-
*
|
|
470218
|
+
* 查找匹配的图层配置(支持递归查找子图层)
|
|
470168
470219
|
*/
|
|
470169
470220
|
findMatchingLayer(layer2, allLayers) {
|
|
470170
|
-
|
|
470171
|
-
|
|
470172
|
-
|
|
470173
|
-
return true;
|
|
470174
|
-
}
|
|
470175
|
-
if (layer2.layerId && l2.id === layer2.layerId) {
|
|
470176
|
-
return true;
|
|
470177
|
-
}
|
|
470178
|
-
if (layer2.layerName && l2.name === layer2.layerName) {
|
|
470179
|
-
return true;
|
|
470221
|
+
for (const config of allLayers) {
|
|
470222
|
+
if (this.isLayerMatch(layer2, config)) {
|
|
470223
|
+
return config;
|
|
470180
470224
|
}
|
|
470181
|
-
if (
|
|
470182
|
-
|
|
470225
|
+
if (config.children && config.children.length > 0) {
|
|
470226
|
+
const match2 = this.findMatchingLayer(layer2, config.children);
|
|
470227
|
+
if (match2)
|
|
470228
|
+
return match2;
|
|
470183
470229
|
}
|
|
470184
|
-
if (
|
|
470185
|
-
|
|
470230
|
+
if (config.layers && config.layers.length > 0) {
|
|
470231
|
+
const match2 = this.findMatchingLayer(layer2, config.layers);
|
|
470232
|
+
if (match2)
|
|
470233
|
+
return match2;
|
|
470186
470234
|
}
|
|
470187
|
-
|
|
470188
|
-
|
|
470235
|
+
}
|
|
470236
|
+
return void 0;
|
|
470237
|
+
}
|
|
470238
|
+
/**
|
|
470239
|
+
* 检查图层实例是否匹配配置
|
|
470240
|
+
*/
|
|
470241
|
+
isLayerMatch(layer2, config) {
|
|
470242
|
+
var _a3;
|
|
470243
|
+
if (((_a3 = layer2.values_) == null ? void 0 : _a3.layerId) && config.id === layer2.values_.layerId) {
|
|
470244
|
+
return true;
|
|
470245
|
+
}
|
|
470246
|
+
if (layer2.layerId && config.id === layer2.layerId) {
|
|
470247
|
+
return true;
|
|
470248
|
+
}
|
|
470249
|
+
if (layer2.layerName && config.name === layer2.layerName) {
|
|
470250
|
+
return true;
|
|
470251
|
+
}
|
|
470252
|
+
if (layer2.get && layer2.get("id") === config.id) {
|
|
470253
|
+
return true;
|
|
470254
|
+
}
|
|
470255
|
+
if (layer2.get && layer2.get("name") === config.name) {
|
|
470256
|
+
return true;
|
|
470257
|
+
}
|
|
470258
|
+
return false;
|
|
470189
470259
|
}
|
|
470190
470260
|
/**
|
|
470191
470261
|
* 初始化地图
|
|
@@ -470304,7 +470374,7 @@ ${this.attributes_.map(
|
|
|
470304
470374
|
const initialCenter = this.config.center || [116.404, 39.915];
|
|
470305
470375
|
const initialZoom = this.config.zoom || 10;
|
|
470306
470376
|
this.mapOperationTool = new MapOperationTool(this.map, initialCenter, initialZoom);
|
|
470307
|
-
this.geoJsonLocationTool = new GeoJSONLocationTool(this.map);
|
|
470377
|
+
this.geoJsonLocationTool = new GeoJSONLocationTool(this.map, this.featureHighlightManager);
|
|
470308
470378
|
const popupConfig = this.config.popupConfig || {};
|
|
470309
470379
|
this.popupManager = new PopupManager(this.map, popupConfig);
|
|
470310
470380
|
this.bindEventManagerEvents();
|