/ ParseTextLinePlacement */ / Lineplacement node fro the text symbolizer. */ /
| 3161 | /* Lineplacement node fro the text symbolizer. */ |
| 3162 | /************************************************************************/ |
| 3163 | int ParseTextLinePlacement(CPLXMLNode *psRoot, classObj *psClass) |
| 3164 | { |
| 3165 | CPLXMLNode *psOffset = NULL, *psAligned=NULL; |
| 3166 | |
| 3167 | if (!psRoot || !psClass) |
| 3168 | return MS_FAILURE; |
| 3169 | |
| 3170 | /*if there is a line placement, we will assume that the |
| 3171 | best setting for mapserver would be for the text to follow |
| 3172 | the line #2806*/ |
| 3173 | psClass->label.anglemode = MS_FOLLOW; |
| 3174 | |
| 3175 | /*sld 1.1.0 has a parameter IsAligned. default value is true*/ |
| 3176 | psAligned = CPLGetXMLNode(psRoot, "IsAligned"); |
| 3177 | if (psAligned && psAligned->psChild && psAligned->psChild->pszValue && |
| 3178 | strcasecmp(psAligned->psChild->pszValue, "false") == 0) |
| 3179 | { |
| 3180 | psClass->label.anglemode = MS_NONE; |
| 3181 | } |
| 3182 | psOffset = CPLGetXMLNode(psRoot, "PerpendicularOffset"); |
| 3183 | if (psOffset && psOffset->psChild && psOffset->psChild->pszValue) |
| 3184 | { |
| 3185 | psClass->label.offsetx = atoi(psOffset->psChild->pszValue); |
| 3186 | psClass->label.offsety = atoi(psOffset->psChild->pszValue); |
| 3187 | |
| 3188 | /*if there is a PerpendicularOffset, we will assume that the |
| 3189 | best setting for mapserver would be to use angle=0 and the |
| 3190 | the offset #2806*/ |
| 3191 | /* since sld 1.1.0 introduces the IsAligned parameter, only |
| 3192 | set the angles if the parameter is not set*/ |
| 3193 | if (!psAligned) |
| 3194 | { |
| 3195 | psClass->label.anglemode = MS_NONE; |
| 3196 | } |
| 3197 | } |
| 3198 | |
| 3199 | return MS_SUCCESS; |
| 3200 | } |
| 3201 | |
| 3202 | |
| 3203 | /************************************************************************/ |
no test coverage detected