[mapserver-commits] r8958 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Apr 23 17:45:45 EDT 2009


Author: assefa
Date: 2009-04-23 17:45:44 -0400 (Thu, 23 Apr 2009)
New Revision: 8958

Modified:
   trunk/mapserver/mapdraw.c
   trunk/mapserver/mapprimitive.c
   trunk/mapserver/mapserver.h
Log:
problem when using minfeaturesize with a LABEL_NO_CLIP #2758

Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2009-04-23 21:01:15 UTC (rev 8957)
+++ trunk/mapserver/mapdraw.c	2009-04-23 21:45:44 UTC (rev 8958)
@@ -1579,7 +1579,11 @@
       /* No-clip labeling support */
       if(shape->text && msLayerGetProcessingKey(layer, "LABEL_NO_CLIP") != NULL) {
         bLabelNoClip = MS_TRUE;
-        annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*minfeaturesize);
+        if (minfeaturesize > 0)
+          annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*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);
       }
@@ -1599,6 +1603,9 @@
           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)) {
@@ -1853,7 +1860,11 @@
     /* No-clip labeling support */
     if(shape->text && msLayerGetProcessingKey(layer, "LABEL_NO_CLIP") != NULL) {
       bLabelNoClip = MS_TRUE;
-      annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*minfeaturesize);
+      if (layer->class[c]->label.minfeaturesize > 0)
+        annocallret = msPolygonLabelPoint(shape, &annopnt, map->cellsize*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);
     }
@@ -1922,6 +1933,9 @@
           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
 	  msDrawLabel(map, image, annopnt, shape->text, &label, layer->scalefactor);

Modified: trunk/mapserver/mapprimitive.c
===================================================================
--- trunk/mapserver/mapprimitive.c	2009-04-23 21:01:15 UTC (rev 8957)
+++ trunk/mapserver/mapprimitive.c	2009-04-23 21:45:44 UTC (rev 8958)
@@ -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: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2009-04-23 21:01:15 UTC (rev 8957)
+++ trunk/mapserver/mapserver.h	2009-04-23 21:45:44 UTC (rev 8958)
@@ -1769,7 +1769,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