|
@@ -47,8 +47,8 @@ CityLandAction.prototype = {
|
|
|
}
|
|
|
// this.context.clicks[this.id] = this
|
|
|
this.obj.addTileLayer(this.context.currentMap)
|
|
|
+ this.context.currentMap.addLayer(this.tempVectorLayer)
|
|
|
this.drawMultiPolygon.show()
|
|
|
- this.tempVectorLayer.setVisible(true)
|
|
|
this.context.landFilter()
|
|
|
this.context.getSldStyleSign(this.obj.wmsData.params.STYLE)
|
|
|
this.startStatus = true;
|
|
@@ -60,7 +60,7 @@ CityLandAction.prototype = {
|
|
|
console.log("startStatus is false")
|
|
|
return
|
|
|
}
|
|
|
- this.tempVectorLayer.setVisible(false)
|
|
|
+ this.context.currentMap.removeLayer(this.tempVectorLayer)
|
|
|
this.obj.removeTileLayer(this.context.currentMap)
|
|
|
console.log("drawMultiPolygon close")
|
|
|
this.drawMultiPolygon.close()
|
|
@@ -159,19 +159,13 @@ CityLandAction.prototype = {
|
|
|
,loadTempVectorLayer(){
|
|
|
let that = this
|
|
|
let map = this.context.currentMap
|
|
|
- let baseUrl = this.context.local_wfs_path
|
|
|
const vectorSource = new ol.source.Vector({
|
|
|
- format: new ol.format.GeoJSON(),
|
|
|
loader: function(extent, resolution, projection, success, failure) {
|
|
|
- const proj = projection.getCode();
|
|
|
- let typeNames = that.obj.getVisibleLayers()
|
|
|
- console.log(typeNames)
|
|
|
- let projCode = "3857"
|
|
|
- if(typeNames == ""){
|
|
|
- typeNames = "p_crop"
|
|
|
- projCode = "4326"
|
|
|
+ if(!that.context.vectorSwitch){
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
+ let typeNames = that.obj.getVisibleLayers()
|
|
|
+ console.log("typeNames",typeNames)
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
xhr.open('GET', "/crop/getGeoJson?tableNames="+typeNames + "&x1=" + extent[0] + "&y1=" + extent[1]+"&x2=" + extent[2] + "&y2="+extent[3]);
|
|
|
const onError = function() {
|
|
@@ -186,11 +180,15 @@ CityLandAction.prototype = {
|
|
|
let features = []
|
|
|
let datas = res.data;
|
|
|
for(let data of datas){
|
|
|
- let feature = that.newFieldPoint(data,projCode)
|
|
|
+ let feature = that.newFieldPoint(data)
|
|
|
vectorSource.addFeature(feature)
|
|
|
features.push(feature)
|
|
|
}
|
|
|
success(features);
|
|
|
+ if(datas.length > 0){
|
|
|
+ that.context.cacheBbox(extent)
|
|
|
+ that.context.vectorSwitch = false
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
onError();
|
|
@@ -202,11 +200,12 @@ CityLandAction.prototype = {
|
|
|
});
|
|
|
|
|
|
let vector = new ol.layer.Vector({
|
|
|
- map: map,
|
|
|
source:vectorSource,
|
|
|
style: globalStyle.cropStyle,
|
|
|
- minZoom:13,
|
|
|
- maxZoom:20
|
|
|
+ minZoom:15,
|
|
|
+ maxZoom:22,
|
|
|
+ zIndex: 3,
|
|
|
+ visible: true
|
|
|
});
|
|
|
|
|
|
that.select = new ol.interaction.Select({
|
|
@@ -217,8 +216,7 @@ CityLandAction.prototype = {
|
|
|
map.addInteraction(that.select)
|
|
|
that.select.on("select",function(e){
|
|
|
if(e.selected.length > 0){
|
|
|
- console.log("coordinates",e.selected[0].getGeometry())
|
|
|
- that.popup.show(e.selected[0].getGeometry().coordinates, that.getInfoHtml(e.selected[0]), e.selected[0])
|
|
|
+ that.popup.show(ol.extent.getCenter(e.selected[0].getGeometry().getExtent()), that.getInfoHtml(e.selected[0]), e.selected[0])
|
|
|
}
|
|
|
})
|
|
|
return vector;
|
|
@@ -236,7 +234,6 @@ CityLandAction.prototype = {
|
|
|
"图片信息":"<a style='color: whitesmoke;' href='javascript:layui.tool.open(!,!,!,!)'>点击查看</a>"
|
|
|
.format('"/crop_image/view?id='+feature.get("id")+'"','"60%"','"图片信息"','{area:["90%","90%"],shade:0.1}'),
|
|
|
}
|
|
|
- console.log(data)
|
|
|
|
|
|
for(let key in data){
|
|
|
html += "<div class='layui-row'><div class='lab' >"+key+"</div><div class='val' >"+data[key]+"</div></div>"
|
|
@@ -247,7 +244,6 @@ CityLandAction.prototype = {
|
|
|
landType:{0:"其他", 1:"湿地", 2:"耕地", 3:"种植", 4:"林地", 5:"草地", 6:"水域"}
|
|
|
,
|
|
|
saveTask(that, feature){
|
|
|
- console.log(feature.getKeys())
|
|
|
let id = feature.getId()
|
|
|
layui.tool.submit("/crop/publish",{"id":feature.get("id") || id.substring(id.indexOf(".") + 1)},function(res){
|
|
|
if(res.code == 0){
|
|
@@ -372,9 +368,9 @@ CityLand.prototype = {
|
|
|
return tile;
|
|
|
},
|
|
|
visibleWMTS(tableNames){
|
|
|
- console.log(tableNames)
|
|
|
this.visibleLayers = tableNames
|
|
|
for(let layer of this.layerData.layer){
|
|
|
+ console.log(layer.get("name"))
|
|
|
if(tableNames.includes(layer.get("name"))){
|
|
|
layer.setVisible(true)
|
|
|
}else{
|