ca888098 by 杨威

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

1 parent 6306e097
...@@ -7,5 +7,20 @@ ...@@ -7,5 +7,20 @@
7 "layerName": "ZRZ", 7 "layerName": "ZRZ",
8 "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", 8 "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",
9 "id": "10" 9 "id": "10"
10 },
11 {
12 "layerName": "DJQ",
13 "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",
14 "id": "13"
15 },
16 {
17 "layerName": "DJZQ",
18 "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",
19 "id": "14"
20 },
21 {
22 "layerName": "XJZQ",
23 "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",
24 "id": "19"
10 } 25 }
11 ] 26 ]
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -407,8 +407,8 @@ export default { ...@@ -407,8 +407,8 @@ export default {
407 }); 407 });
408 }, 408 },
409 /* 409 /*
410 * 导入图形 410 * 导入图形
411 * */ 411 * */
412 importGeo(){ 412 importGeo(){
413 var self = this; 413 var self = this;
414 var BSM = ""; 414 var BSM = "";
......
...@@ -196,11 +196,19 @@ export default { ...@@ -196,11 +196,19 @@ export default {
196 attributes:self.currentClickZd, 196 attributes:self.currentClickZd,
197 geometry:geometry 197 geometry:geometry
198 } 198 }
199 if(self.propertyInfo.type == "zd"){ 199 self.geoJoint(geometry,function (isJoint,message) {
200 self.saveZd(graphic); 200 if(isJoint){
201 }else{ 201 self.$message.warning(message)
202 self.saveZRZ(graphic); 202 return;
203 } 203 }else {
204 if(self.propertyInfo.type == "zd"){
205 self.saveZd(graphic);
206 }else{
207 self.saveZRZ(graphic);
208 }
209 }
210 });
211
204 } else { 212 } else {
205 console.log('error submit!!'); 213 console.log('error submit!!');
206 return false; 214 return false;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
4 4
5 import layers from '@/assets/json/layers.json' 5 import layers from '@/assets/json/layers.json'
6 import queryUtils from "@libs/map/queryUtils"; 6 import queryUtils from "@libs/map/queryUtils";
7 import identifyUtils from '@/libs/map/IdentifyUtils'
7 import {loadModules} from "esri-loader" 8 import {loadModules} from "esri-loader"
8 import arcgisParser from 'terraformer-arcgis-parser' 9 import arcgisParser from 'terraformer-arcgis-parser'
9 import wktParse from 'terraformer-wkt-parser' 10 import wktParse from 'terraformer-wkt-parser'
...@@ -155,6 +156,54 @@ export default { ...@@ -155,6 +156,54 @@ export default {
155 primitive.type = "Polygon" 156 primitive.type = "Polygon"
156 }*/ 157 }*/
157 return arcgisParser.convert(primitive) 158 return arcgisParser.convert(primitive)
159 },
160 //导入空间图形是 先判断数据是否跨界
161 geoJoint(geometry,callBacFunction){
162 var self = this;
163 loadModules([
164 "esri/geometry/geometryEngine",
165 "esri/geometry/Polygon"
166 ]).then(([
167 geometryEngine,
168 Polygon
169 ]) => {
170 var djqLayer = null,djzqLayer = null,xjzqLayer = null;
171 djqLayer = self.getLayerByName("DJQ");
172 djzqLayer = self.getLayerByName("DJZQ");
173 xjzqLayer = self.getLayerByName("XJZQ");
174 var layerIds = [];
175 layerIds.push(djqLayer.id);
176 layerIds.push(djzqLayer.id);
177 layerIds.push(xjzqLayer.id);
178 var polygon = new Polygon(geometry);
179 identifyUtils.methods.identify(djqLayer.layerUrl,layerIds,polygon,function (res) {
180 var results = res.results;
181 var isJoint = false,layerName = "",message="";
182 if(!results || results.length == 0){
183 callBacFunction(true,"不在行政区内,请检查空间位置信息!!!");
184 }
185 for(var i = 0;i < results.length;i++){
186 var feature = results[i].feature;
187 var flag = geometryEngine.disjoint(polygon,feature.geometry);
188 if(flag){
189 isJoint = true;
190 layerName = results[i].layerName;
191 switch (layerName) {
192 case 'DJQ':message = "地块跨越地籍区,数据不合法!!!";break;
193 case 'DJZQ':message = "地块跨越地籍子区,数据不合法!!!";break;
194 case 'XJZQ':message = "地块跨越行政区,数据不合法!!!";break;
195 }
196 break
197 }
198 }
199 if(callBacFunction && typeof callBacFunction == "function"){
200 callBacFunction(isJoint,message);
201 }
202 })
203 }).catch(err => {
204 console.log(err);
205 throw (err);
206 })
158 } 207 }
159 208
160 } 209 }
......
...@@ -10,17 +10,20 @@ export default { ...@@ -10,17 +10,20 @@ export default {
10 "esri/tasks/support/IdentifyParameters" 10 "esri/tasks/support/IdentifyParameters"
11 ]).then(([ 11 ]).then(([
12 IdentifyTask, 12 IdentifyTask,
13 IdentifyParameters 13 IdentifyParameters
14 ]) => { 14 ]) => {
15 var identifyTask = new IdentifyTask({ 15 var identifyTask = new IdentifyTask({
16 url:url 16 url:url
17 }), 17 }),
18 identifyParameters = new identifyParameters(); 18 identifyParameters = new IdentifyParameters();
19 identifyParameters.geometry = geometry; 19 identifyParameters.geometry = geometry;
20 if(layerIds){ 20 if(layerIds){
21 identifyParameters.layerIds = layerIds; 21 identifyParameters.layerIds = layerIds;
22 } 22 }
23 identifyParameters.layerOption = "all"; 23 identifyParameters.layerOption = "all";
24 identifyParameters.tolerance = 3;
25 identifyParameters.mapExtent = geometry.extent;
26 identifyParameters.returnGeometry = true;
24 identifyParameters.spatialReference = geometry.spatialReference; 27 identifyParameters.spatialReference = geometry.spatialReference;
25 identifyTask.execute(identifyParameters).then(result => { 28 identifyTask.execute(identifyParameters).then(result => {
26 if(callBackFunction && typeof callBackFunction == 'function'){ 29 if(callBackFunction && typeof callBackFunction == 'function'){
......