gis重叠分析功能实现
Showing
10 changed files
with
121 additions
and
61 deletions
... | @@ -23,7 +23,15 @@ | ... | @@ -23,7 +23,15 @@ |
23 | "color": "#f50325", | 23 | "color": "#f50325", |
24 | "width": 1 | 24 | "width": 1 |
25 | } | 25 | } |
26 | }, | ||
27 | "importSymbol": { | ||
28 | "type": "simple-fill", | ||
29 | "color": [ 245,3, 37, 0.4 ], | ||
30 | "style": "none", | ||
31 | "outline": { | ||
32 | "color": "#006cff", | ||
33 | "width": 2 | ||
34 | } | ||
26 | } | 35 | } |
27 | |||
28 | } | 36 | } |
29 | } | 37 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -101,7 +101,8 @@ | ... | @@ -101,7 +101,8 @@ |
101 | <li v-show="zdData.type == 'zdy'" @click="deleteZdy">删除</li> | 101 | <li v-show="zdData.type == 'zdy'" @click="deleteZdy">删除</li> |
102 | </ul> | 102 | </ul> |
103 | 103 | ||
104 | <el-dialog title="导入图形" :visible.sync="improtDialog"> | 104 | <!--@close="closeImportDialog"--> |
105 | <el-dialog title="导入图形" :modal="false" :close-on-click-modal="false" custom-class="importDialog" :visible.sync="improtDialog" width="30%" @close="closeImportDialog"> | ||
105 | <import-geo :property-info="zdData" :timeLine="new Date().getTime()" :geo-info="currentClickZdGeo" @closeImportDialog="closeImportDialog"></import-geo> | 106 | <import-geo :property-info="zdData" :timeLine="new Date().getTime()" :geo-info="currentClickZdGeo" @closeImportDialog="closeImportDialog"></import-geo> |
106 | </el-dialog> | 107 | </el-dialog> |
107 | <!-- 添加定着物弹框 --> | 108 | <!-- 添加定着物弹框 --> |
... | @@ -430,6 +431,7 @@ export default { | ... | @@ -430,6 +431,7 @@ export default { |
430 | }else { | 431 | }else { |
431 | BSM = this.zdData.bsm; | 432 | BSM = this.zdData.bsm; |
432 | } | 433 | } |
434 | //当确定导入图形是 跳转到图形界面 | ||
433 | this.queryGeoByBsm(BSM,type,function (features){ | 435 | this.queryGeoByBsm(BSM,type,function (features){ |
434 | if(features && features.length > 0){ | 436 | if(features && features.length > 0){ |
435 | if(features[0].geometry){ | 437 | if(features[0].geometry){ |
... | @@ -438,6 +440,7 @@ export default { | ... | @@ -438,6 +440,7 @@ export default { |
438 | cancelButtonText: '取消', | 440 | cancelButtonText: '取消', |
439 | type: 'warning' | 441 | type: 'warning' |
440 | }).then(() => { | 442 | }).then(() => { |
443 | self.postionToMap(); | ||
441 | self.improtDialog = true; | 444 | self.improtDialog = true; |
442 | self.currentClickZdGeo = features[0]; | 445 | self.currentClickZdGeo = features[0]; |
443 | }).catch(() => { | 446 | }).catch(() => { |
... | @@ -447,11 +450,13 @@ export default { | ... | @@ -447,11 +450,13 @@ export default { |
447 | }); | 450 | }); |
448 | }); | 451 | }); |
449 | }else { | 452 | }else { |
453 | self.postionToMap(); | ||
450 | self.currentClickZdGeo = features[0]; | 454 | self.currentClickZdGeo = features[0]; |
451 | self.improtDialog = true; | 455 | self.improtDialog = true; |
452 | } | 456 | } |
453 | 457 | ||
454 | }else{ | 458 | }else{ |
459 | self.postionToMap(); | ||
455 | self.currentClickZdGeo = null; | 460 | self.currentClickZdGeo = null; |
456 | self.improtDialog = true; | 461 | self.improtDialog = true; |
457 | } | 462 | } |
... | @@ -500,7 +505,6 @@ export default { | ... | @@ -500,7 +505,6 @@ export default { |
500 | }).then(res => { | 505 | }).then(res => { |
501 | debugger | 506 | debugger |
502 | });*/ | 507 | });*/ |
503 | |||
504 | }else{ | 508 | }else{ |
505 | self.$message.warning("暂无空间信息!!!!"); | 509 | self.$message.warning("暂无空间信息!!!!"); |
506 | } | 510 | } |
... | @@ -574,6 +578,7 @@ export default { | ... | @@ -574,6 +578,7 @@ export default { |
574 | //关闭图形弹框 | 578 | //关闭图形弹框 |
575 | closeImportDialog(){ | 579 | closeImportDialog(){ |
576 | this.improtDialog = false; | 580 | this.improtDialog = false; |
581 | this.clearOverLayer(); | ||
577 | } | 582 | } |
578 | 583 | ||
579 | }, | 584 | }, |
... | @@ -722,4 +727,8 @@ export default { | ... | @@ -722,4 +727,8 @@ export default { |
722 | center; | 727 | center; |
723 | background-size: contain; | 728 | background-size: contain; |
724 | } | 729 | } |
730 | /deep/ .importDialog{ | ||
731 | margin-top: 120px!important; | ||
732 | margin-left: 291px; | ||
733 | } | ||
725 | </style> | 734 | </style> | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
... | @@ -37,20 +37,18 @@ | ... | @@ -37,20 +37,18 @@ |
37 | MapView, | 37 | MapView, |
38 | esriMap | 38 | esriMap |
39 | ]) => { | 39 | ]) => { |
40 | var map = new esriMap({ | 40 | // |
41 | basemap:"hybrid" | 41 | var map = new esriMap(); |
42 | }); | ||
43 | //108.95 34.27 | 42 | //108.95 34.27 |
44 | var view = new MapView({ | 43 | var view = new MapView({ |
45 | container: self.viewId, | 44 | container: self.viewId, |
46 | map: map, | 45 | map: map, |
47 | zoom:10, | 46 | zoom:10, |
48 | zoom:10, | 47 | center: [-0.154133333770497,0.6138183594020817], |
49 | center: [-0.154133333770497,0.6138183594020817], | 48 | spatialReference: { |
50 | spatialReference: { | 49 | wkid: 102100 |
51 | wkid: 102100 | 50 | } |
52 | } | 51 | }); |
53 | }); | ||
54 | maps[self.viewId] = view; | 52 | maps[self.viewId] = view; |
55 | if(self.afterLoaderFunction && typeof self.afterLoaderFunction == 'function'){ | 53 | if(self.afterLoaderFunction && typeof self.afterLoaderFunction == 'function'){ |
56 | self.afterLoaderFunction(view); | 54 | self.afterLoaderFunction(view); | ... | ... |
... | @@ -24,7 +24,7 @@ export default { | ... | @@ -24,7 +24,7 @@ export default { |
24 | identifyParameters.tolerance = tolerance ? tolerance : 3; | 24 | identifyParameters.tolerance = tolerance ? tolerance : 3; |
25 | identifyParameters.mapExtent = mapExtent ? mapExtent : geometry.extent; | 25 | identifyParameters.mapExtent = mapExtent ? mapExtent : geometry.extent; |
26 | identifyParameters.returnGeometry = returnGeometry ? returnGeometry : false; | 26 | identifyParameters.returnGeometry = returnGeometry ? returnGeometry : false; |
27 | //identifyParameters.returnFieldName = false; | 27 | //identifyParameters.returnFieldName = true; |
28 | identifyParameters.spatialReference = geometry.spatialReference; | 28 | identifyParameters.spatialReference = geometry.spatialReference; |
29 | identifyTask.execute(identifyParameters).then(result => { | 29 | identifyTask.execute(identifyParameters).then(result => { |
30 | if(callBackFunction && typeof callBackFunction == 'function'){ | 30 | if(callBackFunction && typeof callBackFunction == 'function'){ | ... | ... |
... | @@ -22,20 +22,29 @@ export default { | ... | @@ -22,20 +22,29 @@ export default { |
22 | var featureLayer = new FeatureLayer({ | 22 | var featureLayer = new FeatureLayer({ |
23 | url:url | 23 | url:url |
24 | }) | 24 | }) |
25 | var geo = null; | 25 | var saveGraphics = []; |
26 | if(graphic.geometry.type == 'point'){ | 26 | if(!Array.isArray(graphic)){ |
27 | geo = new Point(graphic.geometry); | 27 | graphic = [graphic]; |
28 | }else if(graphic.geometry.type == 'polyline'){ | 28 | } |
29 | geo = new Polyline(graphic.geometry); | 29 | for(var i = 0;i < graphic.length;i++){ |
30 | }else if(graphic.geometry.type == 'polygon'){ | 30 | var geo = null; |
31 | geo = new Polygon(graphic.geometry); | 31 | if(!graphic[i].geometry){ |
32 | geo = null; | ||
33 | }else if(graphic[i].geometry.type == 'point'){ | ||
34 | geo = new Point(graphic[i].geometry); | ||
35 | }else if(graphic[i].geometry.type == 'polyline'){ | ||
36 | geo = new Polyline(graphic[i].geometry); | ||
37 | }else if(graphic[i].geometry.type == 'polygon'){ | ||
38 | geo = new Polygon(graphic[i].geometry); | ||
39 | } | ||
40 | var saveGraphic = new Graphic({ | ||
41 | attributes:graphic[i].attributes, | ||
42 | geometry:geo | ||
43 | }); | ||
44 | saveGraphics.push(saveGraphic); | ||
32 | } | 45 | } |
33 | var saveGraphic = new Graphic({ | ||
34 | attributes:graphic.attributes, | ||
35 | geometry:geo | ||
36 | }); | ||
37 | featureLayer.applyEdits({ | 46 | featureLayer.applyEdits({ |
38 | addFeatures:[saveGraphic] | 47 | addFeatures:saveGraphics |
39 | }).then(function (res){ | 48 | }).then(function (res){ |
40 | if(callBackFunction && typeof callBackFunction == 'function'){ | 49 | if(callBackFunction && typeof callBackFunction == 'function'){ |
41 | callBackFunction(res); | 50 | callBackFunction(res); |
... | @@ -62,20 +71,30 @@ export default { | ... | @@ -62,20 +71,30 @@ export default { |
62 | var featureLayer = new FeatureLayer({ | 71 | var featureLayer = new FeatureLayer({ |
63 | url:url | 72 | url:url |
64 | }) | 73 | }) |
65 | var geo = null; | 74 | var updGraphics = []; |
66 | if(graphic.geometry.type == 'point'){ | 75 | if(!Array.isArray(graphic)){ |
67 | geo = new Point(graphic.geometry); | 76 | graphic = [graphic]; |
68 | }else if(graphic.geometry.type == 'polyline'){ | 77 | } |
69 | geo = new Polyline(graphic.geometry); | 78 | for(var i = 0;i < graphic.length;i++){ |
70 | }else if(graphic.geometry.type == 'polygon'){ | 79 | var geo = null; |
71 | geo = new Polygon(graphic.geometry); | 80 | if(!graphic[i].geometry){ |
81 | geo = new Polygon(); | ||
82 | }else if(graphic[i].geometry.type == 'point'){ | ||
83 | geo = new Point(graphic[i].geometry); | ||
84 | }else if(graphic[i].geometry.type == 'polyline'){ | ||
85 | geo = new Polyline(graphic[i].geometry); | ||
86 | }else if(graphic[i].geometry.type == 'polygon'){ | ||
87 | geo = new Polygon(graphic[i].geometry); | ||
88 | } | ||
89 | var updGraphic = new Graphic({ | ||
90 | attributes:graphic[i].attributes, | ||
91 | geometry:geo | ||
92 | }); | ||
93 | updGraphics.push(updGraphic); | ||
72 | } | 94 | } |
73 | var updGraphic = new Graphic({ | 95 | |
74 | attributes:graphic.attributes, | ||
75 | geometry:geo | ||
76 | }); | ||
77 | featureLayer.applyEdits({ | 96 | featureLayer.applyEdits({ |
78 | updateFeatures:[updGraphic] | 97 | updateFeatures:updGraphics |
79 | }).then(function (res){ | 98 | }).then(function (res){ |
80 | if(callBackFunction && typeof callBackFunction == 'function'){ | 99 | if(callBackFunction && typeof callBackFunction == 'function'){ |
81 | callBackFunction(res); | 100 | callBackFunction(res); |
... | @@ -102,21 +121,31 @@ export default { | ... | @@ -102,21 +121,31 @@ export default { |
102 | var featureLayer = new FeatureLayer({ | 121 | var featureLayer = new FeatureLayer({ |
103 | url:url | 122 | url:url |
104 | }) | 123 | }) |
105 | var geo = null; | 124 | var delGraphics = []; |
106 | if(graphic.geometry.type == 'point'){ | 125 | if(!Array.isArray(graphic)){ |
107 | geo = new Point(graphic.geometry); | 126 | graphic = [graphic]; |
108 | }else if(graphic.geometry.type == 'polyline'){ | 127 | } |
109 | geo = new Polyline(graphic.geometry); | 128 | for(var i = 0;i < graphic.length;i++){ |
110 | }else if(graphic.geometry.type == 'polygon'){ | 129 | var geo = null; |
111 | geo = new Polygon(graphic.geometry); | 130 | if(!graphic[i].geometry){ |
131 | geo = null; | ||
132 | }else if(graphic[i].geometry.type == 'point'){ | ||
133 | geo = new Point(graphic[i].geometry); | ||
134 | }else if(graphic[i].geometry.type == 'polyline'){ | ||
135 | geo = new Polyline(graphic[i].geometry); | ||
136 | }else if(graphic[i].geometry.type == 'polygon'){ | ||
137 | geo = new Polygon(graphic[i].geometry); | ||
138 | } | ||
139 | var delGraphic = new Graphic({ | ||
140 | attributes:graphic[i].attributes, | ||
141 | geometry:geo | ||
142 | }); | ||
143 | delGraphics.push(delGraphic); | ||
112 | } | 144 | } |
113 | var delGraphic = new Graphic({ | 145 | |
114 | attributes:graphic.attributes, | ||
115 | geometry:geo | ||
116 | }); | ||
117 | 146 | ||
118 | featureLayer.applyEdits({ | 147 | featureLayer.applyEdits({ |
119 | deleteFeatures:[delGraphic] | 148 | deleteFeatures:delGraphics |
120 | }).then(function (res){ | 149 | }).then(function (res){ |
121 | if(callBackFunction && typeof callBackFunction == 'function'){ | 150 | if(callBackFunction && typeof callBackFunction == 'function'){ |
122 | callBackFunction(res); | 151 | callBackFunction(res); | ... | ... |
... | @@ -28,7 +28,7 @@ export default{ | ... | @@ -28,7 +28,7 @@ export default{ |
28 | where += " and "; | 28 | where += " and "; |
29 | } | 29 | } |
30 | if(Array.isArray(parames[i].value)){ | 30 | if(Array.isArray(parames[i].value)){ |
31 | where += parames[i].name + " in (" + parames[i].value.toString + ")"; | 31 | where += parames[i].name + " in (" + parames[i].value.toString() + ")"; |
32 | }else if(typeof parames[i].value == 'number'){ | 32 | }else if(typeof parames[i].value == 'number'){ |
33 | where += parames[i].name + " =" + parames[i].value ; | 33 | where += parames[i].name + " =" + parames[i].value ; |
34 | }else{ | 34 | }else{ | ... | ... |
... | @@ -76,15 +76,20 @@ export default { | ... | @@ -76,15 +76,20 @@ export default { |
76 | }, | 76 | }, |
77 | mixins:[mapLayerManager,findTask], | 77 | mixins:[mapLayerManager,findTask], |
78 | mounted(){ | 78 | mounted(){ |
79 | var query = this.$route.query; | 79 | |
80 | if(query && JSON.stringify(query) != "{}"){ | 80 | var query = this.$route.query |
81 | //self.addGeoByBsm(query.bsm,query.type,self.viewId); | 81 | var self = this; |
82 | if(query.type == 'zd'){ | 82 | setTimeout(function () { |
83 | this.getRightTree(query.bsm) | 83 | if(query && JSON.stringify(query) != "{}"){ |
84 | }else if(query.type == 'zrz'){ | 84 | //self.addGeoByBsm(query.bsm,query.type,self.viewId); |
85 | this.getRightTreeByZrzbsm(query.bsm); | 85 | if(query.type == 'zd'){ |
86 | self.getRightTree(query.bsm) | ||
87 | }else if(query.type == 'zrz'){ | ||
88 | self.getRightTreeByZrzbsm(query.bsm); | ||
89 | } | ||
86 | } | 90 | } |
87 | } | 91 | },500); |
92 | |||
88 | 93 | ||
89 | }, | 94 | }, |
90 | methods:{ | 95 | methods:{ |
... | @@ -94,8 +99,10 @@ export default { | ... | @@ -94,8 +99,10 @@ export default { |
94 | view.ui.remove('zoom'); | 99 | view.ui.remove('zoom'); |
95 | loadModules([ | 100 | loadModules([ |
96 | "esri/layers/MapImageLayer", | 101 | "esri/layers/MapImageLayer", |
102 | "esri/geometry/Extent" | ||
97 | ]).then(([ | 103 | ]).then(([ |
98 | MapImageLayer, | 104 | MapImageLayer, |
105 | Extent | ||
99 | ])=>{ | 106 | ])=>{ |
100 | var mapImageLayer = new MapImageLayer({ | 107 | var mapImageLayer = new MapImageLayer({ |
101 | url:self.layerUrl, | 108 | url:self.layerUrl, |
... | @@ -115,6 +122,13 @@ export default { | ... | @@ -115,6 +122,13 @@ export default { |
115 | }] | 122 | }] |
116 | }); | 123 | }); |
117 | view.map.add(mapImageLayer,1); | 124 | view.map.add(mapImageLayer,1); |
125 | mapImageLayer.when(function () { | ||
126 | var extent = new Extent(JSON.parse(JSON.stringify(mapImageLayer.fullExtent))) | ||
127 | extent.spatialReference = view.spatialReference; | ||
128 | view.center = extent.center; | ||
129 | view.zoom = 15; | ||
130 | // view.extent = mapImageLayer.fullExtent; | ||
131 | }); | ||
118 | var query = self.$route.query; | 132 | var query = self.$route.query; |
119 | if(query && JSON.stringify(query) != "{}"){ | 133 | if(query && JSON.stringify(query) != "{}"){ |
120 | self.addGeoByBsm(query.bsm,query.type,self.viewId); | 134 | self.addGeoByBsm(query.bsm,query.type,self.viewId); |
... | @@ -137,9 +151,11 @@ export default { | ... | @@ -137,9 +151,11 @@ export default { |
137 | }, | 151 | }, |
138 | //图层选择事件 | 152 | //图层选择事件 |
139 | selectLayerChange(){ | 153 | selectLayerChange(){ |
154 | debugger | ||
140 | var self = this; | 155 | var self = this; |
156 | this.features = []; | ||
141 | var layerAndResult = this.results.filter(function (item) { | 157 | var layerAndResult = this.results.filter(function (item) { |
142 | return item.layerId = self.selectResLayerId; | 158 | return item.layerId == self.selectResLayerId; |
143 | }) | 159 | }) |
144 | if(layerAndResult){ | 160 | if(layerAndResult){ |
145 | this.features = layerAndResult[0].features; | 161 | this.features = layerAndResult[0].features; | ... | ... |
... | @@ -79,12 +79,12 @@ export default { | ... | @@ -79,12 +79,12 @@ export default { |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | for(var i = 0;i < searchResult.length;i++){ | 81 | for(var i = 0;i < searchResult.length;i++){ |
82 | var layer = view.map.findLayerById("searchResult"+searchResult.layerName); | 82 | var layer = view.map.findLayerById("searchResult"+searchResult[i].layerId); |
83 | if(layer){ | 83 | if(layer){ |
84 | layer.removeAll(); | 84 | layer.removeAll(); |
85 | }else{ | 85 | }else{ |
86 | layer = new GraphicsLayer({ | 86 | layer = new GraphicsLayer({ |
87 | id:"searchResult"+searchResult.layerName | 87 | id:"searchResult"+searchResult[i].layerId |
88 | }) | 88 | }) |
89 | view.map.add(layer); | 89 | view.map.add(layer); |
90 | } | 90 | } | ... | ... |
-
Please register or sign in to post a comment