|
Geometry : |
Subject: Re: [geometry] Custom Linestring failing with simplify algorithm
From: jakka30 (sjakka_at_[hidden])
Date: 2014-05-03 11:06:17
Hello Barend,
Thank you for your quick reply. Here is my registration info.
Thank you,
Suresh
//Registration of Line strings with Boost
namespace boost
{
namespace geometry
{
namespace traits
{
template<class T>
struct tag<QCS::LineString2D<T>>
{
typedef linestring_tag type;
};
template<class T>
struct push_back<QCS::LineString2D<T>>
{
static inline void apply(QCS::LineString2D<T>&
lineString, QCS::Point2D<T> const& point)
{
lineString.AddPoint(point);
}
};
template<class T>
struct resize<QCS::LineString2D<T>>
{
static inline void apply(QCS::LineString2D<T>&
lineString, std::size_t new_size)
{
lineString.m_points.resize(new_size);
}
};
template<class T>
struct clear<QCS::LineString2D<T>>
{
static inline void apply(QCS::LineString2D<T>&
lineString)
{
lineString.m_points.clear();
}
};
}
}
} // namespace boost::geometry::
namespace boost
{
template <class T>
struct range_iterator<QCS::LineString2D<T>>
{ typedef typename std::vector<QCS::Point2D<T>>::iterator type; };
template<class T>
struct range_const_iterator<QCS::LineString2D<T>>
{ typedef typename std::vector<QCS::Point2D<T>>::const_iterator type;
};
template<class T>
struct range_mutable_iterator<QCS::LineString2D<T>>
{
typedef typename std::vector<QCS::Point2D<T>>::iterator type;
};
}
//In QCS namespace
template<class T>
inline typename std::vector<QCS::Point2D<T>>::iterator
range_begin(QCS::LineString2D<T>& qls) {return qls.m_points.begin();}
template<class T>
inline typename std::vector<QCS::Point2D<T>>::iterator
range_end(QCS::LineString2D<T>& qls) {return qls.m_points.end();}
template<class T>
inline typename std::vector<QCS::Point2D<T>>::const_iterator
range_begin(const QCS::LineString2D<T>& qls) {return qls.m_points.begin();}
template<class T>
inline typename std::vector<QCS::Point2D<T>>::const_iterator
range_end(const QCS::LineString2D<T>& qls) {return qls.m_points.end();}
-- View this message in context: http://boost-geometry.203548.n3.nabble.com/Custom-Linestring-failing-with-simplify-algorithm-tp4025938p4025964.html Sent from the Boost Geometry mailing list archive at Nabble.com.
Geometry list run by mateusz at loskot.net