[OpenLayers-Dev] Class.inherit "fixed"
Slawomir Messner
slawomir.messner at staff.uni-marburg.de
Mon Feb 14 04:25:14 EST 2011
Hi,
the problem was caused by a class which directly inherits from Control
class. I don't know why but when I use an other class as parent class it
works and Control class is only once in the file build by the python-script.
It works now, but I would like to know why it's not working with Control
so I send below the code of the attributes and constructor maybe someone
sees the error:
/**
* @requires OpenLayers/Control.js
*/
/**
*
* Inherits from:
* -<OpenLayers.Control>
*/
OpenLayers.Control.AudioSearchControl = OpenLayers.Class(OpenLayers.Control, {
resultDiv:null,
coordsDiv:null,
iconActive:'olControlAudioItemActive menuIcon',
iconInactive:'olControlAudioItemInactive menuIcon',
iconActiveSide:'olControlAudioLeftActive menuIconLeft',
iconInactiveSide:'olControlAudioLeftInactive menuIconLeft',
toggle:true,
clickOut:false,
audioLayer:null,
featureLayer:null,
layer:null,
lemmataArray: [],
korpusContainer:null,
mediaPointArray: [],
activeFeature:null,
layerSelect:null,
featureSelect:null,
geometryTypes:null,
selectControl:null,
featureSelectControl:null,
initialize:function (options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
this.geometryTypes = ["OpenLayers.Geometry.Polygon"];
},
...
Am 14.02.2011 07:46, schrieb Slawomir Messner:
> 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.
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110214/03421d5b/attachment.html
More information about the Dev
mailing list