Skip to content

Commit

Permalink
Remove find_placements, build_path_follow, build_path_horizontal.
Browse files Browse the repository at this point in the history
Add new find_point_placements to cover the gap left.
Change shield symbolizer to use find_point_placements.
Results are the same as before, but with much less duplicate code.
  • Loading branch information
nehhen committed Jan 24, 2008
1 parent f11a62b commit 5bbe90b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 412 deletions.
22 changes: 9 additions & 13 deletions include/mapnik/placement_finder.hpp
Expand Up @@ -87,26 +87,21 @@ namespace mapnik
public:
placement_finder(DetectorT & detector);

template <typename T>
void find_placements(placement & p, T & path);

//Try place a single label at the given point
void find_point_placement(placement & p, double, double);

//Iterate over the given path, placing point labels with respect to label_spacing
template <typename T>
void find_line_placement(placement & p, T & path);
void find_point_placements(placement & p, T & path);

void clear();

private:
//Iterate over the given path, placing line-following labels with respect to label_spacing
template <typename T>
bool build_path_follow(placement & p, double target_distance, T & path);
void find_line_placements(placement & p, T & path);

template <typename T>
bool build_path_horizontal(placement & p, double target_distance, T & path);

void get_ideal_placements(placement & p, double distance, std::vector<double>&);
void clear();

//Helpers for find_line_placement
private:
///Helpers for find_line_placement

///Returns a possible placement on the given line, does not test for collisions
//index: index of the node the current line ends on
Expand All @@ -133,6 +128,7 @@ namespace mapnik
const double &x1, const double &y1, const double &x2, const double &y2,
double &ix, double &iy);

///General Internals

void update_detector(placement & p);

Expand Down
4 changes: 2 additions & 2 deletions src/agg_renderer.cpp
Expand Up @@ -464,7 +464,7 @@ namespace mapnik
path_type path(t_,geom,prj_trans);
placement text_placement(info, sym);
text_placement.avoid_edges = sym.get_avoid_edges();
finder.find_placements<path_type>(text_placement,path);
finder.find_point_placements<path_type>(text_placement,path);

for (unsigned int ii = 0; ii < text_placement.placements.size(); ++ ii)
{
Expand Down Expand Up @@ -683,7 +683,7 @@ namespace mapnik
}
else //LINE_PLACEMENT
{
finder.find_line_placement<path_type>(text_placement,path);
finder.find_line_placements<path_type>(text_placement,path);
}

for (unsigned int ii = 0; ii < text_placement.placements.size(); ++ii)
Expand Down

0 comments on commit 5bbe90b

Please sign in to comment.