mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-15 01:02:09 +00:00
geometry.index: negation of satisfies() predicate added.
[SVN r84215]
This commit is contained in:
@@ -43,6 +43,17 @@ struct satisfies
|
||||
typedef satisfies_impl<Fun, ::boost::is_function<Fun>::value> base;
|
||||
|
||||
satisfies(Fun const& f) : base(f) {}
|
||||
satisfies(base const& b) : base(b) {}
|
||||
};
|
||||
|
||||
template <typename Fun>
|
||||
struct not_satisfies
|
||||
: satisfies_impl<Fun, ::boost::is_function<Fun>::value>
|
||||
{
|
||||
typedef satisfies_impl<Fun, ::boost::is_function<Fun>::value> base;
|
||||
|
||||
not_satisfies(Fun const& f) : base(f) {}
|
||||
not_satisfies(base const& b) : base(b) {}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
@@ -258,6 +269,16 @@ struct predicate_check<satisfies<Fun>, value_tag>
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Fun>
|
||||
struct predicate_check<not_satisfies<Fun>, value_tag>
|
||||
{
|
||||
template <typename Value, typename Indexable>
|
||||
static inline bool apply(not_satisfies<Fun> const& p, Value const& v, Indexable const&)
|
||||
{
|
||||
return !p.fun(v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<covered_by<Geometry>, value_tag>
|
||||
{
|
||||
@@ -458,6 +479,16 @@ struct predicate_check<satisfies<Fun>, bounds_tag>
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Fun>
|
||||
struct predicate_check<not_satisfies<Fun>, bounds_tag>
|
||||
{
|
||||
template <typename Value, typename Box>
|
||||
static bool apply(not_satisfies<Fun> const&, Value const&, Box const&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct predicate_check<covered_by<Geometry>, bounds_tag>
|
||||
{
|
||||
|
||||
@@ -271,84 +271,98 @@ namespace detail {
|
||||
|
||||
// operator! generators
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Fun> inline
|
||||
not_satisfies<Fun>
|
||||
operator!(satisfies<Fun> const& p)
|
||||
{
|
||||
return not_satisfies<Fun>(p);
|
||||
}
|
||||
|
||||
template <typename Fun> inline
|
||||
satisfies<Fun>
|
||||
operator!(not_satisfies<Fun> const& p)
|
||||
{
|
||||
return satisfies<Fun>(p);
|
||||
}
|
||||
|
||||
template <typename Geometry> inline
|
||||
not_covered_by<Geometry>
|
||||
operator!(covered_by<Geometry> const& p)
|
||||
{
|
||||
return not_covered_by<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
covered_by<Geometry>
|
||||
operator!(not_covered_by<Geometry> const& p)
|
||||
{
|
||||
return covered_by<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
not_disjoint<Geometry>
|
||||
operator!(disjoint<Geometry> const& p)
|
||||
{
|
||||
return not_disjoint<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
disjoint<Geometry>
|
||||
operator!(not_disjoint<Geometry> const& p)
|
||||
{
|
||||
return disjoint<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
not_intersects<Geometry>
|
||||
operator!(intersects<Geometry> const& p)
|
||||
{
|
||||
return not_intersects<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
intersects<Geometry>
|
||||
operator!(not_intersects<Geometry> const& p)
|
||||
{
|
||||
return intersects<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
not_overlaps<Geometry>
|
||||
operator!(overlaps<Geometry> const& p)
|
||||
{
|
||||
return not_overlaps<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
overlaps<Geometry>
|
||||
operator!(not_overlaps<Geometry> const& p)
|
||||
{
|
||||
return overlaps<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
//template <typename Geometry>
|
||||
//template <typename Geometry> inline
|
||||
//not_touches<Geometry>
|
||||
//operator!(touches<Geometry> const& p)
|
||||
//{
|
||||
// return not_touches<Geometry>(p.geometry);
|
||||
//}
|
||||
//
|
||||
//template <typename Geometry>
|
||||
//template <typename Geometry> inline
|
||||
//touches<Geometry>
|
||||
//operator!(not_touches<Geometry> const& p)
|
||||
//{
|
||||
// return touches<Geometry>(p.geometry);
|
||||
//}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
not_within<Geometry>
|
||||
operator!(within<Geometry> const& p)
|
||||
{
|
||||
return not_within<Geometry>(p.geometry);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
template <typename Geometry> inline
|
||||
within<Geometry>
|
||||
operator!(not_within<Geometry> const& p)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user