remove tabs
This commit is contained in:
parent
649e4498c1
commit
de9a46cfeb
8 changed files with 369 additions and 370 deletions
|
@ -119,11 +119,11 @@ public:
|
|||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
inline bool process(rule::symbolizers const& syms,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
// cairo renderer doesn't support processing of multiple symbolizers.
|
||||
return false;
|
||||
// cairo renderer doesn't support processing of multiple symbolizers.
|
||||
return false;
|
||||
};
|
||||
protected:
|
||||
void render_marker(const int x, const int y, marker &marker, const agg::trans_affine & mtx, double opacity=1.0);
|
||||
|
|
|
@ -86,7 +86,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
|
||||
Geometry const& geom() const
|
||||
{
|
||||
return geom_;
|
||||
return geom_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -60,21 +60,21 @@ public:
|
|||
~metawriter_inmem();
|
||||
|
||||
virtual void add_box(box2d<double> const& box, Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_text(placement const& p,
|
||||
face_set_ptr face,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
face_set_ptr face,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_polygon(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
virtual void add_line(path_type & path,
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
Feature const& feature,
|
||||
CoordTransform const& t,
|
||||
metawriter_properties const& properties);
|
||||
|
||||
virtual void start(metawriter_property_map const& properties);
|
||||
virtual void stop();
|
||||
|
|
|
@ -44,26 +44,26 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
class svg_generator : private boost::noncopyable
|
||||
{
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
|
||||
typedef svg::svg_root_attributes_grammar<OutputIterator> root_attributes_grammar;
|
||||
typedef svg::svg_rect_attributes_grammar<OutputIterator> rect_attributes_grammar;
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
|
||||
typedef svg::svg_root_attributes_grammar<OutputIterator> root_attributes_grammar;
|
||||
typedef svg::svg_rect_attributes_grammar<OutputIterator> rect_attributes_grammar;
|
||||
typedef svg::svg_path_data_grammar<OutputIterator, path_type> path_data_grammar;
|
||||
typedef svg::svg_path_attributes_grammar<OutputIterator> path_attributes_grammar;
|
||||
typedef svg::svg_path_dash_array_grammar<OutputIterator> path_dash_array_grammar;
|
||||
typedef svg::svg_path_attributes_grammar<OutputIterator> path_attributes_grammar;
|
||||
typedef svg::svg_path_dash_array_grammar<OutputIterator> path_dash_array_grammar;
|
||||
|
||||
public:
|
||||
explicit svg_generator(OutputIterator& output_iterator);
|
||||
~svg_generator();
|
||||
|
||||
void generate_header();
|
||||
void generate_opening_root(root_output_attributes const& root_attributes);
|
||||
void generate_closing_root();
|
||||
void generate_rect(rect_output_attributes const& rect_attributes);
|
||||
void generate_path(path_type const& path, path_output_attributes const& path_attributes);
|
||||
|
||||
explicit svg_generator(OutputIterator& output_iterator);
|
||||
~svg_generator();
|
||||
|
||||
void generate_header();
|
||||
void generate_opening_root(root_output_attributes const& root_attributes);
|
||||
void generate_closing_root();
|
||||
void generate_rect(rect_output_attributes const& rect_attributes);
|
||||
void generate_path(path_type const& path, path_output_attributes const& path_attributes);
|
||||
|
||||
private:
|
||||
OutputIterator& output_iterator_;
|
||||
OutputIterator& output_iterator_;
|
||||
};
|
||||
}}
|
||||
|
||||
|
|
|
@ -48,56 +48,56 @@ namespace mapnik { namespace svg {
|
|||
*/
|
||||
struct path_output_attributes
|
||||
{
|
||||
path_output_attributes()
|
||||
: fill_color_("none"),
|
||||
fill_opacity_(1.0),
|
||||
stroke_color_("none"),
|
||||
stroke_opacity_(1.0),
|
||||
stroke_width_(0.0),
|
||||
stroke_linecap_("butt"),
|
||||
stroke_linejoin_("miter"),
|
||||
stroke_dasharray_(),
|
||||
stroke_dashoffset_(0.0)
|
||||
{}
|
||||
|
||||
void set_fill_color(color const& fill_color);
|
||||
void set_fill_opacity(const double fill_opacity);
|
||||
void set_stroke_color(color const& stroke_color);
|
||||
void set_stroke_opacity(const double stroke_opacity);
|
||||
void set_stroke_width(const double stroke_width);
|
||||
void set_stroke_linecap(const line_cap_e stroke_linecap);
|
||||
void set_stroke_linejoin(const line_join_e stroke_linejoin);
|
||||
void set_stroke_dasharray(const dash_array stroke_dasharray);
|
||||
void set_stroke_dashoffset(const double stroke_dashoffset);
|
||||
|
||||
const std::string fill_color() const;
|
||||
const double fill_opacity() const;
|
||||
const std::string stroke_color() const;
|
||||
const double stroke_opacity() const;
|
||||
const double stroke_width() const;
|
||||
const std::string stroke_linecap() const;
|
||||
const std::string stroke_linejoin() const;
|
||||
const dash_array stroke_dasharray() const;
|
||||
const double stroke_dashoffset() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
//private:
|
||||
// polygon symbolizer attributes.
|
||||
std::string fill_color_;
|
||||
double fill_opacity_;
|
||||
|
||||
// line symbolizer attributes.
|
||||
std::string stroke_color_;
|
||||
double stroke_opacity_;
|
||||
double stroke_width_;
|
||||
std::string stroke_linecap_;
|
||||
std::string stroke_linejoin_;
|
||||
dash_array stroke_dasharray_;
|
||||
double stroke_dashoffset_;
|
||||
path_output_attributes()
|
||||
: fill_color_("none"),
|
||||
fill_opacity_(1.0),
|
||||
stroke_color_("none"),
|
||||
stroke_opacity_(1.0),
|
||||
stroke_width_(0.0),
|
||||
stroke_linecap_("butt"),
|
||||
stroke_linejoin_("miter"),
|
||||
stroke_dasharray_(),
|
||||
stroke_dashoffset_(0.0)
|
||||
{}
|
||||
|
||||
void set_fill_color(color const& fill_color);
|
||||
void set_fill_opacity(const double fill_opacity);
|
||||
void set_stroke_color(color const& stroke_color);
|
||||
void set_stroke_opacity(const double stroke_opacity);
|
||||
void set_stroke_width(const double stroke_width);
|
||||
void set_stroke_linecap(const line_cap_e stroke_linecap);
|
||||
void set_stroke_linejoin(const line_join_e stroke_linejoin);
|
||||
void set_stroke_dasharray(const dash_array stroke_dasharray);
|
||||
void set_stroke_dashoffset(const double stroke_dashoffset);
|
||||
|
||||
const std::string fill_color() const;
|
||||
const double fill_opacity() const;
|
||||
const std::string stroke_color() const;
|
||||
const double stroke_opacity() const;
|
||||
const double stroke_width() const;
|
||||
const std::string stroke_linecap() const;
|
||||
const std::string stroke_linejoin() const;
|
||||
const dash_array stroke_dasharray() const;
|
||||
const double stroke_dashoffset() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
//private:
|
||||
// polygon symbolizer attributes.
|
||||
std::string fill_color_;
|
||||
double fill_opacity_;
|
||||
|
||||
// line symbolizer attributes.
|
||||
std::string stroke_color_;
|
||||
double stroke_opacity_;
|
||||
double stroke_width_;
|
||||
std::string stroke_linecap_;
|
||||
std::string stroke_linejoin_;
|
||||
dash_array stroke_dasharray_;
|
||||
double stroke_dashoffset_;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -114,45 +114,45 @@ namespace mapnik { namespace svg {
|
|||
*/
|
||||
struct rect_output_attributes
|
||||
{
|
||||
rect_output_attributes()
|
||||
: x_(0),
|
||||
y_(0),
|
||||
width_(400),
|
||||
height_(400),
|
||||
fill_color_("#000000")
|
||||
{}
|
||||
|
||||
rect_output_attributes(const int x, const int y, const unsigned width, const unsigned height, color const& fill_color)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
width_(width),
|
||||
height_(height),
|
||||
fill_color_(fill_color.to_hex_string())
|
||||
{}
|
||||
|
||||
void set_x(const int x);
|
||||
void set_y(const int y);
|
||||
void set_width(const unsigned width);
|
||||
void set_height(const unsigned height);
|
||||
void set_fill_color(color const& fill_color);
|
||||
|
||||
const int x() const;
|
||||
const int y() const;
|
||||
const int width() const;
|
||||
const int height() const;
|
||||
const std::string fill_color() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
//private:
|
||||
int x_;
|
||||
int y_;
|
||||
unsigned width_;
|
||||
unsigned height_;
|
||||
std::string fill_color_;
|
||||
rect_output_attributes()
|
||||
: x_(0),
|
||||
y_(0),
|
||||
width_(400),
|
||||
height_(400),
|
||||
fill_color_("#000000")
|
||||
{}
|
||||
|
||||
rect_output_attributes(const int x, const int y, const unsigned width, const unsigned height, color const& fill_color)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
width_(width),
|
||||
height_(height),
|
||||
fill_color_(fill_color.to_hex_string())
|
||||
{}
|
||||
|
||||
void set_x(const int x);
|
||||
void set_y(const int y);
|
||||
void set_width(const unsigned width);
|
||||
void set_height(const unsigned height);
|
||||
void set_fill_color(color const& fill_color);
|
||||
|
||||
const int x() const;
|
||||
const int y() const;
|
||||
const int width() const;
|
||||
const int height() const;
|
||||
const std::string fill_color() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
//private:
|
||||
int x_;
|
||||
int y_;
|
||||
unsigned width_;
|
||||
unsigned height_;
|
||||
std::string fill_color_;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -168,35 +168,35 @@ namespace mapnik { namespace svg {
|
|||
*/
|
||||
struct root_output_attributes
|
||||
{
|
||||
root_output_attributes();
|
||||
|
||||
root_output_attributes(const unsigned width, const unsigned height);
|
||||
|
||||
void set_width(const unsigned width);
|
||||
void set_height(const unsigned height);
|
||||
void set_svg_version(const double svg_version);
|
||||
void set_svg_namespace_url(std::string const& svg_namespace_url);
|
||||
|
||||
const unsigned width() const;
|
||||
const unsigned height() const;
|
||||
const double svg_version() const;
|
||||
const std::string svg_namespace_url() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
// SVG version to which the generated document will be compliant.
|
||||
static const double SVG_VERSION;
|
||||
// SVG XML namespace url.
|
||||
static const std::string SVG_NAMESPACE_URL;
|
||||
|
||||
//private:
|
||||
unsigned width_;
|
||||
unsigned height_;
|
||||
double svg_version_;
|
||||
std::string svg_namespace_url_;
|
||||
root_output_attributes();
|
||||
|
||||
root_output_attributes(const unsigned width, const unsigned height);
|
||||
|
||||
void set_width(const unsigned width);
|
||||
void set_height(const unsigned height);
|
||||
void set_svg_version(const double svg_version);
|
||||
void set_svg_namespace_url(std::string const& svg_namespace_url);
|
||||
|
||||
const unsigned width() const;
|
||||
const unsigned height() const;
|
||||
const double svg_version() const;
|
||||
const std::string svg_namespace_url() const;
|
||||
|
||||
/*!
|
||||
* @brief Set members back to their default values.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
// SVG version to which the generated document will be compliant.
|
||||
static const double SVG_VERSION;
|
||||
// SVG XML namespace url.
|
||||
static const std::string SVG_NAMESPACE_URL;
|
||||
|
||||
//private:
|
||||
unsigned width_;
|
||||
unsigned height_;
|
||||
double svg_version_;
|
||||
std::string svg_namespace_url_;
|
||||
};
|
||||
}}
|
||||
|
||||
|
|
|
@ -98,8 +98,7 @@ namespace boost { namespace spirit { namespace traits {
|
|||
|
||||
template <>
|
||||
struct is_container<path_type const>
|
||||
: mpl::true_
|
||||
{};
|
||||
: mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct container_iterator<path_type const>
|
||||
|
@ -111,22 +110,22 @@ namespace boost { namespace spirit { namespace traits {
|
|||
struct begin_container<path_type const>
|
||||
{
|
||||
static mapnik::svg::path_iterator_type
|
||||
call(path_type const& path)
|
||||
{
|
||||
return mapnik::svg::path_iterator_type(0, path);
|
||||
}
|
||||
call(path_type const& path)
|
||||
{
|
||||
return mapnik::svg::path_iterator_type(0, path);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct end_container<path_type const>
|
||||
{
|
||||
static mapnik::svg::path_iterator_type
|
||||
call(path_type const& path)
|
||||
{
|
||||
return mapnik::svg::path_iterator_type(path);
|
||||
}
|
||||
static mapnik::svg::path_iterator_type
|
||||
call(path_type const& path)
|
||||
{
|
||||
return mapnik::svg::path_iterator_type(path);
|
||||
}
|
||||
};
|
||||
}}}
|
||||
}}}
|
||||
|
||||
namespace mapnik { namespace svg {
|
||||
|
||||
|
@ -138,118 +137,119 @@ namespace mapnik { namespace svg {
|
|||
{
|
||||
typedef path_iterator_type::value_type vertex_type;
|
||||
|
||||
explicit svg_path_data_grammar(PathType const& path_type)
|
||||
: svg_path_data_grammar::base_type(svg_path),
|
||||
path_type_(path_type)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_path =
|
||||
lit("d=")
|
||||
<< confix('"', '"')[
|
||||
-(path_vertex % lit(' '))];
|
||||
|
||||
path_vertex =
|
||||
path_vertex_command
|
||||
<< double_
|
||||
<< lit(' ')
|
||||
<< double_;
|
||||
|
||||
path_vertex_command = &int_(1) << lit('M') | lit('L');
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, PathType&()> svg_path;
|
||||
karma::rule<OutputIterator, vertex_type()> path_vertex;
|
||||
karma::rule<OutputIterator, int()> path_vertex_command;
|
||||
|
||||
PathType const& path_type_;
|
||||
explicit svg_path_data_grammar(PathType const& path_type)
|
||||
: svg_path_data_grammar::base_type(svg_path),
|
||||
path_type_(path_type)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_path =
|
||||
lit("d=")
|
||||
<< confix('"', '"')[
|
||||
-(path_vertex % lit(' '))];
|
||||
|
||||
path_vertex =
|
||||
path_vertex_command
|
||||
<< double_
|
||||
<< lit(' ')
|
||||
<< double_;
|
||||
|
||||
path_vertex_command = &int_(1) << lit('M') | lit('L');
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, PathType&()> svg_path;
|
||||
karma::rule<OutputIterator, vertex_type()> path_vertex;
|
||||
karma::rule<OutputIterator, int()> path_vertex_command;
|
||||
|
||||
PathType const& path_type_;
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
struct svg_path_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::path_output_attributes()>
|
||||
{
|
||||
explicit svg_path_attributes_grammar()
|
||||
: svg_path_attributes_grammar::base_type(svg_path_attributes)
|
||||
{
|
||||
using karma::double_;
|
||||
using karma::string;
|
||||
using repository::confix;
|
||||
|
||||
svg_path_attributes =
|
||||
lit("fill=") << confix('"', '"')[string]
|
||||
<< lit(" fill-opacity=") << confix('"', '"')[double_]
|
||||
<< lit(" stroke=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-opacity=") << confix('"', '"')[double_]
|
||||
<< lit(" stroke-width=") << confix('"', '"')[double_ << lit("px")]
|
||||
<< lit(" stroke-linecap=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-linejoin=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-dashoffset=") << confix('"', '"')[double_ << lit("px")];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::path_output_attributes()> svg_path_attributes;
|
||||
explicit svg_path_attributes_grammar()
|
||||
: svg_path_attributes_grammar::base_type(svg_path_attributes)
|
||||
{
|
||||
using karma::double_;
|
||||
using karma::string;
|
||||
using repository::confix;
|
||||
|
||||
svg_path_attributes =
|
||||
lit("fill=") << confix('"', '"')[string]
|
||||
<< lit(" fill-opacity=") << confix('"', '"')[double_]
|
||||
<< lit(" stroke=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-opacity=") << confix('"', '"')[double_]
|
||||
<< lit(" stroke-width=") << confix('"', '"')[double_ << lit("px")]
|
||||
<< lit(" stroke-linecap=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-linejoin=") << confix('"', '"')[string]
|
||||
<< lit(" stroke-dashoffset=") << confix('"', '"')[double_ << lit("px")];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::path_output_attributes()> svg_path_attributes;
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
struct svg_path_dash_array_grammar : karma::grammar<OutputIterator, mapnik::dash_array()>
|
||||
{
|
||||
explicit svg_path_dash_array_grammar()
|
||||
: svg_path_dash_array_grammar::base_type(svg_path_dash_array)
|
||||
{
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_path_dash_array =
|
||||
lit("stroke-dasharray=")
|
||||
<< confix('"', '"')[
|
||||
-((double_ << lit(',') << double_) % lit(','))];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::dash_array()> svg_path_dash_array;
|
||||
explicit svg_path_dash_array_grammar()
|
||||
: svg_path_dash_array_grammar::base_type(svg_path_dash_array)
|
||||
{
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_path_dash_array =
|
||||
lit("stroke-dasharray=")
|
||||
<< confix('"', '"')[
|
||||
-((double_ << lit(',') << double_) % lit(','))];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::dash_array()> svg_path_dash_array;
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
struct svg_rect_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::rect_output_attributes()>
|
||||
{
|
||||
explicit svg_rect_attributes_grammar()
|
||||
: svg_rect_attributes_grammar::base_type(svg_rect_attributes)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::string;
|
||||
using repository::confix;
|
||||
|
||||
svg_rect_attributes =
|
||||
lit("x=") << confix('"', '"')[int_]
|
||||
<< lit(" y=") << confix('"', '"')[int_]
|
||||
<< lit(" width=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" height=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" fill=") << confix('"', '"')[string];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::rect_output_attributes()> svg_rect_attributes;
|
||||
explicit svg_rect_attributes_grammar()
|
||||
: svg_rect_attributes_grammar::base_type(svg_rect_attributes)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::string;
|
||||
using repository::confix;
|
||||
|
||||
svg_rect_attributes =
|
||||
lit("x=") << confix('"', '"')[int_]
|
||||
<< lit(" y=") << confix('"', '"')[int_]
|
||||
<< lit(" width=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" height=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" fill=") << confix('"', '"')[string];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::rect_output_attributes()> svg_rect_attributes;
|
||||
};
|
||||
|
||||
template <typename OutputIterator>
|
||||
struct svg_root_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::root_output_attributes()>
|
||||
{
|
||||
explicit svg_root_attributes_grammar()
|
||||
: svg_root_attributes_grammar::base_type(svg_root_attributes)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::string;
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_root_attributes =
|
||||
lit("width=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" height=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< " version=" << confix('"', '"')[double_]
|
||||
<< " xmlns=" << confix('"', '"')[string];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::root_output_attributes()> svg_root_attributes;
|
||||
explicit svg_root_attributes_grammar()
|
||||
: svg_root_attributes_grammar::base_type(svg_root_attributes)
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::string;
|
||||
using karma::double_;
|
||||
using repository::confix;
|
||||
|
||||
svg_root_attributes =
|
||||
lit("width=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< lit(" height=") << confix('"', '"')[int_ << lit("px")]
|
||||
<< " version=" << confix('"', '"')[double_]
|
||||
<< " xmlns=" << confix('"', '"')[string];
|
||||
}
|
||||
|
||||
karma::rule<OutputIterator, mapnik::svg::root_output_attributes()> svg_root_attributes;
|
||||
};
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SVG_OUTPUT_GRAMMARS_HPP
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
template <typename OtherValue>
|
||||
path_iterator(path_iterator<OtherValue, Container> const& other,
|
||||
typename boost::enable_if<boost::is_convertible<OtherValue*, Value*>,
|
||||
enabler>::type = enabler())
|
||||
enabler>::type = enabler())
|
||||
: path_iterator::iterator_adaptor_(other.base()) {}
|
||||
|
||||
private:
|
||||
|
@ -125,29 +125,29 @@ private:
|
|||
unsigned cmd = path_.vertex(&x, &y);
|
||||
|
||||
if(cmd == SEG_END)
|
||||
{
|
||||
// if the end of the sequence is reached, set the reference
|
||||
// to the current element to null, so it matches the value
|
||||
// that marks the end of the sequence as defined in the
|
||||
// "end_iterator" constructor.
|
||||
{
|
||||
// if the end of the sequence is reached, set the reference
|
||||
// to the current element to null, so it matches the value
|
||||
// that marks the end of the sequence as defined in the
|
||||
// "end_iterator" constructor.
|
||||
this->base_reference() = 0;
|
||||
}
|
||||
else if(this->base_reference() == 0)
|
||||
{
|
||||
// the first element of the container is stored in the
|
||||
// member variable 'first_value_' and later assigned
|
||||
// to the reference that boost::iterator_adaptor stores
|
||||
// to track the current element.
|
||||
//
|
||||
// 'first_value_' is used as intermediate storage
|
||||
// because the compiler prohibits the assignment of the
|
||||
// address of a temporary object (&Value(...)).
|
||||
else if(this->base_reference() == 0)
|
||||
{
|
||||
// the first element of the container is stored in the
|
||||
// member variable 'first_value_' and later assigned
|
||||
// to the reference that boost::iterator_adaptor stores
|
||||
// to track the current element.
|
||||
//
|
||||
// 'first_value_' is used as intermediate storage
|
||||
// because the compiler prohibits the assignment of the
|
||||
// address of a temporary object (&Value(...)).
|
||||
*first_value_ = Value(cmd, x, y);
|
||||
this->base_reference() = first_value_.get();
|
||||
this->base_reference() = first_value_.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
// point the reference to the current element to the next.
|
||||
{
|
||||
// point the reference to the current element to the next.
|
||||
*(this->base_reference()) = Value(cmd, x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,106 +40,105 @@ namespace mapnik
|
|||
// can target many other output destinations besides streams.
|
||||
template <typename OutputIterator>
|
||||
class MAPNIK_DECL svg_renderer : public feature_style_processor<svg_renderer<OutputIterator> >,
|
||||
private boost::noncopyable
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
svg_renderer(Map const& m, OutputIterator& output_iterator, unsigned offset_x=0, unsigned offset_y=0);
|
||||
~svg_renderer();
|
||||
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(layer const& lay);
|
||||
void end_layer_processing(layer const& lay);
|
||||
|
||||
/*!
|
||||
* @brief Overloads that process each kind of symbolizer individually.
|
||||
*/
|
||||
void process(point_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(line_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(line_pattern_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(polygon_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(polygon_pattern_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(raster_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(shield_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(text_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(building_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(markers_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(glyph_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
|
||||
/*!
|
||||
* @brief Overload that process the whole set of symbolizers of a rule.
|
||||
* @return true, meaning that this renderer can process multiple symbolizers.
|
||||
*/
|
||||
bool process(rule::symbolizers const& syms,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
|
||||
inline OutputIterator& get_output_iterator()
|
||||
{
|
||||
return output_iterator_;
|
||||
}
|
||||
|
||||
inline const OutputIterator& get_output_iterator() const
|
||||
{
|
||||
return output_iterator_;
|
||||
}
|
||||
svg_renderer(Map const& m, OutputIterator& output_iterator, unsigned offset_x=0, unsigned offset_y=0);
|
||||
~svg_renderer();
|
||||
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(layer const& lay);
|
||||
void end_layer_processing(layer const& lay);
|
||||
|
||||
/*!
|
||||
* @brief Overloads that process each kind of symbolizer individually.
|
||||
*/
|
||||
void process(point_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(line_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(line_pattern_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(polygon_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(polygon_pattern_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(raster_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(shield_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(text_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(building_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(markers_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
void process(glyph_symbolizer const& sym,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
|
||||
/*!
|
||||
* @brief Overload that process the whole set of symbolizers of a rule.
|
||||
* @return true, meaning that this renderer can process multiple symbolizers.
|
||||
*/
|
||||
bool process(rule::symbolizers const& syms,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
|
||||
inline OutputIterator& get_output_iterator()
|
||||
{
|
||||
return output_iterator_;
|
||||
}
|
||||
|
||||
inline const OutputIterator& get_output_iterator() const
|
||||
{
|
||||
return output_iterator_;
|
||||
}
|
||||
|
||||
private:
|
||||
OutputIterator& output_iterator_;
|
||||
const int width_;
|
||||
const int height_;
|
||||
CoordTransform t_;
|
||||
svg::svg_generator<OutputIterator> generator_;
|
||||
svg::path_output_attributes path_attributes_;
|
||||
|
||||
/*!
|
||||
* @brief Visitor that makes the calls to process each symbolizer when stored in a boost::variant.
|
||||
* This object follows the model of that found in feature_style_processor. It appears here, because
|
||||
* the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal
|
||||
* method.
|
||||
*/
|
||||
struct symbol_dispatch : public boost::static_visitor<>
|
||||
{
|
||||
symbol_dispatch(svg_renderer<OutputIterator>& processor,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
: processor_(processor),
|
||||
feature_(feature),
|
||||
prj_trans_(prj_trans)
|
||||
{}
|
||||
|
||||
template <typename Symbolizer>
|
||||
void operator()(Symbolizer const& sym) const
|
||||
{
|
||||
processor_.process(sym, feature_, prj_trans_);
|
||||
}
|
||||
|
||||
svg_renderer<OutputIterator>& processor_;
|
||||
Feature const& feature_;
|
||||
proj_transform const& prj_trans_;
|
||||
};
|
||||
OutputIterator& output_iterator_;
|
||||
const int width_;
|
||||
const int height_;
|
||||
CoordTransform t_;
|
||||
svg::svg_generator<OutputIterator> generator_;
|
||||
svg::path_output_attributes path_attributes_;
|
||||
|
||||
/*!
|
||||
* @brief Visitor that makes the calls to process each symbolizer when stored in a boost::variant.
|
||||
* This object follows the model of that found in feature_style_processor. It appears here, because
|
||||
* the logic that iterates over the set of symbolizer has been moved to an SVG renderer's internal
|
||||
* method.
|
||||
*/
|
||||
struct symbol_dispatch : public boost::static_visitor<>
|
||||
{
|
||||
symbol_dispatch(svg_renderer<OutputIterator>& processor,
|
||||
Feature const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
: processor_(processor),
|
||||
feature_(feature),
|
||||
prj_trans_(prj_trans) {}
|
||||
|
||||
template <typename Symbolizer>
|
||||
void operator()(Symbolizer const& sym) const
|
||||
{
|
||||
processor_.process(sym, feature_, prj_trans_);
|
||||
}
|
||||
|
||||
svg_renderer<OutputIterator>& processor_;
|
||||
Feature const& feature_;
|
||||
proj_transform const& prj_trans_;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue