diff --git a/include/boost/geometry/algorithms/area.hpp b/include/boost/geometry/algorithms/area.hpp index efa1b2c24..c7992bd72 100644 --- a/include/boost/geometry/algorithms/area.hpp +++ b/include/boost/geometry/algorithms/area.hpp @@ -33,8 +33,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/algorithms/centroid.hpp b/include/boost/geometry/algorithms/centroid.hpp index e9a9d113a..d9516b989 100644 --- a/include/boost/geometry/algorithms/centroid.hpp +++ b/include/boost/geometry/algorithms/centroid.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index d8268137f..4f42c4116 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 2d709c194..4a40044b5 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include @@ -48,7 +48,7 @@ #include -#include +#include #include #include @@ -106,12 +106,12 @@ class get_turns_in_sections typedef typename reversible_view < - cview_type1 const, + cview_type1 const, Reverse1 ? iterate_reverse : iterate_forward >::type view_type1; typedef typename reversible_view < - cview_type2 const, + cview_type2 const, Reverse2 ? iterate_reverse : iterate_forward >::type view_type2; diff --git a/include/boost/geometry/algorithms/detail/sections/get_full_section.hpp b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp similarity index 91% rename from include/boost/geometry/algorithms/detail/sections/get_full_section.hpp rename to include/boost/geometry/algorithms/detail/sections/range_by_section.hpp index 46b519a6b..7b7040fcd 100644 --- a/include/boost/geometry/algorithms/detail/sections/get_full_section.hpp +++ b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp @@ -5,10 +5,9 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_GET_FULL_SECTION_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_GET_FULL_SECTION_HPP +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP -// TODO rename to "range_by_section" #include #include @@ -109,7 +108,7 @@ struct range_by_section \param section structure with section */ template -inline typename ring_return_type::type +inline typename ring_return_type::type range_by_section(Geometry const& geometry, Section const& section) { concept::check(); @@ -125,4 +124,4 @@ inline typename ring_return_type::type }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_GET_FULL_SECTION_HPP +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index cf7a5f7aa..5fb4e9113 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -26,8 +26,8 @@ #include #include -#include -#include +#include +#include #include @@ -357,7 +357,7 @@ struct sectionalize_range typedef typename closeable_view::type cview_type; typedef typename reversible_view < - cview_type const, + cview_type const, Reverse ? iterate_reverse : iterate_forward >::type view_type; @@ -540,7 +540,7 @@ struct sectionalize template < - typename LineString, + typename LineString, typename Sections, std::size_t DimensionCount, std::size_t MaxCount diff --git a/include/boost/geometry/algorithms/distance.hpp b/include/boost/geometry/algorithms/distance.hpp index 3bb0326ae..fa5e617f5 100644 --- a/include/boost/geometry/algorithms/distance.hpp +++ b/include/boost/geometry/algorithms/distance.hpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index 587905e5c..ce24478d3 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/geometry/algorithms/num_points.hpp b/include/boost/geometry/algorithms/num_points.hpp index ab64f9449..e1b4872c3 100644 --- a/include/boost/geometry/algorithms/num_points.hpp +++ b/include/boost/geometry/algorithms/num_points.hpp @@ -39,7 +39,7 @@ struct range_count static inline std::size_t apply(Range const& range, bool add_for_open) { std::size_t n = boost::size(range); - if (add_for_open) + if (add_for_open && n > 0) { closure_selector const s = geometry::closure::value; diff --git a/include/boost/geometry/algorithms/within.hpp b/include/boost/geometry/algorithms/within.hpp index 57bd47057..cd299162f 100644 --- a/include/boost/geometry/algorithms/within.hpp +++ b/include/boost/geometry/algorithms/within.hpp @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index b161a205f..ed0ba39c8 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -90,14 +90,14 @@ struct ring_return_type template struct ring_return_type { - typedef LineString type; + typedef LineString& type; }; template struct ring_return_type { - typedef Ring type; + typedef Ring& type; }; diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp index b3104fb66..ca25f8830 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp similarity index 86% rename from include/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp rename to include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index 096ec89ea..93456b5e8 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -5,8 +5,8 @@ // 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_DETAIL_SECTIONS_GET_FULL_SECTION_HPP -#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_GET_FULL_SECTION_HPP +#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP +#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #include @@ -14,7 +14,7 @@ #include #include -#include +#include namespace boost { namespace geometry @@ -81,4 +81,4 @@ struct range_by_section }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_GET_FULL_SECTION_HPP +#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP diff --git a/include/boost/geometry/multi/algorithms/intersection.hpp b/include/boost/geometry/multi/algorithms/intersection.hpp index d06093ce0..3768f78d9 100644 --- a/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/include/boost/geometry/multi/algorithms/intersection.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/union.hpp b/include/boost/geometry/multi/algorithms/union.hpp index bf11a9084..73ae2e04a 100644 --- a/include/boost/geometry/multi/algorithms/union.hpp +++ b/include/boost/geometry/multi/algorithms/union.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include namespace boost { namespace geometry diff --git a/include/boost/geometry/util/order_as_direction.hpp b/include/boost/geometry/util/order_as_direction.hpp index 11e0e7de0..1c84b207a 100644 --- a/include/boost/geometry/util/order_as_direction.hpp +++ b/include/boost/geometry/util/order_as_direction.hpp @@ -10,7 +10,6 @@ #define BOOST_GEOMETRY_UTIL_ORDER_AS_DIRECTION_HPP #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/util/closeable_view.hpp b/include/boost/geometry/views/closeable_view.hpp similarity index 86% rename from include/boost/geometry/util/closeable_view.hpp rename to include/boost/geometry/views/closeable_view.hpp index c4e41949e..6b1980d60 100644 --- a/include/boost/geometry/util/closeable_view.hpp +++ b/include/boost/geometry/views/closeable_view.hpp @@ -5,8 +5,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP -#define BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP +#ifndef BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP +#define BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP #include @@ -17,6 +17,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -56,7 +57,7 @@ struct closeable_view {}; template struct closeable_view { - typedef Range type; + typedef identity_view type; }; @@ -70,4 +71,4 @@ struct closeable_view }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP +#endif // BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP diff --git a/include/boost/geometry/views/identity_view.hpp b/include/boost/geometry/views/identity_view.hpp new file mode 100644 index 000000000..0b48b6ad9 --- /dev/null +++ b/include/boost/geometry/views/identity_view.hpp @@ -0,0 +1,42 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright Barend Gehrels 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_VIEWS_IDENTITY_VIEW_HPP +#define BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP + + +#include + + +namespace boost { namespace geometry +{ + + +template +struct identity_view +{ + typedef typename boost::range_iterator::type const_iterator; + typedef typename boost::range_iterator::type iterator; + + explicit inline identity_view(Range& r) + : m_range(r) + {} + + inline const_iterator begin() const { return boost::begin(m_range); } + inline const_iterator end() const { return boost::end(m_range); } + + inline iterator begin() { return boost::begin(m_range); } + inline iterator end() { return boost::end(m_range); } +private : + Range& m_range; +}; + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_VIEWS_IDENTITY_VIEW_HPP diff --git a/include/boost/geometry/util/reversible_view.hpp b/include/boost/geometry/views/reversible_view.hpp similarity index 76% rename from include/boost/geometry/util/reversible_view.hpp rename to include/boost/geometry/views/reversible_view.hpp index 41669524c..853304b00 100644 --- a/include/boost/geometry/util/reversible_view.hpp +++ b/include/boost/geometry/views/reversible_view.hpp @@ -5,8 +5,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_UTIL_REVERSIBLE_VIEW_HPP -#define BOOST_GEOMETRY_UTIL_REVERSIBLE_VIEW_HPP +#ifndef BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP +#define BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP #include @@ -16,6 +16,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -30,12 +31,12 @@ struct reversible_view {}; template struct reversible_view { - typedef Range type; + typedef identity_view type; }; template -struct reversible_view +struct reversible_view { typedef boost::range_detail::reverse_range type; }; @@ -43,4 +44,4 @@ struct reversible_view }} // namespace boost::geometry -#endif // BOOST_GEOMETRY_UTIL_REVERSIBLE_VIEW_HPP +#endif // BOOST_GEOMETRY_VIEWS_REVERSIBLE_VIEW_HPP