Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[strategies] Relocate area, envelope and expand strategies.
  • Loading branch information
awulkiew committed Aug 5, 2020
commit 52cceae0215fff3fedcacd1108481e20a4d9d4ef
8 changes: 5 additions & 3 deletions include/boost/geometry/algorithms/area.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
// #include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
#include <boost/geometry/algorithms/detail/multi_sum.hpp>

#include <boost/geometry/strategies/area.hpp>
#include <boost/geometry/strategies/area_result.hpp>
#include <boost/geometry/strategies/default_area_result.hpp>
#include <boost/geometry/algorithms/area_result.hpp>
#include <boost/geometry/algorithms/default_area_result.hpp>

#include <boost/geometry/strategies/area/services.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategy/area.hpp>

#include <boost/geometry/strategies/concepts/area_concept.hpp>

Expand Down
152 changes: 152 additions & 0 deletions include/boost/geometry/algorithms/area_result.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// Boost.Geometry

// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle

// 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_STRATEGY_AREA_RESULT_HPP
#define BOOST_GEOMETRY_STRATEGY_AREA_RESULT_HPP


#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/cs.hpp>

#include <boost/geometry/strategies/area/services.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategy/area.hpp>

#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/select_sequence_element.hpp>


#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/variant/variant_fwd.hpp>


namespace boost { namespace geometry
{


#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace area
{


template
<
typename Geometry,
typename Strategy,
bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
>
struct area_result
: decltype(std::declval<Strategy>().area(std::declval<Geometry>()))
::template result_type<Geometry>
{};

template
<
typename Geometry,
typename Strategy
>
struct area_result<Geometry, Strategy, false>
: Strategy::template result_type<Geometry>
{};


}} // namespace detail::area
#endif //DOXYGEN_NO_DETAIL


/*!
\brief Meta-function defining return type of area function
\ingroup area
\note The return-type is defined by Geometry and Strategy
*/
template
<
typename Geometry,
typename Strategy = default_strategy
>
struct area_result
: detail::area::area_result<Geometry, Strategy>
{};

template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Strategy>
struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy>
: geometry::area_result
<
typename geometry::util::select_sequence_element
<
typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
>::type,
Strategy
>
{};

template <typename Geometry>
struct area_result<Geometry, default_strategy>
: geometry::area_result
<
Geometry,
typename geometry::strategies::area::services::default_strategy
<
Geometry
>::type
>
{};

#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace area
{

template <typename Curr, typename Next>
struct pred_more_precise_default_area_result
{
typedef typename geometry::area_result<Curr, default_strategy>::type curr_result_t;
typedef typename geometry::area_result<Next, default_strategy>::type next_result_t;

typedef typename boost::mpl::if_c
<
boost::is_same
<
curr_result_t,
typename geometry::select_most_precise
<
curr_result_t,
next_result_t
>::type
>::value,
Curr,
Next
>::type type;
};

}} // namespace detail::area
#endif //DOXYGEN_NO_DETAIL

template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, default_strategy>
: geometry::area_result
<
typename geometry::util::select_sequence_element
<
typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types,
geometry::detail::area::pred_more_precise_default_area_result
>::type,
default_strategy
>
{};


}} // namespace boost::geometry


#endif // BOOST_GEOMETRY_STRATEGY_AREA_RESULT_HPP
41 changes: 41 additions & 0 deletions include/boost/geometry/algorithms/default_area_result.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.

// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.

// 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_STRATEGY_DEFAULT_AREA_RESULT_HPP
#define BOOST_GEOMETRY_STRATEGY_DEFAULT_AREA_RESULT_HPP


#include <boost/geometry/algorithms/area_result.hpp>


namespace boost { namespace geometry
{

/*!
\brief Meta-function defining return type of area function, using the default strategy
\ingroup area
\note The strategy defines the return-type (so this situation is different
from length, where distance is sqr/sqrt, but length always squared)
*/

template <typename Geometry>
struct default_area_result
: area_result<Geometry>
{};


}} // namespace boost::geometry


