Permalink
Browse files

expand clipping rectangle to account for offset (#4554)

also adresses cleaner defines for single-sided offsets from #4716
  • Loading branch information...
1 parent 650cc30 commit d231a752b884bccd26eaddec1a27738b3dec2f15 @tbonfort tbonfort committed Aug 23, 2013
Showing with 18 additions and 11 deletions.
  1. +3 −0 mapdraw.c
  2. +1 −1 mapprimitive.c
  3. +8 −8 maprendering.c
  4. +4 −0 mapserver.h
  5. +2 −2 maputil.c
View
@@ -2076,6 +2076,9 @@ int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image,
}
maxsize = MS_MAX(msSymbolGetDefaultSize(symbol), MS_MAX(style->size, style->width));
maxunscaledsize = MS_MAX(style->minsize*image->resolutionfactor, style->minwidth*image->resolutionfactor);
+ if(shape->type == MS_SHAPE_POLYGON && !IS_PARALLEL_OFFSET(style->offsety)) {
+ maxsize += MS_MAX(fabs(style->offsety),fabs(style->offsetx));
+ }
clip_buf = MS_MAX(clip_buf,MS_NINT(MS_MAX(maxsize * layer->scalefactor, maxunscaledsize) + 1));
}
View
@@ -1772,7 +1772,7 @@ labelPathObj** msPolylineLabelPath(mapObj *map, imageObj *img,shapeObj *p, int m
offset = -offset;
}
}
- p = msOffsetPolyline(p,offset, -99);
+ p = msOffsetPolyline(p,offset, MS_STYLE_SINGLE_SIDED_OFFSET);
if(!p) return NULL;
}
View
@@ -520,10 +520,10 @@ int msDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p,
finalscalefactor = 1.0;
}
- if(style->offsety==-99) {
- offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,-99);
- } else if(style->offsety==-999) {
- offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,-999);
+ if(style->offsety==MS_STYLE_SINGLE_SIDED_OFFSET) {
+ offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,MS_STYLE_SINGLE_SIDED_OFFSET);
+ } else if(style->offsety==MS_STYLE_DOUBLE_SIDED_OFFSET) {
+ offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,MS_STYLE_DOUBLE_SIDED_OFFSET);
} else if(style->offsetx!=0 || style->offsety!=0) {
offsetLine = msOffsetPolyline(p, style->offsetx * finalscalefactor,
style->offsety * finalscalefactor);
@@ -643,10 +643,10 @@ int msDrawShadeSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p, sty
symbol->renderer = renderer;
if (style->offsetx != 0 || style->offsety != 0) {
- if(style->offsety==-99) {
- offsetPolygon = msOffsetPolyline(p, style->offsetx*scalefactor, -99);
- } else if(style->offsety==-999) {
- offsetPolygon = msOffsetPolyline(p,style->offsetx * scalefactor ,-999);
+ if(style->offsety==MS_STYLE_SINGLE_SIDED_OFFSET) {
+ offsetPolygon = msOffsetPolyline(p, style->offsetx*scalefactor, MS_STYLE_SINGLE_SIDED_OFFSET);
+ } else if(style->offsety==MS_STYLE_DOUBLE_SIDED_OFFSET) {
+ offsetPolygon = msOffsetPolyline(p,style->offsetx * scalefactor ,MS_STYLE_DOUBLE_SIDED_OFFSET);
} else {
offsetPolygon = msOffsetPolyline(p, style->offsetx*scalefactor,style->offsety*scalefactor);
}
View
@@ -944,6 +944,10 @@ extern "C" {
#endif
};
+#define MS_STYLE_SINGLE_SIDED_OFFSET -99
+#define MS_STYLE_DOUBLE_SIDED_OFFSET -999
+#define IS_PARALLEL_OFFSET(offsety) (offsety == MS_STYLE_SINGLE_SIDED_OFFSET || offsety == MS_STYLE_DOUBLE_SIDED_OFFSET)
+
/********************************************************************/
View
@@ -1845,9 +1845,9 @@ shapeObj *msOffsetPolyline(shapeObj *p, double offsetx, double offsety)
{
int i, j;
shapeObj *ret;
- if(offsety == -99) { /* complex calculations */
+ if(offsety == MS_STYLE_SINGLE_SIDED_OFFSET) { /* complex calculations */
return msOffsetCurve(p,offsetx);
- } else if(offsety == -999) {
+ } else if(offsety == MS_STYLE_DOUBLE_SIDED_OFFSET) {
shapeObj *tmp1;
ret = msOffsetCurve(p,offsetx/2.0);
tmp1 = msOffsetCurve(p, -offsetx/2.0);

0 comments on commit d231a75

Please sign in to comment.