[mapserver-commits] r9198 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jul 21 13:43:13 EDT 2009


Author: aboudreault
Date: 2009-07-21 13:43:12 -0400 (Tue, 21 Jul 2009)
New Revision: 9198

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapdraw.c
   trunk/mapserver/mapimagemap.c
   trunk/mapserver/maplabel.c
   trunk/mapserver/mappdf.c
   trunk/mapserver/mapserver.h
   trunk/mapserver/mapsvg.c
   trunk/mapserver/mapswf.c
Log:
Fixed MINDISTANCE not considering label size on lines (#3050)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/HISTORY.TXT	2009-07-21 17:43:12 UTC (rev 9198)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed MINDISTANCE not considering label size on lines (#3050)
+
 - Labeling enhancements: ability to repeat labels along a line/multiline (#3030)
 
 - Modified STYLEITEM code to use the new way of rendering thick lines (#3025)

Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mapdraw.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -2481,7 +2481,7 @@
 
 	    /* Compare against image bounds, rendered labels and markers (sets cachePtr->status), if FORCE=TRUE then skip it */
             if(!labelPtr->force)
-              msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance);
+              msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 	  } else {
 
             if(labelPtr->position == MS_AUTO) {
@@ -2511,7 +2511,7 @@
                   msRectToPolygon(marker_rect, cachePtr->poly); /* save marker bounding polygon */
 
                 /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
-                msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance);
+                msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
                 if(cachePtr->status) /* found a suitable place for this label */ {
                   if(MS_VALID_COLOR(labelPtr->backgroundcolor))
@@ -2552,7 +2552,7 @@
 
               /* Compare against image bounds, rendered labels and markers (sets cachePtr->status), if FORCE=TRUE then skip the test */
               if(!labelPtr->force)
-                msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance);
+                msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, label_buffer + map_edge_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
             }
           }

Modified: trunk/mapserver/mapimagemap.c
===================================================================
--- trunk/mapserver/mapimagemap.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mapimagemap.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -1911,7 +1911,7 @@
 
           /* Compare against rendered labels and markers (sets cachePtr->status) */
           msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
-                                     -1, -1, label_buffer, cachePtr, priority, l, label_mindistance);
+                                     -1, -1, label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
 	  if(cachePtr->status) /* found a suitable place for this label */
 	    break;
@@ -1931,7 +1931,7 @@
 
           /* Compare against rendered labels and markers (sets cachePtr->status) */
           msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
-                                     -1, -1, label_buffer, cachePtr, priority, l,label_mindistance);
+                                     -1, -1, label_buffer, cachePtr, priority, l,label_mindistance, (r.maxx-r.minx));
 
 	  if(cachePtr->status) /* found a suitable place for this label */
 	    break;
@@ -1956,7 +1956,7 @@
 
         /* Compare against rendered labels and markers (sets cachePtr->status) */
         msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
-                                   -1, -1, label_buffer, cachePtr, priority, l,label_mindistance);
+                                   -1, -1, label_buffer, cachePtr, priority, l,label_mindistance, (r.maxx-r.minx));
       }
     } /* end position if-then-else */
 

