1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_SEGMENT_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_SEGMENT_HPP
- #include <boost/core/ignore_unused.hpp>
- #include <boost/geometry/core/point_type.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/algorithms/assign.hpp>
- #include <boost/geometry/algorithms/validity_failure_type.hpp>
- #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
- #include <boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp>
- #include <boost/geometry/algorithms/dispatch/is_valid.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DISPATCH
- namespace dispatch
- {
- template <typename Segment>
- struct is_valid<Segment, segment_tag>
- {
- template <typename VisitPolicy, typename Strategy>
- static inline bool apply(Segment const& segment, VisitPolicy& visitor, Strategy const& strategy)
- {
- boost::ignore_unused(visitor);
- typename point_type<Segment>::type p[2];
- detail::assign_point_from_index<0>(segment, p[0]);
- detail::assign_point_from_index<1>(segment, p[1]);
- if (detail::is_valid::has_invalid_coordinate
- <
- Segment
- >::apply(segment, visitor))
- {
- return false;
- }
- else if (! detail::equals::equals_point_point(p[0], p[1], strategy))
- {
- return visitor.template apply<no_failure>();
- }
- else
- {
- return
- visitor.template apply<failure_wrong_topological_dimension>();
- }
- }
- };
- }
- #endif
- }}
- #endif
|