|
@@ -1,62 +1,23 @@
|
|
|
-function PublishTaskAction(context, id, ext){
|
|
|
+function PublishTaskAction(context, id){
|
|
|
this.context = context
|
|
|
this.id = id
|
|
|
- this.selected = {}
|
|
|
- this.popup = null
|
|
|
- this.tipLayer = null
|
|
|
- this.obj = new TaskLand({
|
|
|
- url : context.local_wfs_path,
|
|
|
- status : ext.status
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
PublishTaskAction.prototype = {
|
|
|
- clickLock:false,
|
|
|
startStatus : false,
|
|
|
- createStatus : false,
|
|
|
create(){
|
|
|
- let that = this
|
|
|
- this.obj.getTileLayer()
|
|
|
- this.popup = new Popup({map: this.context.currentMap,
|
|
|
- close(){
|
|
|
- that.clickLock = false
|
|
|
- },
|
|
|
- buttons:[
|
|
|
- {"name":"放大到合适","click":"fit"}
|
|
|
- ],
|
|
|
- listener: {
|
|
|
- info(){
|
|
|
- window.location = "/field_point/info"
|
|
|
- },
|
|
|
- fit(popup, event, ext){
|
|
|
- that.context.currentView.fit(ext.getGeometry(),{duration:1000})
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- this.createStatus = true;
|
|
|
+
|
|
|
},
|
|
|
start(){
|
|
|
- if(this.startStatus){
|
|
|
- console.log("startStatus is true")
|
|
|
- return
|
|
|
- }
|
|
|
- this.context.clicks[this.id] = this
|
|
|
- this.context.currentMap.addLayer(this.obj.layerData.layer)
|
|
|
- let source = this.obj.layerData.layer.getSource();
|
|
|
- let that = this;
|
|
|
-
|
|
|
- if(that.tipLayer){
|
|
|
- that.context.currentMap.addLayer(that.tipLayer.vector)
|
|
|
- that.context.currentView.fit(source.getExtent(),{duration:1000})
|
|
|
- }else{
|
|
|
- source.on("featuresloadend",function(){
|
|
|
- that.tipLayer = new TipLayer({features: source.getFeatures(), zIndex:3, style: globalStyle.pointStyle })
|
|
|
- that.context.currentMap.addLayer(that.tipLayer.vector)
|
|
|
- that.context.currentView.fit(source.getExtent(),{duration:1000})
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- this.context.getSldStyleSign(this.obj.wmsData.params.STYLE)
|
|
|
+ // if(this.startStatus){
|
|
|
+ // console.log("startStatus is true")
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ layui.tool.dialog2("/task/publish_index","40%","50%",{buttons:["确定","取消"],funs:[
|
|
|
+ function(index) {
|
|
|
+ var iframeBody = parent.layer.getChildFrame('body', index);
|
|
|
+ iframeBody.find('#submit').click();
|
|
|
+ }]})
|
|
|
this.startStatus = true;
|
|
|
},
|
|
|
stop(){
|
|
@@ -64,88 +25,7 @@ PublishTaskAction.prototype = {
|
|
|
console.log("startStatus is false")
|
|
|
return
|
|
|
}
|
|
|
- this.context.currentMap.removeLayer(this.obj.layerData.layer)
|
|
|
- this.context.currentMap.removeLayer(this.tipLayer.vector)
|
|
|
- console.log("tempVectorLayer cleared")
|
|
|
- this.context.clicks[this.id] = null
|
|
|
console.log("remove click")
|
|
|
- this.popup._close()
|
|
|
- console.log("close popup")
|
|
|
this.startStatus = false;
|
|
|
- },
|
|
|
- addFieldPointOfTempLayer(TaskLand){
|
|
|
- let geometry = this.context.wkt.readGeometry(TaskLand.wkt)
|
|
|
- let extent = ol.extent.getCenter(geometry.getExtent());
|
|
|
- let point = new ol.Feature({
|
|
|
- geometry: new ol.geom.Point(extent)
|
|
|
- });
|
|
|
- point.set("isPoint",1)
|
|
|
- point.set("id",TaskLand.id)
|
|
|
- let source = this.tempVectorLayer.getSource();
|
|
|
- source.addFeature(point)
|
|
|
}
|
|
|
- ,
|
|
|
- landType:{
|
|
|
- 0:"其他",
|
|
|
- 1:"湿地",
|
|
|
- 2:"耕地",
|
|
|
- 3:"种植",
|
|
|
- 4:"林地",
|
|
|
- 5:"草地",
|
|
|
- 6:"水域",
|
|
|
- },getInfoHtml(feature){
|
|
|
- let html = ""
|
|
|
- let data = {
|
|
|
- "地块类别":this.landType[feature.get("gridcode")],
|
|
|
- "地块图斑编号":feature.get("id"),
|
|
|
- "地块面积(亩)":feature.get("area"),
|
|
|
- "地块周长(米)":"10000",
|
|
|
- }
|
|
|
- for(let key in data){
|
|
|
- html += "<div class='layui-row'><div class='lab' >"+key+"</div><div class='val' >"+data[key]+"</div></div>"
|
|
|
- }
|
|
|
- return html
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-function TaskLand(opt){
|
|
|
-
|
|
|
- this.name = "TaskLand"
|
|
|
-
|
|
|
- this.wmsData = {
|
|
|
- url: opt.url,
|
|
|
- projection: new ol.proj.Projection({
|
|
|
- code: 'EPSG:4326',
|
|
|
- units: 'degrees',
|
|
|
- axisOrientation: 'neu'
|
|
|
- }),
|
|
|
- params:{
|
|
|
- 'LAYER': "wuhan:p_crop",
|
|
|
- 'STATUS': opt.status,
|
|
|
- 'STYLE': "wuhan:city_land",
|
|
|
- }
|
|
|
- }
|
|
|
- this.layerData = {
|
|
|
- layer : null,
|
|
|
- source : null,
|
|
|
- select : null,
|
|
|
- always : false
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-TaskLand.prototype = {
|
|
|
- getTileLayer(){
|
|
|
- let url = this.wmsData.url +
|
|
|
- "?service=WFS&version=1.0.0&request=GetFeature&typeName="+this.wmsData.params["LAYER"]+"&maxFeatures=1000&outputFormat=application/json"
|
|
|
- url+="&Filter=(<Filter>" +
|
|
|
- "<ogc:PropertyIsEqualTo xmlns:ogc=\"http://www.opengis.net/ogc\" ><ogc:PropertyName>status</ogc:PropertyName>" +
|
|
|
- "<ogc:Literal>"+this.wmsData.params["STATUS"]+"</ogc:Literal></ogc:PropertyIsEqualTo></Filter>)"
|
|
|
- console.log(url)
|
|
|
- let myGeoJsonLayer = new MyGeoJsonLayer({url: url, zIndex:2, style: this.style})
|
|
|
- this.layerData.layer = myGeoJsonLayer.vector;
|
|
|
- },style(f){
|
|
|
- return globalStyle.cityLand(f.get("gridcode"))
|
|
|
- },
|
|
|
-
|
|
|
-}
|