[mapserver-commits] r8971 - branches/branch-5-4/mapserver

svn at osgeo.org svn at osgeo.org
Tue Apr 28 08:23:59 EDT 2009


Author: assefa
Date: 2009-04-28 08:23:59 -0400 (Tue, 28 Apr 2009)
New Revision: 8971

Modified:
   branches/branch-5-4/mapserver/HISTORY.TXT
   branches/branch-5-4/mapserver/mapdraw.c
   branches/branch-5-4/mapserver/mapprimitive.c
   branches/branch-5-4/mapserver/mapserver.h
Log:
Fix problem when using minfeaturesize with a LABEL_NO_CLIP (#2758)

Modified: branches/branch-5-4/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-4/mapserver/HISTORY.TXT	2009-04-28 09:49:45 UTC (rev 8970)
+++ branches/branch-5-4/mapserver/HISTORY.TXT	2009-04-28 12:23:59 UTC (rev 8971)
@@ -12,8 +12,10 @@
 Current Version:
 ----------------
 
-- Fix Getlegendgraphic when sizeunit is set
+- Fix problem when using minfeaturesize with a LABEL_NO_CLIP (#2758)
 
+- Fix Getlegendgraphic when sizeunit is set (#2983)
+
 - Fix mapogcfilter.c not to cause syntax error if PROJ.4 is not compiled in (#2987)
 
 Version 5.4.0 (2009-04-22):

Modified: branches/branch-5-4/mapserver/mapdraw.c
===================================================================
--- branches/branch-5-4/mapserver/mapdraw.c	2009-04-28 09:49:45 UTC (rev 8970)
+++ branches/branch-5-4/mapserver/mapdraw.c	2009-04-28 12:23:59 UTC (rev 8971)
@@ -1573,7 +1573,10 @@
       /* No-clip labeling support */
       if(shape->text && msLayerGetProcessingKey(layer, "LABEL_NO_CLIP") != NULL) {
         bLabelNoClip = MS_TRUE;
-        annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*layer->class[c]->label.minfeaturesize);
+        if (layer->class[c]->label.minfeaturesize > 0)
+          annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*layer->class[c]->label.minfeaturesize);
+        else
+          annocallret = msPolygonLabelPoint(shape, &annopnt, -1);
         annopnt.x = MS_MAP2IMAGE_X(annopnt.x, map->extent.minx, map->cellsize);
         annopnt.y = MS_MAP2IMAGE_Y(annopnt.y, map->extent.maxy, map->cellsize);
       }
@@ -1591,8 +1594,11 @@
 
         if(label.angle != 0)
           label.angle -= map->gt.rotation_angle;
-
+         
         if(layer->labelcache) {
+          /*compute the bounds. Previous bounds were calculated on a non transformed shape*/
+          if (bLabelNoClip == MS_TRUE)
+            msComputeBounds(shape);
           if(msAddLabel(map, layer->index, c, shape, &annopnt, NULL, shape->text, MS_MIN(shape->bounds.maxx-shape->bounds.minx,shape->bounds.maxy-shape->bounds.miny), &label) != MS_SUCCESS) return(MS_FAILURE);
         } else {
 	  if(layer->class[c]->numstyles > 0 && MS_VALID_COLOR(layer->class[c]->styles[0]->color)) {
@@ -1847,7 +1853,11 @@
     /* No-clip labeling support */
     if(shape->text && msLayerGetProcessingKey(layer, "LABEL_NO_CLIP") != NULL) {
       bLabelNoClip = MS_TRUE;
-      annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*layer->class[c]->label.minfeaturesize);
+      if (layer->class[c]->label.minfeaturesize > 0)
+        annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*layer->class[c]->label.minfeaturesize);
+      else
+        annocallret = msPolygonLabelPoint(shape, &annopnt, -1);
+
       annopnt.x = MS_MAP2IMAGE_X(annopnt.x, map->extent.minx, map->cellsize);
       annopnt.y = MS_MAP2IMAGE_Y(annopnt.y, map->extent.maxy, map->cellsize);
     }
@@ -1915,6 +1925,10 @@
         if(label.angle != 0)
           label.angle -= map->gt.rotation_angle;
 
+        /*compute the bounds. Previous bounds were calculated on a non transformed shape*/
+        if (bLabelNoClip == MS_TRUE)
+          msComputeBounds(shape);
+
 	if(layer->labelcache) {
 	  if(msAddLabel(map, layer->index, c, shape, &annopnt, NULL, shape->text, MS_MIN(shape->bounds.maxx-shape->bounds.minx,shape->bounds.maxy-shape->bounds.miny), &label) != MS_SUCCESS) return(MS_FAILURE);
 	} else

Modified: branches/branch-5-4/mapserver/mapprimitive.c
===================================================================
--- branches/branch-5-4/mapserver/mapprimitive.c	2009-04-28 09:49:45 UTC (rev 8970)
+++ branches/branch-5-4/mapserver/mapprimitive.c	2009-04-28 12:23:59 UTC (rev 8971)
@@ -1066,7 +1066,7 @@
 /*
 ** Find a label point in a polygon.
 */
-int msPolygonLabelPoint(shapeObj *p, pointObj *lp, int min_dimension)
+int msPolygonLabelPoint(shapeObj *p, pointObj *lp, double min_dimension)
 {
   double slope;
   pointObj *point1=NULL, *point2=NULL, cp;

Modified: branches/branch-5-4/mapserver/mapserver.h
===================================================================
--- branches/branch-5-4/mapserver/mapserver.h	2009-04-28 09:49:45 UTC (rev 8970)
+++ branches/branch-5-4/mapserver/mapserver.h	2009-04-28 12:23:59 UTC (rev 8971)
@@ -1764,7 +1764,7 @@
 MS_DLL_EXPORT void msImageCartographicPolyline(gdImagePtr im, shapeObj *p, styleObj *style, symbolObj *symbol, int c, double size, double scalefactor);
 MS_DLL_EXPORT int msPolylineLabelPoint(shapeObj *p, pointObj *lp, int min_length, double *angle, double *length);
 MS_DLL_EXPORT labelPathObj* msPolylineLabelPath(imageObj *img, shapeObj *p, int min_length, fontSetObj *fontset, char *string, labelObj *label, double scalefactor, int *status);
-MS_DLL_EXPORT int msPolygonLabelPoint(shapeObj *p, pointObj *lp, int min_dimension);
+MS_DLL_EXPORT int msPolygonLabelPoint(shapeObj *p, pointObj *lp, double min_dimension);
 MS_DLL_EXPORT int msAddLine(shapeObj *p, lineObj *new_line);
 MS_DLL_EXPORT int msAddLineDirectly(shapeObj *p, lineObj *new_line);
 MS_DLL_EXPORT int msAddPointToLine(lineObj *line, pointObj *point );



More information about the mapserver-commits mailing list