|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65255 - in sandbox/geometry/boost/geometry: algorithms algorithms/detail/overlay extensions/gis/io/shapelib multi/algorithms/detail/overlay
From: barend.gehrels_at_[hidden]
Date: 2010-09-04 11:16:58
Author: barendgehrels
Date: 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
New Revision: 65255
URL: http://svn.boost.org/trac/boost/changeset/65255
Log:
Modified IntersectionStrategy and AssignPolicy into a TurnPolicy (having the two)
Added:
sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp (contents, props changed)
Text files modified:
sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp | 12 +
sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp | 109 ++++++++-----------
sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp | 45 ++++---
sandbox/geometry/boost/geometry/algorithms/difference.hpp | 17 +-
sandbox/geometry/boost/geometry/algorithms/disjoint.hpp | 5
sandbox/geometry/boost/geometry/algorithms/intersection.hpp | 216 +++++++++++++++++++++++++++------------
sandbox/geometry/boost/geometry/algorithms/intersects.hpp | 40 ++++---
sandbox/geometry/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp | 28 +++++
sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp | 45 +++-----
sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp | 14 +-
10 files changed, 316 insertions(+), 215 deletions(-)
Added: sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -0,0 +1,145 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-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_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
+
+
+#include <cstddef>
+#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace get_intersection_points
+{
+
+
+template
+<
+ typename Point1,
+ typename Point2,
+ typename TurnInfo
+>
+struct get_turn_without_info
+{
+ typedef strategy_intersection
+ <
+ typename cs_tag<typename TurnInfo::point_type>::type,
+ Point1,
+ Point2,
+ typename TurnInfo::point_type
+ > si;
+
+ typedef typename si::segment_intersection_strategy_type strategy;
+
+
+
+ template <typename OutputIterator>
+ static inline OutputIterator apply(
+ Point1 const& pi, Point1 const& pj, Point1 const& pk,
+ Point2 const& qi, Point2 const& qj, Point2 const& qk,
+ TurnInfo const& tp_model,
+ OutputIterator out)
+ {
+ typedef segment<Point1 const> segment_type1;
+ typedef segment<Point1 const> segment_type2;
+ segment_type1 p1(pi, pj), p2(pj, pk);
+ segment_type2 q1(qi, qj), q2(qj, qk);
+
+ //
+ typename strategy::return_type result = strategy::apply(p1, q1);
+
+ for (std::size_t i = 0; i < result.template get<0>().count; i++)
+ {
+
+ TurnInfo tp;
+ copy_coordinates(result.template get<0>().intersections[i], tp.point);
+ *out++ = tp;
+ }
+
+ return out;
+ }
+};
+
+}} // namespace detail::get_intersection_points
+#endif // DOXYGEN_NO_DETAIL
+
+
+
+
+template
+<
+ typename Geometry1,
+ typename Geometry2,
+ typename Turns
+>
+inline void get_intersection_points(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ Turns& turns)
+{
+ concept::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2 const>();
+
+ typedef detail::get_intersection_points::get_turn_without_info
+ <
+ typename point_type<Geometry1>::type,
+ typename point_type<Geometry2>::type,
+ typename boost::range_value<Turns>::type
+ > TurnPolicy;
+
+ typedef typename strategy_intersection
+ <
+ typename cs_tag<Geometry1>::type,
+ Geometry1,
+ Geometry2,
+ typename boost::range_value<Turns>::type
+ >::segment_intersection_strategy_type segment_intersection_strategy_type;
+
+ detail::get_turns::no_interrupt_policy interrupt_policy;
+
+ boost::mpl::if_c
+ <
+ reverse_dispatch<Geometry1, Geometry2>::type::value,
+ dispatch::get_turns_reversed
+ <
+ typename tag<Geometry1>::type,
+ typename tag<Geometry2>::type,
+ is_multi<Geometry1>::type::value,
+ is_multi<Geometry2>::type::value,
+ Geometry1,
+ Geometry2,
+ Turns, TurnPolicy,
+ //segment_intersection_strategy_type,
+ detail::get_turns::no_interrupt_policy
+ >,
+ dispatch::get_turns
+ <
+ typename tag<Geometry1>::type,
+ typename tag<Geometry2>::type,
+ is_multi<Geometry1>::type::value,
+ is_multi<Geometry2>::type::value,
+ Geometry1,
+ Geometry2,
+ Turns, TurnPolicy,
+ //segment_intersection_strategy_type,
+ detail::get_turns::no_interrupt_policy
+ >
+ >::type::apply(
+ 0, geometry1,
+ 1, geometry2,
+ turns, interrupt_policy);
+}
+
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -682,10 +682,10 @@
/*!
- \brief Policy doing nothing
- \details get_turn_info can have an optional policy to get/assign some
- extra information. By default it does not, and this class
- is that default.
+\brief Policy doing nothing
+\details get_turn_info can have an optional policy to get/assign some
+ extra information. By default it does not, and this class
+ is that default.
*/
struct assign_null_policy
{
@@ -730,7 +730,7 @@
template <typename OutputIterator>
- static inline void apply(
+ static inline OutputIterator apply(
Point1 const& pi, Point1 const& pj, Point1 const& pk,
Point2 const& qi, Point2 const& qj, Point2 const& qk,
TurnInfo const& tp_model,
@@ -881,6 +881,8 @@
default :
std::cout << "get_turns, nyi: " << method << std::endl;
}
+
+ return out;
}
};
Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -85,8 +85,7 @@
typename Geometry1, typename Geometry2,
typename Section1, typename Section2,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
class get_turns_in_sections
@@ -204,12 +203,7 @@
std::size_t const size_before = boost::size(turns);
- detail::overlay::get_turn_info
- <
- point1_type, point2_type,
- turn_info,
- AssignPolicy
- >::apply(*prev1, *it1, *nd_next1, *prev2, *it2, *nd_next2,
+ TurnPolicy::apply(*prev1, *it1, *nd_next1, *prev2, *it2, *nd_next2,
ti, std::back_inserter(turns));
if (InterruptPolicy::enabled)
@@ -302,8 +296,7 @@
typename Geometry1,
typename Geometry2,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
class get_turns_generic
@@ -370,8 +363,8 @@
typename boost::range_value<Sections1>::type,
typename boost::range_value<Sections2>::type,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>::apply(
source_id1, geometry1, *it1,
source_id2, geometry2, *it2,
@@ -500,8 +493,7 @@
typename Range,
typename Box,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns_cs
@@ -580,13 +572,6 @@
if (true)
{
typedef typename boost::range_value<Turns>::type turn_info;
- typedef detail::overlay::get_turn_info
- <
- box_point_type,
- point_type,
- turn_info,
- AssignPolicy
- > relater;
// Depending on code some relations can be left out
turn_info ti;
@@ -595,25 +580,25 @@
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 0);
ti.operations[0].other_id = ti.operations[1].seg_id;
- relater::apply(*prev, *it, *next,
+ TurnPolicy::apply(*prev, *it, *next,
lower_left, upper_left, upper_right,
ti, std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 1);
ti.operations[0].other_id = ti.operations[1].seg_id;
- relater::apply(*prev, *it, *next,
+ TurnPolicy::apply(*prev, *it, *next,
upper_left, upper_right, lower_right,
ti, std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 2);
ti.operations[0].other_id = ti.operations[1].seg_id;
- relater::apply(*prev, *it, *next,
+ TurnPolicy::apply(*prev, *it, *next,
upper_right, lower_right, lower_left,
ti, std::back_inserter(turns));
ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3);
ti.operations[0].other_id = ti.operations[1].seg_id;
- relater::apply(*prev, *it, *next,
+ TurnPolicy::apply(*prev, *it, *next,
lower_right, lower_left, upper_left,
ti, std::back_inserter(turns));
@@ -664,8 +649,7 @@
bool IsMulti1, bool IsMulti2,
typename Geometry1, typename Geometry2,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -674,8 +658,8 @@
Geometry1,
Geometry2,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>
{};
@@ -685,8 +669,7 @@
typename Polygon,
typename Box,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -694,8 +677,7 @@
polygon_tag, box_tag, false, false,
Polygon, Box,
Turns,
- IntersectionStrategy,
- AssignPolicy,
+ TurnPolicy,
InterruptPolicy
>
{
@@ -718,8 +700,8 @@
ring_type,
Box,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
> intersector_type;
intersector_type::apply(
@@ -746,8 +728,7 @@
typename Ring,
typename Box,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -755,8 +736,8 @@
ring_tag, box_tag, false, false,
Ring, Box,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>
{
static inline void apply(
@@ -774,8 +755,8 @@
Ring,
Box,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
> intersector_type;
intersector_type::apply(
@@ -793,8 +774,8 @@
bool IsMulti1, bool IsMulti2,
typename Geometry1, typename Geometry2,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy, typename InterruptPolicy
+ typename TurnPolicy,
+ typename InterruptPolicy
>
struct get_turns_reversed
{
@@ -808,8 +789,8 @@
GeometryTag2, GeometryTag1,
IsMulti2, IsMulti1,
Geometry2, Geometry1,
- Turns, IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ Turns, TurnPolicy,
+ InterruptPolicy
>::apply(source_id2, g2, source_id1, g1, turns, interrupt_policy);
}
};
@@ -821,16 +802,16 @@
/*!
- \brief Calculate intersection points of two geometries
- \ingroup overlay
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam Turns type of turn-container (e.g. vector of "intersection/turn point"'s)
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param turns container which will contain intersection points
- \param interrupt_policy policy determining if process is stopped
- when intersection is found
+\brief \brief_calc2{turn points}
+\ingroup overlay
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam Turns type of turn-container (e.g. vector of "intersection/turn point"'s)
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param turns container which will contain turn points
+\param interrupt_policy policy determining if process is stopped
+ when intersection is found
*/
template
<
@@ -855,6 +836,14 @@
typename boost::range_value<Turns>::type
>::segment_intersection_strategy_type segment_intersection_strategy_type;
+ typedef detail::overlay::get_turn_info
+ <
+ typename point_type<Geometry1>::type,
+ typename point_type<Geometry2>::type,
+ typename boost::range_value<Turns>::type,
+ AssignPolicy
+ > TurnPolicy;
+
boost::mpl::if_c
<
reverse_dispatch<Geometry1, Geometry2>::type::value,
@@ -866,9 +855,8 @@
is_multi<Geometry2>::type::value,
Geometry1,
Geometry2,
- Turns,
- segment_intersection_strategy_type,
- AssignPolicy, InterruptPolicy
+ Turns, TurnPolicy,
+ InterruptPolicy
>,
dispatch::get_turns
<
@@ -878,9 +866,8 @@
is_multi<Geometry2>::type::value,
Geometry1,
Geometry2,
- Turns,
- segment_intersection_strategy_type,
- AssignPolicy, InterruptPolicy
+ Turns, TurnPolicy,
+ InterruptPolicy
>
>::type::apply(
0, geometry1,
Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -33,8 +33,7 @@
<
typename Geometry,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -74,8 +73,8 @@
Geometry, Geometry,
typename boost::range_value<sections_type>::type,
typename boost::range_value<sections_type>::type,
- Turns, IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ Turns, TurnPolicy,
+ InterruptPolicy
>::apply(
0, geometry, *it1,
0, geometry, *it2,
@@ -105,8 +104,7 @@
bool IsMulti,
typename Geometry,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct self_get_turn_points
@@ -118,23 +116,22 @@
<
typename Ring,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct self_get_turn_points
<
ring_tag, false, Ring,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>
: detail::self_get_turn_points::get_turns
<
Ring,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>
{};
@@ -143,22 +140,22 @@
<
typename Polygon,
typename Turns,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct self_get_turn_points
<
polygon_tag, false, Polygon,
- Turns, IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy,
+ InterruptPolicy
>
: detail::self_get_turn_points::get_turns
<
Polygon,
Turns,
- IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ TurnPolicy,
+ InterruptPolicy
>
{};
@@ -198,14 +195,22 @@
typename boost::range_value<Turns>::type
>::segment_intersection_strategy_type strategy_type;
+ typedef detail::overlay::get_turn_info
+ <
+ typename point_type<Geometry>::type,
+ typename point_type<Geometry>::type,
+ typename boost::range_value<Turns>::type,
+ detail::overlay::assign_null_policy
+ > TurnPolicy;
dispatch::self_get_turn_points
<
typename tag<Geometry>::type,
is_multi<Geometry>::type::value,
Geometry,
- Turns, strategy_type,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy,
+ InterruptPolicy
>::apply(geometry, turns, interrupt_policy);
}
Modified: sandbox/geometry/boost/geometry/algorithms/difference.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/difference.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/difference.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -20,14 +20,15 @@
/*!
- \ingroup difference
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam Collection output collection, either a multi-geometry,
- or a std::vector<Geometry> / std::deque<Geometry> etc
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param output_collection the output collection
+\brief_calc2{difference}
+\ingroup difference
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam Collection output collection, either a multi-geometry,
+ or a std::vector<Geometry> / std::deque<Geometry> etc
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param output_collection the output collection
*/
template
<
Modified: sandbox/geometry/boost/geometry/algorithms/disjoint.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/disjoint.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/disjoint.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -170,6 +170,11 @@
: detail::disjoint::disjoint_segment<Linestring1, Linestring2>
{};
+template <typename Linestring, typename Segment>
+struct disjoint<linestring_tag, segment_tag, Linestring, Segment, false, false, 2>
+ : detail::disjoint::disjoint_linear<Linestring, Segment>
+{};
+
template
<
Modified: sandbox/geometry/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/intersection.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/intersection.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -20,49 +20,31 @@
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/algorithms/detail/overlay/clip_linestring.hpp>
#include <boost/geometry/algorithms/detail/overlay/assemble.hpp>
+#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
+#include <boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp>
#include <boost/geometry/ranges/segment_range.hpp>
namespace boost { namespace geometry
{
-#ifndef DOXYGEN_NO_DISPATCH
-namespace dispatch
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace intersection
{
template
<
- typename TagIn1, typename TagIn2, typename TagOut,
- typename Geometry1, typename Geometry2,
- typename OutputIterator,
- typename GeometryOut,
- typename Strategy
->
-struct intersection_inserter
- : detail::overlay::overlay
- <Geometry1, Geometry2, OutputIterator, GeometryOut, -1, Strategy>
-{};
-
-
-template
-<
typename Segment1, typename Segment2,
- typename OutputIterator, typename GeometryOut,
+ typename OutputIterator, typename PointOut,
typename Strategy
>
-struct intersection_inserter
- <
- segment_tag, segment_tag, point_tag,
- Segment1, Segment2,
- OutputIterator, GeometryOut,
- Strategy
- >
+struct intersection_segment_segment_point
{
static inline OutputIterator apply(Segment1 const& segment1,
Segment2 const& segment2, OutputIterator out,
Strategy const& strategy)
{
- typedef typename point_type<GeometryOut>::type point_type;
+ typedef typename point_type<PointOut>::type point_type;
// Get the intersection point (or two points)
segment_intersection_points<point_type> is
@@ -78,15 +60,110 @@
for (std::size_t i = 0; i < is.count; i++)
{
- GeometryOut p;
+ PointOut p;
geometry::copy_coordinates(is.intersections[i], p);
- *out = p;
- out++;
+ *out++ = p;
}
return out;
}
};
+template
+<
+ typename Linestring1, typename Linestring2,
+ typename OutputIterator, typename PointOut,
+ typename Strategy
+>
+struct intersection_linestring_linestring_point
+{
+ static inline OutputIterator apply(Linestring1 const& linestring1,
+ Linestring2 const& linestring2, OutputIterator out,
+ Strategy const& strategy)
+ {
+ typedef typename point_type<PointOut>::type point_type;
+
+ typedef detail::overlay::turn_info<point_type> turn_info;
+ std::deque<turn_info> turns;
+
+ geometry::get_intersection_points(linestring1, linestring2, turns);
+
+ for (typename boost::range_iterator<std::deque<turn_info> const>::type
+ it = boost::begin(turns); it != boost::end(turns); ++it)
+ {
+ PointOut p;
+ geometry::copy_coordinates(it->point, p);
+ *out++ = p;
+ }
+ return out;
+ }
+};
+
+
+
+}} // namespace detail::disjoint
+#endif // DOXYGEN_NO_DETAIL
+
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+template
+<
+ typename TagIn1, typename TagIn2, typename TagOut,
+ typename Geometry1, typename Geometry2,
+ typename OutputIterator,
+ typename GeometryOut,
+ typename Strategy
+>
+struct intersection_inserter
+ : detail::overlay::overlay
+ <Geometry1, Geometry2, OutputIterator, GeometryOut, -1, Strategy>
+{};
+
+
+template
+<
+ typename Segment1, typename Segment2,
+ typename OutputIterator, typename GeometryOut,
+ typename Strategy
+>
+struct intersection_inserter
+ <
+ segment_tag, segment_tag, point_tag,
+ Segment1, Segment2,
+ OutputIterator, GeometryOut,
+ Strategy
+ > : detail::intersection::intersection_segment_segment_point
+ <
+ Segment1, Segment2,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
+
+template
+<
+ typename Linestring1, typename Linestring2,
+ typename OutputIterator, typename GeometryOut,
+ typename Strategy
+>
+struct intersection_inserter
+ <
+ linestring_tag, linestring_tag, point_tag,
+ Linestring1, Linestring2,
+ OutputIterator, GeometryOut,
+ Strategy
+ > : detail::intersection::intersection_linestring_linestring_point
+ <
+ Linestring1, Linestring2,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
template
<
@@ -169,21 +246,24 @@
#endif // DOXYGEN_NO_DISPATCH
/*!
- \brief Intersects two geometries
- \ingroup intersection
- \details The two input geometries are intersected and the resulting
- linestring(s), ring(s) or polygon(s) are sent
- to the specified output operator.
- \tparam GeometryOut output geometry type, must be specified
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam OutputIterator output iterator
- \tparam Strategy compound strategy for intersection
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param out the output iterator, outputting linestrings or polygons
- \param strategy the strategy
- \return the output iterator
+\brief \brief_calc2{intersection} \brief_strategy
+\ingroup intersection
+\details \details_calc2{intersection_inserter, spatial set theoretic intersection}
+ \brief_strategy. \details_inserter{intersection}
+\tparam GeometryOut \tparam_geometry{\p_l_or_c}
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam OutputIterator \tparam_out{\p_l_or_c}
+\tparam Strategy Compound strategy for intersection
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param out \param_out{intersection}
+\param strategy The strategy
+\return \return_out
+
+\qbk{behavior,[qbk_out __point__]:Calculates intersection points of input geometries}
+\qbk{behavior,[qbk_out __linestring__]:Calculates intersection linestrings of input geometries (NYI)}
+\qbk{behavior,[qbk_out __polygon__]:Calculates intersection polygons input (multi)polygons and/or boxes}
*/
template
<
@@ -229,19 +309,19 @@
/*!
- \brief Intersects two geometries
- \ingroup intersection
- \details The two input geometries are intersected and the resulting
- linestring(s), ring(s) or polygon(s) are sent
- to the specified output operator.
- \tparam GeometryOut output geometry type, must be specified
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam OutputIterator output iterator
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param out the output iterator, outputting linestrings or polygons
- \return the output iterator
+\brief \brief_calc2{intersection}
+\ingroup intersection
+\details \details_calc2{intersection_inserter, spatial set theoretic intersection}. \details_inserter{intersection}
+\tparam GeometryOut \tparam_geometry{\p_l_or_c}
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam OutputIterator \tparam_out{\p_l_or_c}
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param out \param_out{intersection}
+\return \return_out
+
+\qbk{snippet,intersection_segment_inserter}
*/
template
<
@@ -271,18 +351,18 @@
/*!
- \brief Intersects two geometries
- \ingroup intersection
- \details The two input geometries are intersected and the resulting
- linestring(s), ring(s) or polygon(s) are added
- to the specified collection.
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \tparam Collection collection of rings, polygons (e.g. a vector<polygon> or a multi_polygon)
- \param geometry1 first geometry
- \param geometry2 second geometry
- \param output_collection the collection
- \return true if successful
+\brief \brief_calc2{intersection}
+\ingroup intersection
+\details \details_calc2{intersection, spatial set theoretic intersection}.
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam Collection Collection of geometries (e.g. std::vector, std::deque, boost::geometry::multi*) of which
+ the value_type (below referred to as 'GeometryOut') fulfills a \p_l_or_c concept.
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param output_collection The collection being filled or extended by the algorithm
+
+\qbk{snippet,intersection_linestring}
*/
template
<
Modified: sandbox/geometry/boost/geometry/algorithms/intersects.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/intersects.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/intersects.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -21,14 +21,13 @@
{
/*!
- \brief Determine if there is at least one intersection
- (crossing or self-tangency)
- \note This function can be called for one geometry (self-intersection) and
- also for two geometries (intersection)
- \ingroup intersects
- \tparam Geometry geometry type
- \param geometry geometry
- \return true if there are intersections, else false
+\brief \brief_check{at least one intersection(crossing or self-tangency)}
+\note This function can be called for one geometry (self-intersection) and
+ also for two geometries (intersection)
+\ingroup intersects
+\tparam Geometry geometry type
+\param geometry geometry
+\return \return_check{is self-intersecting}
*/
template <typename Geometry>
inline bool intersects(Geometry const& geometry)
@@ -50,13 +49,20 @@
typename geometry::point_type<Geometry>::type
>::segment_intersection_strategy_type segment_intersection_strategy_type;
+ typedef detail::overlay::get_turn_info
+ <
+ typename point_type<Geometry>::type,
+ typename point_type<Geometry>::type,
+ turn_info,
+ detail::overlay::assign_null_policy
+ > TurnPolicy;
+
detail::disjoint::disjoint_interrupt_policy policy;
detail::self_get_turn_points::get_turns
<
Geometry,
std::deque<turn_info>,
- segment_intersection_strategy_type,
- detail::overlay::assign_null_policy,
+ TurnPolicy,
detail::disjoint::disjoint_interrupt_policy
>::apply(geometry, turns, policy);
return policy.has_intersections;
@@ -64,13 +70,13 @@
/*!
- \brief Determine if there is at least one intersection
- \ingroup intersects
- \tparam Geometry1 first geometry type
- \tparam Geometry2 second geometry type
- \param geometry1 first geometry
- \param geometry2 second geometry
- \return true if there are intersection(s), else false
+\brief \brief_check2{have at least one intersection}
+\ingroup intersects
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\return \return_check2{intersect each other}
*/
template <typename Geometry1, typename Geometry2>
inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2)
Modified: sandbox/geometry/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -8,9 +8,10 @@
#ifndef BOOST_GEOMETRY_EXT_GIS_IO_SHAPELIB_SHAPE_CREATOR_HPP
#define BOOST_GEOMETRY_EXT_GIS_IO_SHAPELIB_SHAPE_CREATOR_HPP
-
+#include <fstream>
#include "shapefil.h"
+
#include <boost/noncopyable.hpp>
#include <boost/type_traits/promote.hpp>
@@ -78,6 +79,7 @@
{
m_shp = ::SHPCreate((name + ".shp").c_str(), ShapeType);
m_dbf = ::DBFCreate((name + ".dbf").c_str());
+ m_prj_name = name + ".prj";
if (m_shp == NULL || m_dbf == NULL)
{
@@ -122,10 +124,34 @@
>::apply(m_dbf, row_index, field_index, value);
}
+ inline void SetSrid(int srid)
+ {
+ if (srid == 28992)
+ {
+ std::ofstream out(m_prj_name.c_str());
+ out << "PROJCS[\"RD_New\""
+ << ",GEOGCS[\"GCS_Amersfoort\""
+ << ",DATUM[\"D_Amersfoort\""
+ << ",SPHEROID[\"Bessel_1841\",6377397.155,299.1528128]]"
+ << ",PRIMEM[\"Greenwich\",0]"
+ << ",UNIT[\"Degree\",0.0174532925199432955]]"
+ << ",PROJECTION[\"Double_Stereographic\"]"
+ << ",PARAMETER[\"False_Easting\",155000]"
+ << ",PARAMETER[\"False_Northing\",463000]"
+ << ",PARAMETER[\"Central_Meridian\",5.38763888888889]"
+ << ",PARAMETER[\"Scale_Factor\",0.9999079]"
+ << ",PARAMETER[\"Latitude_Of_Origin\",52.15616055555555]"
+ << ",UNIT[\"Meter\",1]]"
+ << std::endl;
+ }
+ }
+
private :
::SHPHandle m_shp;
::DBFHandle m_dbf;
+ std::string m_prj_name;
+
};
Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -34,9 +34,8 @@
typename MultiTag2,
typename MultiGeometry1,
typename MultiGeometry2,
- typename IntersectionPoints,
- typename Strategy,
- typename AssignPolicy,
+ typename Turns,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -44,17 +43,15 @@
MultiTag1, MultiTag2,
true, true,
MultiGeometry1, MultiGeometry2,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
: detail::get_turns::get_turns_generic
<
MultiGeometry1,
MultiGeometry2,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
{};
@@ -65,9 +62,8 @@
typename MultiTag,
typename SingleGeometry,
typename MultiGeometry,
- typename IntersectionPoints,
- typename Strategy,
- typename AssignPolicy,
+ typename Turns,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -75,17 +71,15 @@
SingleTag, MultiTag,
false, true,
SingleGeometry, MultiGeometry,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
: detail::get_turns::get_turns_generic
<
SingleGeometry,
MultiGeometry,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
{};
@@ -97,9 +91,8 @@
typename SingleTag,
typename MultiGeometry,
typename SingleGeometry,
- typename IntersectionPoints,
- typename Strategy,
- typename AssignPolicy,
+ typename Turns,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
@@ -107,17 +100,15 @@
MultiTag, SingleTag,
true, false,
MultiGeometry, SingleGeometry,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
: detail::get_turns::get_turns_generic
<
MultiGeometry,
SingleGeometry,
- IntersectionPoints,
- Strategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
{};
Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp 2010-09-04 11:16:56 EDT (Sat, 04 Sep 2010)
@@ -25,23 +25,21 @@
template
<
typename MultiPolygon,
- typename IntersectionPoints,
- typename IntersectionStrategy,
- typename AssignPolicy,
+ typename Turns,
+ typename TurnPolicy,
typename InterruptPolicy
>
struct self_get_turn_points
<
multi_polygon_tag, true, MultiPolygon,
- IntersectionPoints, IntersectionStrategy,
- AssignPolicy, InterruptPolicy
+ Turns,
+ TurnPolicy, InterruptPolicy
>
: detail::self_get_turn_points::get_turns
<
MultiPolygon,
- IntersectionPoints,
- IntersectionStrategy,
- AssignPolicy,
+ Turns,
+ TurnPolicy,
InterruptPolicy
>
{};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk