[mapserver-commits] r7826 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Jul 21 14:52:27 EDT 2008
Author: dmorissette
Date: 2008-07-21 14:52:26 -0400 (Mon, 21 Jul 2008)
New Revision: 7826
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapogr.cpp
Log:
Several enhancements to STYLEITEM AUTO support for labels in OGR layers
(#2708)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2008-07-17 21:14:10 UTC (rev 7825)
+++ trunk/mapserver/HISTORY.TXT 2008-07-21 18:52:26 UTC (rev 7826)
@@ -10,15 +10,20 @@
For a complete change history, please see the Subversion log comments.
Current Version (5.3-dev, SVN trunk):
-----------------------------
+------------------------------------
+- Several enhancements to STYLEITEM AUTO support for labels in OGR
+ layers (#2708)
+
+
Version 5.2.0 (2008-07-16):
---------------------------
-- mapfile.c: Fixed a bug that prevented using named symbols via URL configuration. (#2700)
+- mapfile.c: Fixed a bug that prevented using named symbols via URL
+ configuration. (#2700)
Version 5.2.0-rc1 (2008-07-09):
----------------------------------
+-------------------------------
- mapowscommon.c: fix support multiple namespaces (#2690)
@@ -78,7 +83,8 @@
- mapsde.c: Test for an active connection before closing it (#2498).
-- mapdraw.c: Fixed issue where path following labels were not being drawn if FORCEd. (#2600)
+- mapdraw.c: Fixed issue where path following labels were not being drawn
+ if FORCEd. (#2600)
- mapshape.c: Applied patch to make the location of tiled data relative to the
tileindex directory if SHAPEPATH is not set. (#2369)
Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp 2008-07-17 21:14:10 UTC (rev 7825)
+++ trunk/mapserver/mapogr.cpp 2008-07-21 18:52:26 UTC (rev 7826)
@@ -2212,29 +2212,70 @@
if (!bIsNull && OGR_ST_GetRGBFromString(hLabelStyle, pszColor,
&r, &g, &b, &t))
{
- MS_INIT_COLOR(c->label.color, r, g, b);
+ MS_INIT_COLOR(c->label.backgroundcolor, r, g, b);
}
+ pszColor = OGR_ST_GetParamStr(hLabelStyle,
+ OGRSTLabelHColor,
+ &bIsNull);
+ if (!bIsNull && OGR_ST_GetRGBFromString(hLabelStyle, pszColor,
+ &r, &g, &b, &t))
+ {
+ MS_INIT_COLOR(c->label.shadowcolor, r, g, b);
+ }
+
+#if GDAL_VERSION_NUM >= 1600
+ pszColor = OGR_ST_GetParamStr(hLabelStyle,
+ OGRSTLabelOColor,
+ &bIsNull);
+ if (!bIsNull && OGR_ST_GetRGBFromString(hLabelStyle, pszColor,
+ &r, &g, &b, &t))
+ {
+ MS_INIT_COLOR(c->label.outlinecolor, r, g, b);
+ }
+#endif /* GDAL_VERSION_NUM >= 1600 */
+
// Label font... do our best to use TrueType fonts, otherwise
// fallback on bitmap fonts.
#if defined(USE_GD_TTF) || defined (USE_GD_FT)
- const char *pszName = OGR_ST_GetParamStr(hLabelStyle,
- OGRSTLabelFontName,
- &bIsNull);
- if (pszName != NULL && !bIsNull && pszName[0] != '\0' &&
- msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL)
+ const char *pszBold = OGR_ST_GetParamNum(hLabelStyle,
+ OGRSTLabelBold,
+ &bIsNull) ? "-bold" : "";
+ const char *pszItalic = OGR_ST_GetParamNum(hLabelStyle,
+ OGRSTLabelItalic,
+ &bIsNull) ? "-italic" : "";
+ const char *pszFontName = OGR_ST_GetParamStr(hLabelStyle,
+ OGRSTLabelFontName,
+ &bIsNull);
+ const char *pszName = CPLSPrintf("%s%s%s", pszFontName, pszBold, pszItalic);
+ bool bFont = true;
+
+ if (pszFontName != NULL && !bIsNull && pszFontName[0] != '\0')
{
- c->label.type = MS_TRUETYPE;
- c->label.font = strdup(pszName);
- // msDebug("** Using '%s' TTF font **\n", pszName);
+ if (msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup(pszName);
+ // msDebug("** Using '%s' TTF font **\n", pszName);
+ }
+ else if ( (strcmp(pszFontName,pszName) != 0) &&
+ msLookupHashTable(&(map->fontset.fonts), (char*)pszFontName) != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup(pszFontName);
+ // msDebug("** Using '%s' TTF font **\n", pszFontName);
+ }
+ else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup("default");
+ // msDebug("** Using 'default' TTF font **\n");
+ }
+ else
+ bFont = false;
}
- else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL)
- {
- c->label.type = MS_TRUETYPE;
- c->label.font = strdup("default");
- // msDebug("** Using 'default' TTF font **\n");
- }
- else
+
+ if (!bFont)
#endif /* USE_GD_FT || USE_GD_FT */
{
c->label.type = MS_BITMAP;
@@ -2270,27 +2311,50 @@
pszColor = poLabelStyle->BackColor(bIsNull);
if (!bIsNull && poLabelStyle->GetRGBFromString(pszColor,r,g,b,t))
{
- MS_INIT_COLOR(c->label.color, r, g, b);
+ MS_INIT_COLOR(c->label.backgroundcolor, r, g, b);
}
+ pszColor = poLabelStyle->ShadowColor(bIsNull);
+ if (!bIsNull && poLabelStyle->GetRGBFromString(pszColor,r,g,b,t))
+ {
+ MS_INIT_COLOR(c->label.shadowcolor, r, g, b);
+ }
+
// Label font... do our best to use TrueType fonts, otherwise
// fallback on bitmap fonts.
#if defined(USE_GD_TTF) || defined (USE_GD_FT)
- const char *pszName = poLabelStyle->FontName(bIsNull);
- if (pszName != NULL && !bIsNull && pszName[0] != '\0' &&
- msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL)
+ const char *pszBold = poLabelStyle->Bold(bIsNull) ? "-bold" : "";
+ const char *pszItalic = poLabelStyle->Italic(bIsNull) ? "-italic" : "";
+ const char *pszFontName = poLabelStyle->FontName(bIsNull);
+ const char *pszName = CPLSPrintf("%s%s%s", pszFontName, pszBold, pszItalic);
+ bool bFont = true;
+
+ if (pszFontName != NULL && !bIsNull && pszFontName[0] != '\0')
{
- c->label.type = MS_TRUETYPE;
- c->label.font = strdup(pszName);
- // msDebug("** Using '%s' TTF font **\n", pszName);
+ if (msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup(pszName);
+ // msDebug("** Using '%s' TTF font **\n", pszName);
+ }
+ else if ( (strcmp(pszFontName,pszName) != 0) &&
+ msLookupHashTable(&(map->fontset.fonts), (char*)pszFontName) != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup(pszFontName);
+ // msDebug("** Using '%s' TTF font **\n", pszFontName);
+ }
+ else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL)
+ {
+ c->label.type = MS_TRUETYPE;
+ c->label.font = strdup("default");
+ // msDebug("** Using 'default' TTF font **\n");
+ }
+ else
+ bFont = false;
}
- else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL)
- {
- c->label.type = MS_TRUETYPE;
- c->label.font = strdup("default");
- // msDebug("** Using 'default' TTF font **\n");
- }
- else
+
+ if (!bFont)
#endif /* USE_GD_FT || USE_GD_FT */
{
c->label.type = MS_BITMAP;
More information about the mapserver-commits
mailing list