Hello Eric, >What OpenLayers version do you use?
I use OpenLayers-2.7 latest version. >Changeset 8616 (<http://trac.openlayers.org/changeset/8616>) should >fix it, give trunk a try. Yes Thank you very much Eric..... it has solved my problem....=) I am able to draw the polygon on single click and also add it in the layer..... Here is the code added in zip file that I have done to just draw a circle of specific size on just one click and also it provides a functionality that user can draw only one circle at a time..... it could be useful for someone else also..... But Eric, There is one problem that I think I need to inform you about... I updated both the files from http://trac.openlayers.org/changeset/8616 i.e. 1) trunk/openlayers/lib/OpenLayers/Handler/RegularPolygon.js (modified) (1 diff) 2) trunk/openlayers/tests/Handler/RegularPolygon.html (modified) (1 diff) Now when I tested the RegularPolygon.html in http://localhost/OpenLayers-2.7/tests/run-tests.html It gives one error while testing.... I am pasting the output in italics below: Handler/RegularPolygon.html: fail 1 ok 6 (detailed: fail 0 ok 25) test_Handler_RegularPolygon_constructor ok 3 ok constructor calls parent with the correct control ok constructor calls parent with the correct callbacks ok regular polygon constructor calls parent with the correct options test_Handler_RegularPolygon_activation ok 3 ok activate returns false if the handler was already active ok activate returns true if the handler was not already active ok deactivate returns true if the handler was active already test_Handler_RegularPolygon_deactivation ok 1 ok deactivate doesn't throw an error if layer was previously destroyed test_Handler_RegularPolygon_four_corners ok 7 ok correct bounds after move ok geometry has 5 components ok geometry is a polygon ok feature radius as set on handler ok correct bounds after move with a fixed radius ok bounds with manual radius setting ok bounds with manual radius setting and mousemove test_Handler_RegularPolygon_circle ok 7 ok correct bounds after move ok geometry has correct numbre of components ok geometry is a polygon ok feature radius as set on handler ok correct bounds after move with fixed radius ok bounds with manual radius setting ok bounds with manual radius setting and mousemove test_Handler_RegularPolygon_irregular ok 4 ok correct right ok correct bottom ok correct left ok correct top test_callbacks planned 1 assertions but got 0; fail 0 ok 0 exception: : object: 'bottom' is null or not an object Eric Lemoine wrote: > > On Mon, Jan 19, 2009 at 1:52 PM, Jatin Ambasana <[email protected]> > wrote: >> http://mail.google.com/mail/#label/openlayers/11eeef3d8dc95c53 >> Hello everyone, >> >> I have added DrawFeature control to my map. >> Whenever it is activated it will always draw a polygon of sides 40 i.e. >> an >> approx circle. >> This is its code: >> >> polyOptions = {sides: 40, radius: rad, angle: 0}; >> polygonControl = new >> OpenLayers.Control.DrawFeature(polygonLayer, >> >> OpenLayers.Handler.RegularPolygon, >> {handlerOptions: polyOptions, >> featureAdded:circleAdded}); >> map.addControl(polygonControl); >> >> Now the problem is that the circleAdded function is not called when a >> circle >> is drawn on map. > > What OpenLayers version do you use? > > Changeset 8616 (<http://trac.openlayers.org/changeset/8616>) should > fix it, give trunk a try. > > Regards, > > -- > Eric > http://n2.nabble.com/file/n2185143/polygons.zip polygons.zip -- View this message in context: http://n2.nabble.com/DrawFeature-control-not-working-properly-tp2181102p2185143.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
