Permalink
Browse files

restore mixed positions/anglemode enum (was causing backwards incompa…

…tibilities in mapscripts)
  • Loading branch information...
tbonfort committed Oct 14, 2013
1 parent 379f263 commit 73990244c6a5883e5af4f324e7a2d2b0b8e422b1
Showing with 1,917 additions and 1,412 deletions.
  1. +2 −2 mapdraw.c
  2. +3 −5 mapfile.c
  3. +1,898 −1,389 maplexer.c
  4. +2 −2 maplexer.l
  5. +4 −4 mapogcsld.c
  6. +2 −2 mapprimitive.c
  7. +4 −4 mapscript/php/php_mapscript.c
  8. +2 −4 mapserver.h
@@ -1603,7 +1603,7 @@ int lineLayerDrawShape(mapObj *map, imageObj *image, layerObj *layer, shapeObj *
msPopulateTextSymbolForLabelAndString(&ts,label,annotext,layer->scalefactor,image->resolutionfactor, layer->labelcache);
if (label->anglemode == MS_ANGLEMODE_FOLLOW) { /* bug #1620 implementation */
if (label->anglemode == MS_FOLLOW) { /* bug #1620 implementation */
struct label_follow_result lfr;
if (!layer->labelcache) {
@@ -2813,7 +2813,7 @@ int msDrawLabelCache(mapObj *map, imageObj *image)
}
/* apply offset and buffer settings */
if(textSymbolPtr->label->anglemode != MS_ANGLEMODE_FOLLOW) {
if(textSymbolPtr->label->anglemode != MS_FOLLOW) {
label_offset_x = textSymbolPtr->label->offsetx * textSymbolPtr->scalefactor;
label_offset_y = textSymbolPtr->label->offsety * textSymbolPtr-> scalefactor;
} else {
@@ -1715,7 +1715,7 @@ void initLabel(labelObj *label)
label->position = MS_CC;
label->angle = 0;
label->anglemode = MS_ANGLEMODE_NONE;
label->anglemode = MS_NONE;
label->minsize = MS_MINFONTSIZE;
label->maxsize = MS_MAXFONTSIZE;
label->buffer = 0;
@@ -1844,7 +1844,7 @@ static int loadLabel(labelObj *label)
for(;;) {
switch(msyylex()) {
case(ANGLE):
if((symbol = getSymbol(5, MS_NUMBER,MS_AUTO,MS_ANGLEMODE_AUTO2,MS_ANGLEMODE_FOLLOW,MS_BINDING)) == -1)
if((symbol = getSymbol(5, MS_NUMBER,MS_AUTO,MS_AUTO2,MS_FOLLOW,MS_BINDING)) == -1)
return(-1);
if(symbol == MS_NUMBER)
@@ -1854,8 +1854,6 @@ static int loadLabel(labelObj *label)
msFree(label->bindings[MS_LABEL_BINDING_ANGLE].item);
label->bindings[MS_LABEL_BINDING_ANGLE].item = msStrdup(msyystring_buffer);
label->numbindings++;
} else if ( symbol == MS_AUTO ) {
label->anglemode = MS_ANGLEMODE_AUTO;
} else {
label->anglemode = symbol;
}
@@ -2139,7 +2137,7 @@ static void writeLabel(FILE *stream, int indent, labelObj *label)
if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_ANGLE].item)
writeAttributeBinding(stream, indent, "ANGLE", &(label->bindings[MS_LABEL_BINDING_ANGLE]));
else writeNumberOrKeyword(stream, indent, "ANGLE", 0, label->angle, label->anglemode, 3, MS_ANGLEMODE_FOLLOW, "FOLLOW", MS_ANGLEMODE_AUTO, "AUTO", MS_ANGLEMODE_AUTO2, "AUTO2");
else writeNumberOrKeyword(stream, indent, "ANGLE", 0, label->angle, label->anglemode, 3, MS_FOLLOW, "FOLLOW", MS_AUTO, "AUTO", MS_AUTO2, "AUTO2");
writeExpression(stream, indent, "EXPRESSION", &(label->expression));
3,287 maplexer.c

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -400,7 +400,7 @@ char path[MS_MAXPATHLEN];
<INITIAL,URL_STRING>annotation { MS_LEXER_RETURN_TOKEN(MS_LAYER_ANNOTATION); }
<INITIAL,URL_STRING>auto { MS_LEXER_RETURN_TOKEN(MS_AUTO); }
<INITIAL,URL_STRING>auto2 { MS_LEXER_RETURN_TOKEN(MS_ANGLEMODE_AUTO2); }
<INITIAL,URL_STRING>auto2 { MS_LEXER_RETURN_TOKEN(MS_AUTO2); }
<INITIAL>bevel { MS_LEXER_RETURN_TOKEN(MS_CJC_BEVEL); }
<INITIAL>bitmap { MS_LEXER_RETURN_TOKEN(MS_BITMAP); }
<INITIAL>butt { MS_LEXER_RETURN_TOKEN(MS_CJC_BUTT); }
@@ -419,7 +419,7 @@ char path[MS_MAXPATHLEN];
<INITIAL,URL_STRING>embed { MS_LEXER_RETURN_TOKEN(MS_EMBED); }
<INITIAL,URL_STRING>false { MS_LEXER_RETURN_TOKEN(MS_FALSE); }
<INITIAL,URL_STRING>feet { MS_LEXER_RETURN_TOKEN(MS_FEET); }
<INITIAL,URL_STRING>follow { MS_LEXER_RETURN_TOKEN(MS_ANGLEMODE_FOLLOW); }
<INITIAL,URL_STRING>follow { MS_LEXER_RETURN_TOKEN(MS_FOLLOW); }
<INITIAL>giant { MS_LEXER_RETURN_TOKEN(MS_GIANT); }
<INITIAL>hatch { MS_LEXER_RETURN_TOKEN(MS_SYMBOL_HATCH); }
<INITIAL>hilite { MS_LEXER_RETURN_TOKEN(MS_HILITE); }
@@ -2669,7 +2669,7 @@ int msSLDParseTextParams(CPLXMLNode *psRoot, layerObj *psLayer,
/*set the angle by default to auto. the angle can be
modified Label Placement #2806*/
psLabelObj->anglemode = MS_ANGLEMODE_AUTO;
psLabelObj->anglemode = MS_AUTO;
/* label */
@@ -3014,13 +3014,13 @@ int ParseTextLinePlacement(CPLXMLNode *psRoot, classObj *psClass)
/*if there is a line placement, we will assume that the
best setting for mapserver would be for the text to follow
the line #2806*/
psLabelObj->anglemode = MS_ANGLEMODE_FOLLOW;
psLabelObj->anglemode = MS_FOLLOW;
/*sld 1.1.0 has a parameter IsAligned. default value is true*/
psAligned = CPLGetXMLNode(psRoot, "IsAligned");
if (psAligned && psAligned->psChild && psAligned->psChild->pszValue &&
strcasecmp(psAligned->psChild->pszValue, "false") == 0) {
psLabelObj->anglemode = MS_ANGLEMODE_NONE;
psLabelObj->anglemode = MS_NONE;
}
psOffset = CPLGetXMLNode(psRoot, "PerpendicularOffset");
if (psOffset && psOffset->psChild && psOffset->psChild->pszValue) {
@@ -3033,7 +3033,7 @@ int ParseTextLinePlacement(CPLXMLNode *psRoot, classObj *psClass)
/* since sld 1.1.0 introduces the IsAligned parameter, only
set the angles if the parameter is not set*/
if (!psAligned) {
psLabelObj->anglemode = MS_ANGLEMODE_NONE;
psLabelObj->anglemode = MS_NONE;
}
}
@@ -1681,9 +1681,9 @@ int msLineLabelPoint(mapObj *map, lineObj *p, textSymbolObj *ts, struct line_len
}
if(label && ts) {
if(label->anglemode != MS_ANGLEMODE_NONE) {
if(label->anglemode != MS_NONE) {
theta = atan2(p->point[j].x - p->point[j-1].x, p->point[j].y - p->point[j-1].y);
if(label->anglemode == MS_ANGLEMODE_AUTO2) {
if(label->anglemode == MS_AUTO2) {
theta -= MS_PI2;
} else { /* AUTO, FOLLOW */
if(p->point[j-1].x < p->point[j].x) { /* i.e. to the left */
@@ -1023,11 +1023,11 @@ PHP_MINIT_FUNCTION(mapscript)
REGISTER_LONG_CONSTANT("MS_UC", MS_UC, const_flag);
REGISTER_LONG_CONSTANT("MS_LC", MS_LC, const_flag);
REGISTER_LONG_CONSTANT("MS_CC", MS_CC, const_flag);
REGISTER_LONG_CONSTANT("MS_AUTO", MS_ANGLEMODE_AUTO, const_flag);
REGISTER_LONG_CONSTANT("MS_AUTO", MS_AUTO, const_flag);
REGISTER_LONG_CONSTANT("MS_XY", MS_XY, const_flag);
REGISTER_LONG_CONSTANT("MS_FOLLOW", MS_ANGLEMODE_FOLLOW, const_flag);
REGISTER_LONG_CONSTANT("MS_AUTO2", MS_ANGLEMODE_AUTO2, const_flag);
REGISTER_LONG_CONSTANT("MS_NONE", MS_ANGLEMODE_NONE, const_flag);
REGISTER_LONG_CONSTANT("MS_FOLLOW", MS_FOLLOW, const_flag);
REGISTER_LONG_CONSTANT("MS_AUTO2", MS_AUTO2, const_flag);
REGISTER_LONG_CONSTANT("MS_NONE", MS_NONE, const_flag);
/* alignment constants*/
REGISTER_LONG_CONSTANT("MS_ALIGN_LEFT", MS_ALIGN_LEFT, const_flag);
@@ -482,9 +482,7 @@ extern "C" {
enum MS_FONT_TYPE {MS_TRUETYPE, MS_BITMAP};
#define MS_POSITIONS_LENGTH 14
enum MS_POSITIONS_ENUM {MS_UL=101, MS_LR, MS_UR, MS_LL, MS_CR, MS_CL, MS_UC, MS_LC, MS_CC, MS_AUTO, MS_XY}; /* Added MS_FOLLOW for bug #1620 implementation. */
enum MS_LABEL_ANGLEMODE{MS_ANGLEMODE_NONE,MS_ANGLEMODE_AUTO,MS_ANGLEMODE_AUTO2,MS_ANGLEMODE_FOLLOW};
enum MS_POSITIONS_ENUM {MS_UL=101, MS_LR, MS_UR, MS_LL, MS_CR, MS_CL, MS_UC, MS_LC, MS_CC, MS_AUTO, MS_XY, MS_NONE, MS_AUTO2,MS_FOLLOW};
#define MS_TINY 5
#define MS_SMALL 7
#define MS_MEDIUM 10
@@ -1021,7 +1019,7 @@ extern "C" {
int offsetx, offsety;
double angle;
enum MS_LABEL_ANGLEMODE anglemode;
enum MS_POSITIONS_ENUM anglemode;
int buffer; /* space to reserve around a label */

0 comments on commit 7399024

Please sign in to comment.