[mapserver-commits] r11852 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Jun 28 13:18:59 EDT 2011
Author: tbonfort
Date: 2011-06-28 10:18:59 -0700 (Tue, 28 Jun 2011)
New Revision: 11852
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapdraw.c
trunk/mapserver/maprendering.c
Log:
Fix rendering of lines with outlinewidth set if not on first style (#3935)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-06-27 15:10:23 UTC (rev 11851)
+++ trunk/mapserver/HISTORY.TXT 2011-06-28 17:18:59 UTC (rev 11852)
@@ -14,6 +14,8 @@
Current Version (SVN trunk, 6.1-dev, future 6.2):
-------------------------------------------------
+- Fix rendering of lines with outlinewidth set if not on first style (#3935)
+
- Correct SLD with spatial filters bbox and intersects (#3929)
- Applied patch for ticket (symbol writing issues) (#3589)
Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c 2011-06-27 15:10:23 UTC (rev 11851)
+++ trunk/mapserver/mapdraw.c 2011-06-28 17:18:59 UTC (rev 11852)
@@ -910,59 +910,55 @@
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
status = msDrawShape(map, layer, &shape, image, -1, MS_FALSE); /* all styles */
if(status != MS_SUCCESS) {
msFreeShape(&shape);
+ msSetError(MS_MISCERR,"foo bar","msDrawLineSymbol()");
retcode = MS_FAILURE;
break;
}
@@ -1007,10 +1003,51 @@
}
if(s==0 && pStyle->outlinewidth>0 && MS_VALID_COLOR(pStyle->color)) {
msDrawLineSymbol(&map->symbolset, image, ¤t->shape, pStyle, layer->scalefactor);
- } else if(s>0)
- msDrawLineSymbol(&map->symbolset, image, ¤t->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, ¤t->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, ¤t->shape, pStyle, layer->scalefactor);
+ }
+ }
+ }
}
freeFeatureList(shpcache);
Modified: trunk/mapserver/maprendering.c
===================================================================
--- trunk/mapserver/maprendering.c 2011-06-27 15:10:23 UTC (rev 11851)
+++ trunk/mapserver/maprendering.c 2011-06-28 17:18:59 UTC (rev 11852)
@@ -439,8 +439,8 @@
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()");
+ return MS_SUCCESS;
}
renderer->renderLine(image,offsetLine,&s);
}
More information about the mapserver-commits
mailing list