[Tickets] Layer display in the right order in legend and "layers box"

Ticket notification list tickets at lists.gispython.org
Thu Dec 28 23:14:39 EET 2006


Hi all,

Layers are displayed in the layer box and in the legend box in the same
order than the list of the plone folder but unfortunately that is the
reverse order of the map display. This is not acceptable to display
geological beds for example.
After a short exchange with SeanG we have tried to fix this.
Sean proposed two solutions :

The first was to "modify legend template in the primagis skin". We did
it and we had also to modify map_templates in this way :

tal:define="items python:here.getLegendData(evaluate=True)"
tal:define="items python:here.getLegendData(evaluate=True); dummy
python:items.reverse()"         tal:define="layers here/getHidableLayers"
tal:define="layers here/getHidableLayers; dummy python:layers.reverse()"

This solution did not work properly because if one changes a layer by
ticking or unticking then click on "update layers" the legend will
display upside down and  one needs to reload the page to get the legend 
on the right order.

The second was to modify the getLegendData method of PrimaGISMap and in
fact we made a deeper modification , here is the proposed patch by S.
Pilloz our ingeneer :

--- PrimaGISMap.py.old  2006-12-28 20:03:20.000000000 +0100
+++ PrimaGISMap.py      2006-12-28 21:32:38.000000000 +0100
@@ -645,10 +645,11 @@
         map is honored.
         """
         sec = getSecurityManager()
-        return [layer
+        layers = [layer
                 for layer in self.contentValues(["PrimaGISDataLayer", "PrimaGISLayer"])
                 if sec.checkPermission(permissions.View, layer)]
-
+       layers.reverse()
+       return layers
 
     security.declarePublic('getDefaultLayers')
     def getDefaultLayers(self):


This seems to work for us but we are not sure of the possible hidden
consequences...
We hope that this may help  to solve properly the problem.

Thanks again for your help.



-- 
Gérard Vidal
Directeur ERTé ACCES INRP-ENS
INRP, 19 mail de Fontenay
BP 17424 69347 Lyon Cedex 07
	e-mail Gerard.Vidal at inrp.fr
tél : (0)4 72 76 62 00
"Si la matière grise était rose, personne n'aurait plus d'idées noires."
Pierre Dac



More information about the Tickets mailing list