Added missing file 'geometry_iterator.hpp'. The iterator is still unused.

This commit is contained in:
Carlos López 2011-01-22 16:45:23 +00:00
parent bdfaee32a6
commit d270a555eb
2 changed files with 73 additions and 12 deletions

View file

@ -0,0 +1,65 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef GEOMETRY_ITERATOR_HPP
#define GEOMETRY_ITERATOR_HPP
// mapnik
#include <mapnik/geometry.hpp>
// boost
#include <boost/iterator/iterator_adaptor.hpp>
template <typename Value, typename Container=mapnik::geometry_type>
class geometry_iterator
: public boost::iterator_adaptor<geometry_iterator<Value, Container>,
Value*,
boost::use_default,
boost::forward_traversal_tag>
{
public:
geometry_iterator(Container const& geometry)
: geometry_iterator::iterator_adaptor_(0),
geometry_(geometry)
{}
explicit geometry_iterator(Value* p, Container const& geometry)
: geometry_iterator::iterator_adaptor_(p),
geometry_(geometry)
{}
private:
friend class boost::iterator_core_access;
void increment()
{
//Container::value_type* x;
double* x;
//Container::value_type* y;
double* y;
*(this->base_reference()) = Value(geometry_.vertex(x, y), *x, *y);
}
Container const& geometry_;
};
#endif //GEOMETRY_ITERATOR_HPP

View file

@ -26,7 +26,7 @@
// mapnik
#include <mapnik/vertex.hpp>
#include <mapnik/geometry.hpp>
//#include <mapnik/geometry_iter.hpp>
#include <mapnik/geometry_iterator.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/svg/svg_output_attributes.hpp>
@ -118,31 +118,27 @@ BOOST_FUSION_ADAPT_STRUCT(
template <>
struct container_iterator<mapnik::geometry_type const>
{
typedef mapnik::geometry_iterator type;
{
typedef mapnik::geometry_type::iterator type;
};
template <>
struct begin_container<mapnik::geometry_type const>
{
static mapnik::geometry_iterator
static mapnik::geometry_type::iterator
call(mapnik::geometry_type const& g)
{
double* x;
double* y;
unsigned cmd = g.vertex(x, y);
return mapnik::geometry_iterator(g, mapnik::geometry_iterator::iter_value(*x, *y, cmd));
return g.begin();
}
};
template <>
struct end_container<mapnik::geometry_type const>
{
static mapnik::geometry_iterator
static mapnik::geometry_type::iterator
call(mapnik::geometry_type const& g)
{
return mapnik::geometry_iterator(g);
return g.end();
}
};
}}}*/
@ -249,7 +245,7 @@ namespace mapnik { namespace svg {
PathType const& path_type_;
coordinate_transformer ct_;
};
};
template <typename OutputIterator>
struct svg_path_attributes_grammar : karma::grammar<OutputIterator, mapnik::svg::path_output_attributes()>