合并代码

hc_zhufu
徐景良 2024-05-21 09:10:21 +08:00
parent eb73b3c4eb
commit 8940e0a8f6
2 changed files with 24 additions and 22 deletions

View File

@ -93,12 +93,10 @@
let nextMapControl: Array<any> = reactive([]);
nextMapControl = props.control
? props.control.map((item) => {
console.log('item::: ', item);
return MapControlConfig[item];
})
: [];
console.log('nextMapControl::: ', nextMapControl);
//
let map: Map;
@ -141,12 +139,10 @@
//
map.on("draw.create", function (e) {
console.log(e);
drawGeojson.geojson = e.features[0]
});
map.on("draw.update", function (e) {
console.log(e);
drawGeojson.geojson = e.features[0]
});
@ -265,7 +261,6 @@
}
const handlerCopyFeature = () => {
console.log("selectFeature",selectFeature);
popup.remove();
createMessage.success("复制成功!")
}
@ -297,7 +292,6 @@
//
const handlerLayerControler = (layerInfo)=>{
console.log("layerinfoinfo",layerInfo)
if(map.getSource(layerInfo.layer.id)){
if(layerInfo.checked){
map.setLayoutProperty(layerInfo.layer.id, "visibility", "visible");
@ -320,7 +314,6 @@
//
const handlerPreviewFeatureInfo = (e) => {
if(e.features){
console.log("EEEEEEE",e.features[0].layer.id,e.features[0].properties);
isOpen.value = true;
}
}
@ -413,23 +406,32 @@
}
const handlerDraw = (feature=null) =>{
let featureTemp = WktToGeojson(feature);
console.log("传入的WKT",featureTemp);
let geo = {
type: "FeatureCollection",
features: [
{
"id": "cd1d93c0e4a6747ff597f190c311d0e3",
"type": "Feature",
"properties": {},
"geometry": featureTemp
let geo = {};
if(feature==null){
geo = {
type: "FeatureCollection",
features: [],
}
}else{
let featureTemp = WktToGeojson(feature);
geo = {
type: "FeatureCollection",
features: [
{
"id": "cd1d93c0e4a6747ff597f190c311d0e3",
"type": "Feature",
"properties": {},
"geometry": featureTemp
}
],
}
],
}
console.log("geo",geo);
handlerInitDrawTool(geo)
}

View File

@ -70,7 +70,7 @@
//
// const feature ="LINESTRING (118.55483239594203 35.81329409678203, 118.54889167836416 35.806406839795216, 118.55647247134772 35.80285975465173, 118.56157492816281 35.803303140294986)"
const feature = "POLYGON ((118.54774514802972 35.80786133598188, 118.54515277045988 35.79816597053564, 118.55919536113471 35.80085134034624, 118.56021460056033 35.80462789316549, 118.5595188628206 35.80695604583504, 118.5580066425723 35.80815336506183, 118.54774514802972 35.80786133598188))"
// const feature = "POLYGON ((118.54774514802972 35.80786133598188, 118.54515277045988 35.79816597053564, 118.55919536113471 35.80085134034624, 118.56021460056033 35.80462789316549, 118.5595188628206 35.80695604583504, 118.5580066425723 35.80815336506183, 118.54774514802972 35.80786133598188))"
// geom
const handlerDrawComplete = (geom)=>{
console.log("绘制完成返回的图斑",geom);
@ -84,7 +84,7 @@
//
// MapboxComponent.value.handlerDraw()
//
MapboxComponent.value.handlerDraw(feature)
MapboxComponent.value.handlerDraw()
},3000)
//