File indexing completed on 2025-01-18 09:35:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_SEGMENT_HPP
0012 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_SEGMENT_HPP
0013
0014 #include <boost/core/ignore_unused.hpp>
0015
0016 #include <boost/geometry/core/point_type.hpp>
0017 #include <boost/geometry/core/tags.hpp>
0018
0019 #include <boost/geometry/algorithms/assign.hpp>
0020 #include <boost/geometry/algorithms/validity_failure_type.hpp>
0021 #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
0022 #include <boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp>
0023 #include <boost/geometry/algorithms/dispatch/is_valid.hpp>
0024
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029
0030
0031 #ifndef DOXYGEN_NO_DISPATCH
0032 namespace dispatch
0033 {
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 template <typename Segment>
0045 struct is_valid<Segment, segment_tag>
0046 {
0047 template <typename VisitPolicy, typename Strategy>
0048 static inline bool apply(Segment const& segment, VisitPolicy& visitor, Strategy const& strategy)
0049 {
0050 boost::ignore_unused(visitor);
0051
0052 typename point_type<Segment>::type p[2];
0053 detail::assign_point_from_index<0>(segment, p[0]);
0054 detail::assign_point_from_index<1>(segment, p[1]);
0055
0056 if (detail::is_valid::has_invalid_coordinate
0057 <
0058 Segment
0059 >::apply(segment, visitor))
0060 {
0061 return false;
0062 }
0063 else if (! detail::equals::equals_point_point(p[0], p[1], strategy))
0064 {
0065 return visitor.template apply<no_failure>();
0066 }
0067 else
0068 {
0069 return
0070 visitor.template apply<failure_wrong_topological_dimension>();
0071 }
0072 }
0073 };
0074
0075
0076 }
0077 #endif
0078
0079
0080 }}
0081
0082
0083 #endif