00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef STROKE_HPP
00025 #define STROKE_HPP
00026
00027 #include <mapnik/color.hpp>
00028 #include <mapnik/enumeration.hpp>
00029
00030 #include <vector>
00031
00032 namespace mapnik
00033 {
00034 using std::pair;
00035 using std::vector;
00036 typedef vector<pair<float,float> > dash_array;
00037
00038
00039
00040 enum line_cap_enum
00041 {
00042 BUTT_CAP,
00043 SQUARE_CAP,
00044 ROUND_CAP,
00045 line_cap_enum_MAX
00046 };
00047
00048 DEFINE_ENUM( line_cap_e, line_cap_enum );
00049
00050
00051
00052 enum line_join_enum
00053 {
00054 MITER_JOIN,
00055 MITER_REVERT_JOIN,
00056 ROUND_JOIN,
00057 BEVEL_JOIN,
00058 line_join_enum_MAX
00059 };
00060
00061 DEFINE_ENUM( line_join_e, line_join_enum );
00062
00063 class MAPNIK_DECL stroke
00064 {
00065 Color c_;
00066 float width_;
00067 float opacity_;
00068 line_cap_e line_cap_;
00069 line_join_e line_join_;
00070 dash_array dash_;
00071 public:
00072 explicit stroke();
00073 stroke(Color const& c, float width=1.0);
00074 stroke(stroke const& other);
00075 stroke& operator=(const stroke& rhs);
00076
00077 void set_color(const Color& c);
00078
00079 Color const& get_color() const;
00080
00081 float get_width() const;
00082 void set_width(float w);
00083 void set_opacity(float opacity);
00084
00085 float get_opacity() const;
00086
00087 void set_line_cap(line_cap_e line_cap);
00088 line_cap_e get_line_cap() const;
00089
00090 void set_line_join(line_join_e line_join);
00091 line_join_e get_line_join() const;
00092
00093 void add_dash(float dash,float gap);
00094 bool has_dash() const;
00095
00096 dash_array const& get_dash_array() const;
00097
00098 private:
00099 void swap(const stroke& other) throw();
00100 };
00101 }
00102
00103 #endif //STROKE_HPP