[OpenLayers-Users] DrawFeature and FeatureAdded event

Lehtonen, Mika mika at digikartta.net
Mon Nov 24 13:58:53 EST 2008


Hej Sture,

I have a little bit similar application and I am using the following 
event handler. It seems to be working just fine.
vlayer.events.on({"featureadded": offBuffer, "featureunselected": 
offBuffer});
vlayer is the vector layer, offBuffer function for added feature event 
(+ for unselected feature).

- mika -

Sture Dingsøyr kirjoitti:
> Hi all
>
> Have made a control in OL that allows the user to draw a regular polygon. Have also added an event that uses the "featureadded" event.
>
> But...when the user only click in the map..a small polygon is drawed, but the event trigger is not fired..
>
> If the user draws a "larger" polygon the trigger fires just fine...
>
> Any suggestions?
>
> My ol code is this:
>
> var myVector = new OpenLayers.Layer.Vector("My vector");
> map.addLayer(myVector);
>
> var findRectangle = new OpenLayers.Control.DrawFeature(
> 	myVector,
> 	OpenLayers.Handler.RegularPolygon,
> 	{
> 		id: 'defaultControl01',
> 		title: "Klikk eller dra ut firkant rundt objekt i kartet for å finne mer informasjon",
> 		handlerOptions: {sides: 4, irregular: true},
> 		displayClass: 'findRectangle'            		
> 	}
> );
>
> findRectangle.events.register('featureadded', findRectangle, findRectangleFeaturAadded);
>
> function findRectangleFeaturAadded(feature) {               
> alert(feature);
> }
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   



More information about the Users mailing list