[mapserver-commits] r7989 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Oct 20 13:27:55 EDT 2008


Author: aboudreault
Date: 2008-10-20 13:27:55 -0400 (Mon, 20 Oct 2008)
New Revision: 7989

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapogr.cpp
Log:
Fixed msOGRGetValues function return default values if the object type is not TEXT.(#2311)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-10-20 14:39:20 UTC (rev 7988)
+++ trunk/mapserver/HISTORY.TXT	2008-10-20 17:27:55 UTC (rev 7989)
@@ -12,6 +12,9 @@
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
 
+- Fixed msOGRGetValues function to return default values if the object 
+  type is not TEXT. (#2311)
+
 - Fix for the access violation caused by msMSSQL2008LayerGetShape (#2795)
 
 - Fixed msMSSQL2008LayerGetItems to retrieve the column names properly (#2791)

Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp	2008-10-20 14:39:20 UTC (rev 7988)
+++ trunk/mapserver/mapogr.cpp	2008-10-20 17:27:55 UTC (rev 7989)
@@ -565,33 +565,45 @@
                 OGR_ST_Destroy(hStylePart);
         }
         int bDefault;
-        if (hLabelStyle && itemindexes[i] == MSOGR_LABELTEXTINDEX)
+        if (itemindexes[i] == MSOGR_LABELTEXTINDEX)
         {
-            values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
+            if (hLabelStyle == NULL)
+                values[i] = strdup("");
+            else
+                values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
                                                   OGRSTLabelTextString, 
                                                   &bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELTEXTNAME " = \"%s\"\n", values[i]);
         }
-        else if (hLabelStyle && itemindexes[i] == MSOGR_LABELANGLEINDEX)
+        else if (itemindexes[i] == MSOGR_LABELANGLEINDEX)
         {
-            values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
+            if (hLabelStyle == NULL)
+                values[i] = strdup("0");
+            else
+                values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
                                                   OGRSTLabelAngle, 
                                                   &bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELANGLENAME " = \"%s\"\n", values[i]);
         }
-        else if (hLabelStyle && itemindexes[i] == MSOGR_LABELSIZEINDEX)
+        else if (itemindexes[i] == MSOGR_LABELSIZEINDEX)
         {
-            values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
+            if (hLabelStyle == NULL)
+                values[i] = strdup("0");
+            else
+                values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
                                                   OGRSTLabelSize, 
                                                   &bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELSIZENAME " = \"%s\"\n", values[i]);
         }
-        else if (hLabelStyle && itemindexes[i] == MSOGR_LABELCOLORINDEX)
+        else if (itemindexes[i] == MSOGR_LABELCOLORINDEX)
         {
-            values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
+            if (hLabelStyle == NULL)
+                values[i] = strdup("#000000");
+            else
+                values[i] = strdup(OGR_ST_GetParamStr(hLabelStyle, 
                                                   OGRSTLabelFColor, 
                                                   &bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
@@ -616,29 +628,41 @@
                 delete poStylePart;
         }
         GBool bDefault;
-        if (poLabelStyle && itemindexes[i] == MSOGR_LABELTEXTINDEX)
+        if (itemindexes[i] == MSOGR_LABELTEXTINDEX)
         {
-            values[i] = strdup(poLabelStyle->TextString(bDefault));
+            if (poLabelStyle == NULL)
+                values[i] = strdup("");
+            else
+                values[i] = strdup(poLabelStyle->TextString(bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELTEXTNAME " = \"%s\"\n", values[i]);
         }
-        else if (poLabelStyle && itemindexes[i] == MSOGR_LABELANGLEINDEX)
+        else if (itemindexes[i] == MSOGR_LABELANGLEINDEX)
         {
-            values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelAngle,
+            if (poLabelStyle == NULL)
+                values[i] = strdup("0");
+            else
+                values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelAngle,
                                                          bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELANGLENAME " = \"%s\"\n", values[i]);
         }
-        else if (poLabelStyle && itemindexes[i] == MSOGR_LABELSIZEINDEX)
+        else if (itemindexes[i] == MSOGR_LABELSIZEINDEX)
         {
-            values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelSize,
+            if (poLabelStyle == NULL)
+                values[i] = strdup("0");
+            else
+                values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelSize,
                                                          bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELSIZENAME " = \"%s\"\n", values[i]);
         }
-        else if (poLabelStyle && itemindexes[i] == MSOGR_LABELCOLORINDEX)
+        else if (itemindexes[i] == MSOGR_LABELCOLORINDEX)
         {
-            values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelFColor,
+            if (poLabelStyle == NULL)
+                values[i] = strdup("#000000");
+            else
+                values[i] = strdup(poLabelStyle->GetParamStr(OGRSTLabelFColor,
                                                          bDefault));
             if (layer->debug >= MS_DEBUGLEVEL_VVV)
                 msDebug(MSOGR_LABELSIZENAME " = \"%s\"\n", values[i]);



More information about the mapserver-commits mailing list