[OpenLayers-Dev] Class.inherit

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Mon Feb 14 01:46:40 EST 2011


Am 12.02.2011 12:12, schrieb Eric Lemoine:
> On Friday, February 11, 2011, Slawomir Messner
> <slawomir.messner at staff.uni-marburg.de>  wrote:
>> Hi,
>> I updated our version of OpenLayers to svn trunk. Now I get the following error:
>> P is undefined
>> I debugged a lot and there seems to be a problem with classes which inherit from a class which is not directly inherits form Class, like ZoomPanel where this error occurs first. Then I tried to fix it with adding OpenLayers.Control as first inherit class:
>> OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control,OpenLayers.Control.Panel,...
>> this works but then the next class came where the parent class is not Control or Class it self. So I edited all of them (I was not expect that this is the solution but I was interested what next comes). The next thing was that the Navigation control couldn't initialize the DragPan. OL.Control.DragPan was undefined.
>> This was the point where I rollback the changes till the update and tried it with several older versions of Class, OpenLayers.js but nothing helped, the error was OpenLayers is undefined.
>> In hope someone can help me so I don't have to rollback before the update and we can stay compatible with the new trunk.
>
> Hi. Could you please provide a small example (with actual code)
> demonstrating the problem? We haven't seen any problem with the new
> Class impl. until now.
>
>
Hi,
I made some more debugging. When I pull out all our custom classes out 
of the build of OpenLayers and include them by script-tags all is fine. 
So push them back and then I found the reason why some classes which 
inherits form classes that inherit from Control throw P is undefined and 
why not all. It's because the code of Control is twice in the build 
OpenLayers.js. First at the beginning and second at line 7xxxx, in the 
second half of the code. So after the second time all classes which 
inherited from Control are gone.
I pulled out the custom class which is after the second control code in 
the build but it didn't help. So now I will pull all our classes out and 
put them one after another back in.
If someone knows what to look for or the reason why control could be 
pasted twice, then I would be thankful to know. It would maybe save a 
lot of time.
There are probably missing or to many @requires tag.




More information about the Dev mailing list