[mapserver-commits] r9472 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Oct 16 14:17:06 EDT 2009
Author: aboudreault
Date: 2009-10-16 14:17:05 -0400 (Fri, 16 Oct 2009)
New Revision: 9472
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapdraw.c
trunk/mapserver/mapimagemap.c
trunk/mapserver/mappdf.c
trunk/mapserver/mapsvg.c
trunk/mapserver/mapswf.c
trunk/mapserver/maputil.c
Log:
Added resolution scaling for swf, svg, pdf and imagemap drivers (#3157)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/HISTORY.TXT 2009-10-16 18:17:05 UTC (rev 9472)
@@ -15,6 +15,8 @@
Current Version (SVN trunk):
----------------------------
+- Added resolution scaling for swf, svg, pdf and imagemap drivers (#3157)
+
- Correct cases where a valid WFS Layer might return errors if
map extent does not overlap the layer extent (#3139)
Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/mapdraw.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -2457,8 +2457,8 @@
label_offset_x = labelPtr->offsetx*scalefactor;
label_offset_y = labelPtr->offsety*scalefactor;
- label_buffer = labelPtr->buffer*image->resolutionfactor;
- label_mindistance = labelPtr->mindistance*image->resolutionfactor;
+ label_buffer = MS_NINT(labelPtr->buffer*image->resolutionfactor);
+ label_mindistance = MS_NINT(labelPtr->mindistance*image->resolutionfactor);
/* if cachePtr->featuresize is set to -1, this check has been done in msPolylineLabelPath() */
if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
Modified: trunk/mapserver/mapimagemap.c
===================================================================
--- trunk/mapserver/mapimagemap.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/mapimagemap.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -990,8 +990,8 @@
}
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);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) return; /* no such symbol, 0 is OK */
/* if(fc<0 && oc<0) return; // nothing to do */
@@ -1198,8 +1198,8 @@
}
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);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) return; /* no such symbol, 0 is OK */
if (suppressEmpty && p->numvalues==0) return;/* suppress area with empty title */
@@ -1411,8 +1411,8 @@
}
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);
/* DEBUG_IF printf ("a"); */
/* if(fc==-1 && oc!=-1) { // use msDrawLineSymbolIM() instead (POLYLINE) */
@@ -1862,10 +1862,10 @@
label_offset_x = labelPtr->offsetx*layerPtr->scalefactor;
label_offset_y = labelPtr->offsety*layerPtr->scalefactor;
- label_buffer = labelPtr->buffer*layerPtr->scalefactor;
- label_mindistance = labelPtr->mindistance*layerPtr->scalefactor;
+ label_buffer = MS_NINT(labelPtr->buffer*img->resolutionfactor);
+ label_mindistance = MS_NINT(labelPtr->mindistance*img->resolutionfactor);
- if(labelPtr->autominfeaturesize && ((r.maxx-r.minx) > cachePtr->featuresize))
+ if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
continue; /* label too large relative to the feature */
marker_offset_x = marker_offset_y = 0; /* assume no marker */
Modified: trunk/mapserver/mappdf.c
===================================================================
--- trunk/mapserver/mappdf.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/mappdf.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -159,6 +159,8 @@
oImage->height = height;
oImage->imagepath = NULL;
oImage->imageurl = NULL;
+ oImage->resolution = map->resolution;
+ oImage->resolutionfactor = map->resolution/map->defresolution;
if (imagepath)
{
@@ -288,7 +290,7 @@
/* scale the pattern */
for (i=0; i<s->patternlength; i++)
{
- symbol_pattern[i] = s->pattern[i]*scalefactor;
+ symbol_pattern[i] = MS_NINT(s->pattern[i]*scalefactor);
}
for(i=0;i<s->patternlength;i++) {
@@ -557,10 +559,10 @@
label_offset_x = labelPtr->offsetx*layerPtr->scalefactor;
label_offset_y = labelPtr->offsety*layerPtr->scalefactor;
- label_buffer = labelPtr->buffer*layerPtr->scalefactor;
- label_mindistance = labelPtr->mindistance*layerPtr->scalefactor;
+ label_buffer = MS_NINT(labelPtr->buffer*image->resolutionfactor);
+ label_mindistance = MS_NINT(labelPtr->mindistance*image->resolutionfactor);
- if(labelPtr->autominfeaturesize && ((r.maxx-r.minx) > cachePtr->featuresize))
+ if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
continue; /* label too large relative to the feature */
draw_marker = marker_offset_x = marker_offset_y = 0; /* assume no marker */
@@ -806,8 +808,8 @@
}
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*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->resolutionfactor);
/* no such symbol, 0 is OK */
if(style->symbol > symbolset->numsymbols || style->symbol < 0)
Modified: trunk/mapserver/mapsvg.c
===================================================================
--- trunk/mapserver/mapsvg.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/mapsvg.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -102,7 +102,9 @@
image->height = height;
image->imagepath = NULL;
image->imageurl = NULL;
-
+ image->resolution = map->resolution;
+ image->resolutionfactor = map->resolution/map->defresolution;
+
if (imagepath)
image->imagepath = strdup(imagepath);
@@ -542,15 +544,15 @@
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*image->resolutionfactor) scalefactor = (float)style->maxsize*image->resolutionfactor/(float)size;
+ if(size*scalefactor < style->minsize*image->resolutionfactor) scalefactor = (float)style->minsize*image->resolutionfactor/(float)size;
size = size*scalefactor;
- size = MS_MAX(size, style->minsize);
- size = MS_MIN(size, style->maxsize);
+ size = MS_MAX(size, style->minsize*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->resolutionfactor);
width = style->width*scalefactor;
- width = MS_MAX(width, style->minwidth);
- width = MS_MIN(width, style->maxwidth);
+ width = MS_MAX(width, style->minwidth*image->resolutionfactor);
+ width = MS_MIN(width, style->maxwidth*image->resolutionfactor);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) return; /* no such symbol, 0 is OK */
@@ -755,8 +757,8 @@
else
size = style->size*scalefactor;
- size = MS_MAX(size, style->minsize);
- size = MS_MIN(size, style->maxsize);
+ size = MS_MAX(size, style->minsize*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->resolutionfactor);
/* scale the symbol pattern */
if (symbol->patternlength > 0)
@@ -1073,8 +1075,8 @@
/* position, offset, angle, buffer, antialias, wrap, encoding */
size = label->size*scalefactor;
- size = MS_MAX(size, label->minsize);
- size = MS_MIN(size, label->maxsize);
+ size = MS_MAX(size, label->minsize*image->resolutionfactor);
+ size = MS_MIN(size, label->maxsize*image->resolutionfactor);
if(!fontset) {
msSetError(MS_TTFERR, "No fontset defined.", "msDrawTextSVG()");
@@ -1206,10 +1208,10 @@
label_offset_x = MS_NINT(labelPtr->offsetx*layerPtr->scalefactor);
label_offset_y = MS_NINT(labelPtr->offsety*layerPtr->scalefactor);
- label_buffer = MS_NINT(labelPtr->buffer*layerPtr->scalefactor);
- label_mindistance = MS_NINT(labelPtr->mindistance*layerPtr->scalefactor);
+ label_buffer = MS_NINT(labelPtr->buffer*image->resolutionfactor);
+ label_mindistance = MS_NINT(labelPtr->mindistance*image->resolutionfactor);
- if(labelPtr->autominfeaturesize && ((r.maxx-r.minx) > cachePtr->featuresize))
+ if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
continue; /* label too large relative to the feature */
marker_offset_x = marker_offset_y = 0; /* assume no marker */
@@ -1359,12 +1361,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*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->resolutionfactor);
width = style->width*scalefactor;
- width = MS_MAX(width, style->minwidth);
- width = MS_MIN(width, style->maxwidth);
+ width = MS_MAX(width, style->minwidth*image->resolutionfactor);
+ width = MS_MIN(width, style->maxwidth*image->resolutionfactor);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) return; /* no such symbol, 0 is OK */
Modified: trunk/mapserver/mapswf.c
===================================================================
--- trunk/mapserver/mapswf.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/mapswf.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -1062,6 +1062,7 @@
image->imagepath = NULL;
image->imageurl = NULL;
image->resolution = map->resolution;
+ image->resolutionfactor = map->resolution/map->defresolution;
if (imagepath)
{
@@ -1476,8 +1477,8 @@
}
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*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->resolutionfactor);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) /* no such symbol, 0 is OK */
@@ -1983,15 +1984,15 @@
size = MS_NINT(style->size*scalefactor);
/* 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*image->resolutionfactor) scalefactor = (float)style->maxsize*image->resolutionfactor/(float)size;
+ if(size*scalefactor < style->minsize*image->resolutionfactor) scalefactor = (float)style->minsize*image->resolutionfactor/(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*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->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*image->resolutionfactor);
+ width = MS_MIN(width, style->maxwidth*image->resolutionfactor);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) /* no such symbol, 0 is OK */
return;
@@ -2115,13 +2116,13 @@
}
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*image->resolutionfactor);
+ size = MS_MIN(size, style->maxsize*image->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*image->resolutionfactor);
+ width = MS_MIN(width, style->maxwidth*image->resolutionfactor);
if(style->symbol > symbolset->numsymbols || style->symbol < 0) /* no such symbol, 0 is OK */
return;
@@ -2304,8 +2305,8 @@
/* double angle_radians = MS_DEG_TO_RAD*label->angle; */
size = label->size*scalefactor;
- shadowsizex = label->shadowsizex*scalefactor;
- shadowsizey = label->shadowsizey*scalefactor;
+ shadowsizex = MS_NINT(label->shadowsizex*image->resolutionfactor);
+ shadowsizey = MS_NINT(label->shadowsizey*image->resolutionfactor);
if(!fontset)
{
@@ -2627,10 +2628,10 @@
label_offset_x = labelPtr->offsetx*layerPtr->scalefactor;
label_offset_y = labelPtr->offsety*layerPtr->scalefactor;
- label_buffer = labelPtr->buffer*layerPtr->scalefactor;
- label_mindistance = labelPtr->mindistance*layerPtr->scalefactor;
+ label_buffer = MS_NINT(labelPtr->buffer*image->resolutionfactor);
+ label_mindistance = MS_NINT(labelPtr->mindistance*image->resolutionfactor);
- if(labelPtr->autominfeaturesize && ((r.maxx-r.minx) > cachePtr->featuresize))
+ if(labelPtr->autominfeaturesize && (cachePtr->featuresize != -1) && ((r.maxx-r.minx) > cachePtr->featuresize))
continue; /* label too large relative to the feature */
draw_marker = marker_offset_x = marker_offset_y = 0; /* assume no marker */
Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c 2009-10-16 17:04:04 UTC (rev 9471)
+++ trunk/mapserver/maputil.c 2009-10-16 18:17:05 UTC (rev 9472)
@@ -1396,8 +1396,10 @@
image->height = height;
image->imagepath = NULL;
image->imageurl = NULL;
- image->tilecache = NULL;
- image->ntiles = 0;
+ image->tilecache = NULL;
+ image->ntiles = 0;
+ image->resolution = map->resolution;
+ image->resolutionfactor = map->resolution/map->defresolution;
if (imagepath)
image->imagepath = strdup(imagepath);
@@ -1455,6 +1457,7 @@
image->imagepath = NULL;
image->imageurl = NULL;
image->resolution = map->resolution;
+ image->resolutionfactor = map->resolution/map->defresolution;
if (imagepath)
image->imagepath = strdup(imagepath);
More information about the mapserver-commits
mailing list