Advertisement
Guest User

Untitled

a guest
Aug 9th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1.  
  2. var filter = new OpenLayers.Filter.Comparison({
  3. type: OpenLayers.Filter.Comparison.LIKE,
  4. matchCase:false,
  5. property: "nome",
  6. value: "searchText"});
  7.  
  8.  
  9. var strategy = new OpenLayers.Strategy.Fixed();
  10.  
  11. var wfsprotocol = new OpenLayers.Protocol.WFS.v1_1_0({
  12. url: host,
  13. featureType: "pontos_interesse",
  14. featureNS: "domain",
  15. srsName: "EPSG:900913",
  16. version: "1.1.0",
  17. extractAttributes: true,
  18. isBaseLayer: false,
  19. visibility: true});
  20.                
  21.                
  22.  
  23.  //selectedLayer = new OpenLayers.Layer.Vector("Selected Layer", {
  24.  //displayOutsideMaxExtent: true,
  25.  //displayInLayerSwitcher: false});
  26.      
  27.      
  28.  
  29.  
  30. wfsprotocol.read ({
  31. filter:filter,
  32. callback: processTheQuery,
  33. scope: strategy});
  34.  
  35.  
  36. function processTheQuery(request) {
  37. // the first bit sets the value of sExt to be the a boundingbox on the
  38. //features returned.
  39. // Depending on application logic, this could happen in other places in
  40. //the code.
  41.      if (request.data && request.data.bbox) {
  42.            var b = request.data.bbox;
  43.            var sExt = new OpenLayers.Bounds(b[0],b[1],b[2],b[3]);
  44.      }else {
  45.            var fts = request.features;
  46.            if (fts.length>0) {
  47.                sExt = fts[0].geometry.getBounds().clone();
  48.                for(var i=1;i<fts.length;i++) {
  49.                   sExt.extend(fts[i].geometry.getBounds());
  50.                }
  51.            }
  52.      };
  53. map.zoomToExtent(sExt);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement