[mapserver-commits] r7919 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Sep 22 17:24:18 EDT 2008


Author: sdlime
Date: 2008-09-22 17:24:18 -0400 (Mon, 22 Sep 2008)
New Revision: 7919

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapagg.cpp
   trunk/mapserver/mapfile.c
   trunk/mapserver/mapogcsld.c
   trunk/mapserver/mapserver.h
   trunk/mapserver/maputil.c
Log:
Changed base type for styleObj size and width from int to double. (#2766)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/HISTORY.TXT	2008-09-22 21:24:18 UTC (rev 7919)
@@ -12,6 +12,8 @@
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
 
+- Changed base type of styleObj size and width from int to double (#2766)
+
 - Correct allocation error in mapmssql2008.c
 
 - Add possibility  to use a full resolution setting for svg output (#1706)

Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/mapagg.cpp	2008-09-22 21:24:18 UTC (rev 7919)
@@ -1240,7 +1240,7 @@
         x = p->x + ox - bounds.minx - (bounds.maxx-bounds.minx)/2.;
         y = p->y + oy - bounds.maxy + (bounds.maxy-bounds.miny)/2.;
         ren->renderGlyphs(x,y,agg_color,agg_ocolor,
-                size,font,symbol->character,angle_radians,AGG_NO_COLOR,0,0,style->width);
+                size,font,symbol->character,angle_radians,AGG_NO_COLOR,0,0,MS_NINT(style->width));
     }
     break;    
     case(MS_SYMBOL_PIXMAP): {
@@ -1538,7 +1538,7 @@
         label_point = get_metrics(&point, position, label_rect, 0, 0, label.angle, 0, NULL);
         ren->renderGlyphs(label_point.x,label_point.y,agg_color,agg_ocolor,label.size,
                           font,symbol->character,label.angle*MS_DEG_TO_RAD,
-                          AGG_NO_COLOR,0,0,style->width);
+                          AGG_NO_COLOR,0,0,MS_NINT(style->width));
         current_length += label_width + gap;
         in = 1;
       }
@@ -1566,10 +1566,12 @@
 
     if(p->numlines==0)
         return;
+
     if(style->size == -1)
         size = msSymbolGetDefaultSize(symbolset->symbol[style->symbol]);
     else
         size = style->size;
+
     size = (size*scalefactor);
     size = MS_MAX(size, style->minsize);
     size = MS_MIN(size, style->maxsize);
@@ -1688,7 +1690,7 @@
             //with a thick line. as we're stroking a line with the vector
             //brush, we don't want to add a white space horizontally to avoid gaps, but we
             //do add some space vertically so the thick lines of the vector symbol appear.
-            ph+=style->width;
+            ph+=MS_NINT(style->width);
             path.transform(agg::trans_affine_translation(0,((double)style->width)/2.0));
             
             if(symbol->filled) {

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/mapfile.c	2008-09-22 21:24:18 UTC (rev 7919)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id$
+ * $id: mapfile.c 7854 2008-08-14 19:22:48Z dmorissette $
  *
  * Project:  MapServer
  * Purpose:  High level Map file parsing code.
@@ -1828,16 +1828,16 @@
       return(MS_SUCCESS); /* done */
       break;
     case(MAXSIZE):
-      if(getInteger(&(style->maxsize)) == -1) return(MS_FAILURE);      
+      if(getDouble(&(style->maxsize)) == -1) return(MS_FAILURE);      
       break;
     case(MINSIZE):
-      if(getInteger(&(style->minsize)) == -1) return(MS_FAILURE);
+      if(getDouble(&(style->minsize)) == -1) return(MS_FAILURE);
       break;
     case(MAXWIDTH):
-      if(getInteger(&(style->maxwidth)) == -1) return(MS_FAILURE);
+      if(getDouble(&(style->maxwidth)) == -1) return(MS_FAILURE);
       break;
     case(MINWIDTH):
-      if(getInteger(&(style->minwidth)) == -1) return(MS_FAILURE);
+      if(getDouble(&(style->minwidth)) == -1) return(MS_FAILURE);
       break;
     case(OFFSET):
       if(getInteger(&(style->offsetx)) == -1) return(MS_FAILURE);
@@ -1854,9 +1854,9 @@
       if((symbol = getSymbol(2, MS_NUMBER,MS_BINDING)) == -1) return(MS_FAILURE);
 
       if(symbol == MS_NUMBER)
-        style->size = (int) msyynumber;
+        style->size = (double) msyynumber;
       else {
-	style->bindings[MS_STYLE_BINDING_SIZE].item = strdup(msyytext);
+ 	      style->bindings[MS_STYLE_BINDING_SIZE].item = strdup(msyytext);
         style->numbindings++;
       }
       break;
@@ -1874,9 +1874,9 @@
       }
       break;
     case(WIDTH):
-      if(getInteger(&(style->width)) == -1) return(MS_FAILURE);
-      if(style->width < 1) {
-        msSetError(MS_MISCERR, "Invalid WIDTH, must an integer greater or equal to 1." , "loadStyle()");
+      if(getDouble(&(style->width)) == -1) return(MS_FAILURE);
+      if(!(style->width > 0)) {
+        msSetError(MS_MISCERR, "Invalid WIDTH, must be greater than 0." , "loadStyle()");
         return(MS_FAILURE);
       }
       break;
@@ -1948,10 +1948,10 @@
       fprintf(stream, "        COLOR [%s]\n", style->bindings[MS_STYLE_BINDING_COLOR].item);
   else writeColor(&(style->color), stream, "COLOR", "        ");
     
-  if(style->maxsize != MS_MAXSYMBOLSIZE) fprintf(stream, "        MAXSIZE %d\n", style->maxsize);
-  if(style->minsize != MS_MINSYMBOLSIZE) fprintf(stream, "        MINSIZE %d\n", style->minsize);
-  if(style->maxwidth != MS_MAXSYMBOLWIDTH) fprintf(stream, "        MAXWIDTH %d\n", style->maxwidth);
-  if(style->minwidth != MS_MINSYMBOLWIDTH) fprintf(stream, "        MINWIDTH %d\n", style->minwidth);  
+  if(style->maxsize != MS_MAXSYMBOLSIZE) fprintf(stream, "        MAXSIZE %g\n", style->maxsize);
+  if(style->minsize != MS_MINSYMBOLSIZE) fprintf(stream, "        MINSIZE %g\n", style->minsize);
+  if(style->maxwidth != MS_MAXSYMBOLWIDTH) fprintf(stream, "        MAXWIDTH %g\n", style->maxwidth);
+  if(style->minwidth != MS_MINSYMBOLWIDTH) fprintf(stream, "        MINWIDTH %g\n", style->minwidth);  
   if(style->opacity > 0) fprintf(stream, "        OPACITY %d\n", style->opacity);
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].item)
@@ -1960,7 +1960,7 @@
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_SIZE].item)
       fprintf(stream, "        SIZE [%s]\n", style->bindings[MS_STYLE_BINDING_SIZE].item);
-  else if(style->size > 0) fprintf(stream, "        SIZE %d\n", style->size);
+  else if(style->size > 0) fprintf(stream, "        SIZE %g\n", style->size);
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_SYMBOL].item)
      fprintf(stream, "        SYMBOL [%s]\n", style->bindings[MS_STYLE_BINDING_SYMBOL].item);
@@ -1971,7 +1971,7 @@
     else
       fprintf(stream, "        SYMBOL %d\n", style->symbol);
   }
