[mapserver-commits] r8482 - in trunk/mapserver: . mapscript/php3
svn at osgeo.org
svn at osgeo.org
Thu Jan 29 18:34:30 EST 2009
Author: tamas
Date: 2009-01-29 18:34:29 -0500 (Thu, 29 Jan 2009)
New Revision: 8482
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapagg.cpp
trunk/mapserver/mapfile.c
trunk/mapserver/mapgd.c
trunk/mapserver/mapimagemap.c
trunk/mapserver/maplabel.c
trunk/mapserver/mapogr.cpp
trunk/mapserver/mappdf.c
trunk/mapserver/mapscale.c
trunk/mapserver/mapscript/php3/php_mapscript.c
trunk/mapserver/mapserver.h
trunk/mapserver/maputil.c
Log:
Changed base type of labelObj size, minsize and maxsize from int to double (#2766)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/HISTORY.TXT 2009-01-29 23:34:29 UTC (rev 8482)
@@ -12,6 +12,8 @@
Current Version (5.3-dev, SVN trunk):
------------------------------------
+- Changed base type of labelObj size, minsize and maxsize from int to double (#2766)
+
- add support for WMS Server title in LAYER object (#885)
- Fixed build problem using --with-gd=static and freetype (#2697)
Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapagg.cpp 2009-01-29 23:34:29 UTC (rev 8482)
@@ -1499,7 +1499,7 @@
if(size*scalefactor > style->maxsize) scalefactor = (float)style->maxsize/(float)size;
if(size*scalefactor < style->minsize) scalefactor = (float)style->minsize/(float)size;
gap = MS_ABS(symbol->gap)* (int) scalefactor;
- label.size = (int) (size * scalefactor);
+ label.size = (size * scalefactor);
// label.minsize = style->minsize;
// label.maxsize = style->maxsize;
@@ -2014,19 +2014,19 @@
/*adjust top line*/
int n=msCountChars(string,'\n');
glyph_gen glyph(0);
- glyph.font(rasterfonts[label->size]);
+ glyph.font(rasterfonts[MS_NINT(label->size)]);
y -= glyph.height()*(n);
ren->renderRasterGlyphs(x,y,
agg_color,
agg_ocolor,
- label->size,
+ MS_NINT(label->size),
string);
return 0;
}
}
-int msGetTruetypeTextBBoxAGG(imageObj *img, char *font, int size, char *string, rectObj *rect, double **advances) {
+int msGetTruetypeTextBBoxAGG(imageObj *img, char *font, double size, char *string, rectObj *rect, double **advances) {
AGGMapserverRenderer* ren = getAGGRenderer(img);
return ren->getLabelSize(string, font, size, rect,advances);
}
Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapfile.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -1328,7 +1328,7 @@
case(LABEL):
break; /* for string loads */
case(MAXSIZE):
- if(getInteger(&(label->maxsize)) == -1) return(-1);
+ if(getDouble(&(label->maxsize)) == -1) return(-1);
break;
case(MAXSCALEDENOM):
if(getDouble(&(label->maxscaledenom)) == -1) return(-1);
@@ -1355,7 +1355,7 @@
if(getDouble(&(label->minscaledenom)) == -1) return(-1);
break;
case(MINSIZE):
- if(getInteger(&(label->minsize)) == -1) return(-1);
+ if(getDouble(&(label->minsize)) == -1) return(-1);
break;
case(OFFSET):
if(getInteger(&(label->offsetx)) == -1) return(-1);
@@ -1403,7 +1403,7 @@
return(-1);
if(symbol == MS_NUMBER) {
- label->size = (int) msyynumber;
+ label->size = (double) msyynumber;
} else if(symbol == MS_BINDING) {
label->bindings[MS_LABEL_BINDING_SIZE].item = strdup(msyytext);
label->numbindings++;
@@ -1460,7 +1460,7 @@
fprintf(stream, "%sLABEL\n", tab);
if(label->type == MS_BITMAP) {
- fprintf(stream, " %sSIZE %s\n", tab, msBitmapFontSizes[label->size]);
+ fprintf(stream, " %sSIZE %s\n", tab, msBitmapFontSizes[MS_NINT(label->size)]);
fprintf(stream, " %sTYPE BITMAP\n", tab);
} else {
if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_ANGLE].item)
@@ -1477,12 +1477,12 @@
if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_FONT].item)
fprintf(stream, " %sFONT [%s]\n", tab, label->bindings[MS_LABEL_BINDING_FONT].item);
else fprintf(stream, " %sFONT \"%s\"\n", tab, label->font);
- fprintf(stream, " %sMAXSIZE %d\n", tab, label->maxsize);
- fprintf(stream, " %sMINSIZE %d\n", tab, label->minsize);
+ fprintf(stream, " %sMAXSIZE %g\n", tab, label->maxsize);
+ fprintf(stream, " %sMINSIZE %g\n", tab, label->minsize);
if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_SIZE].item)
fprintf(stream, " %sSIZE [%s]\n", tab, label->bindings[MS_LABEL_BINDING_SIZE].item);
- else fprintf(stream, " %sSIZE %d\n", tab, label->size);
+ else fprintf(stream, " %sSIZE %g\n", tab, label->size);
fprintf(stream, " %sTYPE TRUETYPE\n", tab);
}
Modified: trunk/mapserver/mapgd.c
===================================================================
--- trunk/mapserver/mapgd.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapgd.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -3007,7 +3007,7 @@
int t, num_tokens;
gdFontPtr fontPtr;
- if((fontPtr = msGetBitmapFont(label->size)) == NULL)
+ if((fontPtr = msGetBitmapFont(MS_NINT(label->size))) == NULL)
return(-1);
if((token = msStringSplit(string, '\n', &(num_tokens))) == NULL)
Modified: trunk/mapserver/mapimagemap.c
===================================================================
--- trunk/mapserver/mapimagemap.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapimagemap.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -1848,7 +1848,7 @@
continue; /* not an error, just don't want to do anything */
if(cachePtr->label.type == MS_TRUETYPE)
- cachePtr->label.size = (int)(cachePtr->label.size*layerPtr->scalefactor);
+ cachePtr->label.size = (cachePtr->label.size*layerPtr->scalefactor);
if(msGetLabelSize(img,cachePtr->text, labelPtr, &r, &(map->fontset), layerPtr->scalefactor, MS_TRUE,NULL) == -1)
return(-1);
Modified: trunk/mapserver/maplabel.c
===================================================================
--- trunk/mapserver/maplabel.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/maplabel.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -182,7 +182,7 @@
* space character shouldn't vary too much between different fonts*/
if(label->space_size_10 == 0.0) {
/*if the cache hasn't been initialized yet, or with pixmap fonts*/
- int size=0; /*initialize this here to avoid compiler warning*/
+ double size=0; /*initialize this here to avoid compiler warning*/
if(label->type == MS_TRUETYPE) {
size = label->size; /*keep a copy of the original size*/
label->size=10;
@@ -648,7 +648,7 @@
#endif
}
-int msGetTruetypeTextBBox(imageObj *img, char *font, int size, char *string, rectObj *rect, double **advances) {
+int msGetTruetypeTextBBox(imageObj *img, char *font, double size, char *string, rectObj *rect, double **advances) {
#ifdef USE_GD_FT
#ifdef USE_AGG
if(img!=NULL && MS_RENDERER_AGG(img->format)) {
@@ -750,12 +750,12 @@
/* assumes an angle of 0 regardless of what's in the label object */
int msGetLabelSize(imageObj *img, char *string, labelObj *label, rectObj *rect, fontSetObj *fontset, double scalefactor, int adjustBaseline, double **advances)
{
- int size;
+ double size;
if(label->type == MS_TRUETYPE) {
#ifdef USE_GD_FT
char *font=NULL;
- size = MS_NINT(label->size*scalefactor);
+ size = label->size*scalefactor;
size = MS_MAX(size, label->minsize);
size = MS_MIN(size, label->maxsize);
@@ -793,7 +793,7 @@
return(-1);
#endif
} else { /* MS_BITMAP font */
- msGetRasterTextBBox(img,label->size,string,rect);
+ msGetRasterTextBBox(img,MS_NINT(label->size),string,rect);
}
return(0);
}
@@ -1056,7 +1056,7 @@
if(size*scalefactor > style->maxsize) scalefactor = (float)style->maxsize/(float)size;
if(size*scalefactor < style->minsize) scalefactor = (float)style->minsize/(float)size;
gap = MS_ABS(symbol->gap)* (int) scalefactor;
- label.size = (int) (size * scalefactor);
+ label.size = (size * scalefactor);
/* label.minsize = style->minsize; */
/* label.maxsize = style->maxsize; */
Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapogr.cpp 2009-01-29 23:34:29 UTC (rev 8482)
@@ -2255,7 +2255,7 @@
c->label.angle = OGR_ST_GetParamDbl(hLabelStyle,
OGRSTLabelAngle, &bIsNull);
- c->label.size = OGR_ST_GetParamNum(hLabelStyle,
+ c->label.size = OGR_ST_GetParamDbl(hLabelStyle,
OGRSTLabelSize, &bIsNull);
if( c->label.size < 1 ) /* no point dropping to zero size */
c->label.size = 1;
Modified: trunk/mapserver/mappdf.c
===================================================================
--- trunk/mapserver/mappdf.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mappdf.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -1206,7 +1206,7 @@
{
int x, y, x1, y1;
int font = 0;
- int size;
+ double size;
float phi = label->angle;
colorObj sColor;
char *wrappedString;
Modified: trunk/mapserver/mapscale.c
===================================================================
--- trunk/mapserver/mapscale.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapscale.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -220,7 +220,7 @@
#endif
}
else
- fontPtr = msGetBitmapFont(map->scalebar.label.size);
+ fontPtr = msGetBitmapFont(MS_NINT(map->scalebar.label.size));
if(!fontPtr) return(NULL);
Modified: trunk/mapserver/mapscript/php3/php_mapscript.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapscript/php3/php_mapscript.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -8873,9 +8873,9 @@
plabel->backgroundshadowsizex);
add_property_long(return_value, "backgroundshadowsizey",
plabel->backgroundshadowsizey);
- add_property_long(return_value, "size", plabel->size);
- add_property_long(return_value, "minsize", plabel->minsize);
- add_property_long(return_value, "maxsize", plabel->maxsize);
+ add_property_double(return_value, "size", plabel->size);
+ add_property_double(return_value, "minsize", plabel->minsize);
+ add_property_double(return_value, "maxsize", plabel->maxsize);
add_property_long(return_value, "position", plabel->position);
add_property_long(return_value, "offsetx", plabel->offsetx);
add_property_long(return_value, "offsety", plabel->offsety);
@@ -9003,9 +9003,9 @@
else IF_SET_LONG( "shadowsizey", self->shadowsizey)
else IF_SET_LONG( "backgroundshadowsizex", self->backgroundshadowsizex)
else IF_SET_LONG( "backgroundshadowsizey", self->backgroundshadowsizey)
- else IF_SET_LONG( "size", self->size)
- else IF_SET_LONG( "minsize", self->minsize)
- else IF_SET_LONG( "maxsize", self->maxsize)
+ else IF_SET_DOUBLE( "size", self->size)
+ else IF_SET_DOUBLE( "minsize", self->minsize)
+ else IF_SET_DOUBLE( "maxsize", self->maxsize)
else IF_SET_LONG( "position", self->position)
else IF_SET_LONG( "offsetx", self->offsetx)
else IF_SET_LONG( "offsety", self->offsety)
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/mapserver.h 2009-01-29 23:34:29 UTC (rev 8482)
@@ -592,8 +592,8 @@
colorObj backgroundshadowcolor;
int backgroundshadowsizex, backgroundshadowsizey;
- int size;
- int minsize, maxsize;
+ double size;
+ double minsize, maxsize;
int position;
int offsetx, offsety;
@@ -1967,7 +1967,7 @@
MS_DLL_EXPORT void msDrawMarkerSymbolAGG(symbolSetObj *symbolset, imageObj *image, pointObj *p, styleObj *style, double scalefactor);
MS_DLL_EXPORT void msDrawLineSymbolAGG(symbolSetObj *symbolset, imageObj *image, shapeObj *p, styleObj *style, double scalefactor);
MS_DLL_EXPORT void msDrawShadeSymbolAGG(symbolSetObj *symbolset, imageObj *image,shapeObj *p, styleObj *style, double scalefactor);
-int msGetTruetypeTextBBoxAGG(imageObj *img, char *font, int size, char *string, rectObj *rect, double **advances);
+int msGetTruetypeTextBBoxAGG(imageObj *img, char *font, double size, char *string, rectObj *rect, double **advances);
int msGetRasterTextBBoxAGG(imageObj *img, int size, char *string, rectObj *rect);
MS_DLL_EXPORT int msDrawTextAGG(imageObj *imgage, pointObj labelPnt, char *string, labelObj *label, fontSetObj *fontset, double scalefactor);
MS_DLL_EXPORT int msDrawTextLineAGG(imageObj *image, char *string, labelObj *label, labelPathObj *labelpath, fontSetObj *fontset, double scalefactor);
Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c 2009-01-29 20:20:50 UTC (rev 8481)
+++ trunk/mapserver/maputil.c 2009-01-29 23:34:29 UTC (rev 8482)
@@ -178,7 +178,7 @@
if(label->bindings[MS_LABEL_BINDING_SIZE].index != -1) {
label->size = 1;
- bindIntegerAttribute(&label->size, shape->values[label->bindings[MS_LABEL_BINDING_SIZE].index]);
+ bindDoubleAttribute(&label->size, shape->values[label->bindings[MS_LABEL_BINDING_SIZE].index]);
}
if(label->bindings[MS_LABEL_BINDING_COLOR].index != -1) {
More information about the mapserver-commits
mailing list