[OpenLayers-Users] Capture screen coordinates
Ivan Grcic
igrcic at gmail.com
Wed Nov 25 12:46:43 EST 2009
hi,
1)
register featureAdded function in your draw control;
new OpenLayers.Control.DrawFeature(
polygon,
OpenLayers.Handler.Polygon,
{
featureAdded: function(evt){
var geom = evt.geometry;
//do what ever you want to do with it
}
}
),
2)
http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.getCenter
cheers
On Thu, Sep 24, 2009 at 5:40 PM, Diego Roberto
<diegorrborges at yahoo.com.br> wrote:
> 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: Top 10 -
> Celebridades - Música - Esportes
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
Ivan Grcic
More information about the Users
mailing list