[mapserver-commits] r13041 - sandbox/sdlime/rfc-77
svn at osgeo.org
svn at osgeo.org
Sun Feb 5 13:55:12 EST 2012
Author: sdlime
Date: 2012-02-05 10:55:12 -0800 (Sun, 05 Feb 2012)
New Revision: 13041
Modified:
sandbox/sdlime/rfc-77/mapdraw.c
sandbox/sdlime/rfc-77/maplabel.c
sandbox/sdlime/rfc-77/mapserver.h
Log:
Remove text attribute of labelCacheMemberObj. That information is now stored at the labelObj level.
Modified: sandbox/sdlime/rfc-77/mapdraw.c
===================================================================
--- sandbox/sdlime/rfc-77/mapdraw.c 2012-02-05 01:06:25 UTC (rev 13040)
+++ sandbox/sdlime/rfc-77/mapdraw.c 2012-02-05 18:55:12 UTC (rev 13041)
@@ -2334,7 +2334,7 @@
if(!cachePtr->status)
continue;
- msDrawTextLine(image, cachePtr->text, labelPtr, cachePtr->labelpath, &(map->fontset), layerPtr->scalefactor); /* Draw the curved label */
+ msDrawTextLine(image, labelPtr->annotext, labelPtr, cachePtr->labelpath, &(map->fontset), layerPtr->scalefactor); /* Draw the curved label */
} else { /* point-based label */
int drawLabelText=MS_TRUE; // unused
Modified: sandbox/sdlime/rfc-77/maplabel.c
===================================================================
--- sandbox/sdlime/rfc-77/maplabel.c 2012-02-05 01:06:25 UTC (rev 13040)
+++ sandbox/sdlime/rfc-77/maplabel.c 2012-02-05 18:55:12 UTC (rev 13041)
@@ -634,68 +634,77 @@
labelCacheMemberObj *cachePtr, int current_priority,
int current_label, int mindistance, double label_size)
{
- int i, p;
+ int i, p;
+ labelCacheMemberObj *curCachePtr=NULL;
- cachePtr->status = MS_TRUE; /* by default */
+ cachePtr->status = MS_TRUE; /* by default */
- /* Check against image bounds first
- ** Pass mapwidth=-1 to skip this test
- */
- if(!labelPtr->partials && mapwidth > 0 && mapheight > 0) {
- if(labelInImage(mapwidth, mapheight, cachePtr->poly, buffer) == MS_FALSE) {
- cachePtr->status = MS_FALSE;
- return;
- }
+ /* Check against image bounds first
+ ** Pass mapwidth=-1 to skip this test
+ */
+ if(!labelPtr->partials && mapwidth > 0 && mapheight > 0) {
+ if(labelInImage(mapwidth, mapheight, cachePtr->poly, buffer) == MS_FALSE) {
+ cachePtr->status = MS_FALSE;
+ return;
}
+ }
- /* Compare against all rendered markers from this priority level and higher.
- ** Labels can overlap their own marker and markers from lower priority levels
- */
- for (p=current_priority; p < MS_MAX_LABEL_PRIORITY; p++) {
- labelCacheSlotObj *markerslot;
- markerslot = &(labelcache->slots[p]);
+ /* Compare against all rendered markers from this priority level and higher.
+ ** Labels can overlap their own marker and markers from lower priority levels
+ */
+ for (p=current_priority; p < MS_MAX_LABEL_PRIORITY; p++) {
+ labelCacheSlotObj *markerslot;
+ markerslot = &(labelcache->slots[p]);
- for ( i = 0; i < markerslot->nummarkers; i++ ) {
- if ( !(p == current_priority && current_label == markerslot->markers[i].id) ) { /* labels can overlap their own marker */
- if ( intersectLabelPolygons(markerslot->markers[i].poly, cachePtr->poly ) == MS_TRUE ) {
- cachePtr->status = MS_FALSE; /* polys intersect */
- return;
- }
- }
+ for ( i = 0; i < markerslot->nummarkers; i++ ) {
+ if ( !(p == current_priority && current_label == markerslot->markers[i].id) ) { /* labels can overlap their own marker */
+ if ( intersectLabelPolygons(markerslot->markers[i].poly, cachePtr->poly ) == MS_TRUE ) {
+ cachePtr->status = MS_FALSE; /* polys intersect */
+ return;
}
+ }
}
+ }
- /* compare against rendered labels */
- i = current_label+1;
+ /* compare against rendered labels */
+ i = current_label+1;
- for(p=current_priority; p<MS_MAX_LABEL_PRIORITY; p++) {
- labelCacheSlotObj *cacheslot;
- cacheslot = &(labelcache->slots[p]);
+ for(p=current_priority; p<MS_MAX_LABEL_PRIORITY; p++) {
+ labelCacheSlotObj *cacheslot;
+ cacheslot = &(labelcache->slots[p]);
- for( ; i < cacheslot->numlabels; i++) {
- if(cacheslot->labels[i].status == MS_TRUE) { /* compare bounding polygons and check for duplicates */
- /* 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(label_size > 0 && (mindistance != -1) &&
- (cachePtr->layerindex == cacheslot->labels[i].layerindex) && (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;
- }
+ for( ; i < cacheslot->numlabels; i++) {
+ curCachePtr = &(cacheslot->labels[i]);
- if(intersectLabelPolygons(cacheslot->labels[i].poly, cachePtr->poly) == MS_TRUE) { /* polys intersect */
- cachePtr->status = MS_FALSE;
- return;
- }
- }
- } /* i */
+ if(curCachePtr->status == MS_TRUE) { /* compare bounding polygons and check for duplicates */
- i = 0; /* Start over with 1st label of next slot */
- } /* p */
+ /*
+ ** Note 1: 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.
+ **
+ ** Note 2: We only check the first label (could be multiples (RFC 77)) since that is *by far* the most common
+ ** use case. Could change in the future but it's not worth the overhead at this point.
+ */
+ if(label_size > 0 && (mindistance != -1) &&
+ (cachePtr->layerindex == curCachePtr->layerindex) &&
+ (cachePtr->classindex == curCachePtr->classindex) &&
+ (strcmp(cachePtr->labels[0].annotext, curCachePtr->labels[0].annotext) == 0) &&
+ (msDistancePointToPoint(&(cachePtr->point), &(curCachePtr->point)) <= (mindistance + label_size))) { /* label is a duplicate */
+ cachePtr->status = MS_FALSE;
+ return;
+ }
+
+ if(intersectLabelPolygons(cacheslot->labels[i].poly, cachePtr->poly) == MS_TRUE) { /* polys intersect */
+ cachePtr->status = MS_FALSE;
+ return;
+ }
+ }
+ } /* i */
+
+ i = 0; /* Start over with 1st label of next slot */
+ } /* p */
}
-
/* msGetLabelCacheMember()
**
** Returns label cache members by index, making all members of the cache
Modified: sandbox/sdlime/rfc-77/mapserver.h
===================================================================
--- sandbox/sdlime/rfc-77/mapserver.h 2012-02-05 01:06:25 UTC (rev 13040)
+++ sandbox/sdlime/rfc-77/mapserver.h 2012-02-05 18:55:12 UTC (rev 13041)
@@ -1064,7 +1064,6 @@
%immutable;
#endif /* SWIG */
typedef struct {
- char *text; /* RFC 77: remove */
double featuresize;
styleObj *styles; /* copied from the classObj, only present if there is a marker to be drawn */
More information about the mapserver-commits
mailing list