[OpenLayers-Users] Capture screen coordinates

Diego Roberto diegorrborges at yahoo.com.br
Thu Sep 24 12:40:34 EDT 2009


Hi,

- I will generate a search space as follows: User draws a polygon
(OpenLayers.Layer.Vector) on the screen and when to draw this polygon
as the application will return all the points that are within this
polygon. Currently the application works this way only when the User
draw the polygon he has to click the search button or triggering event
"onclick" and calling the function serialize () to capture the
coordinates into a JSON object. What I want is to eliminate the need
for the User clicks the search button, or just make a fence on the
screen capture system has the coordinates to perform the search. How
should I proceed in this case? As the caption event so he finished
drawing without clicking any button or trigger an onclick event? If
there is no better way to search through what you display or link so I
can search? 
Solution to use: OpenLayers + JSON + Java + DWR + PostGIS. 

Here is the code below the layers of vectors that do get to catch
the details after the User draw on the screen to generate the search. 

    
             / / Layer to design for polygon generation of space research 
             rectangle = new OpenLayers..Layer.Vector ( 'Simple Search', 
             / / Style applied to the blue rectangle 
                              
   ( 
                     Style: OpenLayers.StyleMap new (( 
                         fillColor: "# 333399" 
                         fillOpacity: 0.5 
                     )) 
                     ) 
       ); 
            
             / / Layer to design for polygon generation of space research 
             polygon = new OpenLayers.Layer.Vector ( 'Search Polygon', 
                                 / / Blue Style applied to the polygon 
                                 ( 
                     Style: OpenLayers.StyleMap new (( 
                         fillColor: "# 333399" 
                         fillOpacity: 0.5 
                     )) 
                     ) 
       ); 
            
            
                 / / Layer to design a point for the generation of space research 
             point = new OpenLayers.Layer.Vector ( 'Search Point'); 
            
               / / Search through the rectangle is inserted into a new layer of rectangle on the map 
                retanguloOptions = (sides: 4); 
         retanguloControl = new OpenLayers.Control.DrawFeature (rectangle, 
                                             OpenLayers.Handler.RegularPolygon, 
                                             (handlerOptions: retanguloOptions)); 
        
          / / Search through polygon is inserted into a new layer of polygon on the map 
         poligonoControl = new OpenLayers.Control.DrawFeature (polygon, 
                                             OpenLayers.Handler.Polygon); 
        
           / / Search through point is inserted a new layer of point on the map 
         pontoControl = new OpenLayers.Control.DrawFeature (point, 
                                             OpenLayers.Handler.Point); 



- Another question also must generate a search in which I capture
the coordinates of the center of the screen to generate a buffer. User
will not make any drawing only a select category of hospitals and click
search. The application then captures the coordinates of the center of
the screen to generate a buffer of 2 km of the center point. I already
have the running buffer to know what heading to use these coordinates
of the center of the screen (map)? 



Regards, 
Diego Roberto
Phone: + 55 62 96190902 
Msn: diego_roberto at live.com 
Skype: diego.rrborges 


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090924/4beec366/attachment.html


More information about the Users mailing list