Handle additional boxes from ShieldSymbolizer.

This commit is contained in:
Hermann Kraus 2012-01-29 20:28:32 +01:00
parent 16e5fefb4d
commit 49225d7468
3 changed files with 17 additions and 14 deletions

View file

@ -172,9 +172,15 @@ public:
//Output by placement finder
/** Bounding box of all texts placed. */
box2d<double> extents;
/** Additional boxes to take into account when finding placement.
* Used for finding line placements where multiple placements are returned.
* Boxes are relative to starting point of current placement.
*/
std::vector<box2d<double> > additional_boxes;
/* TODO */
std::queue< box2d<double> > envelopes;
/* TODO */
/** Used to return all placements found. */
boost::ptr_vector<text_path> placements;
};

View file

@ -458,12 +458,10 @@ void placement_finder<DetectorT>::find_point_placement(double label_x, double la
x += cwidth; // move position to next character
}
#if 0
//TODO
// check the placement of any additional envelopes
if (!p.allow_overlap && !p.additional_boxes.empty())
if (!p.allow_overlap && !pi.additional_boxes.empty())
{
BOOST_FOREACH(box2d<double> box, p.additional_boxes)
BOOST_FOREACH(box2d<double> box, pi.additional_boxes)
{
box2d<double> pt(box.minx() + current_placement->starting_x,
box.miny() + current_placement->starting_y,
@ -476,7 +474,6 @@ void placement_finder<DetectorT>::find_point_placement(double label_x, double la
c_envelopes.push(pt);
}
}
#endif
// since there was no early exit, add the character envelopes to the placements' envelopes
while( !c_envelopes.empty() )

View file

@ -262,15 +262,15 @@ text_placement_info_ptr shield_symbolizer_helper<FaceManagerT, DetectorT>::get_p
template <typename FaceManagerT, typename DetectorT>
text_placement_info_ptr shield_symbolizer_helper<FaceManagerT, DetectorT>::get_line_placement()
{
#if 0
TODO: Not supported by placement_finder atm
position const& pos = placement_->properties.displacement;
text_placement.additional_boxes.push_back(
box2d<double>(-0.5 * label_ext.width() - pos.first,
-0.5 * label_ext.height() - pos.second,
0.5 * label_ext.width() - pos.first,
0.5 * label_ext.height() - pos.second));
#endif
placement_->additional_boxes.push_back(
/*TODO: I'm not sure this is correct. It's what the old code did, but
I think transfroms can make the marker non-centered.
*/
box2d<double>(-0.5 * marker_ext_.width() - pos.first,
-0.5 * marker_ext_.height() - pos.second,
0.5 * marker_ext_.width() - pos.first,
0.5 * marker_ext_.height() - pos.second));
return text_symbolizer_helper<FaceManagerT, DetectorT>::get_line_placement();
}