diff --git a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp index ea10fc465..cbc024255 100644 --- a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp @@ -83,6 +83,17 @@ template {}; +template +struct point_in_geometry +{ + template static inline + int apply(Point1 const& point1, Point2 const& point2, Strategy const& strategy) + { + boost::ignore_unused_variable_warning(strategy); + return strategy.apply(point1, point2) ? 1 : -1; + } +}; + template struct point_in_geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/within/point_in_geometry.hpp b/include/boost/geometry/multi/algorithms/detail/within/point_in_geometry.hpp index da8005512..970dfcd7d 100644 --- a/include/boost/geometry/multi/algorithms/detail/within/point_in_geometry.hpp +++ b/include/boost/geometry/multi/algorithms/detail/within/point_in_geometry.hpp @@ -5,8 +5,8 @@ // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. -// This file was modified by Oracle on 2013. -// Modifications copyright (c) 2013, Oracle and/or its affiliates. +// This file was modified by Oracle on 2013, 2014. +// Modifications copyright (c) 2013, 2014 Oracle and/or its affiliates. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -113,6 +113,26 @@ struct point_in_geometry } }; +template +struct point_in_geometry +{ + template static inline + int apply(Point const& point, Geometry const& geometry, Strategy const& strategy) + { + typedef typename boost::range_value::type point_type; + typedef typename boost::range_const_iterator::type iterator; + for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it ) + { + int pip = point_in_geometry::apply(point, *it, strategy); + + if ( pip > 0 ) // inside + return 1; + } + + return -1; // outside + } +}; + }} // namespace detail_dispatch::within #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/strategies/agnostic/point_in_point.hpp b/include/boost/geometry/strategies/agnostic/point_in_point.hpp new file mode 100644 index 000000000..b45bad70f --- /dev/null +++ b/include/boost/geometry/strategies/agnostic/point_in_point.hpp @@ -0,0 +1,88 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2014 Oracle and/or its affiliates. + +// 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) + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +#ifndef BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP +#define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP + +#include + +#include +#include + + +namespace boost { namespace geometry +{ + +namespace strategy { namespace within +{ + +template +< + typename Point1, typename Point2 +> +struct point_in_point +{ + static inline bool apply(Point1 const& point1, Point2 const& point2) + { + return detail::equals::equals_point_point(point1, point2); + } +}; + + +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS + +namespace services +{ + +template +struct default_strategy +{ + typedef strategy::within::point_in_point type; +}; + +template +struct default_strategy +{ + typedef strategy::within::point_in_point::type> type; +}; + +} // namespace services + +#endif + + +}} // namespace strategy::within + + + +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS +namespace strategy { namespace covered_by { namespace services +{ + +template +struct default_strategy +{ + typedef strategy::within::point_in_point type; +}; + +template +struct default_strategy +{ + typedef strategy::within::point_in_point::type> type; +}; + +}}} // namespace strategy::covered_by::services +#endif + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP diff --git a/include/boost/geometry/strategies/strategies.hpp b/include/boost/geometry/strategies/strategies.hpp index 3aa9ab00f..70cb2d95f 100644 --- a/include/boost/geometry/strategies/strategies.hpp +++ b/include/boost/geometry/strategies/strategies.hpp @@ -4,6 +4,9 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014 Oracle and/or its affiliates. + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -11,6 +14,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + #ifndef BOOST_GEOMETRY_STRATEGIES_STRATEGIES_HPP #define BOOST_GEOMETRY_STRATEGIES_STRATEGIES_HPP @@ -46,6 +51,7 @@ #include #include +#include #include #include