[mapserver-commits] r9454 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Oct 13 16:57:56 EDT 2009


Author: aboudreault
Date: 2009-10-13 16:57:54 -0400 (Tue, 13 Oct 2009)
New Revision: 9454

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapgd.c
   trunk/mapserver/maplabel.c
Log:
Added resolution scaling of some properties for GD driver (#3157)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-10-13 20:06:23 UTC (rev 9453)
+++ trunk/mapserver/HISTORY.TXT	2009-10-13 20:57:54 UTC (rev 9454)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Added resolution scaling of some properties for GD driver (#3157)
+
 - Modified GD functions API to be consistent with all others drivers (#3157)
 
 - OGC Filter: strip all namespaces (not only ogc, gml) (#1350)

Modified: trunk/mapserver/mapgd.c
===================================================================
--- trunk/mapserver/mapgd.c	2009-10-13 20:06:23 UTC (rev 9453)
+++ trunk/mapserver/mapgd.c	2009-10-13 20:57:54 UTC (rev 9454)
@@ -72,8 +72,8 @@
         size = MS_NINT(size*scalefactor);
     } else
       size = MS_NINT(style->size*scalefactor);
-    size = MS_MAX(size, style->minsize);
-    size = MS_MIN(size, style->maxsize);
+    size = MS_MAX(size, style->minsize*img->resolutionfactor);
+    size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
     gap = MS_ABS(symbol->gap)* (int) scalefactor;  
 
@@ -602,12 +602,12 @@
     size = style->size;
 
   size = MS_NINT(size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
   gdImageSetThickness(hatch, width);
 
   /* normalize the angle (180 to 0, 0 is east, 90 is north 180 is west) */
@@ -1074,12 +1074,12 @@
     size = style->size;
 
   size = MS_NINT(size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
 
   if(style->symbol >= symbolset->numsymbols || style->symbol < 0) return; /* no such symbol, 0 is OK */
   if(fc < 0) return; /* nothing to do */
@@ -1286,12 +1286,12 @@
     size = MS_NINT(size*scalefactor);
   } else
     size = MS_NINT(style->size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
 
   angle = (style->angle) ? style->angle : 0.0;
   angle_radians = angle*MS_DEG_TO_RAD;
@@ -1506,12 +1506,12 @@
     size = MS_NINT(size*scalefactor);
   } else
     size = MS_NINT(style->size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
 
   angle = (style->angle) ? style->angle : 0.0;
   angle_radians = angle*MS_DEG_TO_RAD;
@@ -1746,16 +1746,16 @@
     size = style->size;
 
   /* TODO: Don't get this modification, is it needed elsewhere? */
-  /* if(size*scalefactor > style->maxsize) scalefactor = (float)style->maxsize/(float)size; */
-  /* if(size*scalefactor < style->minsize) scalefactor = (float)style->minsize/(float)size; */
+  /* if(size*scalefactor > style->maxsize*img->resolutionfactor) scalefactor = (float)style->maxsize/(float)size; */
+  /* if(size*scalefactor < style->minsize*img->resolutionfactor) scalefactor = (float)style->minsize/(float)size; */
   
   size = MS_NINT(size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
 
   angle = (style->angle) ? style->angle : 0.0;
 
@@ -1942,7 +1942,7 @@
     /* and scale the pattern */
     int n=0;
     for(i=0; i<symbol->patternlength; i++) {
-      symbol_pattern[i] = symbol->pattern[i];
+      symbol_pattern[i] = symbol->pattern[i]*img->resolutionfactor;
       n += symbol_pattern[i];
     }
     style = (int *) malloc (n * sizeof(int));
@@ -2027,12 +2027,12 @@
       size = MS_NINT(size*scalefactor);
   } else
       size = MS_NINT(style->size*scalefactor);
-  size = MS_MAX(size, style->minsize);
-  size = MS_MIN(size, style->maxsize);
+  size = MS_MAX(size, style->minsize*img->resolutionfactor);
+  size = MS_MIN(size, style->maxsize*img->resolutionfactor);
 
   width = MS_NINT(style->width*scalefactor);
-  width = MS_MAX(width, style->minwidth);
-  width = MS_MIN(width, style->maxwidth);
+  width = MS_MAX(width, style->minwidth*img->resolutionfactor);
+  width = MS_MIN(width, style->maxwidth*img->resolutionfactor);
 
   angle = (style->angle) ? style->angle : 0.0;
   angle_radians = angle*MS_DEG_TO_RAD;
@@ -2874,8 +2874,8 @@
   if(label->outlinecolor.pen == MS_PEN_UNSET) msImageSetPenGD(img->img.gd, &(label->outlinecolor));
   if(label->shadowcolor.pen == MS_PEN_UNSET) msImageSetPenGD(img->img.gd, &(label->shadowcolor));
 
-  shadowsizex = label->shadowsizex;
-  shadowsizey = label->shadowsizey;
+  shadowsizex = label->shadowsizex*img->resolutionfactor;
+  shadowsizey = label->shadowsizey*img->resolutionfactor;
 
   if(label->type == MS_TRUETYPE) {
     char *error=NULL, *font=NULL;
@@ -2884,8 +2884,8 @@
     double size;
 
     size = label->size*scalefactor;
-    size = MS_MAX(size, label->minsize);
-    size = MS_MIN(size, label->maxsize);
+    size = MS_MAX(size, label->minsize*img->resolutionfactor);
+    size = MS_MIN(size, label->maxsize*img->resolutionfactor);
 
 #ifdef USE_GD_FT
     if(!fontset) {
@@ -3006,10 +3006,10 @@
     char s[11]; /* UTF-8 characters can be up to 6 bytes wide, html entities 10 */
 
     size = label->size*scalefactor;
-    size = MS_MAX(size, label->minsize);
-    size = MS_MIN(size, label->maxsize);
-    shadowsizex = label->shadowsizex;
-    shadowsizey = label->shadowsizey;
+    size = MS_MAX(size, label->minsize*img->resolutionfactor);
+    size = MS_MIN(size, label->maxsize*img->resolutionfactor);
+    shadowsizex = label->shadowsizex*img->resolutionfactor;
+    shadowsizey = label->shadowsizey*img->resolutionfactor;
 
 #ifdef USE_GD_FT
     if(!fontset) {

Modified: trunk/mapserver/maplabel.c
===================================================================
--- trunk/mapserver/maplabel.c	2009-10-13 20:06:23 UTC (rev 9453)
+++ trunk/mapserver/maplabel.c	2009-10-13 20:57:54 UTC (rev 9454)
@@ -1082,8 +1082,8 @@
   }
   else
       size = style->size;
-  if(size*scalefactor > style->maxsize) scalefactor = (float)style->maxsize/(float)size;
-  if(size*scalefactor < style->minsize) scalefactor = (float)style->minsize/(float)size;
+  if(size*scalefactor > style->maxsize*img->resolutionfactor) scalefactor = (float)style->maxsize/(float)size;
+  if(size*scalefactor < style->minsize*img->resolutionfactor) scalefactor = (float)style->minsize/(float)size;
   gap = MS_ABS(symbol->gap)* (int) scalefactor;
   label.size = size ;/* "* scalefactor" removed: this is already scaled in msDrawTextGD()*/
   /* label.minsize = style->minsize; */



More information about the mapserver-commits mailing list