[Users] Ext 3, printExtent, vector-layers with attributes and too much recursion

Andreas Hocevar ahocevar at opengeo.org
Mon Aug 9 16:07:19 CEST 2010


On Aug 9, 2010, at 13:19 , Marc Jansen wrote:

> Hi Andreas,
> 
> thanks for your response.
> 
> If I get that right, the error occurs whenever an attribute is an object 
> with another circular reference poniting towards the first object. In my 
> particular case I don't store GeoExt-objects in the attributes, just 
> plain JavaScript-objects that include references as described. So you 
> would suggest storing only scalar values within attributes, right? If 
> so, this should IMHO at least be documented (or is it already).

Added to the APIdocs just now:
http://trac.openlayers.org/changeset/10609

Regards,
Andreas.

> 
> Thanks again,
> Marc
> 
> 
> 
> 
> On 09.08.2010 12:56, Andreas Hocevar wrote:
>> Hi Marc,
>> 
>> the issue you are seeing is not related to #133. But you could easily avoid it by not referencing GeoExt objects in feature attributes. This is a bad practice anyway (just as bad as what we do in Feature- and LayerRecords). If you really need features to keep a reference to GeoExt objects, don't do it on the attributes, but e.g. on the feature directly (e.g. feature.test instead of feature.attributes.test).
>> 
>> Regards,
>> Andreas.
>> 
>> On Aug 9, 2010, at 12:36 , Marc Jansen wrote:
>> 
>> 
>>> Hi list,
>>> 
>>> I get a too much recursion exception when I try to print a vectorlayer
>>> that has features with attributes that reference GeoExt-objects. I am
>>> pretty sure that the issue I have is related to this ticket:
>>> https://www.geoext.org/ticket/133
>>> 
>>> You can test the behaviour with the online print-example:
>>> http://dev.geoext.org/trunk/geoext/examples/print-extent.html
>>> 
>>> Just add a new layer to the mappanel with firebug and give it afeature
>>> that has one of its attributes pointing towards the mappanel object:
>>> 
>>> 
>>> var v = new OpenLayers.Layer.Vector('testmj');
>>> mapPanel.map.addLayer(v);
>>> 
>>> v.addFeatures([
>>>   new OpenLayers.Feature.Vector(
>>>    OpenLayers.Geometry.fromWKT(
>>>     "POLYGON(146.1 -41, 146.2 -41, 146.2 -41.1, 146.1 -41.1)"
>>>    ), {test:mapPanel}  // this is causing the infinite recursion
>>> )]);
>>> 
>>> 
>>> If you hit "print" afterwards, the error occurs.
>>> 
>>> Attached to the ticket #133 (current status "Needs more work") there is
>>> a patch, which is not in trunk yet. Is there any chance this ticket gets
>>> closed soon? Or can anybody provide a suitable workaround?
>>> 
>>> Regards and thanks in advance,
>>> Marc
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>> 
>> 
>> 
>> 
> 
> 
> -- 
> 
>   .................................................................
>    Karten im (Inter|Intra)net?
> 
>    OpenLayers - Webentwicklung mit dynamischen Karten und Geodaten
>    von M. Jansen und T. Adams, OpenSourcePress, München.
> 
>    ISBN: 978-3-937514-92-5
>    URL:  http://openlayers-buch.de
>   .................................................................
> 
> 
>   Dipl.-Geogr. Marc Jansen
>   - Anwendungsentwickler -
> 
>   terrestris GmbH&  Co. KG
>   Irmintrudisstraße 17
>   53111 Bonn
> 
>   Tel:    ++49 (0)228 / 96 28 99 -53
>   Fax:    ++49 (0)228 / 96 28 99 -57
> 
>   Email:  jansen at terrestris.de
>   Web:    http://www.terrestris.de
> 
>   Amtsgericht Bonn, HRA 6835
>   Komplementärin:  terrestris Verwaltungsgesellschaft mbH
>   vertreten durch: Hinrich Paulsen, Till Adams
> 
> 
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list