[mapserver-commits] r9581 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Dec 4 17:40:21 EST 2009


Author: warmerdam
Date: 2009-12-04 17:40:19 -0500 (Fri, 04 Dec 2009)
New Revision: 9581

Modified:
   trunk/mapserver/mapogr.cpp
Log:
add support for label positioning with ogr autostyling

Modified: trunk/mapserver/mapogr.cpp
===================================================================
--- trunk/mapserver/mapogr.cpp	2009-12-04 22:24:21 UTC (rev 9580)
+++ trunk/mapserver/mapogr.cpp	2009-12-04 22:40:19 UTC (rev 9581)
@@ -2778,6 +2778,28 @@
               // OGR default is anchor point = LL, so label is at UR of anchor
               c->label.position = MS_UR;
 
+              int nPosition = OGR_ST_GetParamNum(hLabelStyle, 
+                                                 OGRSTLabelAnchor,
+                                                 &bIsNull);
+              if( !bIsNull )
+              {
+                  switch( nPosition ) {
+                    case 1: c->label.position = MS_UR; break;
+                    case 2: c->label.position = MS_UC; break;
+                    case 3: c->label.position = MS_UL; break;
+                    case 4: c->label.position = MS_CR; break;
+                    case 5: c->label.position = MS_CC; break;
+                    case 6: c->label.position = MS_CL; break;
+                    case 7: c->label.position = MS_LR; break;
+                    case 8: c->label.position = MS_LC; break;
+                    case 9: c->label.position = MS_LL; break;
+                    case 10: c->label.position = MS_LR; break; /*approximate*/
+                    case 11: c->label.position = MS_LC; break;
+                    case 12: c->label.position = MS_LL; break;
+                    default: break;
+                  }
+              }
+
               const char *pszColor = OGR_ST_GetParamStr(hLabelStyle, 
                                                         OGRSTLabelFColor,
                                                         &bIsNull);



More information about the mapserver-commits mailing list