+ make stroke and fill optional

+ return expression_ptr by const ref
+ change init order
This commit is contained in:
artemp 2012-07-05 17:11:52 +01:00
parent 6af5fd7151
commit 847f284a97
2 changed files with 22 additions and 24 deletions

View file

@ -31,6 +31,9 @@
#include <mapnik/enumeration.hpp>
#include <mapnik/expression.hpp>
// boost
#include <boost/optional.hpp>
namespace mapnik {
// TODO - consider merging with text_symbolizer label_placement_e
@ -47,7 +50,7 @@ struct MAPNIK_DECL markers_symbolizer :
{
public:
explicit markers_symbolizer();
markers_symbolizer(path_expression_ptr filename);
markers_symbolizer(path_expression_ptr const& filename);
markers_symbolizer(markers_symbolizer const& rhs);
void set_ignore_placement(bool ignore_placement);
bool get_ignore_placement() const;
@ -57,26 +60,25 @@ public:
double get_spacing() const;
void set_max_error(double max_error);
double get_max_error() const;
void set_fill(color fill);
color const& get_fill() const;
void set_width(expression_ptr width);
expression_ptr get_width() const;
void set_height(expression_ptr height);
expression_ptr get_height() const;
stroke const& get_stroke() const;
void set_width(expression_ptr const&width);
expression_ptr const& get_width() const;
void set_height(expression_ptr const& height);
expression_ptr const& get_height() const;
void set_fill(color const& fill);
boost::optional<color> get_fill() const;
void set_stroke(stroke const& stroke);
boost::optional<stroke> get_stroke() const;
void set_marker_placement(marker_placement_e marker_p);
marker_placement_e get_marker_placement() const;
private:
bool ignore_placement_;
bool allow_overlap_;
color fill_;
double spacing_;
double max_error_;
expression_ptr width_;
expression_ptr height_;
stroke stroke_;
boost::optional<color> fill_;
boost::optional<stroke> stroke_;
marker_placement_e marker_p_;
};

View file

@ -41,25 +41,21 @@ markers_symbolizer::markers_symbolizer()
symbolizer_base(),
ignore_placement_(false),
allow_overlap_(false),
fill_(color(0,0,255)),
spacing_(100.0),
max_error_(0.2),
width_(boost::make_shared<expr_node>(10.0)),
height_(boost::make_shared<expr_node>(10.0)),
stroke_(),
marker_p_(MARKER_LINE_PLACEMENT) {}
markers_symbolizer::markers_symbolizer(path_expression_ptr filename)
markers_symbolizer::markers_symbolizer(path_expression_ptr const& filename)
: symbolizer_with_image(filename),
symbolizer_base(),
ignore_placement_(false),
allow_overlap_(false),
fill_(color(0,0,255)),
spacing_(100.0),
max_error_(0.2),
width_(boost::make_shared<expr_node>(10.0)),
height_(boost::make_shared<expr_node>(10.0)),
stroke_(),
marker_p_(MARKER_LINE_PLACEMENT) {}
markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
@ -67,11 +63,11 @@ markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
symbolizer_base(rhs),
ignore_placement_(rhs.ignore_placement_),
allow_overlap_(rhs.allow_overlap_),
fill_(rhs.fill_),
spacing_(rhs.spacing_),
max_error_(rhs.max_error_),
width_(rhs.width_),
height_(rhs.height_),
fill_(rhs.fill_),
stroke_(rhs.stroke_),
marker_p_(rhs.marker_p_) {}
@ -115,37 +111,37 @@ double markers_symbolizer::get_max_error() const
return max_error_;
}
void markers_symbolizer::set_fill(color fill)
void markers_symbolizer::set_fill(color const& fill)
{
fill_ = fill;
}
color const& markers_symbolizer::get_fill() const
boost::optional<color> markers_symbolizer::get_fill() const
{
return fill_;
}
void markers_symbolizer::set_width(expression_ptr width)
void markers_symbolizer::set_width(expression_ptr const& width)
{
width_ = width;
}
expression_ptr markers_symbolizer::get_width() const
expression_ptr const& markers_symbolizer::get_width() const
{
return width_;
}
void markers_symbolizer::set_height(expression_ptr height)
void markers_symbolizer::set_height(expression_ptr const& height)
{
height_ = height;
}
expression_ptr markers_symbolizer::get_height() const
expression_ptr const& markers_symbolizer::get_height() const
{
return height_;
}
stroke const& markers_symbolizer::get_stroke() const
boost::optional<stroke> markers_symbolizer::get_stroke() const
{
return stroke_;
}