Update text_placement_info_simple to use new functions and locations.

This commit is contained in:
Hermann Kraus 2012-01-22 03:23:27 +01:00
parent 7d01f509ab
commit cae0c31ee8

View file

@ -373,56 +373,64 @@ void text_placement_info::init(double scale_factor_,
bool text_placement_info_simple::next() bool text_placement_info_simple::next()
{ {
position_state = 0; while (1) {
if (state == 0) { if (state == 0) {
text_size = parent_->text_size_; properties.processor.defaults.text_size = parent_->properties.processor.defaults.text_size;
} else { } else {
if (state > parent_->text_sizes_.size()) return false; if (state > parent_->text_sizes_.size()) return false;
text_size = parent_->text_sizes_[state-1]; properties.processor.defaults.text_size = parent_->text_sizes_[state-1];
} }
if (!next_position_only()) {
state++; state++;
position_state = 0;
} else {
break;
}
}
return true; return true;
} }
bool text_placement_info_simple::next_position_only() bool text_placement_info_simple::next_position_only()
{ {
const position &pdisp = parent_->properties.displacement;
position &displacement = properties.displacement;
if (position_state >= parent_->direction_.size()) return false; if (position_state >= parent_->direction_.size()) return false;
directions_t dir = parent_->direction_[position_state]; directions_t dir = parent_->direction_[position_state];
switch (dir) { switch (dir) {
case EXACT_POSITION: case EXACT_POSITION:
displacement = parent_->displacement_; displacement = pdisp;
break; break;
case NORTH: case NORTH:
displacement = boost::make_tuple(0, -abs(parent_->displacement_.get<1>())); displacement = boost::make_tuple(0, -abs(pdisp.get<1>()));
break; break;
case EAST: case EAST:
displacement = boost::make_tuple(abs(parent_->displacement_.get<0>()), 0); displacement = boost::make_tuple(abs(pdisp.get<0>()), 0);
break; break;
case SOUTH: case SOUTH:
displacement = boost::make_tuple(0, abs(parent_->displacement_.get<1>())); displacement = boost::make_tuple(0, abs(pdisp.get<1>()));
break; break;
case WEST: case WEST:
displacement = boost::make_tuple(-abs(parent_->displacement_.get<0>()), 0); displacement = boost::make_tuple(-abs(pdisp.get<0>()), 0);
break; break;
case NORTHEAST: case NORTHEAST:
displacement = boost::make_tuple( displacement = boost::make_tuple(
abs(parent_->displacement_.get<0>()), abs(pdisp.get<0>()),
-abs(parent_->displacement_.get<1>())); -abs(pdisp.get<1>()));
break; break;
case SOUTHEAST: case SOUTHEAST:
displacement = boost::make_tuple( displacement = boost::make_tuple(
abs(parent_->displacement_.get<0>()), abs(pdisp.get<0>()),
abs(parent_->displacement_.get<1>())); abs(pdisp.get<1>()));
break; break;
case NORTHWEST: case NORTHWEST:
displacement = boost::make_tuple( displacement = boost::make_tuple(
-abs(parent_->displacement_.get<0>()), -abs(pdisp.get<0>()),
-abs(parent_->displacement_.get<1>())); -abs(pdisp.get<1>()));
break; break;
case SOUTHWEST: case SOUTHWEST:
displacement = boost::make_tuple( displacement = boost::make_tuple(
-abs(parent_->displacement_.get<0>()), -abs(pdisp.get<0>()),
abs(parent_->displacement_.get<1>())); abs(pdisp.get<1>()));
break; break;
default: default:
std::cerr << "WARNING: Unknown placement\n"; std::cerr << "WARNING: Unknown placement\n";
@ -431,7 +439,6 @@ bool text_placement_info_simple::next_position_only()
return true; return true;
} }
text_placement_info_ptr text_placements_simple::get_placement_info() const text_placement_info_ptr text_placements_simple::get_placement_info() const
{ {
return text_placement_info_ptr(new text_placement_info_simple(this)); return text_placement_info_ptr(new text_placement_info_simple(this));