From a5d7239cfc7db019f6bddb699a2d5c7987058145 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 27 Feb 2012 16:15:36 -0800 Subject: [PATCH 1/2] fix minor spelling in code comments --- src/symbolizer_helpers.cpp | 3 ++- src/text_placements/simple.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 6d1cdad4a..24d72ae19 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -316,7 +316,7 @@ text_placement_info_ptr shield_symbolizer_helper::get_l position const& pos = placement_->properties.displacement; 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. + I think transforms can make the marker non-centered. */ box2d(-0.5 * marker_ext_.width() - pos.first, -0.5 * marker_ext_.height() - pos.second, @@ -372,6 +372,7 @@ pixel_position shield_symbolizer_helper::get_marker_pos double px = lx - 0.5*marker_w_; double py = ly - 0.5*marker_h_; marker_ext_.re_center(lx, ly); + // detector_->insert(label_ext); //TODO: Is this done by placement_finder? if (writer_.first) writer_.first->add_box(marker_ext_, feature_, t_, writer_.second); diff --git a/src/text_placements/simple.cpp b/src/text_placements/simple.cpp index 81af87195..588abd341 100644 --- a/src/text_placements/simple.cpp +++ b/src/text_placements/simple.cpp @@ -147,7 +147,7 @@ void text_placements_simple::set_positions(std::string positions) std::cerr << "WARNING: Could not parse text_placement_simple placement string ('" << positions << "').\n"; } if (direction_.size() == 0) { - std::cerr << "WARNING: text_placements_simple with no valid placments! ('"<< positions<<"')\n"; + std::cerr << "WARNING: text_placements_simple with no valid placements! ('"<< positions<<"')\n"; } } From 82bd78d9a54cd600635786b70114311e30506344 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 27 Feb 2012 16:39:34 -0800 Subject: [PATCH 2/2] use boost::make_shared instead of new as per mapnik coding conventions --- src/text_placements/dummy.cpp | 5 ++++- src/text_placements/list.cpp | 8 ++++++-- src/text_placements/simple.cpp | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/text_placements/dummy.cpp b/src/text_placements/dummy.cpp index cf2d43f15..3c66b1f14 100644 --- a/src/text_placements/dummy.cpp +++ b/src/text_placements/dummy.cpp @@ -19,7 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ + #include +#include + namespace mapnik { bool text_placement_info_dummy::next() @@ -32,7 +35,7 @@ bool text_placement_info_dummy::next() text_placement_info_ptr text_placements_dummy::get_placement_info( double scale_factor, dimension_type dim, bool has_dimensions) const { - return text_placement_info_ptr(new text_placement_info_dummy( + return text_placement_info_ptr(boost::make_shared( this, scale_factor, dim, has_dimensions)); } diff --git a/src/text_placements/list.cpp b/src/text_placements/list.cpp index 9d93fda94..80762baea 100644 --- a/src/text_placements/list.cpp +++ b/src/text_placements/list.cpp @@ -19,7 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ + #include +#include + namespace mapnik { @@ -56,7 +59,7 @@ text_symbolizer_properties & text_placements_list::get(unsigned i) text_placement_info_ptr text_placements_list::get_placement_info( double scale_factor, dimension_type dim, bool has_dimensions) const { - return text_placement_info_ptr(new text_placement_info_list(this, + return text_placement_info_ptr(boost::make_shared(this, scale_factor, dim, has_dimensions)); } @@ -89,7 +92,8 @@ text_placements_ptr text_placements_list::from_xml(boost::property_tree::ptree c list->defaults.from_xml(xml, fontsets); ptree::const_iterator itr = xml.begin(); ptree::const_iterator end = xml.end(); - for( ;itr != end; ++itr) { + for( ;itr != end; ++itr) + { if ((itr->first.find('<') != std::string::npos) || (itr->first != "Placement")) continue; //TODO: ensure_attrs(symIter->second, "TextSymbolizer/Placement", s_common.str()); text_symbolizer_properties &p = list->add(); diff --git a/src/text_placements/simple.cpp b/src/text_placements/simple.cpp index 588abd341..49151066f 100644 --- a/src/text_placements/simple.cpp +++ b/src/text_placements/simple.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace mapnik { @@ -101,7 +102,7 @@ bool text_placement_info_simple::next_position_only() text_placement_info_ptr text_placements_simple::get_placement_info( double scale_factor, dimension_type dim, bool has_dimensions) const { - return text_placement_info_ptr(new text_placement_info_simple(this, + return text_placement_info_ptr(boost::make_shared(this, scale_factor, dim, has_dimensions)); } @@ -168,7 +169,7 @@ std::string text_placements_simple::get_positions() text_placements_ptr text_placements_simple::from_xml(boost::property_tree::ptree const &xml, fontset_map const & fontsets) { - text_placements_ptr ptr = text_placements_ptr(new text_placements_simple( + text_placements_ptr ptr = text_placements_ptr(boost::make_shared( get_attr(xml, "placements", "X"))); ptr->defaults.from_xml(xml, fontsets); return ptr;