Permalink
Browse files

implement offseted line outlines (#4716)

  • Loading branch information...
1 parent 7596c68 commit e498ec47edff06a52552f5ae38b407968bc2f7cb @tbonfort tbonfort committed Jul 29, 2013
Showing with 23 additions and 4 deletions.
  1. +1 −0 mapcairo.c
  2. +7 −2 maprendering.c
  3. +1 −0 mapserver.h
  4. +13 −1 maputil.c
  5. +1 −1 msautotest
View
@@ -212,6 +212,7 @@ int renderLineCairo(imageObj *img, shapeObj *p, strokeStyleObj *stroke)
msCairoSetSourceColor(r->cr,stroke->color);
for(i=0; i<p->numlines; i++) {
lineObj *l = &(p->line[i]);
+ if(l->numpoints == 0) continue;
cairo_move_to(r->cr,l->point[0].x,l->point[0].y);
for(j=1; j<l->numpoints; j++) {
cairo_line_to(r->cr,l->point[j].x,l->point[j].y);
View
@@ -522,6 +522,8 @@ int msDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p,
if(style->offsety==-99) {
offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,-99);
+ } else if(style->offsety==-999) {
+ offsetLine = msOffsetPolyline(p,style->offsetx * finalscalefactor ,-999);
} else if(style->offsetx!=0 || style->offsety!=0) {
offsetLine = msOffsetPolyline(p, style->offsetx * finalscalefactor,
style->offsety * finalscalefactor);
@@ -641,10 +643,13 @@ int msDrawShadeSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p, sty
symbol->renderer = renderer;
if (style->offsetx != 0 || style->offsety != 0) {
- if(style->offsety==-99)
+ if(style->offsety==-99) {
offsetPolygon = msOffsetPolyline(p, style->offsetx*scalefactor, -99);
- else
+ } else if(style->offsety==-999) {
+ offsetPolygon = msOffsetPolyline(p,style->offsetx * scalefactor ,-999);
+ } else {
offsetPolygon = msOffsetPolyline(p, style->offsetx*scalefactor,style->offsety*scalefactor);
+ }
} else {
offsetPolygon=p;
}
View
@@ -2627,6 +2627,7 @@ extern "C" {
MS_DLL_EXPORT shapeObj *msGEOSIntersection(shapeObj *shape1, shapeObj *shape2);
MS_DLL_EXPORT shapeObj *msGEOSDifference(shapeObj *shape1, shapeObj *shape2);
MS_DLL_EXPORT shapeObj *msGEOSSymDifference(shapeObj *shape1, shapeObj *shape2);
+ MS_DLL_EXPORT shapeObj *msGEOSOffsetCurve(shapeObj *p, double offset);
MS_DLL_EXPORT int msGEOSContains(shapeObj *shape1, shapeObj *shape2);
MS_DLL_EXPORT int msGEOSOverlaps(shapeObj *shape1, shapeObj *shape2);
View
@@ -49,7 +49,9 @@
#ifdef USE_RSVG
#include <glib-object.h>
#endif
-
+#ifdef USE_GEOS
+#include <geos_c.h>
+#endif
extern char *msyystring_buffer;
@@ -1845,6 +1847,16 @@ shapeObj *msOffsetPolyline(shapeObj *p, double offsetx, double offsety)
shapeObj *ret;
if(offsety == -99) { /* complex calculations */
return msOffsetCurve(p,offsetx);
+ } else if(offsety == -999) {
+ shapeObj *tmp1;
+ ret = msOffsetCurve(p,offsetx/2.0);
+ tmp1 = msOffsetCurve(p, -offsetx/2.0);
+ for(i=0;i<tmp1->numlines; i++) {
+ msAddLineDirectly(ret,tmp1->line + i);
+ }
+ msFreeShape(tmp1);
+ free(tmp1);
+ return ret;
}
ret = (shapeObj*)msSmallMalloc(sizeof(shapeObj));

0 comments on commit e498ec4

Please sign in to comment.