[mapserver-commits] r13185 - sandbox/tb-labels

svn at osgeo.org svn at osgeo.org
Wed Feb 29 13:20:20 EST 2012


Author: tbonfort
Date: 2012-02-29 10:20:20 -0800 (Wed, 29 Feb 2012)
New Revision: 13185

Modified:
   sandbox/tb-labels/mapdraw.c
   sandbox/tb-labels/maplabel.c
Log:
tab/spaces, fix space around label marker


Modified: sandbox/tb-labels/mapdraw.c
===================================================================
--- sandbox/tb-labels/mapdraw.c	2012-02-29 17:07:23 UTC (rev 13184)
+++ sandbox/tb-labels/mapdraw.c	2012-02-29 18:20:20 UTC (rev 13185)
@@ -1817,32 +1817,33 @@
       break;
     default: /* points and anything with out a proper type */
       for(l=0; l<layer->class[c]->numlabels; l++)
-        if(layer->class[c]->labels[l]->angle != 0) layer->class[c]->labels[l]->angle -= map->gt.rotation_angle;
+         if(layer->class[c]->labels[l]->angle != 0) layer->class[c]->labels[l]->angle -= map->gt.rotation_angle;
 
+      double invcellsize = 1.0/map->cellsize;
       for(j=0; j<shape->numlines;j++) {
-	for(i=0; i<shape->line[j].numpoints;i++) {
-	  point = &(shape->line[j].point[i]);
+         for(i=0; i<shape->line[j].numpoints;i++) {
+            point = &(shape->line[j].point[i]);
 
-	  if(layer->transform == MS_TRUE) {
-	    if(!msPointInRect(point, &map->extent)) return(MS_SUCCESS);
-	    point->x = MS_MAP2IMAGE_X_IC_DBL(point->x, map->extent.minx, map->cellsize);
-	    point->y = MS_MAP2IMAGE_Y_IC_DBL(point->y, map->extent.maxy, map->cellsize);
-	  } else
-            msOffsetPointRelativeTo(point, layer);
+            if(layer->transform == MS_TRUE) {
+               if(!msPointInRect(point, &map->extent)) return(MS_SUCCESS);
+               point->x = MS_MAP2IMAGE_X_IC_DBL(point->x, map->extent.minx, invcellsize);
+               point->y = MS_MAP2IMAGE_Y_IC_DBL(point->y, map->extent.maxy, invcellsize);
+            } else
+               msOffsetPointRelativeTo(point, layer);
 
-          if(layer->labelcache) {
-            if(msAddLabelGroup(map, layer->index, c, shape, point, -1) != MS_SUCCESS) return (MS_FAILURE);
-	  } else {
-            if(layer->class[c]->numstyles > 0 && MS_VALID_COLOR(layer->class[c]->styles[0]->color)) {
-              for(s=0; s<layer->class[c]->numstyles; s++) {
-                if(msScaleInBounds(map->scaledenom, layer->class[c]->styles[s]->minscaledenom, layer->class[c]->styles[s]->maxscaledenom))
-                  msDrawMarkerSymbol(&map->symbolset, image, point, layer->class[c]->styles[s], layer->scalefactor);
-              }
+            if(layer->labelcache) {
+               if(msAddLabelGroup(map, layer->index, c, shape, point, -1) != MS_SUCCESS) return (MS_FAILURE);
+            } else {
+               if(layer->class[c]->numstyles > 0 && MS_VALID_COLOR(layer->class[c]->styles[0]->color)) {
+                  for(s=0; s<layer->class[c]->numstyles; s++) {
+                     if(msScaleInBounds(map->scaledenom, layer->class[c]->styles[s]->minscaledenom, layer->class[c]->styles[s]->maxscaledenom))
+                        msDrawMarkerSymbol(&map->symbolset, image, point, layer->class[c]->styles[s], layer->scalefactor);
+                  }
+               }
+               for(l=0; l<layer->class[c]->numlabels; l++)
+                  msDrawLabel(map, image, *point, layer->class[c]->labels[l]->annotext, layer->class[c]->labels[l], layer->scalefactor);
             }
-            for(l=0; l<layer->class[c]->numlabels; l++)
-              msDrawLabel(map, image, *point, layer->class[c]->labels[l]->annotext, layer->class[c]->labels[l], layer->scalefactor);
-          }
-	}
+         }
       }
     }
     break;  /* end MS_LAYER_ANNOTATION */

Modified: sandbox/tb-labels/maplabel.c
===================================================================
--- sandbox/tb-labels/maplabel.c	2012-02-29 17:07:23 UTC (rev 13184)
+++ sandbox/tb-labels/maplabel.c	2012-02-29 18:20:20 UTC (rev 13185)
@@ -1180,7 +1180,7 @@
   switch(position) {
   case MS_UL:
     x1 = -w - ox;
-    y1 = -oy;
+    y1 = -oy - MARKER_SLOP;
     break;
   case MS_UC:
     x1 = -(w/2.0);
@@ -1188,7 +1188,7 @@
     break;
   case MS_UR:
     x1 = ox;
-    y1 = -oy;
+    y1 = -oy - MARKER_SLOP;
     break;
   case MS_CL:
     x1 = -w - ox - MARKER_SLOP;
@@ -1204,7 +1204,7 @@
     break;
   case MS_LL:
     x1 = -w - ox;
-    y1 = h + oy;
+    y1 = h + oy + MARKER_SLOP;
     break;
   case MS_LC:
     x1 = -(w/2.0);
@@ -1212,7 +1212,7 @@
     break;
   case MS_LR:
     x1 = ox;
-    y1 = h + oy;
+    y1 = h + oy + MARKER_SLOP;
     break;
   }
 



More information about the mapserver-commits mailing list