|
Geometry : |
Subject: Re: [geometry] Integrating OGR library with Boost.Geometry
From: Eric MSP Veith (eveith_at_[hidden])
Date: 2015-05-22 09:06:55
Hi Menelaos,
On Friday 22 May 2015 15:24:32, Menelaos Karavelas
<menelaos.karavelas_at_[hidden]> wrote:
> Could you please try the attached program with your geometries?
> Basically, what I am asking is that you change the typedefs for
> point_type and linestring_type to indicate your geometries. Then give it
> a try.
>
> I want to make sure that point and segment iterator for your linestrings
> work correctly. If they do then we can see what needs to be done next.
I've changed the typedefs and added the required headers:
//...
#include <boost/geometry.hpp>
#include <gdal/ogr_geometry.h>
#include "boost/OGRPointAdapter.h"
#include "boost/OGRLineStringAdapter.h"
#include "boost/OGRPointCollectionIterator.h"
namespace bg = boost::geometry;
typedef OGRPoint point_type;
typedef OGRLineString linestring_type;
typedef bg::point_iterator<linestring_type const> point_iterator_type;
typedef bg::segment_iterator<linestring_type const> segment_iterator_type;
int main()
{ //...
But the code doesn't compile. I'm quoting only the first few lines:
---%<---
In file included from
/usr/include/boost/geometry/algorithms/detail/distance/iterator_selector.hpp:16:0,
from
/usr/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp:48,
from
/usr/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp:17,
from
/usr/include/boost/geometry/strategies/strategies.hpp:48,
from /usr/include/boost/geometry/geometry.hpp:50,
from /usr/include/boost/geometry.hpp:17,
from t.cpp:3:
/usr/include/boost/geometry/iterators/point_iterator.hpp: In instantiation of
âboost::geometry::point_iterator<Geometry>::point_iterator(const
boost::geometry::point_iterator<G>&) [w
ith OtherGeometry = OGRLineString; Geometry = const OGRLineString]â:
t.cpp:29:62: required from here
/usr/include/boost/geometry/iterators/point_iterator.hpp:268:57: error: no
matching function for call to
âboost::iterators::iterator_adaptor<boost::geometry::point_iterator<const OGR
LineString>, Winzent::Simulation::boost::OGRPointCollectionIter<const
OGRLineString, OGRPoint>, boost::iterators::use_default,
boost::iterators::use_default, boost::iterators::use_de
fault, boost::iterators::use_default>::iterator_adaptor(const
Winzent::Simulation::boost::OGRPointCollectionIter<OGRLineString, OGRPoint>&)â
: point_iterator::iterator_adaptor_(other.base())
^
/usr/include/boost/geometry/iterators/point_iterator.hpp:268:57: note:
candidates are:
In file included from /usr/include/boost/iterator/reverse_iterator.hpp:12:0,
from /usr/include/boost/range/reverse_iterator.hpp:21,
from /usr/include/boost/range/rbegin.hpp:19,
from /usr/include/boost/range/functions.hpp:23,
from /usr/include/boost/range/iterator_range_core.hpp:38,
from /usr/include/boost/lexical_cast.hpp:30,
from /usr/include/boost/math/constants/constants.hpp:18,
from /usr/include/boost/geometry/util/math.hpp:28,
from /usr/include/boost/geometry/core/radian_access.hpp:28,
from /usr/include/boost/geometry/geometry.hpp:43,
from /usr/include/boost/geometry.hpp:17,
from t.cpp:3:
/usr/include/boost/iterator/iterator_adaptor.hpp:265:16: note:
boost::iterators::iterator_adaptor<Derived, Base, Value, Traversal, Reference,
Difference>::iterator_adaptor(const Base
&) [with Derived = boost::geometry::point_iterator<const OGRLineString>; Base
= Winzent::Simulation::boost::OGRPointCollectionIter<const OGRLineString,
OGRPoint>; Value = boost::iter
ators::use_default; Traversal = boost::iterators::use_default; Reference =
boost::iterators::use_default; Difference = boost::iterators::use_default]
explicit iterator_adaptor(Base const &iter)
^
/usr/include/boost/iterator/iterator_adaptor.hpp:265:16: note: no known
conversion for argument 1 from âconst
Winzent::Simulation::boost::OGRPointCollectionIter<OGRLineString, OGRPoint>â
to âconst Winzent::Simulation::boost::OGRPointCollectionIter<const
OGRLineString, OGRPoint>&â
/usr/include/boost/iterator/iterator_adaptor.hpp:263:7: note:
boost::iterators::iterator_adaptor<Derived, Base, Value, Traversal, Reference,
Difference>::iterator_adaptor() [with Derived =
boost::geometry::point_iterator<const OGRLineString>; Base =
Winzent::Simulation::boost::OGRPointCollectionIter<const OGRLineString,
OGRPoint>; Value = boost::iterators::use_default; Traversal =
boost::iterators::use_default; Reference = boost::iterators::use_default;
Difference = boost::iterators::use_default]
iterator_adaptor() {}
^
/usr/include/boost/iterator/iterator_adaptor.hpp:263:7: note: candidate
expects 0 arguments, 1 provided
--->%---
My OGRPointCollectionIterator is both default and copy constructible:
---%<---
OGRPointCollectionIter(): m_currentPointIndex(0)
{
}
OGRPointCollectionIter(const OGRPointCollectionIter &other):
m_currentPointIndex(other.m_currentPointIndex),
m_collection(other.m_collection.get())
{
}
--->%---
--- Eric
Geometry list run by mateusz at loskot.net