mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
SVG renderer now outputs path tags for polygons, with a fixed stroke color and size.
This commit is contained in:
parent
9af87ba8db
commit
eec4864f41
@ -25,6 +25,7 @@
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/svg/svg_generator_path_grammar.hpp>
|
||||
|
||||
@ -45,7 +46,7 @@ namespace mapnik { namespace svg {
|
||||
|
||||
void generate_root();
|
||||
void generate_rect();
|
||||
void generate_path(path_type const& path);
|
||||
void generate_path(path_type const& path, color const& fill);
|
||||
|
||||
private:
|
||||
OutputIterator& output_iterator_;
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
BOOST_FUSION_ADAPT_CLASS(
|
||||
mapnik::vertex_vector2<mapnik::vertex2d>::vertex_type,
|
||||
(unsigned, unsigned, obj.get<2>(), /**/)
|
||||
// (unsigned, unsigned, obj.get<2>(), /**/)
|
||||
(mapnik::vertex_vector2<mapnik::vertex2d>::value_type, mapnik::vertex_vector2<mapnik::vertex2d>::value_type, obj.get<0>(), /**/)
|
||||
(mapnik::vertex_vector2<mapnik::vertex2d>::value_type, mapnik::vertex_vector2<mapnik::vertex2d>::value_type, obj.get<1>(), /**/)
|
||||
(mapnik::vertex_vector2<mapnik::vertex2d>::value_type, mapnik::vertex_vector2<mapnik::vertex2d>::value_type, obj.get<0>(), /**/)
|
||||
@ -131,21 +131,28 @@ namespace mapnik { namespace svg {
|
||||
{
|
||||
using karma::int_;
|
||||
using karma::double_;
|
||||
using karma::eol;
|
||||
using karma::omit;
|
||||
using karma::_1;
|
||||
using karma::_a;
|
||||
using karma::eol;
|
||||
using karma::omit;
|
||||
|
||||
svg_path = *(path_vertex);
|
||||
path_vertex = int_
|
||||
<< omit[path_vertex_component_x] << omit[path_vertex_component_y]
|
||||
svg_path =
|
||||
lit('M')
|
||||
<< *(path_vertex << lit(' '))
|
||||
<< lit('Z');
|
||||
|
||||
path_vertex =
|
||||
omit[path_vertex_component_x] << omit[path_vertex_component_y]
|
||||
<< path_vertex_transformed_x
|
||||
<< ' '
|
||||
<< path_vertex_transformed_y
|
||||
<< eol;
|
||||
<< lit(' ')
|
||||
<< path_vertex_transformed_y;
|
||||
|
||||
path_vertex_component_x = double_[_1 = _a][bind(&coordinate_transformer::set_current_x, &ct_, _a)][_a = _val];
|
||||
|
||||
path_vertex_component_y = double_[_1 = _a][bind(&coordinate_transformer::set_current_y, &ct_, _a)][_a = _val];
|
||||
|
||||
path_vertex_transformed_x = double_[_1 = _a][bind(&coordinate_transformer::current_x, &ct_, _a)];
|
||||
|
||||
path_vertex_transformed_y = double_[_1 = _a][bind(&coordinate_transformer::current_y, &ct_, _a)];
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ namespace mapnik
|
||||
if(geom.num_points() > 2)
|
||||
{
|
||||
path_type path(t_, geom, prj_trans);
|
||||
generator_.generate_path(path);
|
||||
generator_.generate_path(path, sym.get_fill());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,10 +46,13 @@ namespace mapnik { namespace svg {
|
||||
void svg_generator<OutputIterator>::generate_rect() {}
|
||||
|
||||
template <typename OutputIterator>
|
||||
void svg_generator<OutputIterator>::generate_path(path_type const& path)
|
||||
void svg_generator<OutputIterator>::generate_path(path_type const& path, color const& fill)
|
||||
{
|
||||
path_grammar grammar(path);
|
||||
|
||||
karma::generate(output_iterator_, lit("<path d=\""));
|
||||
karma::generate(output_iterator_, grammar, path.geom());
|
||||
karma::generate(output_iterator_, lit("\" stroke=\"blue\" stroke-width=\"1px\"/>\n"));
|
||||
}
|
||||
|
||||
template class svg_generator<std::ostream_iterator<char> >;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user