This commit is contained in:
Artem Pavlenko 2012-01-26 16:24:48 +00:00
parent 5c6fdc780f
commit 5ebdd84940

View File

@ -402,23 +402,23 @@ bool text_placement_info_simple::next_position_only()
break;
case NORTHEAST:
displacement = boost::make_tuple(
abs(pdisp.get<0>()),
-abs(pdisp.get<1>()));
abs(pdisp.get<0>()),
-abs(pdisp.get<1>()));
break;
case SOUTHEAST:
displacement = boost::make_tuple(
abs(pdisp.get<0>()),
abs(pdisp.get<1>()));
abs(pdisp.get<0>()),
abs(pdisp.get<1>()));
break;
case NORTHWEST:
displacement = boost::make_tuple(
-abs(pdisp.get<0>()),
-abs(pdisp.get<1>()));
-abs(pdisp.get<0>()),
-abs(pdisp.get<1>()));
break;
case SOUTHWEST:
displacement = boost::make_tuple(
-abs(pdisp.get<0>()),
abs(pdisp.get<1>()));
-abs(pdisp.get<0>()),
abs(pdisp.get<1>()));
break;
default:
std::cerr << "WARNING: Unknown placement\n";
@ -433,16 +433,16 @@ text_placement_info_ptr text_placements_simple::get_placement_info() const
}
/** Position string: [POS][SIZE]
* [POS] is any combination of
* N, E, S, W, NE, SE, NW, SW, X (exact position) (separated by commas)
* [SIZE] is a list of font sizes, separated by commas. The first font size
* is always the one given in the TextSymbolizer's parameters.
* First all directions are tried, then font size is reduced
* and all directions are tried again. The process ends when a placement is
* found or the last fontsize is tried without success.
* Example: N,S,15,10,8 (tries placement above, then below and if
* that fails it tries the additional font sizes 15, 10 and 8.
*/
* [POS] is any combination of
* N, E, S, W, NE, SE, NW, SW, X (exact position) (separated by commas)
* [SIZE] is a list of font sizes, separated by commas. The first font size
* is always the one given in the TextSymbolizer's parameters.
* First all directions are tried, then font size is reduced
* and all directions are tried again. The process ends when a placement is
* found or the last fontsize is tried without success.
* Example: N,S,15,10,8 (tries placement above, then below and if
* that fails it tries the additional font sizes 15, 10 and 8.
*/
void text_placements_simple::set_positions(std::string positions)
{
positions_ = positions;
@ -460,16 +460,16 @@ void text_placements_simple::set_positions(std::string positions)
("NW", NORTHWEST)
("SW", SOUTHWEST)
("X" , EXACT_POSITION)
;
;
}
} direction_name;
std::string::iterator first = positions.begin(), last = positions.end();
qi::phrase_parse(first, last,
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> qi::float_[push_back(phoenix::ref(text_sizes_), _1)]),
space
);
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> qi::float_[push_back(phoenix::ref(text_sizes_), _1)]),
space
);
if (first != last) {
std::cerr << "WARNING: Could not parse text_placement_simple placement string ('" << positions << "').\n";
}