石超 2025-04-21 17:07:52 +08:00
commit 8c7ded2b50
6 changed files with 132 additions and 41 deletions

View File

@ -24,6 +24,7 @@ enum Api {
GetGeom = "/api/ShpLayerSource/GetShapeData",
CalTubanArea = "/api/DroneCaseInfoSingle/CalTubanArea",
SplitAndCalTubanArea = "/api/DroneCaseInfoSingle/SplitAndCalTubanArea",
SplitTubanBackYuan = "/api/DroneCaseInfoSingle/SplitTubanBackYuan",
GetPermCode = '/getPermCode',
TestRetry = '/testRetry',
Login = '/api/Check/Login',
@ -135,6 +136,14 @@ export function splitAndCalTubanArea(params:CalTubanAreaModel){
}
export function splitTubanBackYuan(params:CalTubanAreaModel){
return defHttp.post(
{
url: Api.SplitTubanBackYuan,
params,
}
)
}
export function getConfig(params) {

View File

@ -109,7 +109,7 @@
<!-- <p class="split-panel-item" >地类图斑分割</p> -->
<a-dropdown>
<!-- <a-dropdown>
<p @click.prevent>地类图斑分割 <DownOutlined /></p>
<template #overlay>
<a-menu>
@ -121,13 +121,12 @@
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</a-dropdown> -->
</div>
</template>
<div class="split-line" ></div>
</a-popover>
<a-tooltip>
<template #title>线分割图斑</template>
</a-tooltip>
@ -338,7 +337,7 @@
import { message, Modal } from 'ant-design-vue';
import { useCloudQueryStore } from '@/store/modules/cloudquery';
//
import { splitAndCalTubanArea } from '@/api/sys/layerManagement';
import { splitAndCalTubanArea,splitTubanBackYuan } from '@/api/sys/layerManagement';
import { CalTubanAreaModel } from '@/api/sys/model/layerModel';
import { AddDroneTask, LoadLandType, AddDroneLandTask, LoadCloudQueryByCaseNo } from '@/api/demo/cloudQuery';
@ -366,7 +365,6 @@
let geojson = JSON.parse(JSON.stringify(res))
// shapgefile
handlerDetails(
res,
@ -419,6 +417,29 @@
caseid:null,
})
//
function splitMultiPolygons(str) {
let hadnlerStr = str.replace(",MULTIPOLYGON","-MULTIPOLYGON");
let result = hadnlerStr.split("-");
// "MULTIPOLYGON"
// const cleanedStr = str.replace(/^MULTIPOLYGON\(/, '').replace(/\)+$/, '');
// // 使
// const polygonStrings = cleanedStr.split(/\)\),\s*MULTIPOLYGON\(\(/);
// // MULTIPOLYGON
// const result = polygonStrings.map(poly => {
// //
// const fixedPoly = poly.startsWith('((') ? poly : `((${poly}`;
// return `MULTIPOLYGON(${fixedPoly}))`;
// });
return result;
}
//
const handlerSelectLandType = (type)=>{
@ -433,6 +454,59 @@
"type":type
}
splitTubanBackYuan(calAreaParams).then(res=>{
let geojson = {
type:"FeatureCollection",
features:[]
};
let wktArray = splitMultiPolygons(res.gengdituban);
if(wktArray.length>0){
wktArray?.forEach((item,index)=>{
console.log("item",item);
let feature = {
"type": "Feature",
"properties": {
"id": generateUUID()
},
"geometry": WktToGeojson(item)
}
geojson.features.push(feature);
})
}else{
//
let feature = {
"type": "Feature",
"properties": {
"id": generateUUID()
},
"geometry": WktToGeojson(res.gengdituban)
}
}
console.log("splitTubanBackYuan",geojson)
splitFeatureByMultiFill(geojson);
handlerDetails(
{type:"FeatureCollection",features:[]},
'shapefileSource',
'shapefileLayer',
{
lineStyle: { 'line-color': '#ff0000', 'line-width': 3 },
fillStyle: { 'fill-color': '#ff0000', 'fill-opacity': 0.1 },
}
)
})
return null;
splitAndCalTubanArea(calAreaParams).then(res=>{
if(res){
@ -1154,6 +1228,7 @@
projection: 'equirectangular', // wgs84
style: MapboxDefaultStyle,
// maxZoom: props.mapConfig.maxZoom ? props.mapConfig.maxZoom:18,
maxZoom:50,
minZoom: props.mapConfig.minZoom ? props.mapConfig.minZoom : 1,
zoom: props.mapConfig.zoom ? props.mapConfig.zoom : 10,
pitch: props.mapConfig.angle ? props.mapConfig.angle : 0,
@ -1280,6 +1355,8 @@
};
// shapefile
const splitFeatureByMultiFill = (geojson)=>{
let splitPolygon = currentGeoJson.value;
splitPolygonByMultiFill(geojson.features,JSON.parse(JSON.stringify(editGeoJson.value))).then(features=>{
if(features){

View File

@ -344,7 +344,7 @@ export async function splitPolygonByMultiFill(drawPolygons,outerPolygon){
// 处理精度后绘制图斑
let turfPolygon = turf.truncate(splitPolygonItem,dealOptions);
//console.log("💩第4步处理精度后绘制图斑",turfPolygon);
console.log("求交集的处理数据:",turf.featureCollection([featuresArray[0],turfPolygon]));
// 取交集
let intersection = turf.intersect(turf.featureCollection([featuresArray[0],turfPolygon]),dealOptions);
@ -354,11 +354,12 @@ export async function splitPolygonByMultiFill(drawPolygons,outerPolygon){
//console.log("💩第5步交集"+index+"",intersection)
splitFeaturesArray.push(turfPolygon);
}catch(e){
//console.log(e);
console.log(e);
}
})
// 取差集
console.log("求差集的处理数据:",turf.featureCollection(featuresArray.concat(splitFeaturesArray)));
var difference = turf.difference(turf.featureCollection(featuresArray.concat(splitFeaturesArray)));
//console.log("💩第6步差集",difference);
if(difference){

View File

@ -3,16 +3,14 @@ import { wktToGeoJSON,geojsonToWKT } from "@terraformer/wkt"
const wktCollectionToGeoJson = (wktStr) => {
alert(999);
console.log("wktStr",wktStr);
let geojson = WKT.parse(wktStr);
console.log("geojson",geojson);
alert(123);
}
const WktToGeojson = (wktData)=> {
// return WKT.parse(wktData)
console.log("wktData",wktToGeoJSON(wktData));
console.log("wktData",wktData);
return wktToGeoJSON(wktData);
}
@ -51,7 +49,9 @@ const removeZM = (geoJSON) => {
default:
throw new Error(`Unsupported geometry type: ${geoJSON.type}`);
}
return geoJSON;
}
export {WktToGeojson,GeojsonToWkt,removeZM,wktCollectionToGeoJson}

View File

@ -27,6 +27,8 @@
<LayerControl @handlerLayerButtonClick="handlerLayerButtonClick"></LayerControl>
<div class="right-container">
<div class="data-container" v-show="true">
<div class="open-button" @click="changeUavContaienrShow">
<ShrinkOutlined v-if="uavContaienrShow" />
@ -49,6 +51,7 @@
</div>
<TCVideo v-if="showTCLPlayer" :play-url="'12334344'"></TCVideo>
</div>
</div>
<!-- layer center -->
@ -282,14 +285,18 @@ onMounted(() => {
background: url('/videosupervision/main-bottom.png');
background-size: 100% 100%;
}
.right-container{
width:418px;
min-height:200px;
position: absolute;
bottom:32px;
right: 24px;
}
.data-container {
width: 418px;
height:300px;
position: absolute;
bottom:-100px;
right: 24px;
transform: translate(0, -50%);
z-index:9999999;
position: relative;
.open-button{
width:30px;
height:30px;
@ -388,9 +395,8 @@ onMounted(() => {
}
.TC-videoi-container{
position: absolute;
bottom:48px;
right:38px;
margin-top:16px;
position: relative;
width:418px;
height:300px;
.close-button{

View File

@ -13,11 +13,10 @@
</div>
<div class="home-button" @click="handlerInitialize">
<HomeOutlined />
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import MonitoringData from './MonitoringData.json';
@ -1291,13 +1290,12 @@ const handlerInitialize = ()=>{
}
.home-button{
width:100px;
height:100px;
width:40px;
height:40px;
background:url(/map/home-btn.png);
background-size: 100% 100%;
float:right;
position:relative;
top:-25px;
line-height:100px;
text-align:center;
}