Add init_alignment() function.
This commit is contained in:
parent
716dd1c79e
commit
6b3810c9b0
2 changed files with 55 additions and 0 deletions
|
@ -101,6 +101,7 @@ public:
|
||||||
|
|
||||||
bool next_position();
|
bool next_position();
|
||||||
private:
|
private:
|
||||||
|
void init_alignment();
|
||||||
Feature const& feature_;
|
Feature const& feature_;
|
||||||
DetectorType const& detector_;
|
DetectorType const& detector_;
|
||||||
box2d<double> const& extent_;
|
box2d<double> const& extent_;
|
||||||
|
@ -108,6 +109,10 @@ private:
|
||||||
text_layout layout_;
|
text_layout layout_;
|
||||||
text_placement_info_ptr info_;
|
text_placement_info_ptr info_;
|
||||||
bool valid_;
|
bool valid_;
|
||||||
|
|
||||||
|
vertical_alignment_e valign_;
|
||||||
|
horizontal_alignment_e halign_;
|
||||||
|
justify_alignment_e jalign_;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<placement_finder_ng> placement_finder_ng_ptr;
|
typedef boost::shared_ptr<placement_finder_ng> placement_finder_ng_ptr;
|
||||||
|
|
|
@ -68,10 +68,60 @@ bool placement_finder_ng::next_position()
|
||||||
} else {
|
} else {
|
||||||
angle_ = 0.0;
|
angle_ = 0.0;
|
||||||
}
|
}
|
||||||
|
init_alignment();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void placement_finder_ng::init_alignment()
|
||||||
|
{
|
||||||
|
text_symbolizer_properties const& p = info_->properties;
|
||||||
|
valign_ = p.valign;
|
||||||
|
if (valign_ == V_AUTO)
|
||||||
|
{
|
||||||
|
if (p.displacement.second > 0.0)
|
||||||
|
{
|
||||||
|
valign_ = V_BOTTOM;
|
||||||
|
} else if (p.displacement.second < 0.0)
|
||||||
|
{
|
||||||
|
valign_ = V_TOP;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
valign_ = V_MIDDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
halign_ = p.halign;
|
||||||
|
if (halign_ == H_AUTO)
|
||||||
|
{
|
||||||
|
if (p.displacement.first > 0.0)
|
||||||
|
{
|
||||||
|
halign_ = H_RIGHT;
|
||||||
|
} else if (p.displacement.first < 0.0)
|
||||||
|
{
|
||||||
|
halign_ = H_LEFT;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
halign_ = H_MIDDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jalign_ = p.jalign;
|
||||||
|
if (jalign_ == J_AUTO)
|
||||||
|
{
|
||||||
|
if (p.displacement.first > 0.0)
|
||||||
|
{
|
||||||
|
jalign_ = J_LEFT;
|
||||||
|
} else if (p.displacement.first < 0.0)
|
||||||
|
{
|
||||||
|
jalign_ = J_RIGHT;
|
||||||
|
} else {
|
||||||
|
jalign_ = J_MIDDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
glyph_positions::glyph_positions()
|
glyph_positions::glyph_positions()
|
||||||
: base_point_(), const_angle_(true)
|
: base_point_(), const_angle_(true)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue