From ff44b535830d0230045adf3056b483a75003f642 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 26 Jan 2012 16:25:26 +0000 Subject: [PATCH] use geometries_to_process --- include/mapnik/symbolizer_helpers.hpp | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/mapnik/symbolizer_helpers.hpp b/include/mapnik/symbolizer_helpers.hpp index e471bb026..00db41f0f 100644 --- a/include/mapnik/symbolizer_helpers.hpp +++ b/include/mapnik/symbolizer_helpers.hpp @@ -29,7 +29,7 @@ #include #include - +#include namespace mapnik { @@ -58,7 +58,8 @@ public: Feature const& feature, proj_transform const& prj_trans); private: - bool initialize_geometries(text_symbolizer const& sym, + bool initialize_geometries(std::vector & geometries_to_process, + text_symbolizer const& sym, Feature const& feature, proj_transform const& prj_trans); @@ -69,8 +70,6 @@ private: FaceManagerT &font_manager_; DetectorT &detector_; boost::shared_ptr text_; /*TODO: Use shared pointers for text placement so we don't need to keep a reference here! */ - // Use a boost::ptr_vector here instread of std::vector? - std::vector geometries_to_process_; }; @@ -80,7 +79,10 @@ text_placement_info_ptr text_symbolizer_helper::get_pla Feature const& feature, proj_transform const& prj_trans) { - if (!initialize_geometries(sym, feature, prj_trans)) return text_placement_info_ptr(); + std::vector geometries_to_process; + + if (!initialize_geometries(geometries_to_process,sym, feature, prj_trans)) + return text_placement_info_ptr(); text_ = boost::shared_ptr(new processed_text(font_manager_, scale_factor_)); metawriter_with_properties writer = sym.get_metawriter(); @@ -110,13 +112,10 @@ text_placement_info_ptr text_symbolizer_helper::get_pla angle = boost::apply_visitor(evaluate(feature),*(p.orientation)).to_double(); } placement_finder finder(*placement, info, detector_, dims); - - unsigned num_geom = feature.num_geometries(); - for (unsigned i=0; iplacements.size()) continue; if (writer.first) writer.first->add_text(*placement, font_manager_, feature, t_, writer.second); @@ -128,6 +127,7 @@ text_placement_info_ptr text_symbolizer_helper::get_pla template bool text_symbolizer_helper::initialize_geometries( + std::vector & geometries_to_process, text_symbolizer const& sym, Feature const& feature, proj_transform const& prj_trans) @@ -150,10 +150,10 @@ bool text_symbolizer_helper::initialize_geometries( } } // TODO - calculate length here as well - geometries_to_process_.push_back(const_cast(&geom)); + geometries_to_process.push_back(const_cast(&geom)); } - - if (!geometries_to_process_.size() > 0) + + if (!geometries_to_process.size() > 0) { // early return to avoid significant overhead of rendering setup return false;