[mapserver-commits] r7579 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon May 12 13:26:36 EDT 2008


Author: tbonfort
Date: 2008-05-12 13:26:36 -0400 (Mon, 12 May 2008)
New Revision: 7579

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapagg.cpp
Log:
AGG: allow dashed hatch symbols (#2614)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-05-12 17:13:24 UTC (rev 7578)
+++ trunk/mapserver/HISTORY.TXT	2008-05-12 17:26:36 UTC (rev 7579)
@@ -12,6 +12,8 @@
 
 Current Version (5.1-dev, SVN trunk):
 -------------------------------------
+- AGG: allow dashed hatch symbols (#2614)
+
 - AGG: enable offset lines of type x -99 (#2588)
 
 - AGG: use an agg specific label size calculation function where possible (#2357)

Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp	2008-05-12 17:13:24 UTC (rev 7578)
+++ trunk/mapserver/mapagg.cpp	2008-05-12 17:26:36 UTC (rev 7579)
@@ -1780,12 +1780,25 @@
             //translate the hatch so it overlaps the current shape
             hatch.transform(agg::trans_affine_translation(p->bounds.minx, p->bounds.miny));
             
-            agg::conv_stroke <agg::path_storage > stroke(hatch);
-            stroke.width(style->width);
             
-            //render the hatch clipped by the shape
-            ren->renderPathSolidClipped(stroke,*polygons,agg_color);
             
+            if(symbol->patternlength>1) {
+                //dash the hatch and render it clipped by the shape
+                agg::conv_dash<agg::path_storage > dash(hatch);
+                agg::conv_stroke<agg::conv_dash<agg::path_storage> > stroke_dash(dash);  
+                for (int i=0; i<symbol->patternlength; i+=2) {
+                    if (i < symbol->patternlength-1)
+                        dash.add_dash(symbol->pattern[i], symbol->pattern[i+1]);
+                }
+                stroke_dash.width(style->width);
+                ren->renderPathSolidClipped(stroke_dash,*polygons,agg_color);
+            } else {
+                //render the hatch clipped by the shape
+                agg::conv_stroke <agg::path_storage > stroke(hatch);
+                stroke.width(style->width);
+                ren->renderPathSolidClipped(stroke,*polygons,agg_color);
+            }
+            
             //render the optional outline
             ren->renderPathSolid(*polygons,AGG_NO_COLOR,agg_ocolor,1);
         }



More information about the mapserver-commits mailing list