[mapguide-commits] r7895 - trunk/MgDev/Common/Renderers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Nov 3 13:04:06 PST 2013


Author: waltweltonlair
Date: 2013-11-03 13:04:06 -0800 (Sun, 03 Nov 2013)
New Revision: 7895

Modified:
   trunk/MgDev/Common/Renderers/AGGRenderer.cpp
Log:
Fix #2285 (DOTS hatch pattern from DWF files not rendering using AGG Renderer)

Reviewed and applied path from from Faruk attached to ticket.


Modified: trunk/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/AGGRenderer.cpp	2013-11-03 20:46:34 UTC (rev 7894)
+++ trunk/MgDev/Common/Renderers/AGGRenderer.cpp	2013-11-03 21:04:06 UTC (rev 7895)
@@ -2012,8 +2012,8 @@
                 xform->transform(tx, ty, tx, ty);
 
             // detect a close segment (in a Linebuffer this is caused by first and
-            // last point of the contour being equal
-            if (tx == sx && ty == sy)
+            // last point of the contour being equal and size of contour > 2 points)
+            if (tx == sx && ty == sy && ptlast > 1) 
                 c->ps.close_polygon();
             else if (ptlast == 1)
             {
@@ -2030,11 +2030,21 @@
                 if (len2 < 100.0*LINE_SEGMENT_DOT_SIZE*LINE_SEGMENT_DOT_SIZE)
                 {
                     // found a dot - draw it as a 1-pixel long line
-                    double len = sqrt(len2);
-                    dx /= len;
-                    dy /= len;
-                    c->ps.move_to(tx-0.5*dx, ty-0.5*dy);
-                    c->ps.line_to(tx+0.5*dx, ty+0.5*dy);
+                    if (len2 > 0.0)
+                    {
+                        double len = sqrt(len2);
+                        dx /= len;
+                        dy /= len;
+                        c->ps.move_to(tx-0.5*dx, ty-0.5*dy);
+                        c->ps.line_to(tx+0.5*dx, ty+0.5*dy);
+                    }
+                    else
+                    {
+                        // length of line can be 0 when DOTS_HATCH is rendered from DWF
+                        // so use LINE_SEGMENT_DOT_SIZE to render that dots
+                        c->ps.move_to(tx-LINE_SEGMENT_DOT_SIZE, ty-LINE_SEGMENT_DOT_SIZE);
+                        c->ps.line_to(tx+LINE_SEGMENT_DOT_SIZE, ty+LINE_SEGMENT_DOT_SIZE);
+                    }
                 }
                 else
                 {



More information about the mapguide-commits mailing list