[mapserver-commits] r11855 - branches/branch-6-0/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jun 28 13:29:17 EDT 2011


Author: tbonfort
Date: 2011-06-28 10:29:16 -0700 (Tue, 28 Jun 2011)
New Revision: 11855

Modified:
   branches/branch-6-0/mapserver/HISTORY.TXT
   branches/branch-6-0/mapserver/mapdraw.c
   branches/branch-6-0/mapserver/maprendering.c
Log:
Fix rendering of lines with outlinewidth set if not on first style (#3935)

Modified: branches/branch-6-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-6-0/mapserver/HISTORY.TXT	2011-06-28 17:23:39 UTC (rev 11854)
+++ branches/branch-6-0/mapserver/HISTORY.TXT	2011-06-28 17:29:16 UTC (rev 11855)
@@ -14,6 +14,7 @@
 
 Version 6.0.1 (SVN branch-6-0):
 ---------------------------
+- Fix rendering of lines with outlinewidth set if not on first style (#3935)
 
 - Added writing of cluster object when saving map. Also improved handling of
   cluster parsing errors (#3934)

Modified: branches/branch-6-0/mapserver/mapdraw.c
===================================================================
--- branches/branch-6-0/mapserver/mapdraw.c	2011-06-28 17:23:39 UTC (rev 11854)
+++ branches/branch-6-0/mapserver/mapdraw.c	2011-06-28 17:29:16 UTC (rev 11855)
@@ -910,53 +910,48 @@
 
     
     if (cache) {
-        int i;
-        for (i = 0; i < layer->class[shape.classindex]->numstyles; i++) {
-            styleObj *pStyle = layer->class[shape.classindex]->styles[i];
-            colorObj tmp;
-           if (pStyle->outlinewidth > 0) {
-                /* 
-                 * RFC 49 implementation
-                 * if an outlinewidth is used:
-                 *  - augment the style's width to account for the outline width
-                 *  - swap the style color and outlinecolor
-                 *  - draw the shape (the outline) in the first pass of the
-                 *    caching mechanism
-                 */
-                
-                /* adapt width (must take scalefactor into account) */
-                pStyle->width += (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
-                pStyle->minwidth += pStyle->outlinewidth * 2;
-                pStyle->maxwidth += pStyle->outlinewidth * 2;
-                pStyle->size += (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
+      styleObj *pStyle = layer->class[shape.classindex]->styles[0];
+      colorObj tmp;
+      if (pStyle->outlinewidth > 0) {
+          /* 
+           * RFC 49 implementation
+           * if an outlinewidth is used:
+           *  - augment the style's width to account for the outline width
+           *  - swap the style color and outlinecolor
+           *  - draw the shape (the outline) in the first pass of the
+           *    caching mechanism
+           */
+          
+          /* adapt width (must take scalefactor into account) */
+          pStyle->width += (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
+          pStyle->minwidth += pStyle->outlinewidth * 2;
+          pStyle->maxwidth += pStyle->outlinewidth * 2;
+          pStyle->size += (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
 
-                /*swap color and outlinecolor*/
-                tmp = pStyle->color;
-                pStyle->color = pStyle->outlinecolor;
-                pStyle->outlinecolor = tmp;
-            }
-            if (i == 0 || pStyle->outlinewidth > 0) {
-                status = msDrawShape(map, layer, &shape, image, i, MS_FALSE); /* draw a single style */
-            }
-            if (pStyle->outlinewidth > 0) {
-                /*
-                 * RFC 49 implementation: switch back the styleobj to its
-                 * original state, so the line fill will be drawn in the
-                 * second pass of the caching mechanism
-                 */
-                
-                /* reset widths to original state */
-                pStyle->width -= (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
-                pStyle->minwidth -= pStyle->outlinewidth * 2;
-                pStyle->maxwidth -= pStyle->outlinewidth * 2;
-                pStyle->size -= (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
+          /*swap color and outlinecolor*/
+          tmp = pStyle->color;
+          pStyle->color = pStyle->outlinecolor;
+          pStyle->outlinecolor = tmp;
+      }
+      status = msDrawShape(map, layer, &shape, image, 0, MS_FALSE); /* draw a single style */
+      if (pStyle->outlinewidth > 0) {
+          /*
+           * RFC 49 implementation: switch back the styleobj to its
+           * original state, so the line fill will be drawn in the
+           * second pass of the caching mechanism
+           */
+          
+          /* reset widths to original state */
+          pStyle->width -= (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
+          pStyle->minwidth -= pStyle->outlinewidth * 2;
+          pStyle->maxwidth -= pStyle->outlinewidth * 2;
+          pStyle->size -= (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
 
-                /*reswap colors to original state*/
-                tmp = pStyle->color;
-                pStyle->color = pStyle->outlinecolor;
-                pStyle->outlinecolor = tmp;
-            }
-        }
+          /*reswap colors to original state*/
+          tmp = pStyle->color;
+          pStyle->color = pStyle->outlinecolor;
+          pStyle->outlinecolor = tmp;
+      }
     }
 
     else
@@ -1007,10 +1002,51 @@
           }
           if(s==0 && pStyle->outlinewidth>0 && MS_VALID_COLOR(pStyle->color)) {
             msDrawLineSymbol(&map->symbolset, image, &current->shape, pStyle, layer->scalefactor);  
-          } else if(s>0)
-            msDrawLineSymbol(&map->symbolset, image, &current->shape, pStyle, layer->scalefactor);
-        }
-      }
+          } else if(s>0) {
+             if (pStyle->outlinewidth > 0 && MS_VALID_COLOR(pStyle->outlinecolor)) {
+                colorObj tmp;
+                /* 
+                 * RFC 49 implementation
+                 * if an outlinewidth is used:
+                 *  - augment the style's width to account for the outline width
+                 *  - swap the style color and outlinecolor
+                 *  - draw the shape (the outline) in the first pass of the
+                 *    caching mechanism
+                 */
+
+                /* adapt width (must take scalefactor into account) */
+                pStyle->width += (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
+                pStyle->minwidth += pStyle->outlinewidth * 2;
+                pStyle->maxwidth += pStyle->outlinewidth * 2;
+                pStyle->size += (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
+
+                /*swap color and outlinecolor*/
+                tmp = pStyle->color;
+                pStyle->color = pStyle->outlinecolor;
+                pStyle->outlinecolor = tmp;
+                msDrawLineSymbol(&map->symbolset, image, &current->shape, pStyle, layer->scalefactor);
+                /*
+                 * RFC 49 implementation: switch back the styleobj to its
+                 * original state, so the line fill will be drawn in the
+                 * second pass of the caching mechanism
+                 */
+
+                /* reset widths to original state */
+                pStyle->width -= (pStyle->outlinewidth / (layer->scalefactor/image->resolutionfactor)) * 2;
+                pStyle->minwidth -= pStyle->outlinewidth * 2;
+                pStyle->maxwidth -= pStyle->outlinewidth * 2;
+                pStyle->size -= (pStyle->outlinewidth/layer->scalefactor*(map->resolution/map->defresolution));
+
+                /*reswap colors to original state*/
+                tmp = pStyle->color;
+                pStyle->color = pStyle->outlinecolor;
+                pStyle->outlinecolor = tmp;
+             }
+             if(MS_VALID_COLOR(pStyle->color))
+               msDrawLineSymbol(&map->symbolset, image, &current->shape, pStyle, layer->scalefactor);
+         }
+       }
+     }
     }
     
     freeFeatureList(shpcache);

Modified: branches/branch-6-0/mapserver/maprendering.c
===================================================================
--- branches/branch-6-0/mapserver/maprendering.c	2011-06-28 17:23:39 UTC (rev 11854)
+++ branches/branch-6-0/mapserver/maprendering.c	2011-06-28 17:29:16 UTC (rev 11855)
@@ -439,8 +439,9 @@
             else if(MS_VALID_COLOR(style->outlinecolor))
                s.color = &style->outlinecolor;
             else {
-               msSetError(MS_MISCERR,"no color defined for line styling","msDrawLineSymbol()");
-               return MS_FAILURE;
+               /* msSetError(MS_MISCERR,"no color defined for line styling","msDrawLineSymbol()"); 
+                * not really an error */
+               return MS_SUCCESS;
             }
             renderer->renderLine(image,offsetLine,&s);
          }



More information about the mapserver-commits mailing list