4cd04f02 by 杨威

gis重叠分析功能实现

1 parent 3f9a05d3
......@@ -23,7 +23,15 @@
"color": "#f50325",
"width": 1
}
},
"importSymbol": {
"type": "simple-fill",
"color": [ 245,3, 37, 0.4 ],
"style": "none",
"outline": {
"color": "#006cff",
"width": 2
}
}
}
}
\ No newline at end of file
......
......@@ -101,7 +101,8 @@
<li v-show="zdData.type == 'zdy'" @click="deleteZdy">删除</li>
</ul>
<el-dialog title="导入图形" :visible.sync="improtDialog">
<!--@close="closeImportDialog"-->
<el-dialog title="导入图形" :modal="false" :close-on-click-modal="false" custom-class="importDialog" :visible.sync="improtDialog" width="30%" @close="closeImportDialog">
<import-geo :property-info="zdData" :timeLine="new Date().getTime()" :geo-info="currentClickZdGeo" @closeImportDialog="closeImportDialog"></import-geo>
</el-dialog>
<!-- 添加定着物弹框 -->
......@@ -430,6 +431,7 @@ export default {
}else {
BSM = this.zdData.bsm;
}
//当确定导入图形是 跳转到图形界面
this.queryGeoByBsm(BSM,type,function (features){
if(features && features.length > 0){
if(features[0].geometry){
......@@ -438,6 +440,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
self.postionToMap();
self.improtDialog = true;
self.currentClickZdGeo = features[0];
}).catch(() => {
......@@ -447,11 +450,13 @@ export default {
});
});
}else {
self.postionToMap();
self.currentClickZdGeo = features[0];
self.improtDialog = true;
}
}else{
self.postionToMap();
self.currentClickZdGeo = null;
self.improtDialog = true;
}
......@@ -500,7 +505,6 @@ export default {
}).then(res => {
debugger
});*/
}else{
self.$message.warning("暂无空间信息!!!!");
}
......@@ -574,6 +578,7 @@ export default {
//关闭图形弹框
closeImportDialog(){
this.improtDialog = false;
this.clearOverLayer();
}
},
......@@ -722,4 +727,8 @@ export default {
center;
background-size: contain;
}
/deep/ .importDialog{
margin-top: 120px!important;
margin-left: 291px;
}
</style>
......
......@@ -37,15 +37,13 @@
MapView,
esriMap
]) => {
var map = new esriMap({
basemap:"hybrid"
});
//
var map = new esriMap();
//108.95 34.27
var view = new MapView({
container: self.viewId,
map: map,
zoom:10,
zoom:10,
center: [-0.154133333770497,0.6138183594020817],
spatialReference: {
wkid: 102100
......
......@@ -24,7 +24,7 @@ export default {
identifyParameters.tolerance = tolerance ? tolerance : 3;
identifyParameters.mapExtent = mapExtent ? mapExtent : geometry.extent;
identifyParameters.returnGeometry = returnGeometry ? returnGeometry : false;
//identifyParameters.returnFieldName = false;
//identifyParameters.returnFieldName = true;
identifyParameters.spatialReference = geometry.spatialReference;
identifyTask.execute(identifyParameters).then(result => {
if(callBackFunction && typeof callBackFunction == 'function'){
......
......@@ -22,20 +22,29 @@ export default {
var featureLayer = new FeatureLayer({
url:url
})
var saveGraphics = [];
if(!Array.isArray(graphic)){
graphic = [graphic];
}
for(var i = 0;i < graphic.length;i++){
var geo = null;
if(graphic.geometry.type == 'point'){
geo = new Point(graphic.geometry);
}else if(graphic.geometry.type == 'polyline'){
geo = new Polyline(graphic.geometry);
}else if(graphic.geometry.type == 'polygon'){
geo = new Polygon(graphic.geometry);
if(!graphic[i].geometry){
geo = null;
}else if(graphic[i].geometry.type == 'point'){
geo = new Point(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polyline'){
geo = new Polyline(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polygon'){
geo = new Polygon(graphic[i].geometry);
}
var saveGraphic = new Graphic({
attributes:graphic.attributes,
attributes:graphic[i].attributes,
geometry:geo
});
saveGraphics.push(saveGraphic);
}
featureLayer.applyEdits({
addFeatures:[saveGraphic]
addFeatures:saveGraphics
}).then(function (res){
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(res);
......@@ -62,20 +71,30 @@ export default {
var featureLayer = new FeatureLayer({
url:url
})
var updGraphics = [];
if(!Array.isArray(graphic)){
graphic = [graphic];
}
for(var i = 0;i < graphic.length;i++){
var geo = null;
if(graphic.geometry.type == 'point'){
geo = new Point(graphic.geometry);
}else if(graphic.geometry.type == 'polyline'){
geo = new Polyline(graphic.geometry);
}else if(graphic.geometry.type == 'polygon'){
geo = new Polygon(graphic.geometry);
if(!graphic[i].geometry){
geo = new Polygon();
}else if(graphic[i].geometry.type == 'point'){
geo = new Point(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polyline'){
geo = new Polyline(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polygon'){
geo = new Polygon(graphic[i].geometry);
}
var updGraphic = new Graphic({
attributes:graphic.attributes,
attributes:graphic[i].attributes,
geometry:geo
});
updGraphics.push(updGraphic);
}
featureLayer.applyEdits({
updateFeatures:[updGraphic]
updateFeatures:updGraphics
}).then(function (res){
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(res);
......@@ -102,21 +121,31 @@ export default {
var featureLayer = new FeatureLayer({
url:url
})
var delGraphics = [];
if(!Array.isArray(graphic)){
graphic = [graphic];
}
for(var i = 0;i < graphic.length;i++){
var geo = null;
if(graphic.geometry.type == 'point'){
geo = new Point(graphic.geometry);
}else if(graphic.geometry.type == 'polyline'){
geo = new Polyline(graphic.geometry);
}else if(graphic.geometry.type == 'polygon'){
geo = new Polygon(graphic.geometry);
if(!graphic[i].geometry){
geo = null;
}else if(graphic[i].geometry.type == 'point'){
geo = new Point(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polyline'){
geo = new Polyline(graphic[i].geometry);
}else if(graphic[i].geometry.type == 'polygon'){
geo = new Polygon(graphic[i].geometry);
}
var delGraphic = new Graphic({
attributes:graphic.attributes,
attributes:graphic[i].attributes,
geometry:geo
});
delGraphics.push(delGraphic);
}
featureLayer.applyEdits({
deleteFeatures:[delGraphic]
deleteFeatures:delGraphics
}).then(function (res){
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(res);
......
......@@ -28,7 +28,7 @@ export default{
where += " and ";
}
if(Array.isArray(parames[i].value)){
where += parames[i].name + " in (" + parames[i].value.toString + ")";
where += parames[i].name + " in (" + parames[i].value.toString() + ")";
}else if(typeof parames[i].value == 'number'){
where += parames[i].name + " =" + parames[i].value ;
}else{
......
......@@ -76,15 +76,20 @@ export default {
},
mixins:[mapLayerManager,findTask],
mounted(){
var query = this.$route.query;
var query = this.$route.query
var self = this;
setTimeout(function () {
if(query && JSON.stringify(query) != "{}"){
//self.addGeoByBsm(query.bsm,query.type,self.viewId);
if(query.type == 'zd'){
this.getRightTree(query.bsm)
self.getRightTree(query.bsm)
}else if(query.type == 'zrz'){
this.getRightTreeByZrzbsm(query.bsm);
self.getRightTreeByZrzbsm(query.bsm);
}
}
},500);
},
methods:{
......@@ -94,8 +99,10 @@ export default {
view.ui.remove('zoom');
loadModules([
"esri/layers/MapImageLayer",
"esri/geometry/Extent"
]).then(([
MapImageLayer,
Extent
])=>{
var mapImageLayer = new MapImageLayer({
url:self.layerUrl,
......@@ -115,6 +122,13 @@ export default {
}]
});
view.map.add(mapImageLayer,1);
mapImageLayer.when(function () {
var extent = new Extent(JSON.parse(JSON.stringify(mapImageLayer.fullExtent)))
extent.spatialReference = view.spatialReference;
view.center = extent.center;
view.zoom = 15;
// view.extent = mapImageLayer.fullExtent;
});
var query = self.$route.query;
if(query && JSON.stringify(query) != "{}"){
self.addGeoByBsm(query.bsm,query.type,self.viewId);
......@@ -137,9 +151,11 @@ export default {
},
//图层选择事件
selectLayerChange(){
debugger
var self = this;
this.features = [];
var layerAndResult = this.results.filter(function (item) {
return item.layerId = self.selectResLayerId;
return item.layerId == self.selectResLayerId;
})
if(layerAndResult){
this.features = layerAndResult[0].features;
......
......@@ -79,12 +79,12 @@ export default {
return;
}
for(var i = 0;i < searchResult.length;i++){
var layer = view.map.findLayerById("searchResult"+searchResult.layerName);
var layer = view.map.findLayerById("searchResult"+searchResult[i].layerId);
if(layer){
layer.removeAll();
}else{
layer = new GraphicsLayer({
id:"searchResult"+searchResult.layerName
id:"searchResult"+searchResult[i].layerId
})
view.map.add(layer);
}
......