Permalink
Browse files

fix cgi label commands after multi-label changes (#4621)

  • Loading branch information...
1 parent 484e28c commit 6e9dec9f2fe59edf3409a345f37be2f6b4c79535 @tbonfort tbonfort committed Apr 3, 2013
Showing with 1,648 additions and 1,146 deletions.
  1. +5 −0 MIGRATION_GUIDE.txt
  2. +25 −13 mapfile.c
  3. +1,614 −1,129 maplexer.c
  4. +1 −1 maplexer.l
  5. +1 −1 mapscript/php/mapscript_i.c
  6. +1 −1 mapscript/swiginc/label.i
  7. +1 −1 mapserver.h
View
@@ -33,6 +33,11 @@ CGI Changes
-----------
* Changing MIN/MAXSCALE or MIN/MAXSCALEDENOM via URL is no longer supported.
+* The syntax for changing a LABEL with CGI commands has changed along with the
+ ability to support multiple labels
+ The previous syntax ...&map.layer[0].class[0]=label+color+255+0+0+end&... is
+ replaced with ...&map.layer[0].class[0].label[0]=color+255+0+0&...
+ Note that cgi label modifications are/were broken in 6.2.0 and fixed in 6.2.1
-----------------
Rendering changes
View
@@ -2051,13 +2051,17 @@ static int loadLabel(labelObj *label)
} /* next token */
}
-int msUpdateLabelFromString(labelObj *label, char *string)
+int msUpdateLabelFromString(labelObj *label, char *string, int url_string)
{
if(!label || !string) return MS_FAILURE;
msAcquireLock( TLOCK_PARSER );
+
+ if(url_string)
+ msyystate = MS_TOKENIZE_URL_STRING;
+ else
+ msyystate = MS_TOKENIZE_STRING;
- msyystate = MS_TOKENIZE_STRING;
msyystring = string;
msyylex(); /* sets things up, but doesn't process any tokens */
@@ -6189,17 +6193,25 @@ int msUpdateMapFromURL(mapObj *map, char *variable, char *string)
if(msLookupHashTable(&(GET_LAYER(map, i)->class[j]->validation), "immutable"))
return(MS_SUCCESS); /* fail silently */
- if(msyylex() == STYLE) {
- if(getInteger(&k) == -1) return MS_FAILURE;
-
- if(k>=GET_LAYER(map, i)->class[j]->numstyles || k<0) {
- msSetError(MS_MISCERR, "Style to be modified not valid.", "msUpdateMapFromURL()");
- return MS_FAILURE;
- }
-
- if(msUpdateStyleFromString((GET_LAYER(map, i))->class[j]->styles[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
- } else {
- if(msUpdateClassFromString((GET_LAYER(map, i))->class[j], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
+ switch(msyylex()) {
+ case STYLE:
+ if(getInteger(&k) == -1) return MS_FAILURE;
+ if(k>=GET_LAYER(map, i)->class[j]->numstyles || k<0) {
+ msSetError(MS_MISCERR, "Style to be modified not valid.", "msUpdateMapFromURL()");
+ return MS_FAILURE;
+ }
+ if(msUpdateStyleFromString((GET_LAYER(map, i))->class[j]->styles[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
+ break;
+ case LABEL:
+ if(getInteger(&k) == -1) return MS_FAILURE;
+ if(k>=GET_LAYER(map, i)->class[j]->numlabels || k<0) {
+ msSetError(MS_MISCERR, "Label to be modified not valid.", "msUpdateMapFromURL()");
+ return MS_FAILURE;
+ }
+ if(msUpdateLabelFromString((GET_LAYER(map, i))->class[j]->labels[k], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
+ break;
+ default:
+ if(msUpdateClassFromString((GET_LAYER(map, i))->class[j], string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
}
} else {
if(msUpdateLayerFromString((GET_LAYER(map, i)), string, MS_TRUE) != MS_SUCCESS) return MS_FAILURE;
Oops, something went wrong.

0 comments on commit 6e9dec9

Please sign in to comment.