Added dummy grammar to generate SVG paths from geometries, as well as an SVG generator component.

This commit is contained in:
Carlos López 2010-07-26 04:25:09 +00:00
parent 87fd78f313
commit f44333fa4e
4 changed files with 23 additions and 9 deletions

View file

@ -42,7 +42,7 @@ enum GeomType {
};
template <typename T>
class geometry : private boost::noncopyable
class geometry //: private boost::noncopyable
{
public:
typedef T vertex_type;
@ -153,6 +153,19 @@ private:
container_type cont_;
mutable unsigned itr_;
public:
typedef typename container_type::const_iterator iterator;
iterator begin() const
{
return cont_.begin();
}
iterator end() const
{
return cont_.end();
}
polygon()
: //geometry_base(),
itr_(0)
@ -320,8 +333,8 @@ public:
unsigned vertex(double* x, double* y) const
{
return cont_.get_vertex(itr_++,x,y);
}
}
void rewind(unsigned ) const
{
itr_=0;

View file

@ -42,7 +42,7 @@ namespace mapnik
{
public:
svg_renderer(Map const& m, T& output_iterator);
svg_renderer(Map const& m, T& output_iterator, unsigned offset_x=0, unsigned offset_y=0);
~svg_renderer();
void start_map_processing(Map const& map);
@ -83,13 +83,11 @@ namespace mapnik
Feature const& feature,
proj_transform const& prj_trans);
// should this function be inline?
inline T& get_output_iterator()
{
return output_iterator_;
}
// should this function be inline?
inline const T& get_output_iterator() const
{
return output_iterator_;
@ -108,6 +106,7 @@ namespace mapnik
T& output_iterator_;
const int width_;
const int height_;
CoordTransform t_;
};
}

View file

@ -140,7 +140,7 @@ private:
};
template <typename T>
struct vertex_vector2 : boost::noncopyable
struct vertex_vector2 //: boost::noncopyable
{
typedef typename T::type value_type;
typedef boost::tuple<value_type,value_type,char> vertex_type;

View file

@ -23,6 +23,7 @@
// mapnik
#include <mapnik/svg_renderer.hpp>
#include <mapnik/svg/svg_generator_path_grammar.hpp>
// stl
#ifdef MAPNIK_DEBUG
@ -63,11 +64,12 @@ namespace mapnik
const std::string svg_renderer<T>::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg";
template <typename T>
svg_renderer<T>::svg_renderer(Map const& m, T & output_iterator) :
svg_renderer<T>::svg_renderer(Map const& m, T & output_iterator, unsigned offset_x, unsigned offset_y) :
feature_style_processor<svg_renderer>(m),
output_iterator_(output_iterator),
width_(m.width()),
height_(m.height())
height_(m.height()),
t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y)
{
// nothing yet.
}