ca888098 by 杨威

行政区、地籍区、地籍子区覆盖判断

1 parent 6306e097
......@@ -7,5 +7,20 @@
"layerName": "ZRZ",
"layerUrl": "http://192.168.2.201:6080/arcgis/rest/services/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E4%B8%8D%E5%8A%A8%E4%BA%A7/XA_%E4%B8%8D%E5%8A%A8%E4%BA%A7/MapServer",
"id": "10"
},
{
"layerName": "DJQ",
"layerUrl": "http://192.168.2.201:6080/arcgis/rest/services/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E4%B8%8D%E5%8A%A8%E4%BA%A7/XA_%E4%B8%8D%E5%8A%A8%E4%BA%A7/MapServer",
"id": "13"
},
{
"layerName": "DJZQ",
"layerUrl": "http://192.168.2.201:6080/arcgis/rest/services/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E4%B8%8D%E5%8A%A8%E4%BA%A7/XA_%E4%B8%8D%E5%8A%A8%E4%BA%A7/MapServer",
"id": "14"
},
{
"layerName": "XJZQ",
"layerUrl": "http://192.168.2.201:6080/arcgis/rest/services/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E4%B8%8D%E5%8A%A8%E4%BA%A7/XA_%E4%B8%8D%E5%8A%A8%E4%BA%A7/MapServer",
"id": "19"
}
]
\ No newline at end of file
......
......@@ -407,8 +407,8 @@ export default {
});
},
/*
* 导入图形
* */
* 导入图形
* */
importGeo(){
var self = this;
var BSM = "";
......
......@@ -196,11 +196,19 @@ export default {
attributes:self.currentClickZd,
geometry:geometry
}
if(self.propertyInfo.type == "zd"){
self.saveZd(graphic);
}else{
self.saveZRZ(graphic);
}
self.geoJoint(geometry,function (isJoint,message) {
if(isJoint){
self.$message.warning(message)
return;
}else {
if(self.propertyInfo.type == "zd"){
self.saveZd(graphic);
}else{
self.saveZRZ(graphic);
}
}
});
} else {
console.log('error submit!!');
return false;
......
......@@ -4,6 +4,7 @@
import layers from '@/assets/json/layers.json'
import queryUtils from "@libs/map/queryUtils";
import identifyUtils from '@/libs/map/IdentifyUtils'
import {loadModules} from "esri-loader"
import arcgisParser from 'terraformer-arcgis-parser'
import wktParse from 'terraformer-wkt-parser'
......@@ -155,6 +156,54 @@ export default {
primitive.type = "Polygon"
}*/
return arcgisParser.convert(primitive)
},
//导入空间图形是 先判断数据是否跨界
geoJoint(geometry,callBacFunction){
var self = this;
loadModules([
"esri/geometry/geometryEngine",
"esri/geometry/Polygon"
]).then(([
geometryEngine,
Polygon
]) => {
var djqLayer = null,djzqLayer = null,xjzqLayer = null;
djqLayer = self.getLayerByName("DJQ");
djzqLayer = self.getLayerByName("DJZQ");
xjzqLayer = self.getLayerByName("XJZQ");
var layerIds = [];
layerIds.push(djqLayer.id);
layerIds.push(djzqLayer.id);
layerIds.push(xjzqLayer.id);
var polygon = new Polygon(geometry);
identifyUtils.methods.identify(djqLayer.layerUrl,layerIds,polygon,function (res) {
var results = res.results;
var isJoint = false,layerName = "",message="";
if(!results || results.length == 0){
callBacFunction(true,"不在行政区内,请检查空间位置信息!!!");
}
for(var i = 0;i < results.length;i++){
var feature = results[i].feature;
var flag = geometryEngine.disjoint(polygon,feature.geometry);
if(flag){
isJoint = true;
layerName = results[i].layerName;
switch (layerName) {
case 'DJQ':message = "地块跨越地籍区,数据不合法!!!";break;
case 'DJZQ':message = "地块跨越地籍子区,数据不合法!!!";break;
case 'XJZQ':message = "地块跨越行政区,数据不合法!!!";break;
}
break
}
}
if(callBacFunction && typeof callBacFunction == "function"){
callBacFunction(isJoint,message);
}
})
}).catch(err => {
console.log(err);
throw (err);
})
}
}
......
......@@ -10,17 +10,20 @@ export default {
"esri/tasks/support/IdentifyParameters"
]).then(([
IdentifyTask,
IdentifyParameters
IdentifyParameters
]) => {
var identifyTask = new IdentifyTask({
url:url
}),
identifyParameters = new identifyParameters();
identifyParameters = new IdentifyParameters();
identifyParameters.geometry = geometry;
if(layerIds){
identifyParameters.layerIds = layerIds;
}
identifyParameters.layerOption = "all";
identifyParameters.tolerance = 3;
identifyParameters.mapExtent = geometry.extent;
identifyParameters.returnGeometry = true;
identifyParameters.spatialReference = geometry.spatialReference;
identifyTask.execute(identifyParameters).then(result => {
if(callBackFunction && typeof callBackFunction == 'function'){
......