[mapserver-commits] r12813 - sandbox/sdlime/rfc-77

svn at osgeo.org svn at osgeo.org
Sun Nov 27 16:33:19 EST 2011


Author: sdlime
Date: 2011-11-27 13:33:19 -0800 (Sun, 27 Nov 2011)
New Revision: 12813

Modified:
   sandbox/sdlime/rfc-77/mapscale.c
Log:
Updated a few things with scalebar embedding to deal with multiple class labels.

Modified: sandbox/sdlime/rfc-77/mapscale.c
===================================================================
--- sandbox/sdlime/rfc-77/mapscale.c	2011-11-27 21:30:27 UTC (rev 12812)
+++ sandbox/sdlime/rfc-77/mapscale.c	2011-11-27 21:33:19 UTC (rev 12813)
@@ -434,21 +434,23 @@
   if (msMaybeAllocateClassStyle(GET_LAYER(map, l)->class[0], 0)==MS_FAILURE) return MS_FAILURE;
   GET_LAYER(map, l)->class[0]->styles[0]->symbol = map->symbolset.numsymbols -1 ;
   GET_LAYER(map, l)->class[0]->styles[0]->color.pen = -1;
-  GET_LAYER(map, l)->class[0]->label.force = MS_TRUE;
-  GET_LAYER(map, l)->class[0]->label.size = MS_MEDIUM; /* must set a size to have a valid label definition */
-  GET_LAYER(map, l)->class[0]->label.priority = MS_MAX_LABEL_PRIORITY;
 
+  if(!GET_LAYER(map, l)->class[0]->labels) {
+    if(msGrowClassLabels(GET_LAYER(map, l)->class[0]) == NULL) return MS_FAILURE;
+  }
+  initLabel(GET_LAYER(map, l)->class[0]->labels[0]);
+  GET_LAYER(map, l)->class[0]->labels[0]->force = MS_TRUE;
+  GET_LAYER(map, l)->class[0]->labels[0]->size = MS_MEDIUM; /* must set a size to have a valid label definition */
+  GET_LAYER(map, l)->class[0]->labels[0]->priority = MS_MAX_LABEL_PRIORITY;
+
   if(map->scalebar.postlabelcache) /* TODO: add it directly to the image */
-  {
-      msDrawMarkerSymbol(&map->symbolset, img, &point, GET_LAYER(map, l)->class[0]->styles[0], 1.0);
-  } else {
+    msDrawMarkerSymbol(&map->symbolset, img, &point, GET_LAYER(map, l)->class[0]->styles[0], 1.0);
+  else
     msAddLabel(map, l, 0, NULL, &point, NULL, "", 1.0, NULL);
-  }
 
   /* Mark layer as deleted so that it doesn't interfere with html legends or with saving maps */
   GET_LAYER(map, l)->status = MS_DELETE;
 
-
   msFreeImage( image );
   return(0);
 }



More information about the mapserver-commits mailing list