[Thuban-commits] r2860 - trunk/thuban/Extensions/umn_mapserver

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 30 05:18:04 CEST 2008


Author: elachuni
Date: 2008-07-30 05:18:02 +0200 (Wed, 30 Jul 2008)
New Revision: 2860

Modified:
   trunk/thuban/Extensions/umn_mapserver/mapfile.py
Log:
Line width from Thuban's classifications is now kept when exporting a
mapfile, for lines and polygons.



Modified: trunk/thuban/Extensions/umn_mapserver/mapfile.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mapfile.py	2008-07-29 07:14:45 UTC (rev 2859)
+++ trunk/thuban/Extensions/umn_mapserver/mapfile.py	2008-07-30 03:18:02 UTC (rev 2860)
@@ -482,6 +482,7 @@
         new_styleobj = MF_Style(styleObj(self._clazz))
         if type == "line":
             new_styleobj.set_color(tb_style.GetLineColor())
+            new_styleobj.set_width(tb_style.GetLineWidth())
         elif type == "point":
             # set a default symbol to show circles not only a small dot
             # symbol "circle" must create before
@@ -493,10 +494,16 @@
                 new_styleobj.set_linecolor(tb_style.GetLineColor())
             new_styleobj.set_color(tb_style.GetFill())
         else:
-            new_styleobj.set_size(tb_style.GetLineWidth())
+    # Suppose this is a polygon.  We'll need two styles for applying
+    # the background color and outline width, as explained in
+    # http://mapserver.gis.umn.edu/docs/faq/faqsection_view?section=Map%20Output
+            new_styleobj.set_color(tb_style.GetFill())
+    # And a second style.
+    # The order here matters (first the background, then the
+            new_styleobj = MF_Style(styleObj(self._clazz))
+            new_styleobj.set_width(tb_style.GetLineWidth())
             if tb_style.GetLineColor() != Transparent:
                 new_styleobj.set_linecolor(tb_style.GetLineColor())
-            new_styleobj.set_color(tb_style.GetFill())
 
 
 
@@ -730,7 +737,7 @@
         new_class.set_status(tb_class.IsVisible())
 
     def remove_allclasses(self):
-        for i in range(0,len(self.get_classes()), 1):
+        for i in range(len(self.get_classes())):
             self._mf_layer.removeClass(i)
         self.set_classes([])
 
@@ -1440,7 +1447,7 @@
     """
     The following parameters, which the mapscript style obj
     contains, are used:
-    color, backgroundcolor, outlinecolor, size, symbolname
+    color, backgroundcolor, outlinecolor, size, symbolname, width
 
     The following are not used:
     symbol, sizescaled, minsize, maxsize, offsetx, offsety,
@@ -1468,6 +1475,9 @@
     def get_color(self):
         return self._color
     
+    def get_width(self):
+        return self._style.width
+    
     def get_outlinecolor(self):
         return self._outlinecolor
    
@@ -1487,9 +1497,12 @@
         new_color.set_thubancolor(tb_color)
         self._color = new_color
         self._style.color = new_color.get_mfcolor()
-    
+
     def set_size(self, newsize):
         self._style.size = newsize
+
+    def set_width(self, newwidth):
+        self._style.width = newwidth
     
     def set_symbolname(self, newsymbol):
         # its possible to use stringnames instead of numbers



More information about the Thuban-commits mailing list