From 984f1363518ace8deb4c9f0574e17520662b3258 Mon Sep 17 00:00:00 2001 From: Hermann Kraus Date: Thu, 2 Aug 2012 00:37:43 +0200 Subject: [PATCH] Add dummy functions for line placements and reenable line placement code in symbolizer helpers. --- include/mapnik/text/placement_finder_ng.hpp | 8 +++++- src/symbolizer_helpers.cpp | 19 +++++++++------ src/text/placement_finder_ng.cpp | 27 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/include/mapnik/text/placement_finder_ng.hpp b/include/mapnik/text/placement_finder_ng.hpp index e74f621f5..59b5e23d4 100644 --- a/include/mapnik/text/placement_finder_ng.hpp +++ b/include/mapnik/text/placement_finder_ng.hpp @@ -99,7 +99,13 @@ public: /** Try to place a single label at the given point. */ glyph_positions_ptr find_point_placement(pixel_position pos); - + /** Iterate over the given path, placing line-following labels with respect to label_spacing. */ + template + glyph_positions_ptr find_line_placements(T & path); + /** Iterate over the given path, placing point labels with respect to label_spacing. */ + template + glyph_positions_ptr find_point_on_line_placements(T & path); + /** Try next position alternative from placement_info. */ bool next_position(); private: void init_alignment(); diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 07e4eced6..12f2a4402 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -76,28 +76,33 @@ glyph_positions_ptr text_symbolizer_helper::next_line_p typedef coord_transform path_type; 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_); -#if 0 + glyph_positions_ptr glyphs; if (points_on_line_) { - finder_->find_point_placements(path); +#if 0 + finder_.find_point_on_line_placements(path); +#endif } else { - finder_->find_line_placements(path); + glyphs = finder_.find_line_placements(path); } - if (!finder_->get_results().empty()) + if (glyphs) { //Found a placement +#if 0 if (points_on_line_) { finder_->update_detector(); } + geo_itr_ = geometries_to_process_.erase(geo_itr_); if (writer_.first) writer_.first->add_text( finder_->get_results(), finder_->get_extents(), feature_, t_, writer_.second); - return true; + #endif + return glyphs; } -#endif //No placement for this geometry. Keep it in geometries_to_process_ for next try. geo_itr_++; } diff --git a/src/text/placement_finder_ng.cpp b/src/text/placement_finder_ng.cpp index ad1a26715..0cbbeaae5 100644 --- a/src/text/placement_finder_ng.cpp +++ b/src/text/placement_finder_ng.cpp @@ -25,10 +25,14 @@ #include #include #include +#include //boost #include +// agg +#include "agg_conv_clip_polyline.h" + namespace mapnik { @@ -217,6 +221,19 @@ glyph_positions_ptr placement_finder_ng::find_point_placement(pixel_position pos } +template +glyph_positions_ptr placement_finder_ng::find_point_on_line_placements(T & path) +{ + return glyph_positions_ptr(); +} + +template +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 clipped_geometry_type; +typedef coord_transform ClippedPathType; +typedef coord_transform PathType; +template glyph_positions_ptr placement_finder_ng::find_point_on_line_placements(ClippedPathType &); +template glyph_positions_ptr placement_finder_ng::find_line_placements(ClippedPathType &); +template glyph_positions_ptr placement_finder_ng::find_point_on_line_placements(PathType &); +template glyph_positions_ptr placement_finder_ng::find_line_placements(PathType &); + + }// ns mapnik