From 4e7feaf747a406d0be1c761bbbf461d785965dae Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 12 Oct 2014 13:46:35 -0700 Subject: [PATCH] move glyph_positions to new cpp --- include/mapnik/cairo/cairo_context.hpp | 2 +- .../process_group_symbolizer.hpp | 2 +- ...lacements_list.hpp => glyph_positions.hpp} | 2 +- include/mapnik/text/placement_finder.hpp | 2 +- include/mapnik/text/placement_finder_impl.hpp | 2 +- src/build.py | 1 + src/text/glyph_positions.cpp | 87 +++++++++++++++++++ src/text/placement_finder.cpp | 56 +----------- 8 files changed, 94 insertions(+), 60 deletions(-) rename include/mapnik/text/{placements_list.hpp => glyph_positions.hpp} (98%) create mode 100644 src/text/glyph_positions.cpp diff --git a/include/mapnik/cairo/cairo_context.hpp b/include/mapnik/cairo/cairo_context.hpp index c037f1795..b4c20346c 100644 --- a/include/mapnik/cairo/cairo_context.hpp +++ b/include/mapnik/cairo/cairo_context.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/mapnik/renderer_common/process_group_symbolizer.hpp b/include/mapnik/renderer_common/process_group_symbolizer.hpp index 774296f13..a35babb79 100644 --- a/include/mapnik/renderer_common/process_group_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_group_symbolizer.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/mapnik/text/placements_list.hpp b/include/mapnik/text/glyph_positions.hpp similarity index 98% rename from include/mapnik/text/placements_list.hpp rename to include/mapnik/text/glyph_positions.hpp index 8ec3eeebd..9e03c3f1e 100644 --- a/include/mapnik/text/placements_list.hpp +++ b/include/mapnik/text/glyph_positions.hpp @@ -76,7 +76,7 @@ public: void reserve(unsigned count); pixel_position const& get_base_point() const; - void set_base_point(pixel_position base_point); + void set_base_point(pixel_position const& base_point); void set_marker(marker_info_ptr marker, pixel_position const& marker_pos); marker_info_ptr marker() const; pixel_position const& marker_pos() const; diff --git a/include/mapnik/text/placement_finder.hpp b/include/mapnik/text/placement_finder.hpp index 2fc44b835..f5c863572 100644 --- a/include/mapnik/text/placement_finder.hpp +++ b/include/mapnik/text/placement_finder.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/mapnik/text/placement_finder_impl.hpp b/include/mapnik/text/placement_finder_impl.hpp index e0ab56cde..6b3068a57 100644 --- a/include/mapnik/text/placement_finder_impl.hpp +++ b/include/mapnik/text/placement_finder_impl.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/build.py b/src/build.py index adfae461f..1dc4e53e6 100644 --- a/src/build.py +++ b/src/build.py @@ -210,6 +210,7 @@ source = Split( text/itemizer.cpp text/scrptrun.cpp text/face.cpp + text/glyph_positions.cpp text/placement_finder.cpp text/properties_util.cpp text/renderer.cpp diff --git a/src/text/glyph_positions.cpp b/src/text/glyph_positions.cpp new file mode 100644 index 000000000..c5d357f15 --- /dev/null +++ b/src/text/glyph_positions.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ +//mapnik +#include +#include +#include +#include + +// stl +#include + +namespace mapnik +{ + +glyph_positions::glyph_positions() + : data_(), + base_point_(), + marker_(), + marker_pos_(), + bbox_() {} + +glyph_positions::const_iterator glyph_positions::begin() const +{ + return data_.begin(); +} + +glyph_positions::const_iterator glyph_positions::end() const +{ + return data_.end(); +} + +void glyph_positions::push_back(glyph_info const& glyph, pixel_position offset, rotation const& rot) +{ + data_.push_back(glyph_position(glyph, offset, rot)); +} + +void glyph_positions::reserve(unsigned count) +{ + data_.reserve(count); +} + +pixel_position const& glyph_positions::get_base_point() const +{ + return base_point_; +} + +void glyph_positions::set_base_point(pixel_position const& base_point) +{ + base_point_ = base_point; +} + +void glyph_positions::set_marker(marker_info_ptr marker, pixel_position const& marker_pos) +{ + marker_ = marker; + marker_pos_ = marker_pos; +} + +marker_info_ptr glyph_positions::marker() const +{ + return marker_; +} + +pixel_position const& glyph_positions::marker_pos() const +{ + return marker_pos_; +} + +}// ns mapnik diff --git a/src/text/placement_finder.cpp b/src/text/placement_finder.cpp index d37ceb037..b473f1343 100644 --- a/src/text/placement_finder.cpp +++ b/src/text/placement_finder.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include // agg @@ -397,58 +397,4 @@ box2d placement_finder::get_bbox(text_layout const& layout, glyph_info c return bbox; } - -glyph_positions::glyph_positions() - : data_(), - base_point_(), - marker_(), - marker_pos_(), - bbox_() {} - -glyph_positions::const_iterator glyph_positions::begin() const -{ - return data_.begin(); -} - -glyph_positions::const_iterator glyph_positions::end() const -{ - return data_.end(); -} - -void glyph_positions::push_back(glyph_info const& glyph, pixel_position const offset, rotation const& rot) -{ - data_.push_back(glyph_position(glyph, offset, rot)); -} - -void glyph_positions::reserve(unsigned count) -{ - data_.reserve(count); -} - -pixel_position const& glyph_positions::get_base_point() const -{ - return base_point_; -} - -void glyph_positions::set_base_point(pixel_position const base_point) -{ - base_point_ = base_point; -} - -void glyph_positions::set_marker(marker_info_ptr marker, pixel_position const& marker_pos) -{ - marker_ = marker; - marker_pos_ = marker_pos; -} - -marker_info_ptr glyph_positions::marker() const -{ - return marker_; -} - -pixel_position const& glyph_positions::marker_pos() const -{ - return marker_pos_; -} - }// ns mapnik