[geometry] added combinations point/ring, point/polygon, point/multi_polygon for disjoint and intersects

[SVN r81955]
This commit is contained in:
Barend Gehrels
2012-12-14 22:12:12 +00:00
parent 30cd790db3
commit f7040ca437
4 changed files with 66 additions and 0 deletions

View File

@@ -26,6 +26,7 @@
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/util/math.hpp>
@@ -165,6 +166,19 @@ struct box_box<Box1, Box2, DimensionCount, DimensionCount>
};
template
<
typename Geometry1, typename Geometry2
>
struct reverse_covered_by
{
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
return ! geometry::covered_by(geometry1, geometry2);
}
};
/*!
\brief Internal utility function to detect of boxes are disjoint

View File

@@ -234,6 +234,16 @@ struct disjoint<Point, Box, DimensionCount, point_tag, box_tag, Reverse>
: detail::disjoint::point_box<Point, Box, 0, DimensionCount>
{};
template <typename Point, typename Ring, std::size_t DimensionCount, bool Reverse>
struct disjoint<Point, Ring, DimensionCount, point_tag, ring_tag, Reverse>
: detail::disjoint::reverse_covered_by<Point, Ring>
{};
template <typename Point, typename Polygon, std::size_t DimensionCount, bool Reverse>
struct disjoint<Point, Polygon, DimensionCount, point_tag, polygon_tag, Reverse>
: detail::disjoint::reverse_covered_by<Point, Polygon>
{};
template <typename Linestring1, typename Linestring2, bool Reverse>
struct disjoint<Linestring1, Linestring2, 2, linestring_tag, linestring_tag, Reverse>
: detail::disjoint::disjoint_linear<Linestring1, Linestring2>

View File

@@ -0,0 +1,41 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2012 Bruno Lalande, Paris, France.
// Copyright (c) 2012 Mateusz Loskot, London, UK.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP
#include <boost/geometry/algorithms/disjoint.hpp>
#include <boost/geometry/multi/algorithms/covered_by.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Point, typename MultiPolygon>
struct disjoint<Point, MultiPolygon, 2, point_tag, multi_polygon_tag, false>
: detail::disjoint::reverse_covered_by<Point, MultiPolygon>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP

View File

@@ -32,6 +32,7 @@
#include <boost/geometry/multi/algorithms/convert.hpp>
#include <boost/geometry/multi/algorithms/correct.hpp>
#include <boost/geometry/multi/algorithms/covered_by.hpp>
#include <boost/geometry/multi/algorithms/disjoint.hpp>
#include <boost/geometry/multi/algorithms/distance.hpp>
#include <boost/geometry/multi/algorithms/envelope.hpp>
#include <boost/geometry/multi/algorithms/equals.hpp>