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

svn at osgeo.org svn at osgeo.org
Mon Feb 6 12:15:17 EST 2012


Author: sdlime
Date: 2012-02-06 09:15:17 -0800 (Mon, 06 Feb 2012)
New Revision: 13053

Modified:
   sandbox/sdlime/rfc-77/mapcopy.c
   sandbox/sdlime/rfc-77/mapdraw.c
   sandbox/sdlime/rfc-77/maplayer.c
   sandbox/sdlime/rfc-77/maputil.c
Log:
Fixed error in base processing of label expression. Fixed logic error in msDrawLabelCache() related to label status...

Modified: sandbox/sdlime/rfc-77/mapcopy.c
===================================================================
--- sandbox/sdlime/rfc-77/mapcopy.c	2012-02-06 15:48:55 UTC (rev 13052)
+++ sandbox/sdlime/rfc-77/mapcopy.c	2012-02-06 17:15:17 UTC (rev 13053)
@@ -329,6 +329,7 @@
   /*
   ** other book keeping information (RFC 77 TODO)
   */
+  MS_COPYSTELEM(status);
   MS_COPYSTRING(dst->annotext, src->annotext);
 
   return MS_SUCCESS;

Modified: sandbox/sdlime/rfc-77/mapdraw.c
===================================================================
--- sandbox/sdlime/rfc-77/mapdraw.c	2012-02-06 15:48:55 UTC (rev 13052)
+++ sandbox/sdlime/rfc-77/mapdraw.c	2012-02-06 17:15:17 UTC (rev 13053)
@@ -2379,7 +2379,11 @@
               msFreeShape(poly);
               labelPtr = &(cachePtr->labels[ll]);
 
-              if(labelPtr->status != MS_ON) continue; /* skip this label */
+               fprintf(stderr, "working on %d...\n", ll);
+              if(labelPtr->status != MS_ON) {
+                fprintf(stderr, "skipping %d...\n", ll);
+                continue; /* skip this label */
+              }
               if(!labelPtr->annotext || strlen(labelPtr->annotext) == 0) continue; /* skip this label (RFC 77 TODO: ok to bail here?) */
 
               /* compute label size */
@@ -2486,7 +2490,9 @@
   		  fprintf(stderr, "%d ", i);
                   labelPtr->annopoint = get_metrics(&(cachePtr->point), positions[i], r, (marker_offset_x + label_offset_x), (marker_offset_y + label_offset_y), labelPtr->angle, label_buffer, poly);
 
-                  if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) { 
+                  /* if cachePtr->status we're still working on the first valid label with a valid status value */
+                  /* was: if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) { */
+                  if(cachePtr->status != MS_FALSE && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) {                  
                     fprintf(stderr, "[%d] ", poly->numlines);
                     msShapeDeleteLine(poly, poly->numlines-1);
                     cachePtr->status = MS_FALSE;
@@ -2538,12 +2544,13 @@
                   msCopyShape(poly, cachePtr->poly);
                   cachePtr->status = MS_TRUE;
                 } else {
-                  if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) {
+                  /* if cachePtr->status we're still working on the first valid label with a valid status value */
+                  if(cachePtr->status != MS_FALSE && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) {
                     cachePtr->status = MS_FALSE;
                     break; /* collision within the group, done... */
                   }
                   msCopyShape(poly, cachePtr->poly);
-                  msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, (map_edge_buffer-label_buffer), cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
+                  msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, (map_edge_buffer-label_buffer), cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));                  
                 }
               } /* end else */
               fprintf(stderr, "    after: %d, %d, %d\n", ll, cachePtr->numlabels-1, cachePtr->status);

Modified: sandbox/sdlime/rfc-77/maplayer.c
===================================================================
--- sandbox/sdlime/rfc-77/maplayer.c	2012-02-06 15:48:55 UTC (rev 13052)
+++ sandbox/sdlime/rfc-77/maplayer.c	2012-02-06 17:15:17 UTC (rev 13053)
@@ -521,7 +521,7 @@
 
       /* RFC 77: will need to support expression and text attributes here... */
       if(layer->class[i]->labels[l]->expression.type == MS_EXPRESSION)
-        nt += msCountChars(layer->class[i]->expression.string, '[');
+        nt += msCountChars(layer->class[i]->labels[l]->expression.string, '[');
       if(layer->class[i]->labels[l]->text.type == MS_EXPRESSION || (layer->class[i]->labels[l]->text.string && strchr(layer->class[i]->labels[l]->text.string,'[') != NULL && strchr(layer->class[i]->labels[l]->text.string,']') != NULL))
         nt += msCountChars(layer->class[i]->labels[l]->text.string, '[');
     }

Modified: sandbox/sdlime/rfc-77/maputil.c
===================================================================
--- sandbox/sdlime/rfc-77/maputil.c	2012-02-06 15:48:55 UTC (rev 13052)
+++ sandbox/sdlime/rfc-77/maputil.c	2012-02-06 17:15:17 UTC (rev 13053)
@@ -638,6 +638,8 @@
 int msShapeGetAnnotation(layerObj *layer, shapeObj *shape) {
   int i, j;
 
+  fprintf(stderr, "in msShapeGetAnnotation()... Scale=%g\n", layer->map->scaledenom);
+
   /* RFC 77 TODO: check and throw some errors here... */
   if(!layer || !shape) return MS_FAILURE;
 



More information about the mapserver-commits mailing list