[OpenLayers-Users] wfs-t wfs layers and interesction

islanis islanis at infomed.sld.cu
Wed Aug 22 04:04:15 PDT 2012


Hi people, i need your help to know how can i do a save action between a wfs layer and a save's transaction of a wfs-t because i want to restrict the save and the update only en that intersection here is the wfs layer

//------------------------------------------------------------------------------------------------------------------
// variable that has the state vector
//--------------------------------------------------------------------------------------------------------------------
vlayerMunicipios = new OpenLayers.Layer.Vector("Municipios disponibles", {
     strategies : [new OpenLayers.Strategy.BBOX()],
     protocol : new OpenLayers.Protocol.WFS({
          url : "http://localhost:8080/geoserver/wfs",
          featureType : "uneMunicipios",
          featureNS : ""
     }
     ),
     styleMap : new OpenLayers.StyleMap({
          "default" : new OpenLayers.Style({
               pointRadius : "${type}",
               fillColor : "#BFF7C7",
               strokeColor : "#DEBCBC",
               strokeWidth : 2,
               graphicZIndex : 1,
               label : "${nombre}",
               fontSize : "15",
               fontColor : "#1072C2",
               fontWeight : "Bold",
               labelYOffset : - 17
          }
          ),
          "select" : new OpenLayers.Style({
               fillColor : "#FFFF2B",
               strokeColor : "#00D200",
               graphicZIndex : 2
          }
          )
     }
     ),
     filter : new OpenLayers.Filter.Logical({
          type : OpenLayers.Filter.Logical.OR,
          filters : [
          new OpenLayers.Filter.Comparison({
               type : OpenLayers.Filter.Comparison.EQUAL_TO,
               property : "nombre",
               value : "Municipio Especial Isla de la Juventud"
          }
          ),
          new OpenLayers.Filter.Comparison({
               type : OpenLayers.Filter.Comparison.EQUAL_TO,
               property : "nombre",
               value : "Guama"
          }
          )
          ]
     }
     )/*,
     hover : true*/
}
);



//////////////////////////////////////////////////////////////////////////////////////////////
//And here is the layer that draw points over the map
////////////////////////////////////////////////////////////////////////////////////////////
vlayer = new OpenLayers.Layer.Vector("Puntos de Biogas seleccionados", {
     styleMap : new OpenLayers.StyleMap({
          'default' : {
               strokeColor : "#EC0000",
               // strokeOpacity : 1,
               strokeWidth : 1,
               fillColor : "#616161",
               fillOpacity : 0.2,
               pointRadius : 9
               // pointerEvents : "visiblePainted"// ,
               // label with \n linebreaks
               // label : "name: ${name}\n\nage: ${age}",

               // fontColor : "${favColor}",
               // fontSize : "12px",
               // fontFamily : "Courier New, monospace",
               // fontWeight : "bold",
               // labelAlign : "${align}",
               // labelXOffset : "${xOffset}",
               // labelYOffset : "${yOffset}"
          }
     }
     )
}
);
///////////////////////////////////////////////////////////////////////////////////////////////////

//------------------------------------------------------------------------------------------------------------------
// And this is the grid panel that i use to show,modify,delete and create the points that i select over the map but in this form it can create points in any place, and i want to restrict that.I want that the user can create points over the map but just over the vlayerMunicipios layer.
//------------------------------------------------------------------------------------------------------------------
featureGrid = new Ext.grid.EditorGridPanel({
   ref : "featureGrid",
   collapsible : 'true',
   animCollapse : true,
   collapsed : true,
   title : "Feature Table",
   region : "south",
   height : 150,
   sm : new GeoExt.grid.FeatureSelectionModel(),
   store : new Ext.data.Store(),
   columns : [],
   listeners : {
         "beforecollapse" : function(p,a) {
			selectvlayer.activate();
         },
		 "beforeexpand" : function(p,a) {
			selectvlayer.deactivate();
         }
      },
   sm : new GeoExt.grid.FeatureSelectionModel({
      selectControl : modifyControl.selectControl,
      autoActivateControl : false,
      singleSelect : true
   }
   ),
   store : new Ext.data.Store(),
   bbar : [
   {
      text : "Eliminar",
      handler : function() {
         featureGrid.getSelectionModel().each(function(rec) {
            var feature = rec.getFeature();
            modifyControl.unselectFeature(feature);
            vlayer.removeFeatures([feature]);
            if (feature.state !== OpenLayers.State.INSERT) {
               feature.state = OpenLayers.State.DELETE;
               featureGrid.store.featureFilter = new OpenLayers.Filter({
                  evaluate : function(f) {
                     return feature !== f;

                  }
               }
               );
               vlayer.addFeatures([feature]);
            }
         }
         );
      }
   }
   ,
   new GeoExt.Action({
      control : drawControl,
      text : "Crear",
      enableToggle : true,
      ref : 'crear'
   }
   ),
   {
      text : "Guardar cambios",
      handler : function() {
         featureGrid.store.proxy.protocol.commit(
         vlayer.features, {
            callback : function() {
               selectedLayer.redraw(true);
               featureGrid.store.reload();
            }
         }
         );
      }
   }
   ]
});
//////////////////////////////////////////////////////////////////////////////////////////////////
help , and thatks for all.

--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


More information about the Users mailing list