123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #ifndef BOOST_GEOMETRY_VIEWS_SEGMENT_VIEW_HPP
- #define BOOST_GEOMETRY_VIEWS_SEGMENT_VIEW_HPP
- #include <boost/geometry/core/point_type.hpp>
- #include <boost/geometry/views/detail/points_view.hpp>
- #include <boost/geometry/algorithms/assign.hpp>
- namespace boost { namespace geometry
- {
- template <typename Segment>
- struct segment_view
- : public detail::points_view
- <
- typename geometry::point_type<Segment>::type,
- 2
- >
- {
- typedef typename geometry::point_type<Segment>::type point_type;
-
- explicit segment_view(Segment const& segment)
- : detail::points_view<point_type, 2>(copy_policy(segment))
- {}
- private :
- class copy_policy
- {
- public :
- inline copy_policy(Segment const& segment)
- : m_segment(segment)
- {}
- inline void apply(point_type* points) const
- {
- geometry::detail::assign_point_from_index<0>(m_segment, points[0]);
- geometry::detail::assign_point_from_index<1>(m_segment, points[1]);
- }
- private :
- Segment const& m_segment;
- };
- };
- #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
- namespace traits
- {
- template<typename Segment>
- struct tag<segment_view<Segment> >
- {
- typedef linestring_tag type;
- };
- }
- #endif
- }}
- #endif
|