prefer hyphens as word separator for enum values

This commit is contained in:
Jiri Drbalek 2015-02-06 15:24:29 +00:00
parent 187a42f006
commit 5418b8ea40
4 changed files with 9 additions and 6 deletions

View file

@ -30,6 +30,7 @@
#include <bitset>
#include <iostream>
#include <cstdlib>
#include <algorithm>
namespace mapnik {
@ -176,9 +177,11 @@ public:
* */
void from_string(std::string const& str)
{
std::string str_copy(str);
std::replace(str_copy.begin(), str_copy.end(), '_', '-');
for (unsigned i = 0; i < THE_MAX; ++i)
{
if (str == our_strings_[i])
if (str_copy == our_strings_[i])
{
value_ = static_cast<ENUM>(i);
return;

View file

@ -76,7 +76,7 @@ private:
bool collision(box2d<double> const& box, const value_unicode_string &repeat_key, bool line_placement) const;
// Adds marker to glyph_positions and to collision detector. Returns false if there is a collision.
bool add_marker(glyph_positions_ptr glyphs, pixel_position const& pos) const;
// Maps upright==auto, left_only and right_only to left,right to simplify processing.
// Maps upright==auto, left-only and right-only to left,right to simplify processing.
// angle = angle of at start of line (to estimate best option for upright==auto)
text_upright_e simplify_upright(text_upright_e upright, double angle) const;
box2d<double> get_bbox(text_layout const& layout, glyph_info const& glyph, pixel_position const& pos, rotation const& rot);

View file

@ -35,7 +35,7 @@ IMPLEMENT_ENUM( line_cap_e, line_cap_strings )
static const char * line_join_strings[] = {
"miter",
"miter_revert",
"miter-revert",
"round",
"bevel",
""
@ -171,8 +171,8 @@ static const char * text_upright_strings[] = {
"auto-down",
"left",
"right",
"left_only",
"right_only",
"left-only",
"right-only",
""
};
IMPLEMENT_ENUM(text_upright_e, text_upright_strings)

View file

@ -300,7 +300,7 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
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
// upright==left-only or right-only and more than 50% of characters upside down => no placement
else if (orientation == UPRIGHT_LEFT_ONLY || orientation == UPRIGHT_RIGHT_ONLY)
{
return false;