[mapserver-commits] r13052 - sandbox/sdlime/rfc-77
svn at osgeo.org
svn at osgeo.org
Mon Feb 6 10:48:55 EST 2012
Author: sdlime
Date: 2012-02-06 07:48:55 -0800 (Mon, 06 Feb 2012)
New Revision: 13052
Modified:
sandbox/sdlime/rfc-77/mapfile.c
sandbox/sdlime/rfc-77/maplabel.c
sandbox/sdlime/rfc-77/maputil.c
Log:
Activated label expressions. Moved label scale checking to msShapeGetAnnotation() (from msAddLabel())...
Modified: sandbox/sdlime/rfc-77/mapfile.c
===================================================================
--- sandbox/sdlime/rfc-77/mapfile.c 2012-02-06 14:35:33 UTC (rev 13051)
+++ sandbox/sdlime/rfc-77/mapfile.c 2012-02-06 15:48:55 UTC (rev 13052)
@@ -1748,6 +1748,14 @@
case(EOF):
msSetError(MS_EOFERR, NULL, "loadLabel()");
return(-1);
+ case(EXPRESSION):
+ if(loadExpression(&(label->expression)) == -1) return(-1); /* loadExpression() cleans up previously allocated expression */
+ if(msyysource == MS_URL_TOKENS) {
+ msSetError(MS_MISCERR, "URL-based EXPRESSION configuration failed pattern validation." , "loadClass()");
+ freeExpression(&(label->expression));
+ return(-1);
+ }
+ break;
case(FONT):
#if defined (USE_GD_TTF) || defined (USE_GD_FT)
if((symbol = getSymbol(2, MS_STRING, MS_BINDING)) == -1)
@@ -1908,6 +1916,7 @@
if(loadExpression(&(label->text)) == -1) return(-1); /* loadExpression() cleans up previously allocated expression */
if(msyysource == MS_URL_TOKENS) {
msSetError(MS_MISCERR, "URL-based TEXT configuration not supported for labels." , "loadLabel()");
+ freeExpression(&(label->text));
return(-1);
}
if((label->text.type != MS_STRING) && (label->text.type != MS_EXPRESSION)) {
Modified: sandbox/sdlime/rfc-77/maplabel.c
===================================================================
--- sandbox/sdlime/rfc-77/maplabel.c 2012-02-06 14:35:33 UTC (rev 13051)
+++ sandbox/sdlime/rfc-77/maplabel.c 2012-02-06 15:48:55 UTC (rev 13052)
@@ -322,17 +322,6 @@
return msAddLabel(map, classPtr->labels[0], layerindex, classindex, shape, point, NULL, featuresize);
}
- // if( label == NULL )
- // label = &(classPtr->label);
-
- // RFC 77 TODO : could happen in msShapeGetAnnotation() or move to the numtext/numlabels loops below
- // if(map->scaledenom > 0) {
- // if((label->maxscaledenom != -1) && (map->scaledenom >= label->maxscaledenom))
- // return(MS_SUCCESS);
- // if((label->minscaledenom != -1) && (map->scaledenom < label->minscaledenom))
- // return(MS_SUCCESS);
- // }
-
/* Validate label priority value and get ref on label cache for it */
priority = classPtr->labels[0]->priority; /* take priority from the first label */
if (priority < 1)
@@ -473,13 +462,6 @@
// if( label == NULL )
// label = &(classPtr->label);
- if(map->scaledenom > 0) {
- if((label->maxscaledenom != -1) && (map->scaledenom >= label->maxscaledenom))
- return(MS_SUCCESS);
- if((label->minscaledenom != -1) && (map->scaledenom < label->minscaledenom))
- return(MS_SUCCESS);
- }
-
/* Validate label priority value and get ref on label cache for it */
if (label->priority < 1)
label->priority = 1;
Modified: sandbox/sdlime/rfc-77/maputil.c
===================================================================
--- sandbox/sdlime/rfc-77/maputil.c 2012-02-06 14:35:33 UTC (rev 13051)
+++ sandbox/sdlime/rfc-77/maputil.c 2012-02-06 15:48:55 UTC (rev 13052)
@@ -645,8 +645,20 @@
for(j=0; j<layer->class[i]->numlabels; j++) {
layer->class[i]->labels[j]->status = MS_ON;
- /* RFC 77 TODO: will evaluate label scale limits here... */
- /* RFC 77 TODO: will evaluate label expressions here... */
+ if(layer->map->scaledenom > 0) {
+ if((layer->class[i]->labels[j]->maxscaledenom != -1) && (layer->map->scaledenom >= layer->class[i]->labels[j]->maxscaledenom)) {
+ layer->class[i]->labels[j]->status = MS_OFF;
+ continue; /* next label */
+ }
+ if((layer->class[i]->labels[j]->minscaledenom != -1) && (layer->map->scaledenom < layer->class[i]->labels[j]->minscaledenom)) {
+ layer->class[i]->labels[j]->status = MS_OFF;
+ continue; /* next label */
+ }
+ }
+ if(msEvalExpression(layer, shape, &(layer->class[i]->labels[j]->expression), -1) != MS_TRUE) {
+ layer->class[i]->labels[j]->status = MS_OFF;
+ continue; /* next label */
+ }
msFree(layer->class[i]->labels[j]->annotext);
layer->class[i]->labels[j]->annotext = NULL;
More information about the mapserver-commits
mailing list