Compare commits
5 Commits
6e7a671ec0
...
0b62a65019
| Author | SHA1 | Date |
|---|---|---|
|
|
0b62a65019 | |
|
|
a560632df9 | |
|
|
09cfeb75d5 | |
|
|
ae1138c59f | |
|
|
192709831c |
|
|
@ -183,7 +183,7 @@ import { features } from 'process';
|
|||
}else{ // 如果没找到数据 则添加到数组
|
||||
geojson.geojson.features.push(feature);
|
||||
}
|
||||
console.log("geojson.geojson",geojson.geojson);
|
||||
handlerDrawComplete()
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
|
|
@ -195,7 +195,7 @@ import { features } from 'process';
|
|||
geojson.geojson.features.splice(i,1);
|
||||
}
|
||||
}
|
||||
console.log("geojson.geojson",geojson.geojson);
|
||||
handlerDrawComplete()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -247,9 +247,12 @@ import { features } from 'process';
|
|||
|
||||
// 初始化绘图空间
|
||||
const handlerInitDrawTool = (feature) => {
|
||||
|
||||
geojson.geojson = feature;
|
||||
|
||||
if(drawTool){
|
||||
drawTool.deleteAll();
|
||||
drawTool.set(geojson.geojson);
|
||||
}else{
|
||||
drawTool = new MapboxDraw({
|
||||
modes: {
|
||||
|
|
@ -455,6 +458,7 @@ import { features } from 'process';
|
|||
|
||||
const handlerCancleDraw = () => {
|
||||
map.removeControl(drawTool)
|
||||
drawTool = null;
|
||||
drawing.value = false;
|
||||
// drawTool.set(geojson.geojson)
|
||||
}
|
||||
|
|
@ -472,26 +476,30 @@ import { features } from 'process';
|
|||
}else{
|
||||
if(features.length > 0){
|
||||
for(let i=0; i < features.length; i++){
|
||||
let featureTemp = WktToGeojson(features[i].value);
|
||||
|
||||
featureTemp.type="Polygon";
|
||||
let feature = {
|
||||
"id": "cd1d93c0e4a6747ff597f"+parseInt(1000000000*Math.random()).toString(),
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": featureTemp
|
||||
try{
|
||||
let featureTemp = WktToGeojson(features[i].value);
|
||||
let feature = {
|
||||
"id": "cd1d93c0e4a6747ff597f"+parseInt(1000000000*Math.random()).toString(),
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": featureTemp
|
||||
}
|
||||
geo.features.push(feature);
|
||||
}catch(e){
|
||||
console.log("WKT解析错误,请检查WKT数据格式是否有误")
|
||||
}
|
||||
geo.features.push(feature);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("geo.geo",geo);
|
||||
handlerInitDrawTool(geo)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handlerDraw,
|
||||
handlerLocation
|
||||
handlerLocation,
|
||||
handlerCancleDraw,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
zoom: 8,
|
||||
};
|
||||
|
||||
|
||||
// 展示的图层列表
|
||||
const layers = reactive([
|
||||
{
|
||||
|
|
@ -106,16 +105,18 @@
|
|||
// 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))"
|
||||
|
||||
|
||||
let drawFeatures = [{
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.55901684631719 35.8045110934671, 118.55946931550466 35.80449259041045, 118.55946551324392 35.80463444717644, 118.559024450841 35.80464061486234, 118.55901684631719 35.8045110934671))"
|
||||
}, {
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.5591119028685 35.804344565958516, 118.5594579087177 35.804344565958516, 118.55945410645693 35.80424279914757, 118.55910049608158 35.80423663146167, 118.5591119028685 35.804344565958516))"
|
||||
}, {
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.55922520818172 35.8049069756666, 118.5594647506927 35.80490080800186, 118.55945714616884 35.80477128705068, 118.55921380139475 35.804783622380114, 118.55922520818172 35.8049069756666))"
|
||||
}];
|
||||
let drawFeatures = [
|
||||
{
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.55901684631719 35.8045110934671, 118.55946931550466 35.80449259041045, 118.55946551324392 35.80463444717644, 118.559024450841 35.80464061486234, 118.55901684631719 35.8045110934671))"
|
||||
}, {
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.5591119028685 35.804344565958516, 118.5594579087177 35.804344565958516, 118.55945410645693 35.80424279914757, 118.55910049608158 35.80423663146167, 118.5591119028685 35.804344565958516))"
|
||||
}, {
|
||||
"columnName": "mapgeom",
|
||||
"value": "POLYGON ((118.55922520818172 35.8049069756666, 118.5594647506927 35.80490080800186, 118.55945714616884 35.80477128705068, 118.55921380139475 35.804783622380114, 118.55922520818172 35.8049069756666))"
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
// 绘图完成返回geom
|
||||
|
|
|
|||
Loading…
Reference in New Issue