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

svn at osgeo.org svn at osgeo.org
Sat Jan 21 15:11:29 EST 2012


Author: sdlime
Date: 2012-01-21 12:11:29 -0800 (Sat, 21 Jan 2012)
New Revision: 13005

Modified:
   sandbox/sdlime/rfc-77/mapdraw.c
   sandbox/sdlime/rfc-77/maplabel.c
Log:
Tightened up various collision tests.

Modified: sandbox/sdlime/rfc-77/mapdraw.c
===================================================================
--- sandbox/sdlime/rfc-77/mapdraw.c	2012-01-21 20:00:28 UTC (rev 13004)
+++ sandbox/sdlime/rfc-77/mapdraw.c	2012-01-21 20:11:29 UTC (rev 13005)
@@ -2390,7 +2390,7 @@
             */
             cachePtr->status = MS_FALSE; /* assume this cache element *can't* be placed */
 
-            for(ll=0; ll<cachePtr->numlabels; ll++) {
+            for(ll=0; ll<cachePtr->numlabels; ll++) { /* RFC 77 TODO: Still may want to step through backwards... */
               labelPtr = &(cachePtr->labels[ll]);
 
               if(labelPtr->status != MS_ON) continue; /* skip this label */
@@ -2524,17 +2524,22 @@
                 // if(label_marker_width > 0 && label_marker_height > 0)
                 //   msRectToPolygon(label_marker_rect, poly); /* save marker bounding polygon, part of overlap tests */
 
-                fprintf(stderr, "    %d, %d\n", ll, cachePtr->numlabels-1);
+                fprintf(stderr, "    before: %d, %d, %d\n", ll, cachePtr->numlabels-1, cachePtr->status);
                 if(labelPtr->force) {
                   msCopyShape(poly, cachePtr->poly);
                   cachePtr->status = MS_TRUE;
                 } else {
-                  if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) break; /* collision within the group, done... */
+                  if((ll != 0) && 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));
                 }
               } /* end else */
 
+              fprintf(stderr, "    after: %d, %d, %d\n", ll, cachePtr->numlabels-1, cachePtr->status);
+
               if(!cachePtr->status)
                 break; /* no point looking at more labels */
 

Modified: sandbox/sdlime/rfc-77/maplabel.c
===================================================================
--- sandbox/sdlime/rfc-77/maplabel.c	2012-01-21 20:00:28 UTC (rev 13004)
+++ sandbox/sdlime/rfc-77/maplabel.c	2012-01-21 20:11:29 UTC (rev 13005)
@@ -636,6 +636,8 @@
 {
     int i, p;
 
+    cachePtr->status = MS_TRUE; /* by default */
+
     /* Check against image bounds first 
     ** Pass mapwidth=-1 to skip this test
      */



More information about the mapserver-commits mailing list