stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_HPP
|
||||
|
||||
#include <boost/geometry/views/detail/boundary_view/interface.hpp>
|
||||
#include <boost/geometry/views/detail/boundary_view/implementation.hpp>
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_HPP
|
||||
+466
@@ -0,0 +1,466 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_IMPLEMENTATION_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_IMPLEMENTATION_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
#include <boost/geometry/core/exterior_ring.hpp>
|
||||
#include <boost/geometry/core/interior_rings.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/iterators/flatten_iterator.hpp>
|
||||
|
||||
#include <boost/geometry/util/range.hpp>
|
||||
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/num_interior_rings.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace boundary_views
|
||||
{
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Polygon,
|
||||
typename Value = typename ring_type<Polygon>::type,
|
||||
typename Reference = typename ring_return_type<Polygon>::type,
|
||||
typename Difference = typename boost::range_difference
|
||||
<
|
||||
typename boost::remove_reference
|
||||
<
|
||||
typename interior_return_type<Polygon>::type
|
||||
>::type
|
||||
>::type
|
||||
>
|
||||
class polygon_rings_iterator
|
||||
: public boost::iterator_facade
|
||||
<
|
||||
polygon_rings_iterator<Polygon, Value, Reference, Difference>,
|
||||
Value,
|
||||
boost::random_access_traversal_tag,
|
||||
Reference,
|
||||
Difference
|
||||
>
|
||||
{
|
||||
typedef typename boost::range_size
|
||||
<
|
||||
typename boost::remove_reference
|
||||
<
|
||||
typename interior_return_type<Polygon>::type
|
||||
>::type
|
||||
>::type size_type;
|
||||
|
||||
public:
|
||||
// default constructor
|
||||
polygon_rings_iterator()
|
||||
: m_polygon(NULL)
|
||||
, m_index(0)
|
||||
{}
|
||||
|
||||
// for begin
|
||||
polygon_rings_iterator(Polygon& polygon)
|
||||
: m_polygon(boost::addressof(polygon))
|
||||
, m_index(0)
|
||||
{}
|
||||
|
||||
// for end
|
||||
polygon_rings_iterator(Polygon& polygon, bool)
|
||||
: m_polygon(boost::addressof(polygon))
|
||||
, m_index(static_cast<size_type>(num_rings(polygon)))
|
||||
{}
|
||||
|
||||
template
|
||||
<
|
||||
typename OtherPolygon,
|
||||
typename OtherValue,
|
||||
typename OtherReference,
|
||||
typename OtherDifference
|
||||
>
|
||||
polygon_rings_iterator(polygon_rings_iterator
|
||||
<
|
||||
OtherPolygon,
|
||||
OtherValue,
|
||||
OtherReference,
|
||||
OtherDifference
|
||||
> const& other)
|
||||
: m_polygon(other.m_polygon)
|
||||
, m_index(other.m_index)
|
||||
{
|
||||
static const bool is_convertible
|
||||
= boost::is_convertible<OtherPolygon, Polygon>::value;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG((is_convertible),
|
||||
NOT_CONVERTIBLE,
|
||||
(types<OtherPolygon>));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
template
|
||||
<
|
||||
typename OtherPolygon,
|
||||
typename OtherValue,
|
||||
typename OtherReference,
|
||||
typename OtherDifference
|
||||
>
|
||||
friend class polygon_rings_iterator;
|
||||
|
||||
|
||||
static inline std::size_t num_rings(Polygon const& polygon)
|
||||
{
|
||||
return geometry::num_interior_rings(polygon) + 1;
|
||||
}
|
||||
|
||||
inline Reference dereference() const
|
||||
{
|
||||
if (m_index == 0)
|
||||
{
|
||||
return exterior_ring(*m_polygon);
|
||||
}
|
||||
return range::at(interior_rings(*m_polygon), m_index - 1);
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename OtherPolygon,
|
||||
typename OtherValue,
|
||||
typename OtherReference,
|
||||
typename OtherDifference
|
||||
>
|
||||
inline bool equal(polygon_rings_iterator
|
||||
<
|
||||
OtherPolygon,
|
||||
OtherValue,
|
||||
OtherReference,
|
||||
OtherDifference
|
||||
> const& other) const
|
||||
{
|
||||
BOOST_GEOMETRY_ASSERT(m_polygon == other.m_polygon);
|
||||
return m_index == other.m_index;
|
||||
}
|
||||
|
||||
inline void increment()
|
||||
{
|
||||
++m_index;
|
||||
}
|
||||
|
||||
inline void decrement()
|
||||
{
|
||||
--m_index;
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename OtherPolygon,
|
||||
typename OtherValue,
|
||||
typename OtherReference,
|
||||
typename OtherDifference
|
||||
>
|
||||
inline Difference distance_to(polygon_rings_iterator
|
||||
<
|
||||
OtherPolygon,
|
||||
OtherValue,
|
||||
OtherReference,
|
||||
OtherDifference
|
||||
> const& other) const
|
||||
{
|
||||
return static_cast<Difference>(other.m_index)
|
||||
- static_cast<Difference>(m_index);
|
||||
}
|
||||
|
||||
inline void advance(Difference n)
|
||||
{
|
||||
m_index += n;
|
||||
}
|
||||
|
||||
private:
|
||||
Polygon* m_polygon;
|
||||
size_type m_index;
|
||||
};
|
||||
|
||||
|
||||
template <typename Ring>
|
||||
class ring_boundary : closeable_view<Ring, closure<Ring>::value>::type
|
||||
{
|
||||
private:
|
||||
typedef typename closeable_view<Ring, closure<Ring>::value>::type base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::iterator iterator;
|
||||
typedef typename base_type::const_iterator const_iterator;
|
||||
|
||||
typedef linestring_tag tag_type;
|
||||
|
||||
explicit ring_boundary(Ring& ring)
|
||||
: base_type(ring) {}
|
||||
|
||||
iterator begin() { return base_type::begin(); }
|
||||
iterator end() { return base_type::end(); }
|
||||
const_iterator begin() const { return base_type::begin(); }
|
||||
const_iterator end() const { return base_type::end(); }
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
|
||||
struct num_rings
|
||||
{};
|
||||
|
||||
template <typename Polygon>
|
||||
struct num_rings<Polygon, polygon_tag>
|
||||
{
|
||||
static inline std::size_t apply(Polygon const& polygon)
|
||||
{
|
||||
return geometry::num_interior_rings(polygon) + 1;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename MultiPolygon>
|
||||
struct num_rings<MultiPolygon, multi_polygon_tag>
|
||||
{
|
||||
static inline std::size_t apply(MultiPolygon const& multipolygon)
|
||||
{
|
||||
return geometry::num_interior_rings(multipolygon)
|
||||
+ static_cast<std::size_t>(boost::size(multipolygon));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
|
||||
struct views_container_initializer
|
||||
{};
|
||||
|
||||
template <typename Polygon>
|
||||
struct views_container_initializer<Polygon, polygon_tag>
|
||||
{
|
||||
template <typename BoundaryView>
|
||||
static inline void apply(Polygon const& polygon, BoundaryView* views)
|
||||
{
|
||||
typedef polygon_rings_iterator<Polygon> rings_iterator_type;
|
||||
|
||||
std::uninitialized_copy(rings_iterator_type(polygon),
|
||||
rings_iterator_type(polygon, true),
|
||||
views);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename MultiPolygon>
|
||||
class views_container_initializer<MultiPolygon, multi_polygon_tag>
|
||||
{
|
||||
typedef typename boost::mpl::if_
|
||||
<
|
||||
boost::is_const<MultiPolygon>,
|
||||
typename boost::range_value<MultiPolygon>::type const,
|
||||
typename boost::range_value<MultiPolygon>::type
|
||||
>::type polygon_type;
|
||||
|
||||
typedef polygon_rings_iterator<polygon_type> inner_iterator_type;
|
||||
|
||||
struct polygon_rings_begin
|
||||
{
|
||||
static inline inner_iterator_type apply(polygon_type& polygon)
|
||||
{
|
||||
return inner_iterator_type(polygon);
|
||||
}
|
||||
};
|
||||
|
||||
struct polygon_rings_end
|
||||
{
|
||||
static inline inner_iterator_type apply(polygon_type& polygon)
|
||||
{
|
||||
return inner_iterator_type(polygon, true);
|
||||
}
|
||||
};
|
||||
|
||||
typedef flatten_iterator
|
||||
<
|
||||
typename boost::range_iterator<MultiPolygon>::type,
|
||||
inner_iterator_type,
|
||||
typename std::iterator_traits<inner_iterator_type>::value_type,
|
||||
polygon_rings_begin,
|
||||
polygon_rings_end,
|
||||
typename std::iterator_traits<inner_iterator_type>::reference
|
||||
> rings_iterator_type;
|
||||
|
||||
public:
|
||||
template <typename BoundaryView>
|
||||
static inline void apply(MultiPolygon const& multipolygon,
|
||||
BoundaryView* views)
|
||||
{
|
||||
rings_iterator_type first(boost::begin(multipolygon),
|
||||
boost::end(multipolygon));
|
||||
rings_iterator_type last(boost::end(multipolygon));
|
||||
|
||||
std::uninitialized_copy(first, last, views);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Areal>
|
||||
class areal_boundary
|
||||
{
|
||||
typedef boundary_view<typename ring_type<Areal>::type> boundary_view_type;
|
||||
typedef views_container_initializer<Areal> exception_safe_initializer;
|
||||
|
||||
template <typename T>
|
||||
struct automatic_deallocator
|
||||
{
|
||||
automatic_deallocator(T* ptr) : m_ptr(ptr) {}
|
||||
|
||||
~automatic_deallocator()
|
||||
{
|
||||
operator delete(m_ptr);
|
||||
}
|
||||
|
||||
inline void release() { m_ptr = NULL; }
|
||||
|
||||
T* m_ptr;
|
||||
};
|
||||
|
||||
inline void initialize_views(Areal const& areal)
|
||||
{
|
||||
// initialize number of rings
|
||||
std::size_t n_rings = num_rings<Areal>::apply(areal);
|
||||
|
||||
if (n_rings == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate dynamic memory
|
||||
boundary_view_type* views_ptr = static_cast
|
||||
<
|
||||
boundary_view_type*
|
||||
>(operator new(sizeof(boundary_view_type) * n_rings));
|
||||
|
||||
// initialize; if exceptions are thrown by constructors
|
||||
// they are handled automatically by automatic_deallocator
|
||||
automatic_deallocator<boundary_view_type> deallocator(views_ptr);
|
||||
exception_safe_initializer::apply(areal, views_ptr);
|
||||
deallocator.release();
|
||||
|
||||
// now initialize member variables safely
|
||||
m_views = views_ptr;
|
||||
m_num_rings = n_rings;
|
||||
}
|
||||
|
||||
// disallow copies and/or assignments
|
||||
areal_boundary(areal_boundary const&);
|
||||
areal_boundary& operator=(areal_boundary const&);
|
||||
|
||||
public:
|
||||
typedef boundary_view_type* iterator;
|
||||
typedef boundary_view_type const* const_iterator;
|
||||
|
||||
typedef multi_linestring_tag tag_type;
|
||||
|
||||
explicit areal_boundary(Areal& areal)
|
||||
: m_views(NULL)
|
||||
, m_num_rings(0)
|
||||
{
|
||||
initialize_views(areal);
|
||||
}
|
||||
|
||||
~areal_boundary()
|
||||
{
|
||||
boundary_view_type* last = m_views + m_num_rings;
|
||||
for (boundary_view_type* it = m_views; it != last; ++it)
|
||||
{
|
||||
it->~boundary_view_type();
|
||||
}
|
||||
operator delete(m_views);
|
||||
}
|
||||
|
||||
inline iterator begin() { return m_views; }
|
||||
inline iterator end() { return m_views + m_num_rings; }
|
||||
inline const_iterator begin() const { return m_views; }
|
||||
inline const_iterator end() const { return m_views + m_num_rings; }
|
||||
|
||||
private:
|
||||
boundary_view_type* m_views;
|
||||
std::size_t m_num_rings;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace detail::boundary_view
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace detail_dispatch
|
||||
{
|
||||
|
||||
|
||||
template <typename Ring>
|
||||
struct boundary_view<Ring, ring_tag>
|
||||
: detail::boundary_views::ring_boundary<Ring>
|
||||
{
|
||||
explicit boundary_view(Ring& ring)
|
||||
: detail::boundary_views::ring_boundary<Ring>(ring)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename Polygon>
|
||||
struct boundary_view<Polygon, polygon_tag>
|
||||
: detail::boundary_views::areal_boundary<Polygon>
|
||||
{
|
||||
explicit boundary_view(Polygon& polygon)
|
||||
: detail::boundary_views::areal_boundary<Polygon>(polygon)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename MultiPolygon>
|
||||
struct boundary_view<MultiPolygon, multi_polygon_tag>
|
||||
: detail::boundary_views::areal_boundary<MultiPolygon>
|
||||
{
|
||||
explicit boundary_view(MultiPolygon& multipolygon)
|
||||
: detail::boundary_views::areal_boundary
|
||||
<
|
||||
MultiPolygon
|
||||
>(multipolygon)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail_dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_IMPLEMENTATION_HPP
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_INTERFACE_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_INTERFACE_HPP
|
||||
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace detail_dispatch
|
||||
{
|
||||
|
||||
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
|
||||
struct boundary_view
|
||||
: not_implemented<Tag>
|
||||
{};
|
||||
|
||||
} // namespace detail_dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct boundary_view
|
||||
: detail_dispatch::boundary_view<Geometry>
|
||||
{
|
||||
explicit boundary_view(Geometry& geometry)
|
||||
: detail_dispatch::boundary_view<Geometry>(geometry)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template <typename Geometry>
|
||||
struct tag< geometry::detail::boundary_view<Geometry> >
|
||||
{
|
||||
typedef typename detail_dispatch::boundary_view
|
||||
<
|
||||
Geometry
|
||||
>::tag_type type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_BOUNDARY_VIEW_INTERFACE_HPP
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, 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_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/core/coordinate_system.hpp>
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Geometry, std::size_t Index>
|
||||
class indexed_point_view
|
||||
{
|
||||
indexed_point_view & operator=(indexed_point_view const&);
|
||||
|
||||
public:
|
||||
typedef typename geometry::point_type<Geometry>::type point_type;
|
||||
typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
|
||||
|
||||
indexed_point_view(Geometry & geometry)
|
||||
: m_geometry(geometry)
|
||||
{}
|
||||
|
||||
template <std::size_t Dimension>
|
||||
inline coordinate_type get() const
|
||||
{
|
||||
return geometry::get<Index, Dimension>(m_geometry);
|
||||
}
|
||||
|
||||
template <std::size_t Dimension>
|
||||
inline void set(coordinate_type const& value)
|
||||
{
|
||||
geometry::set<Index, Dimension>(m_geometry, value);
|
||||
}
|
||||
|
||||
private:
|
||||
Geometry & m_geometry;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
template <typename Geometry, std::size_t Index>
|
||||
struct tag< geometry::detail::indexed_point_view<Geometry, Index> >
|
||||
{
|
||||
typedef point_tag type;
|
||||
};
|
||||
|
||||
template <typename Geometry, std::size_t Index>
|
||||
struct coordinate_type< geometry::detail::indexed_point_view<Geometry, Index> >
|
||||
{
|
||||
typedef typename geometry::coordinate_type<Geometry>::type type;
|
||||
};
|
||||
|
||||
template <typename Geometry, std::size_t Index>
|
||||
struct coordinate_system
|
||||
<
|
||||
geometry::detail::indexed_point_view<Geometry, Index>
|
||||
>
|
||||
{
|
||||
typedef typename geometry::coordinate_system<Geometry>::type type;
|
||||
};
|
||||
|
||||
template <typename Geometry, std::size_t Index>
|
||||
struct dimension< geometry::detail::indexed_point_view<Geometry, Index> >
|
||||
: geometry::dimension<Geometry>
|
||||
{};
|
||||
|
||||
template<typename Geometry, std::size_t Index, std::size_t Dimension>
|
||||
struct access
|
||||
<
|
||||
geometry::detail::indexed_point_view<Geometry, Index>, Dimension
|
||||
>
|
||||
{
|
||||
typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
|
||||
|
||||
static inline coordinate_type get(
|
||||
geometry::detail::indexed_point_view<Geometry, Index> const& p)
|
||||
{
|
||||
return p.template get<Dimension>();
|
||||
}
|
||||
|
||||
static inline void set(
|
||||
geometry::detail::indexed_point_view<Geometry, Index> & p,
|
||||
coordinate_type const& value)
|
||||
{
|
||||
p.template set<Dimension>(value);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
|
||||
@@ -0,0 +1,117 @@
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
|
||||
// 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_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/geometry/views/detail/range_type.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/util/order_as_direction.hpp>
|
||||
|
||||
namespace boost { namespace geometry {
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Geometry>
|
||||
struct normalized_view
|
||||
{
|
||||
static const bool is_const = boost::is_const<Geometry>::value;
|
||||
|
||||
//typedef typename ring_type<Geometry>::type ring_type;
|
||||
|
||||
typedef typename detail::range_type<Geometry>::type range_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
range_type const,
|
||||
range_type
|
||||
>::type range;
|
||||
|
||||
typedef typename
|
||||
reversible_view
|
||||
<
|
||||
range,
|
||||
order_as_direction
|
||||
<
|
||||
geometry::point_order<Geometry>::value
|
||||
>::value
|
||||
>::type reversible_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
reversible_type const,
|
||||
reversible_type
|
||||
>::type reversible;
|
||||
|
||||
typedef typename
|
||||
closeable_view
|
||||
<
|
||||
reversible,
|
||||
geometry::closure<Geometry>::value
|
||||
>::type closeable_type;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_c
|
||||
<
|
||||
is_const,
|
||||
closeable_type const,
|
||||
closeable_type
|
||||
>::type closeable;
|
||||
|
||||
explicit inline normalized_view(range & r)
|
||||
: m_reversible(r)
|
||||
, m_closeable(m_reversible)
|
||||
{}
|
||||
|
||||
typedef typename boost::range_iterator<closeable>::type iterator;
|
||||
typedef typename boost::range_const_iterator<closeable>::type const_iterator;
|
||||
|
||||
inline const_iterator begin() const { return boost::begin(m_closeable); }
|
||||
inline const_iterator end() const { return boost::end(m_closeable); }
|
||||
|
||||
inline iterator begin() { return boost::begin(m_closeable); }
|
||||
inline iterator end() { return boost::end(m_closeable); }
|
||||
|
||||
private:
|
||||
reversible_type m_reversible;
|
||||
closeable_type m_closeable;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
||||
@@ -0,0 +1,142 @@
|
||||
// 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.
|
||||
|
||||
// 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_VIEWS_DETAIL_POINTS_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_POINTS_VIEW_HPP
|
||||
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
#include <boost/geometry/core/exception.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Adapts pointer, on points, to a Boost.Range
|
||||
template <typename Point, int MaxSize>
|
||||
class points_view
|
||||
{
|
||||
// Iterates over a series of points (indicated by pointer
|
||||
// to have it lightweight). Probably there is already an
|
||||
// equivalent of this within Boost. If so, TODO: use that one.
|
||||
// This used to be "box_iterator" and "segment_iterator".
|
||||
// ALTERNATIVE: use boost:array and its iterators
|
||||
struct points_iterator
|
||||
: public boost::iterator_facade
|
||||
<
|
||||
points_iterator,
|
||||
Point const,
|
||||
boost::random_access_traversal_tag
|
||||
>
|
||||
{
|
||||
// Constructor: Begin iterator
|
||||
inline points_iterator(Point const* p)
|
||||
: m_points(p)
|
||||
, m_index(0)
|
||||
{}
|
||||
|
||||
// Constructor: End iterator
|
||||
inline points_iterator(Point const* p, bool)
|
||||
: m_points(p)
|
||||
, m_index(MaxSize)
|
||||
{}
|
||||
|
||||
// Constructor: default (for Range Concept checking).
|
||||
inline points_iterator()
|
||||
: m_points(NULL)
|
||||
, m_index(MaxSize)
|
||||
{}
|
||||
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
inline Point const& dereference() const
|
||||
{
|
||||
if (m_index >= 0 && m_index < MaxSize)
|
||||
{
|
||||
return m_points[m_index];
|
||||
}
|
||||
|
||||
// If it index larger (or smaller) return first point
|
||||
// (assuming initialized)
|
||||
return m_points[0];
|
||||
}
|
||||
|
||||
inline bool equal(points_iterator const& other) const
|
||||
{
|
||||
return other.m_index == this->m_index;
|
||||
}
|
||||
|
||||
inline void increment()
|
||||
{
|
||||
m_index++;
|
||||
}
|
||||
|
||||
inline void decrement()
|
||||
{
|
||||
m_index--;
|
||||
}
|
||||
|
||||
inline difference_type distance_to(points_iterator const& other) const
|
||||
{
|
||||
return other.m_index - this->m_index;
|
||||
}
|
||||
|
||||
inline void advance(difference_type n)
|
||||
{
|
||||
m_index += n;
|
||||
}
|
||||
|
||||
Point const* m_points;
|
||||
difference_type m_index;
|
||||
};
|
||||
|
||||
public :
|
||||
|
||||
typedef points_iterator const_iterator;
|
||||
typedef points_iterator iterator; // must be defined
|
||||
|
||||
const_iterator begin() const { return const_iterator(m_points); }
|
||||
const_iterator end() const { return const_iterator(m_points, true); }
|
||||
|
||||
// It may NOT be used non-const, so commented:
|
||||
//iterator begin() { return m_begin; }
|
||||
//iterator end() { return m_end; }
|
||||
|
||||
protected :
|
||||
|
||||
template <typename CopyPolicy>
|
||||
explicit points_view(CopyPolicy const& copy)
|
||||
{
|
||||
copy.apply(m_points);
|
||||
}
|
||||
|
||||
private :
|
||||
// Copy points here - box might define them otherwise
|
||||
Point m_points[MaxSize];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_POINTS_VIEW_HPP
|
||||
@@ -0,0 +1,134 @@
|
||||
// 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.
|
||||
|
||||
// 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_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/views/box_view.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace dispatch
|
||||
{
|
||||
|
||||
|
||||
template <typename Geometry,
|
||||
typename Tag = typename tag<Geometry>::type>
|
||||
struct range_type
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG
|
||||
(
|
||||
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
|
||||
, (types<Geometry>)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, ring_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, linestring_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, polygon_tag>
|
||||
{
|
||||
typedef typename ring_type<Geometry>::type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, box_tag>
|
||||
{
|
||||
typedef box_view<Geometry> type;
|
||||
};
|
||||
|
||||
|
||||
// multi-point acts itself as a range
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_point_tag>
|
||||
{
|
||||
typedef Geometry type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_linestring_tag>
|
||||
{
|
||||
typedef typename boost::range_value<Geometry>::type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
struct range_type<Geometry, multi_polygon_tag>
|
||||
{
|
||||
// Call its single-version
|
||||
typedef typename dispatch::range_type
|
||||
<
|
||||
typename boost::range_value<Geometry>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
// Will probably be replaced by the more generic "view_as", therefore in detail
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
/*!
|
||||
\brief Meta-function defining a type which is a boost-range.
|
||||
\details
|
||||
- For linestrings and rings, it defines the type itself.
|
||||
- For polygons it defines the ring type.
|
||||
- For multi-points, it defines the type itself
|
||||
- For multi-polygons and multi-linestrings, it defines the single-version
|
||||
(so in the end the linestring and ring-type-of-multi-polygon)
|
||||
\ingroup iterators
|
||||
*/
|
||||
template <typename Geometry>
|
||||
struct range_type
|
||||
{
|
||||
typedef typename dispatch::range_type
|
||||
<
|
||||
Geometry
|
||||
>::type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
#ifndef BOOST_GEOMETRY_VIEWS_DETAIL_TWO_DIMENSIONAL_VIEW_HPP
|
||||
#define BOOST_GEOMETRY_VIEWS_DETAIL_TWO_DIMENSIONAL_VIEW_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/core/coordinate_system.hpp>
|
||||
#include <boost/geometry/core/coordinate_dimension.hpp>
|
||||
#include <boost/geometry/core/point_type.hpp>
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
std::size_t Dimension1 = 0,
|
||||
std::size_t Dimension2 = 1,
|
||||
typename Tag = typename tag<Geometry>::type
|
||||
>
|
||||
struct two_dimensional_view
|
||||
: not_implemented<Tag>
|
||||
{};
|
||||
|
||||
|
||||
// View that enables to choose two dimensions of a point and see it as
|
||||
// a two-dimensional point
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct two_dimensional_view<Point, Dimension1, Dimension2, point_tag>
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(Dimension1 < static_cast<std::size_t>(dimension<Point>::value)),
|
||||
COORDINATE_DIMENSION1_IS_LARGER_THAN_POINT_DIMENSION,
|
||||
(boost::mpl::int_<Dimension1>));
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(Dimension2 < static_cast<std::size_t>(dimension<Point>::value)),
|
||||
COORDINATE_DIMENSION2_IS_LARGER_THAN_POINT_DIMENSION,
|
||||
(boost::mpl::int_<Dimension2>));
|
||||
|
||||
two_dimensional_view(Point& point)
|
||||
: m_point(point)
|
||||
{}
|
||||
|
||||
Point& m_point;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
namespace traits
|
||||
{
|
||||
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct tag
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
>
|
||||
{
|
||||
typedef point_tag type;
|
||||
};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct coordinate_system
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
> : coordinate_system<typename geometry::point_type<Point>::type>
|
||||
{};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct coordinate_type
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
> : coordinate_type<typename geometry::point_type<Point>::type>
|
||||
{};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct dimension
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
> : boost::mpl::int_<2>
|
||||
{};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct point_type
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>
|
||||
>
|
||||
{
|
||||
typedef typename geometry::point_type<Point>::type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct access
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>,
|
||||
0
|
||||
>
|
||||
{
|
||||
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
|
||||
typedef geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
> view_type;
|
||||
|
||||
static inline coordinate_type get(view_type const& view)
|
||||
{
|
||||
return geometry::get<Dimension1>(view.m_point);
|
||||
}
|
||||
|
||||
static inline void set(view_type& view, coordinate_type const& value)
|
||||
{
|
||||
geometry::set<Dimension1>(view.m_point, value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Point, std::size_t Dimension1, std::size_t Dimension2>
|
||||
struct access
|
||||
<
|
||||
geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
>,
|
||||
1
|
||||
>
|
||||
{
|
||||
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
|
||||
typedef geometry::detail::two_dimensional_view
|
||||
<
|
||||
Point, Dimension1, Dimension2, point_tag
|
||||
> view_type;
|
||||
|
||||
static inline coordinate_type get(view_type const& view)
|
||||
{
|
||||
return geometry::get<Dimension2>(view.m_point);
|
||||
}
|
||||
|
||||
static inline void set(view_type& view, coordinate_type const& value)
|
||||
{
|
||||
geometry::set<Dimension2>(view.m_point, value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace traits
|
||||
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_VIEWS_DETAIL_TWO_DIMENSIONAL_VIEW_HPP
|
||||
Reference in New Issue
Block a user