Permalink
Browse files

+ add miterlimit parameter

  • Loading branch information...
1 parent 2f0fa10 commit 44c5efbf75dafc5a75a223b35f4ac330af8c576a @artemp artemp committed May 2, 2012
Showing with 29 additions and 7 deletions.
  1. +7 −3 include/mapnik/stroke.hpp
  2. +1 −1 include/mapnik/vertex_converters.hpp
  3. +4 −0 src/load_map.cpp
  4. +17 −3 src/stroke.cpp
View
@@ -73,9 +73,10 @@ class MAPNIK_DECL stroke
gamma_method_e gamma_method_;
dash_array dash_;
double dash_offset_;
+ double miterlimit_;
public:
- explicit stroke();
- stroke(color const& c, double width=1.0);
+ stroke();
+ explicit stroke(color const& c, double width=1.0);
stroke(stroke const& other);
stroke& operator=(const stroke& rhs);
@@ -107,7 +108,10 @@ class MAPNIK_DECL stroke
double dash_offset() const;
dash_array const& get_dash_array() const;
-
+
+ void set_miterlimit(double val);
+ double get_miterlimit() const;
+
private:
void swap(const stroke& other) throw();
};
@@ -147,7 +147,7 @@ struct converter_traits<T, mapnik::stroke_tag>
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
stroke const& stroke_ = sym.get_stroke();
set_join_caps(stroke_,geom);
- geom.generator().miter_limit(4.0); // FIXME : make configurable
+ geom.generator().miter_limit(stroke_.get_miterlimit());
double scale_factor = 1.0; //FIXME
geom.generator().width(stroke_.get_width() * scale_factor);
}
View
@@ -1413,6 +1413,10 @@ void map_parser::parse_stroke(stroke & strk, xml_node const & sym)
"list of floats or 'none' but got '" + (*str) + "'");
}
}
+
+ // stroke-miterlimit
+ optional<double> miterlimit = sym.get_opt_attr<double>("stroke-miterlimit");
+ if (miterlimit) strk.set_miterlimit(*miterlimit);
}
void map_parser::parse_line_symbolizer(rule & rule, xml_node const & sym)
View
@@ -55,7 +55,8 @@ stroke::stroke()
gamma_(1.0),
gamma_method_(GAMMA_POWER),
dash_(),
- dash_offset_(0) {}
+ dash_offset_(0),
+ miterlimit_(4.0) {}
stroke::stroke(color const& c, double width)
: c_(c),
@@ -66,7 +67,8 @@ stroke::stroke(color const& c, double width)
gamma_(1.0),
gamma_method_(GAMMA_POWER),
dash_(),
- dash_offset_(0.0) {}
+ dash_offset_(0.0),
+ miterlimit_(4.0) {}
stroke::stroke(stroke const& other)
: c_(other.c_),
@@ -77,7 +79,8 @@ stroke::stroke(stroke const& other)
gamma_(other.gamma_),
gamma_method_(other.gamma_method_),
dash_(other.dash_),
- dash_offset_(other.dash_offset_) {}
+ dash_offset_(other.dash_offset_),
+ miterlimit_(other.miterlimit_) {}
stroke & stroke::operator=(const stroke& rhs)
{
@@ -182,6 +185,16 @@ dash_array const& stroke::get_dash_array() const
return dash_;
}
+void stroke::set_miterlimit(double val)
+{
+ miterlimit_ = val;
+}
+
+double stroke::get_miterlimit() const
+{
+ return miterlimit_;
+}
+
void stroke::swap(const stroke& other) throw()
{
c_ = other.c_;
@@ -193,5 +206,6 @@ void stroke::swap(const stroke& other) throw()
gamma_method_ = other.gamma_method_;
dash_ = other.dash_;
dash_offset_ = other.dash_offset_;
+ miterlimit_ = other.miterlimit_;
}
}

0 comments on commit 44c5efb

Please sign in to comment.