-  if(style->width > 1) fprintf(stream, "        WIDTH %d\n", style->width);
+  if(style->width > 1) fprintf(stream, "        WIDTH %g\n", style->width);
   if (style->offsetx != 0 || style->offsety != 0)  fprintf(stream, "        OFFSET %d %d\n", style->offsetx, style->offsety);
 
   if(style->rangeitem) {
@@ -2268,11 +2268,11 @@
 #endif
     case(MAXSIZE):
       if (msMaybeAllocateStyle(class, 0)) return MS_FAILURE;
-      if(getInteger(&(class->styles[0]->maxsize)) == -1) return(-1);
+      if(getDouble(&(class->styles[0]->maxsize)) == -1) return(-1);
       break;
     case(MINSIZE):      
       if (msMaybeAllocateStyle(class, 0)) return MS_FAILURE;
-      if(getInteger(&(class->styles[0]->minsize)) == -1) return(-1);
+      if(getDouble(&(class->styles[0]->minsize)) == -1) return(-1);
       break;
     case(OUTLINECOLOR):            
       if (msMaybeAllocateStyle(class, 0)) return MS_FAILURE;
@@ -2281,7 +2281,7 @@
       break;
     case(SIZE):
       if (msMaybeAllocateStyle(class, 0)) return MS_FAILURE;
-      if(getInteger(&(class->styles[0]->size)) == -1) return(-1);
+      if(getDouble(&(class->styles[0]->size)) == -1) return(-1);
       break;
     case(SYMBOL):
       if (msMaybeAllocateStyle(class, 0)) return MS_FAILURE;
@@ -2307,11 +2307,11 @@
       break;
     case(OVERLAYMAXSIZE):
       if (msMaybeAllocateStyle(class, 1)) return MS_FAILURE;
-      if(getInteger(&(class->styles[1]->maxsize)) == -1) return(-1);
+      if(getDouble(&(class->styles[1]->maxsize)) == -1) return(-1);
       break;
     case(OVERLAYMINSIZE):      
       if (msMaybeAllocateStyle(class, 1)) return MS_FAILURE;
-      if(getInteger(&(class->styles[1]->minsize)) == -1) return(-1);
+      if(getDouble(&(class->styles[1]->minsize)) == -1) return(-1);
       break;
     case(OVERLAYOUTLINECOLOR):      
       if (msMaybeAllocateStyle(class, 1)) return MS_FAILURE;
@@ -2320,7 +2320,7 @@
       break;
     case(OVERLAYSIZE):
       if (msMaybeAllocateStyle(class, 1)) return MS_FAILURE;
-      if(getInteger(&(class->styles[1]->size)) == -1) return(-1);
+      if(getDouble(&(class->styles[1]->size)) == -1) return(-1);
       break;
     case(OVERLAYSYMBOL):
       if (msMaybeAllocateStyle(class, 1)) return MS_FAILURE;

Modified: trunk/mapserver/mapogcsld.c
===================================================================
--- trunk/mapserver/mapogcsld.c	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/mapogcsld.c	2008-09-22 21:24:18 UTC (rev 7919)
@@ -3108,7 +3108,7 @@
                     
                         if (psStyle->size > 0)
                         {
-                            sprintf(szTmp, "<Size>%d</Size>\n", psStyle->size);
+                            sprintf(szTmp, "<Size>%g</Size>\n", psStyle->size);
                             pszSLD = msStringConcatenate(pszSLD, szTmp);
                         }
 
@@ -3171,7 +3171,7 @@
                         pszSLD = msStringConcatenate(pszSLD, szTmp);
 
                         if (psStyle->size > 0)
-                          sprintf(szTmp, "<Size>%d</Size>\n", psStyle->size);
+                          sprintf(szTmp, "<Size>%g</Size>\n", psStyle->size);
                         pszSLD = msStringConcatenate(pszSLD, szTmp);
 
                         sprintf(szTmp, "%s\n", "</Graphic>");
@@ -3242,7 +3242,7 @@
             pszSLD = msStringConcatenate(pszSLD, szTmp);
 
             if (psStyle->size > 0)
-              sprintf(szTmp, "<Size>%d</Size>\n", psStyle->size);
+              sprintf(szTmp, "<Size>%g</Size>\n", psStyle->size);
             else
               sprintf(szTmp, "<Size>%d</Size>\n", 1);
             pszSLD = msStringConcatenate(pszSLD, szTmp);

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/mapserver.h	2008-09-22 21:24:18 UTC (rev 7919)
@@ -186,10 +186,10 @@
 #define MS_ITEMNAMELEN 32
 #define MS_NAMELEN 20
 
-#define MS_MINSYMBOLSIZE 1   /* in pixels */
+#define MS_MINSYMBOLSIZE 0   /* in pixels */
 #define MS_MAXSYMBOLSIZE 500
 
-#define MS_MINSYMBOLWIDTH 1   /* in pixels */
+#define MS_MINSYMBOLWIDTH 0   /* in pixels */
 #define MS_MAXSYMBOLWIDTH 32
 
 #define MS_URL 0 /* template types */
@@ -700,11 +700,11 @@
   int symbol;
   char *symbolname;
 
-  int size;
-  int minsize, maxsize;
+  double size;
+  double minsize, maxsize;
 
-  int width;
-  int minwidth, maxwidth;
+  double width;
+  double minwidth, maxwidth;
 
   int offsetx, offsety; /* for shadows, hollow symbols, etc... */
 

Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c	2008-09-22 17:56:04 UTC (rev 7918)
+++ trunk/mapserver/maputil.c	2008-09-22 21:24:18 UTC (rev 7919)
@@ -147,7 +147,7 @@
 
         if(style->bindings[MS_STYLE_BINDING_SIZE].index != -1) {
           style->size = 1;
-          bindIntegerAttribute(&style->size, shape->values[style->bindings[MS_STYLE_BINDING_SIZE].index]);
+          bindDoubleAttribute(&style->size, shape->values[style->bindings[MS_STYLE_BINDING_SIZE].index]);
         }
 
         if(style->bindings[MS_STYLE_BINDING_COLOR].index != -1) {



More information about the mapserver-commits mailing list