[mapserver-commits] r13007 - sandbox/sdlime/rfc-77
svn at osgeo.org
svn at osgeo.org
Sat Jan 21 19:51:26 EST 2012
Author: sdlime
Date: 2012-01-21 16:51:26 -0800 (Sat, 21 Jan 2012)
New Revision: 13007
Modified:
sandbox/sdlime/rfc-77/mapdraw.c
Log:
Fixed label polygon handling within position auto loop.
Modified: sandbox/sdlime/rfc-77/mapdraw.c
===================================================================
--- sandbox/sdlime/rfc-77/mapdraw.c 2012-01-21 22:14:35 UTC (rev 13006)
+++ sandbox/sdlime/rfc-77/mapdraw.c 2012-01-22 00:51:26 UTC (rev 13007)
@@ -2288,8 +2288,6 @@
labelCacheSlotObj *cacheslot;
cacheslot = &(map->labelcache.slots[priority]);
- fprintf(stderr, " priority=%d has %d labels\n", priority, cacheslot->numlabels);
-
for(l=cacheslot->numlabels-1; l>=0; l--) {
double scalefactor,size;
cachePtr = &(cacheslot->labels[l]); /* point to right spot in the label cache */
@@ -2303,8 +2301,8 @@
if(cachePtr->labelpath) { /* path-based label */
labelPtr = &(cachePtr->labels[0]);
- if(!labelPtr->annotext || strlen(labelPtr->annotext) == 0)
- continue; /* skip this label, nothing to with curved labels when there is nothing to draw */
+ if(labelPtr->status != MS_ON) continue; /* skip this label */
+ if(!labelPtr->annotext || strlen(labelPtr->annotext) == 0) continue; /* skip this label, nothing to with curved labels when there is nothing to draw */
/* path-following labels *must* be TRUETYPE */
size = labelPtr->size * layerPtr->scalefactor;
@@ -2390,6 +2388,7 @@
cachePtr->status = MS_FALSE; /* assume this cache element *can't* be placed */
for(ll=0; ll<cachePtr->numlabels; ll++) { /* RFC 77 TODO: Still may want to step through backwards... */
+ msFreeShape(poly);
labelPtr = &(cachePtr->labels[ll]);
if(labelPtr->status != MS_ON) continue; /* skip this label */
@@ -2462,6 +2461,8 @@
if(drawLabelText && labelPtr->position == MS_AUTO) {
int positions[MS_POSITIONS_LENGTH], npositions=0;
+ fprintf(stderr, " (%d) position auto:", cachePtr->status);
+
/*
** If the ANNOTATION has an associated marker then the position is handled like a point regardless of underlying shape type. (#2993)
** (Note: might be able to re-order this for more speed.)
@@ -2480,16 +2481,18 @@
if(label_marker_width > 0 && label_marker_height > 0)
msRectToPolygon(label_marker_rect, poly); /* save marker bounding polygon */
- for(i=0; i<npositions; i++) {
+ for(i=0; i<npositions; i++) {
+ fprintf(stderr, "%d ", i);
labelPtr->annopoint = get_metrics(&(cachePtr->point), positions[i], r, (marker_offset_x + label_offset_x), (marker_offset_y + label_offset_y), labelPtr->angle, label_buffer, poly);
- /* first, compare poly against cachePtr->poly (group poly) if not the first label in the group */
- if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) continue; /* next position */
+ if((ll != 0) && intersectLabelPolygons(poly, cachePtr->poly) == MS_TRUE) {
+ fprintf(stderr, "[%d] ", poly->numlines);
+ msShapeDeleteLine(poly, poly->numlines-1);
+ cachePtr->status = MS_FALSE;
+ continue; /* next position */
+ }
- /* second, add poly to cachePtr->poly */
msCopyShape(poly, cachePtr->poly); // RFC 77 - HMMM, this isn't right (need to save existing cache->poly value in case there's a collision)...
-
- /* finally, compare against image bounds, rendered labels and markers (sets cachePtr->status) */
msTestLabelCacheCollisions(&(map->labelcache), labelPtr, image->width, image->height, (map_edge_buffer-label_buffer), cachePtr, priority, l, label_mindistance, (r.maxx-r.minx));
/* found a suitable place for this label */
@@ -2498,13 +2501,17 @@
get_metrics_line(&(cachePtr->point), positions[i], r, (marker_offset_x + label_offset_x), (marker_offset_y + label_offset_y), labelPtr->angle, 1, labelPoly.line);
break; /* ...out of position loop */
} else {
- /* reset some things */
+ /* reset some things */
+ fprintf(stderr, "{%d} ", poly->numlines);
msShapeDeleteLine(cachePtr->poly, cachePtr->poly->numlines-1);
if(poly->numlines == 2) msShapeDeleteLine(cachePtr->poly, cachePtr->poly->numlines-1); /* marker too */
msShapeDeleteLine(poly, poly->numlines-1);
+ fprintf(stderr, "(%d) ", poly->numlines);
}
} /* next position */
+ fprintf(stderr, "end (%d)\n", cachePtr->status);
+
if(!cachePtr->status && labelPtr->force) {
if(drawLabelPoly)
get_metrics_line(&(cachePtr->point), positions[npositions-1], r, (marker_offset_x + label_offset_x), (marker_offset_y + label_offset_y), labelPtr->angle, 1, labelPoly.line);
@@ -2544,7 +2551,6 @@
if(!cachePtr->status)
break; /* no point looking at more labels */
-
} /* next label in the group */
if(!cachePtr->status)
More information about the mapserver-commits
mailing list