Add dummy functions for line placements and reenable line placement code in symbolizer helpers.

This commit is contained in:
Hermann Kraus 2012-08-02 00:37:43 +02:00
parent f2e2483109
commit 984f136351
3 changed files with 46 additions and 8 deletions

View file

@ -99,7 +99,13 @@ public:
/** Try to place a single label at the given point. */ /** Try to place a single label at the given point. */
glyph_positions_ptr find_point_placement(pixel_position pos); glyph_positions_ptr find_point_placement(pixel_position pos);
/** Iterate over the given path, placing line-following labels with respect to label_spacing. */
template <typename T>
glyph_positions_ptr find_line_placements(T & path);
/** Iterate over the given path, placing point labels with respect to label_spacing. */
template <typename T>
glyph_positions_ptr find_point_on_line_placements(T & path);
/** Try next position alternative from placement_info. */
bool next_position(); bool next_position();
private: private:
void init_alignment(); void init_alignment();

View file

@ -76,28 +76,33 @@ glyph_positions_ptr text_symbolizer_helper<FaceManagerT, DetectorT>::next_line_p
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type; typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
clipped_geometry_type clipped(**geo_itr_); clipped_geometry_type clipped(**geo_itr_);
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy()); clipped.clip_box(query_extent_.minx(), query_extent_.miny(),
query_extent_.maxx(), query_extent_.maxy());
path_type path(t_, clipped, prj_trans_); path_type path(t_, clipped, prj_trans_);
#if 0 glyph_positions_ptr glyphs;
if (points_on_line_) { if (points_on_line_) {
finder_->find_point_placements(path); #if 0
finder_.find_point_on_line_placements(path);
#endif
} else { } else {
finder_->find_line_placements(path); glyphs = finder_.find_line_placements(path);
} }
if (!finder_->get_results().empty()) if (glyphs)
{ {
//Found a placement //Found a placement
#if 0
if (points_on_line_) if (points_on_line_)
{ {
finder_->update_detector(); finder_->update_detector();
} }
geo_itr_ = geometries_to_process_.erase(geo_itr_); geo_itr_ = geometries_to_process_.erase(geo_itr_);
if (writer_.first) writer_.first->add_text( if (writer_.first) writer_.first->add_text(
finder_->get_results(), finder_->get_extents(), finder_->get_results(), finder_->get_extents(),
feature_, t_, writer_.second); feature_, t_, writer_.second);
return true; #endif
return glyphs;
} }
#endif
//No placement for this geometry. Keep it in geometries_to_process_ for next try. //No placement for this geometry. Keep it in geometries_to_process_ for next try.
geo_itr_++; geo_itr_++;
} }

View file

@ -25,10 +25,14 @@
#include <mapnik/text_properties.hpp> #include <mapnik/text_properties.hpp>
#include <mapnik/debug.hpp> #include <mapnik/debug.hpp>
#include <mapnik/label_collision_detector.hpp> #include <mapnik/label_collision_detector.hpp>
#include <mapnik/ctrans.hpp>
//boost //boost
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
// agg
#include "agg_conv_clip_polyline.h"
namespace mapnik namespace mapnik
{ {
@ -217,6 +221,19 @@ glyph_positions_ptr placement_finder_ng::find_point_placement(pixel_position pos
} }
template <typename T>
glyph_positions_ptr placement_finder_ng::find_point_on_line_placements(T & path)
{
return glyph_positions_ptr();
}
template <typename T>
glyph_positions_ptr placement_finder_ng::find_line_placements(T & path)
{
return glyph_positions_ptr();
}
/*********************************************************************************************/ /*********************************************************************************************/
@ -270,4 +287,14 @@ void glyph_positions::set_base_point(pixel_position base_point)
} }
/*************************************************************************************/
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
typedef coord_transform<CoordTransform,clipped_geometry_type> ClippedPathType;
typedef coord_transform<CoordTransform,geometry_type> PathType;
template glyph_positions_ptr placement_finder_ng::find_point_on_line_placements<ClippedPathType>(ClippedPathType &);
template glyph_positions_ptr placement_finder_ng::find_line_placements<ClippedPathType>(ClippedPathType &);
template glyph_positions_ptr placement_finder_ng::find_point_on_line_placements<PathType>(PathType &);
template glyph_positions_ptr placement_finder_ng::find_line_placements<PathType>(PathType &);
}// ns mapnik }// ns mapnik