[OpenLayers-Users] DrawFeature control not working properly

Jatin Ambasana jatin.a at iworktech.com
Tue Jan 20 02:11:39 EST 2009


Hello Eric,

I also had another problem that came to notice some what late.....
The program that I had attached in last post (polygons.html) does work fine
but it shows a error occurred symbol on left hand side of browser's status
bar.
On checking the symbol I get to see following error:
Line: 379
Char: 9
Error: 'this.layer.renderer' is null or not an object

Although it is not giving any problem in working of the code but I am not
able to understand why it is giving such error.
I feel I should take its care now itself since I am going to extend the code
with some more functionalities.

But I don't know where to look for and I don't know anything about Renderer
and its working....


Jatin Ambasana wrote:
> 
> 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 <jatin.a at iworktech.com>
>> 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-tp2181102p2185299.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list