石超 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", GetGeom = "/api/ShpLayerSource/GetShapeData",
CalTubanArea = "/api/DroneCaseInfoSingle/CalTubanArea", CalTubanArea = "/api/DroneCaseInfoSingle/CalTubanArea",
SplitAndCalTubanArea = "/api/DroneCaseInfoSingle/SplitAndCalTubanArea", SplitAndCalTubanArea = "/api/DroneCaseInfoSingle/SplitAndCalTubanArea",
SplitTubanBackYuan = "/api/DroneCaseInfoSingle/SplitTubanBackYuan",
GetPermCode = '/getPermCode', GetPermCode = '/getPermCode',
TestRetry = '/testRetry', TestRetry = '/testRetry',
Login = '/api/Check/Login', 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) { export function getConfig(params) {

View File

@ -109,7 +109,7 @@
<!-- <p class="split-panel-item" >地类图斑分割</p> --> <!-- <p class="split-panel-item" >地类图斑分割</p> -->
<a-dropdown> <!-- <a-dropdown>
<p @click.prevent>地类图斑分割 <DownOutlined /></p> <p @click.prevent>地类图斑分割 <DownOutlined /></p>
<template #overlay> <template #overlay>
<a-menu> <a-menu>
@ -121,13 +121,12 @@
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>
</a-dropdown> </a-dropdown> -->
</div> </div>
</template> </template>
<div class="split-line" ></div> <div class="split-line" ></div>
</a-popover> </a-popover>
<a-tooltip> <a-tooltip>
<template #title>线分割图斑</template> <template #title>线分割图斑</template>
</a-tooltip> </a-tooltip>
@ -338,7 +337,7 @@
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { useCloudQueryStore } from '@/store/modules/cloudquery'; 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 { CalTubanAreaModel } from '@/api/sys/model/layerModel';
import { AddDroneTask, LoadLandType, AddDroneLandTask, LoadCloudQueryByCaseNo } from '@/api/demo/cloudQuery'; import { AddDroneTask, LoadLandType, AddDroneLandTask, LoadCloudQueryByCaseNo } from '@/api/demo/cloudQuery';
@ -366,7 +365,6 @@
let geojson = JSON.parse(JSON.stringify(res)) let geojson = JSON.parse(JSON.stringify(res))
// shapgefile // shapgefile
handlerDetails( handlerDetails(
res, res,
@ -418,6 +416,29 @@
geomData:null, geomData:null,
caseid:null, 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)=>{ const handlerSelectLandType = (type)=>{
@ -433,6 +454,59 @@
"type":type "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=>{ splitAndCalTubanArea(calAreaParams).then(res=>{
if(res){ if(res){
@ -1154,6 +1228,7 @@
projection: 'equirectangular', // wgs84 projection: 'equirectangular', // wgs84
style: MapboxDefaultStyle, style: MapboxDefaultStyle,
// maxZoom: props.mapConfig.maxZoom ? props.mapConfig.maxZoom:18, // maxZoom: props.mapConfig.maxZoom ? props.mapConfig.maxZoom:18,
maxZoom:50,
minZoom: props.mapConfig.minZoom ? props.mapConfig.minZoom : 1, minZoom: props.mapConfig.minZoom ? props.mapConfig.minZoom : 1,
zoom: props.mapConfig.zoom ? props.mapConfig.zoom : 10, zoom: props.mapConfig.zoom ? props.mapConfig.zoom : 10,
pitch: props.mapConfig.angle ? props.mapConfig.angle : 0, pitch: props.mapConfig.angle ? props.mapConfig.angle : 0,
@ -1280,6 +1355,8 @@
}; };
// shapefile // shapefile
const splitFeatureByMultiFill = (geojson)=>{ const splitFeatureByMultiFill = (geojson)=>{
let splitPolygon = currentGeoJson.value; let splitPolygon = currentGeoJson.value;
splitPolygonByMultiFill(geojson.features,JSON.parse(JSON.stringify(editGeoJson.value))).then(features=>{ splitPolygonByMultiFill(geojson.features,JSON.parse(JSON.stringify(editGeoJson.value))).then(features=>{
if(features){ if(features){

View File

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

View File

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

View File

@ -27,27 +27,30 @@
<LayerControl @handlerLayerButtonClick="handlerLayerButtonClick"></LayerControl> <LayerControl @handlerLayerButtonClick="handlerLayerButtonClick"></LayerControl>
<div class="data-container" v-show="true"> <div class="right-container">
<div class="open-button" @click="changeUavContaienrShow">
<ShrinkOutlined v-if="uavContaienrShow" /> <div class="data-container" v-show="true">
<ArrowsAltOutlined v-else /> <div class="open-button" @click="changeUavContaienrShow">
<ShrinkOutlined v-if="uavContaienrShow" />
<ArrowsAltOutlined v-else />
</div>
<!-- tif list -->
<!-- <TifList v-if="drawState" ref="TifListComponent" @changeTifLayer="changeTifLayer"></TifList> -->
<!-- case list -->
<!-- <CaseList v-show="false" @handlerLayerButtonClick="handlerLayerButtonClick" @toPosition="toPosition"></CaseList> -->
<!-- uav -->
<UAV v-show="uavContaienrShow" @toPosition="toPosition" @handlerUpdateUavLayerData="handlerUpdateUavLayerData" @handlerLayerButtonClick="handlerLayerButtonClick"></UAV>
</div> </div>
<!-- tif list --> <!-- monitor -->
<!-- <TifList v-if="drawState" ref="TifListComponent" @changeTifLayer="changeTifLayer"></TifList> --> <!-- <Monitor :currentMonitor="monitorInfo" @register="registerModal" /> -->
<!-- case list --> <!-- TCVideo -->
<!-- <CaseList v-show="false" @handlerLayerButtonClick="handlerLayerButtonClick" @toPosition="toPosition"></CaseList> --> <div class="TC-videoi-container" v-if="showTCLPlayer" v-drag>
<!-- uav --> <div class="close-button" @click="showTCLPlayer = false;">
<UAV v-show="uavContaienrShow" @toPosition="toPosition" @handlerUpdateUavLayerData="handlerUpdateUavLayerData" @handlerLayerButtonClick="handlerLayerButtonClick"></UAV> <CloseOutlined></CloseOutlined>
</div>
<!-- monitor --> </div>
<!-- <Monitor :currentMonitor="monitorInfo" @register="registerModal" /> --> <TCVideo v-if="showTCLPlayer" :play-url="'12334344'"></TCVideo>
<!-- TCVideo -->
<div class="TC-videoi-container" v-if="showTCLPlayer" v-drag>
<div class="close-button" @click="showTCLPlayer = false;">
<CloseOutlined></CloseOutlined>
</div> </div>
<TCVideo v-if="showTCLPlayer" :play-url="'12334344'"></TCVideo>
</div> </div>
<!-- layer center --> <!-- layer center -->
@ -282,14 +285,18 @@ onMounted(() => {
background: url('/videosupervision/main-bottom.png'); background: url('/videosupervision/main-bottom.png');
background-size: 100% 100%; background-size: 100% 100%;
} }
.right-container{
width:418px;
min-height:200px;
position: absolute;
bottom:32px;
right: 24px;
}
.data-container { .data-container {
width: 418px; width: 418px;
height:300px; height:300px;
position: absolute;
bottom:-100px;
right: 24px;
transform: translate(0, -50%);
z-index:9999999; z-index:9999999;
position: relative;
.open-button{ .open-button{
width:30px; width:30px;
height:30px; height:30px;
@ -388,9 +395,8 @@ onMounted(() => {
} }
.TC-videoi-container{ .TC-videoi-container{
position: absolute; margin-top:16px;
bottom:48px; position: relative;
right:38px;
width:418px; width:418px;
height:300px; height:300px;
.close-button{ .close-button{

View File

@ -13,9 +13,8 @@
</div> </div>
<div class="home-button" @click="handlerInitialize"> <div class="home-button" @click="handlerInitialize">
<HomeOutlined />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
@ -1291,13 +1290,12 @@ const handlerInitialize = ()=>{
} }
.home-button{ .home-button{
width:100px; width:40px;
height:100px; height:40px;
background:url(/map/home-btn.png); background:url(/map/home-btn.png);
background-size: 100% 100%; background-size: 100% 100%;
float:right; float:right;
position:relative; position:relative;
top:-25px;
line-height:100px; line-height:100px;
text-align:center; text-align:center;
} }