Replace tabs with spaces. Remove unused method prototype.

This commit is contained in:
Jordan Hollinger 2014-02-07 18:11:54 -05:00
parent 586bb3b91a
commit 658d7e8888
6 changed files with 35 additions and 40 deletions

View file

@ -101,7 +101,7 @@ public:
pixel_position alignment_offset() const;
double jalign_offset(double line_width) const;
void init_orientation(feature_impl const& feature);
void init_orientation(feature_impl const& feature);
private:
void break_line(text_line & line, double wrap_width, unsigned text_ratio, bool wrap_before);
@ -147,37 +147,37 @@ private:
class layout_container
{
public:
layout_container() : glyphs_count_(0), line_count_(0) {}
layout_container() : glyphs_count_(0), line_count_(0) {}
void add(text_layout_ptr layout);
void clear();
void add(text_layout_ptr layout);
void clear();
void layout();
void layout();
inline size_t size() const { return layouts_.size(); }
inline size_t size() const { return layouts_.size(); }
inline text_layout_vector::const_iterator begin() const { return layouts_.begin(); }
inline text_layout_vector::const_iterator end() const { return layouts_.end(); }
inline text_layout_vector::const_iterator begin() const { return layouts_.begin(); }
inline text_layout_vector::const_iterator end() const { return layouts_.end(); }
inline mapnik::value_unicode_string const& text() const { return text_; }
inline mapnik::value_unicode_string const& text() const { return text_; }
inline unsigned glyphs_count() const { return glyphs_count_; }
inline unsigned line_count() const { return line_count_; }
inline unsigned glyphs_count() const { return glyphs_count_; }
inline unsigned line_count() const { return line_count_; }
inline box2d<double> const& bounds() const { return bounds_; }
inline box2d<double> const& bounds() const { return bounds_; }
inline double width() const { return bounds_.width(); }
inline double height() const { return bounds_.height(); }
inline double width() const { return bounds_.width(); }
inline double height() const { return bounds_.height(); }
private:
text_layout_vector layouts_;
text_layout_vector layouts_;
mapnik::value_unicode_string text_;
mapnik::value_unicode_string text_;
unsigned glyphs_count_;
unsigned line_count_;
unsigned glyphs_count_;
unsigned line_count_;
box2d<double> bounds_;
box2d<double> bounds_;
};
}

View file

@ -63,12 +63,7 @@ public:
void set_marker(marker_info_ptr m, box2d<double> box, bool marker_unlocked, pixel_position const& marker_displacement);
private:
//bool find_point_placement(pixel_position const& pos, bool add_marker, text_layout const& layout, placements_list &placements, std::vector<box2d<double> > &bboxes);
bool single_line_placement(vertex_cache &pp, text_upright_e orientation);
//bool single_line_placement(vertex_cache &pp, text_upright_e real_orientation, text_layout const& layout,
// placements_list &placements, std::vector<box2d<double> > &bboxes,
// int &glyph_count, int &upside_down_glyph_count);
bool line_layout_placement();
/** Moves dx pixels but makes sure not to fall of the end. */
void path_move_dx(vertex_cache &pp);
/** Normalize angle in range [-pi, +pi]. */

View file

@ -135,7 +135,7 @@ DEFINE_ENUM(text_upright_e, text_upright);
/** Properties for building the layout of a single text placement */
struct MAPNIK_DECL text_layout_properties
{
text_layout_properties();
text_layout_properties();
/** Load all values from XML ptree. */
void from_xml(xml_node const &sym);

View file

@ -60,7 +60,7 @@ void layout_node::to_xml(ptree &xml) const
node_ptr layout_node::from_xml(xml_node const& xml)
{
layout_node *n = new layout_node();
layout_node *n = new layout_node();
node_ptr np(n);
node_ptr child = node::from_xml(xml);
@ -82,9 +82,9 @@ node_ptr layout_node::from_xml(xml_node const& xml)
void layout_node::apply(char_properties_ptr p, feature_impl const& feature, text_layout &output) const
{
text_layout_properties_ptr new_properties = std::make_shared<text_layout_properties>(*output.get_layout_properties());
if (dx) new_properties->displacement.x = *dx;
if (dy) new_properties->displacement.y = *dy;
text_layout_properties_ptr new_properties = std::make_shared<text_layout_properties>(*output.get_layout_properties());
if (dx) new_properties->displacement.x = *dx;
if (dy) new_properties->displacement.y = *dy;
if (halign) new_properties->halign = *halign;
if (valign) new_properties->valign = *valign;
if (jalign) new_properties->jalign = *jalign;

View file

@ -73,7 +73,7 @@ void text_layout::add_text(mapnik::value_unicode_string const& str, char_propert
void text_layout::add_child(text_layout_ptr child_layout)
{
child_layout_list_.push_back(child_layout);
child_layout_list_.push_back(child_layout);
}
mapnik::value_unicode_string const& text_layout::text() const
@ -277,15 +277,15 @@ void text_layout::init_alignment()
{
if (p.displacement.x > 0.0)
{
halign_ = H_RIGHT;
halign_ = H_RIGHT;
}
else if (p.displacement.x < 0.0)
{
halign_ = H_LEFT;
halign_ = H_LEFT;
}
else
{
halign_ = H_MIDDLE;
halign_ = H_MIDDLE;
}
}
@ -357,7 +357,7 @@ void layout_container::layout()
line_count_ = 0;
bool first = true;
for (text_layout_ptr const& layout : layouts_)
for (text_layout_ptr const& layout : layouts_)
{
layout->layout();

View file

@ -179,7 +179,7 @@ bool placement_finder::find_point_placement(pixel_position const& pos)
bool base_point_set = false;
for (auto const& layout_ptr : layouts_)
{
text_layout const& layout = *layout_ptr;
text_layout const& layout = *layout_ptr;
rotation const& orientation = layout.orientation();
/* Find text origin. */
@ -314,10 +314,10 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
* IMPORTANT NOTE: See note about coordinate systems in find_point_placement()! *
********************************************************************************/
vertex_cache::scoped_state begin(pp);
text_upright_e real_orientation = simplify_upright(orientation, pp.angle());
text_upright_e real_orientation = simplify_upright(orientation, pp.angle());
glyph_positions_ptr glyphs = std::make_shared<glyph_positions>();
std::vector<box2d<double> > bboxes;
glyph_positions_ptr glyphs = std::make_shared<glyph_positions>();
std::vector<box2d<double> > bboxes;
glyphs->reserve(layouts_.glyphs_count());
bboxes.reserve(layouts_.glyphs_count());
@ -396,7 +396,7 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
if (orientation == UPRIGHT_AUTO)
{
//Try again with oposite orientation
begin.restore();
begin.restore();
return single_line_placement(pp, real_orientation == UPRIGHT_RIGHT ? UPRIGHT_LEFT : UPRIGHT_RIGHT);
}
//upright==left_only or right_only and more than 50% of characters upside down => no placement
@ -412,7 +412,7 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
}
placements_.push_back(glyphs);
return true;
return true;
}
void placement_finder::path_move_dx(vertex_cache &pp)