Modified: trunk/mapserver/maplabel.c
===================================================================
--- trunk/mapserver/maplabel.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/maplabel.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -470,7 +470,7 @@
 void msTestLabelCacheCollisions(labelCacheObj *labelcache, labelObj *labelPtr, 
                                 int mapwidth, int mapheight, int buffer,
                                 labelCacheMemberObj *cachePtr, int current_priority, 
-                                int current_label, int mindistance)
+                                int current_label, int mindistance, double label_size)
 {
     int i, p;
 
@@ -510,8 +510,9 @@
 
         for(  ; i < cacheslot->numlabels; i++) { 
             if(cacheslot->labels[i].status == MS_TRUE) { /* compare bounding polygons and check for duplicates */
-
-                if((mindistance != -1) && (cachePtr->classindex == cacheslot->labels[i].classindex) && (strcmp(cachePtr->text,cacheslot->labels[i].text) == 0) && (msDistancePointToPoint(&(cachePtr->point), &(cacheslot->labels[i].point)) <= mindistance)) { /* label is a duplicate */
+                /* We add the label_size to the mindistance value when comparing because we do want the mindistance 
+                   value between the labels and not only from point to point. */
+                if((mindistance != -1) && (cachePtr->classindex == cacheslot->labels[i].classindex) && (strcmp(cachePtr->text,cacheslot->labels[i].text) == 0) && (msDistancePointToPoint(&(cachePtr->point), &(cacheslot->labels[i].point)) <= (mindistance + label_size))) { /* label is a duplicate */
                     cachePtr->status = MS_FALSE;
                     return;
                 }

Modified: trunk/mapserver/mappdf.c
===================================================================
--- trunk/mapserver/mappdf.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mappdf.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -615,7 +615,7 @@
                     /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                     msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                                map->width, map->height, 
-                                               label_buffer, cachePtr, priority, l, label_mindistance);
+                                               label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
                     /*found a suitable place for this label*/
                     if(cachePtr->status)
@@ -649,7 +649,7 @@
                     /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                     msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                                map->width, map->height, 
-                                               label_buffer, cachePtr, priority, l, label_mindistance);
+                                               label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
                     /* found a suitable place for this label*/
                     if(cachePtr->status)
@@ -699,7 +699,7 @@
                 /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                 msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                            map->width, map->height, 
-                                           label_buffer, cachePtr, priority, l, label_mindistance);
+                                           label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
             }
         } /* end position if-then-else */
 

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mapserver.h	2009-07-21 17:43:12 UTC (rev 9198)
@@ -1803,7 +1803,7 @@
 MS_DLL_EXPORT char *msTransformLabelText(mapObj *map, imageObj* image, labelObj *label, char *text);
 MS_DLL_EXPORT int msGetLabelSize(imageObj *img, char *string, labelObj *label, rectObj *rect, fontSetObj *fontSet, double scalefactor, int adjustBaseline,double **advances);
 MS_DLL_EXPORT int msAddLabel(mapObj *map, int layerindex, int classindex, shapeObj *shape, pointObj *point, labelPathObj *labelpath, char *string, double featuresize, labelObj *label);
-MS_DLL_EXPORT void msTestLabelCacheCollisions(labelCacheObj *labelcache, labelObj *labelPtr, int mapwidth, int mapheight, int buffer, labelCacheMemberObj *cachePtr, int current_priority, int current_label, int mindistance);
+MS_DLL_EXPORT void msTestLabelCacheCollisions(labelCacheObj *labelcache, labelObj *labelPtr, int mapwidth, int mapheight, int buffer, labelCacheMemberObj *cachePtr, int current_priority, int current_label, int mindistance, double label_size);
 MS_DLL_EXPORT labelCacheMemberObj *msGetLabelCacheMember(labelCacheObj *labelcache, int i);
 
 MS_DLL_EXPORT gdFontPtr msGetBitmapFont(int size);

Modified: trunk/mapserver/mapsvg.c
===================================================================
--- trunk/mapserver/mapsvg.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mapsvg.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -1247,7 +1247,7 @@
           /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
           msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                      map->width, map->height, 
-                                     label_buffer, cachePtr, priority, l, label_mindistance);
+                                     label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
 
 	  if(cachePtr->status) /* found a suitable place for this label */
@@ -1269,7 +1269,7 @@
           /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
           msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                      map->width, map->height, 
-                                     label_buffer, cachePtr, priority, l, label_mindistance);
+                                     label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
 	  if(cachePtr->status) /* found a suitable place for this label */
 	    break;
@@ -1294,7 +1294,7 @@
         /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
         msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                    map->width, map->height, 
-                                   label_buffer, cachePtr, priority, l, label_mindistance);
+                                   label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
       }
     } /* end position if-then-else */
 

Modified: trunk/mapserver/mapswf.c
===================================================================
--- trunk/mapserver/mapswf.c	2009-07-21 16:27:29 UTC (rev 9197)
+++ trunk/mapserver/mapswf.c	2009-07-21 17:43:12 UTC (rev 9198)
@@ -2675,7 +2675,7 @@
                     /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                     msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                                map->width, map->height, 
-                                               label_buffer, cachePtr, priority, l, label_mindistance);
+                                               label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
                     if(cachePtr->status) /* found a suitable place for this label */
                         break;
@@ -2696,7 +2696,7 @@
                     /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                     msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                                map->width, map->height, 
-                                               label_buffer, cachePtr, priority, l, label_mindistance);
+                                               label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
 
                     if(cachePtr->status) /* found a suitable place for this label */
                         break;
@@ -2722,7 +2722,7 @@
               /* Compare against image bounds, rendered labels and markers (sets cachePtr->status) */
                 msTestLabelCacheCollisions(&(map->labelcache), labelPtr, 
                                            map->width, map->height, 
-                                           label_buffer, cachePtr, priority, l, label_mindistance);
+                                           label_buffer, cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
             }
         } /* end position if-then-else */
 



More information about the mapserver-commits mailing list