[mapserver-commits] r11252 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Mar 18 14:14:18 EDT 2011


Author: tbonfort
Date: 2011-03-18 11:14:18 -0700 (Fri, 18 Mar 2011)
New Revision: 11252

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maprendering.c
   trunk/mapserver/mapserver.h
Log:
correct scaling of symbol GAP and PATTERN (#3752)



Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-03-18 18:13:41 UTC (rev 11251)
+++ trunk/mapserver/HISTORY.TXT	2011-03-18 18:14:18 UTC (rev 11252)
@@ -14,6 +14,8 @@
 
 Current Version (SVN trunk):
 ----------------------------
+- correct scaling of symbol GAP and PATTERN (#3752)
+
 - remove references to SWF/MING
 
 - CGI runtime substitution requires a validation pattern (was optional before) (#3522)

Modified: trunk/mapserver/maprendering.c
===================================================================
--- trunk/mapserver/maprendering.c	2011-03-18 18:13:41 UTC (rev 11251)
+++ trunk/mapserver/maprendering.c	2011-03-18 18:14:18 UTC (rev 11252)
@@ -37,9 +37,10 @@
 void computeSymbolStyle(symbolStyleObj *s, styleObj *src, symbolObj *symbol, double scalefactor) {
    double default_size;
    double target_size;
+   double style_size;
 
    default_size = msSymbolGetDefaultSize(symbol);
-   target_size = (src->size==-1)?default_size:src->size;
+   style_size = (src->size==-1)?default_size:src->size;
 
    INIT_SYMBOL_STYLE(*s);
    if(symbol->type == MS_SYMBOL_PIXMAP) {
@@ -62,10 +63,11 @@
       s->backgroundcolor = &(src->backgroundcolor);
    }
 
-   target_size *= scalefactor;
+   target_size = style_size * scalefactor;
    target_size = MS_MAX(target_size, src->minsize);
    target_size = MS_MIN(target_size, src->maxsize);
    s->scale = target_size / default_size;
+   s->gap = src->gap * target_size / style_size;
 
    if(s->outlinecolor) {
       s->outlinewidth =  src->width * scalefactor;
@@ -443,10 +445,10 @@
             //compute a markerStyle and use it on the line
             if(style->gap<0) {
                //special function that treats any other symbol used as a marker, not a brush
-               msImagePolylineMarkers(image,p,symbol,&s,-style->gap,1);
+               msImagePolylineMarkers(image,p,symbol,&s,-s.gap,1);
             }
             else if(style->gap>0) {
-               msImagePolylineMarkers(image,p,symbol,&s,style->gap,0);
+               msImagePolylineMarkers(image,p,symbol,&s,s.gap,0);
             } else {
                //void* tile = getTile(image, symbolset, &s);
                //r->renderLineTiled(image, theShape, tile);
@@ -587,13 +589,12 @@
                if(ret != MS_SUCCESS) goto cleanup;
             }
 
-
             if(s.scale != 1) {
-               pw = MS_NINT(symbol->sizex * s.scale)+1+style->gap;
-               ph = MS_NINT(symbol->sizey * s.scale)+1+style->gap;
+               pw = MS_NINT(symbol->sizex * s.scale + s.gap)+1;
+               ph = MS_NINT(symbol->sizey * s.scale + s.gap)+1;
             } else {
-               pw = symbol->sizex + style->gap;
-               ph = symbol->sizey + style->gap;
+               pw = symbol->sizex + s.gap;
+               ph = symbol->sizey + s.gap;
             }
 
             /* if we're doing vector symbols with an antialiased pixel rendererer, we want to enable

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2011-03-18 18:13:41 UTC (rev 11251)
+++ trunk/mapserver/mapserver.h	2011-03-18 18:14:18 UTC (rev 11252)
@@ -2528,6 +2528,10 @@
     /* rotation to apply on the symbol (and the tile?)
      * in radians */
     double rotation;
+   
+    /* the gap to space symbols appart when used as a polygon tile
+     */
+    double gap;
 
     /* style object, necessary for vector type renderers to be able
      * to render symbols through other renders such as cairo/agg */



More information about the mapserver-commits mailing list