#endif // BOOST_GEOMETRY_STRATEGY_DEFAULT_AREA_RESULT_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@


// TEMP
#include <boost/geometry/strategies2/envelope.hpp>
#include <boost/geometry/strategies/envelope/cartesian.hpp>
#include <boost/geometry/strategies/envelope/geographic.hpp>
#include <boost/geometry/strategies/envelope/spherical.hpp>


namespace boost { namespace geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2013-2019.
// Modifications copyright (c) 2013-2019, Oracle and/or its affiliates.
// This file was modified by Oracle on 2013-2020.
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Expand Down Expand Up @@ -40,7 +40,7 @@
#include <boost/geometry/geometries/box.hpp>

// Temporary, for envelope_segment_impl
#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
#include <boost/geometry/strategy/spherical/envelope_segment.hpp>

namespace boost { namespace geometry
{
Expand Down
4 changes: 0 additions & 4 deletions include/boost/geometry/algorithms/detail/envelope/box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@

#include <boost/geometry/core/tags.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/envelope_box.hpp>
#include <boost/geometry/strategies/spherical/envelope_box.hpp>


namespace boost { namespace geometry
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/envelope.hpp>
#include <boost/geometry/strategies2/base.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/envelope/services.hpp>
#include <boost/geometry/strategy/envelope.hpp>

#include <boost/geometry/util/select_most_precise.hpp>

Expand Down
9 changes: 2 additions & 7 deletions include/boost/geometry/algorithms/detail/envelope/linear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.

// This file was modified by Oracle on 2015, 2016, 2018.
// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2020.
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Expand All @@ -25,11 +25,6 @@

#include <boost/geometry/algorithms/dispatch/envelope.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/envelope.hpp>
#include <boost/geometry/strategies/spherical/envelope.hpp>
#include <boost/geometry/strategies/geographic/envelope.hpp>

namespace boost { namespace geometry
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2015-2018, Oracle and/or its affiliates.
// Copyright (c) 2015-2020, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Expand All @@ -17,10 +17,6 @@

#include <boost/geometry/algorithms/dispatch/envelope.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/envelope_multipoint.hpp>
#include <boost/geometry/strategies/spherical/envelope_multipoint.hpp>

namespace boost { namespace geometry
{

Expand Down
9 changes: 2 additions & 7 deletions include/boost/geometry/algorithms/detail/envelope/point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.

// This file was modified by Oracle on 2015, 2016, 2017, 2018.
// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2020.
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.

// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Expand All @@ -22,11 +22,6 @@

#include <boost/geometry/algorithms/dispatch/envelope.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/envelope_point.hpp>
#include <boost/geometry/strategies/spherical/envelope_point.hpp>


namespace boost { namespace geometry
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/algorithms/dispatch/envelope.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
#include <boost/geometry/strategies/geographic/envelope_segment.hpp>

// TEMP
#include <boost/geometry/strategies2/base.hpp>
#include <boost/geometry/strategies/detail.hpp>

namespace boost { namespace geometry
{
Expand Down
4 changes: 0 additions & 4 deletions include/boost/geometry/algorithms/detail/expand/box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@

#include <boost/geometry/core/tags.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/expand_box.hpp>
#include <boost/geometry/strategies/spherical/expand_box.hpp>


namespace boost { namespace geometry
{
Expand Down
5 changes: 3 additions & 2 deletions include/boost/geometry/algorithms/detail/expand/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include <boost/geometry/algorithms/dispatch/expand.hpp>

#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/expand.hpp>
#include <boost/geometry/strategies2/base.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/expand/services.hpp>
#include <boost/geometry/strategy/expand.hpp>


namespace boost { namespace geometry
Expand Down
4 changes: 0 additions & 4 deletions include/boost/geometry/algorithms/detail/expand/point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

#include <boost/geometry/core/tags.hpp>

// For backward compatibility
#include <boost/geometry/strategies/cartesian/expand_point.hpp>
#include <boost/geometry/strategies/spherical/expand_point.hpp>


namespace boost { namespace geometry
{
Expand Down
Loading