Replaced Object

This commit is contained in:
Efi Fogel 2012-02-09 16:21:01 +00:00
parent b8817aa69c
commit 5a7309f692
12 changed files with 199 additions and 321 deletions

2
.gitattributes vendored
View File

@ -476,7 +476,7 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_d
Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h -text
Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_point_location.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h -text

View File

@ -27,14 +27,11 @@
//#define CGAL_DEBUG_LM
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_point_location/Arr_lm_vertices_generator.h>
#include <CGAL/Object.h>
#include <set>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
@ -69,23 +66,20 @@ public:
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
Ccb_halfedge_const_circulator;
typedef typename Arrangement_2::Outer_ccb_const_iterator
Outer_ccb_const_iterator;
Outer_ccb_const_iterator;
typedef typename Arrangement_2::Inner_ccb_const_iterator
Inner_ccb_const_iterator;
Inner_ccb_const_iterator;
typedef typename Arrangement_2::Isolated_vertex_const_iterator
Isolated_vertex_const_iterator;
typedef typename Arrangement_2::Point_2 Point_2;
typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> Result;
typedef typename Result::Type Result_type;
// Support boost::result_of
typedef Result_type result_type;
protected:
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
@ -100,25 +94,6 @@ protected:
typedef std::set<Halfedge_const_handle, Less_halfedge_handle> Halfedge_set;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
// Data members:
const Arrangement_2* p_arr; // The associated arrangement.
const Traits_adaptor_2* m_traits; // Its associated traits object.
@ -126,6 +101,10 @@ protected:
bool own_gen; // Indicates whether the generator
// has been locally allocated.
template<typename T>
Result_type result_return(T t) const { return Result()(t); }
inline Result_type result_return() const { return Result()(); }
public:
/*! Default constructor. */
Arr_landmarks_point_location() :

View File

@ -22,12 +22,8 @@
#ifndef CGAL_ARR_NAIVE_POINT_LOCATION_H
#define CGAL_ARR_NAIVE_POINT_LOCATION_H
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Object.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
/*! \file
* Definition of the Arr_naive_point_location<Arrangement> template.
@ -55,44 +51,25 @@ public:
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> Result;
typedef typename Result::Type Result_type;
// Support boost::result_of
typedef Result_type result_type;
protected:
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
// Data members:
const Arrangement_2* p_arr; // The associated arrangement.
const Traits_adaptor_2* geom_traits; // Its associated geometry traits.
const Topology_traits* top_traits; // Its associated topology traits.
template<typename T>
Result_type result_return(T t) const { return Result()(t); }
inline Result_type result_return() const { return Result()(); }
public:
/*! Default constructor. */
Arr_naive_point_location() :
p_arr(NULL),
@ -101,8 +78,7 @@ public:
{}
/*! Constructor given an arrangement. */
Arr_naive_point_location(const Arrangement_2& arr) :
p_arr(&arr)
Arr_naive_point_location(const Arrangement_2& arr) : p_arr(&arr)
{
geom_traits = static_cast<const Traits_adaptor_2*>(p_arr->geometry_traits());
top_traits = p_arr->topology_traits();
@ -131,7 +107,7 @@ public:
* query point. This object is either a Face_const_handle or a
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type locate(const Point_2& p) const;
Result_type locate(const Point_2& p) const;
};
} //namespace CGAL

View File

@ -16,13 +16,14 @@
//
// Author(s) : Idit Haran <haranidi@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_ARR_LANDMARKS_GENERATOR_H
#define CGAL_ARR_LANDMARKS_GENERATOR_H
/*! \file
* Definition of the Arr_landmarks_generator_base<Arrangement> template.
*/
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h>
@ -31,8 +32,6 @@
#include <list>
#include <algorithm>
#include <vector>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
@ -72,14 +71,8 @@ public:
typedef std::vector<Point_2> Points_set;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object PL_result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> PL_variant_type;
typedef typename boost::optional<PL_variant_type> PL_result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> PL_result;
typedef typename PL_result::Type PL_result_type;
typedef std::pair<Point_2, PL_result_type> PL_pair;
typedef std::vector<PL_pair> Pairs_set;
@ -92,24 +85,6 @@ private:
protected:
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object pl_result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object pl_result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline PL_result_type pl_result_return(T t) const { return PL_result_type(t); }
inline PL_result_type pl_result_return() const { return PL_result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
// Data members:
const Traits_adaptor_2* m_traits; // The associated traits object.
Nearest_neighbor nn; // The associated nearest neighbor object.
@ -117,6 +92,10 @@ protected:
bool updated;
int num_small_not_updated_changes;
template<typename T>
PL_result_type pl_result_return(T t) { return PL_result()(t); }
inline PL_result_type pl_result_return() { return PL_result()(); }
public:
bool is_empty() const { return nn.is_empty(); }

View File

@ -27,7 +27,7 @@
#include <CGAL/basic.h>
#include <CGAL/Search_traits.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <boost/variant.hpp>
@ -43,25 +43,19 @@ namespace CGAL {
template <typename Arrangement_>
class Arr_landmarks_nearest_neighbor {
public:
typedef Arrangement_ Arrangement_2;
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object PL_result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> PL_variant_type;
typedef typename boost::optional<PL_variant_type> PL_result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> PL_result;
typedef typename PL_result::Type PL_result_type;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Geometry_traits_2::Approximate_number_type
Approximate_number_type;
typedef typename Geometry_traits_2::Point_2 Point_2;
Approximate_number_type;
typedef typename Geometry_traits_2::Point_2 Point_2;
/*! \class NN_Point_2
* Stores a point along with its approximate coordinates and its location

View File

@ -33,7 +33,7 @@ namespace CGAL {
// Locate the arrangement feature containing the given point.
//
template <class Arrangement>
typename Arr_naive_point_location<Arrangement>::result_type
typename Arr_naive_point_location<Arrangement>::Result_type
Arr_naive_point_location<Arrangement>::locate(const Point_2& p) const
{
// Go over the arrangement vertices and check whether one of them equals

View File

@ -1,37 +0,0 @@
// Copyright (c) 2012 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_POINT_LOCATION_H
#define CGAL_ARR_POINT_LOCATION_H
// The macro CGAL_POINT_LOCATION_VERSION controls which version of the
// point location is used. Currently two values are supported:
// 1. Point location with CGAL::Object
// 2. Point location with boost::optional<boost::variant<...> >
// The default value is 2.
#if !defined(CGAL_POINT_LOCATION_VERSION)
#define CGAL_POINT_LOCATION_VERSION 2
#endif
namespace CGAL {
} //namespace CGAL
#endif

View File

@ -0,0 +1,80 @@
// Copyright (c) 2012 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: $
// $Id: $
//
//
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_POINT_LOCATION_RESULT_H
#define CGAL_ARR_POINT_LOCATION_RESULT_H
// The macro CGAL_POINT_LOCATION_VERSION controls which version of the
// point location is used. Currently two values are supported:
// 1. Point location with CGAL::Object
// 2. Point location with boost::optional<boost::variant<...> >
// The default value is 2.
#if !defined(CGAL_POINT_LOCATION_VERSION)
#define CGAL_POINT_LOCATION_VERSION 2
#endif
#include <CGAL/Object.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
template <typename Arrangement_>
struct Arr_point_location_result {
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object Type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> Variant_type;
typedef typename boost::optional<Variant_type> Type;
#endif
typedef Type type;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object operator()(T t) const { return CGAL::make_object(t); }
inline CGAL::Object operator()() const { return CGAL::Object(); }
#else
template<typename T>
inline Type operator()(T t) const { return Type(t); }
inline Type operator()() const { return Type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
};
} //namespace CGAL
#endif

View File

@ -26,12 +26,8 @@
* Definition of the Arr_simple_point_location<Arrangement> template.
*/
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Object.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
@ -55,45 +51,26 @@ public:
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> Result;
typedef typename Result::Type Result_type;
// Support boost::result_of
typedef Result_type result_type;
protected:
typedef typename Topology_traits::Dcel Dcel;
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
// Data members:
const Arrangement_2* p_arr; // The associated arrangement.
const Traits_adaptor_2* geom_traits; // Its associated geometry traits.
const Topology_traits* top_traits; // Its associated topology traits.
public:
template<typename T>
Result_type result_return(T t) const { return Result()(t); }
inline Result_type result_return() const { return Result()(); }
public:
/*! Default constructor. */
Arr_simple_point_location() :
p_arr(NULL),
@ -145,9 +122,7 @@ public:
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type ray_shoot_up(const Point_2& p) const
{
return (_vertical_ray_shoot(p, true));
}
{ return (_vertical_ray_shoot(p, true)); }
/*!
* Locate the arrangement feature which a downward vertical ray emanating
@ -158,12 +133,9 @@ public:
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type ray_shoot_down(const Point_2& p) const
{
return (_vertical_ray_shoot(p, false));
}
{ return (_vertical_ray_shoot(p, false)); }
protected:
/*!
* Locate the arrangement feature which a vertical ray emanating from the
* given point hits (not inculding isolated vertices).

View File

@ -25,15 +25,11 @@
* Definition of the Arr_trapezoid_ric_point_location<Arrangement> template.
*/
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <CGAL/Arr_point_location/Td_traits.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/Object.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
@ -93,31 +89,31 @@ public:
template <typename Arrangement_>
class Arr_trapezoid_ric_point_location : public Arr_observer <Arrangement_> {
public:
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2;
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator;
typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator;
typedef typename Arrangement_2::Halfedge_const_iterator
Halfedge_const_iterator;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator;
typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator;
typedef typename Arrangement_2::Halfedge_const_iterator
Halfedge_const_iterator;
typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator
Halfedge_around_vertex_const_circulator;
Halfedge_around_vertex_const_circulator;
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
Ccb_halfedge_const_circulator;
Ccb_halfedge_const_circulator;
typedef typename Arrangement_2::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
Ccb_halfedge_circulator;
typedef typename Arrangement_2::Isolated_vertex_const_iterator
Isolated_vertex_const_iterator;
Isolated_vertex_const_iterator;
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
@ -128,41 +124,21 @@ public:
typedef PL_X_curve_plus<Arrangement_2> X_curve_plus;
typedef CGAL::Td_traits<Traits_adaptor_2, X_curve_plus> Td_traits;
typedef Trapezoidal_decomposition_2<Td_traits> Trapezoidal_decomposition;
typedef std::vector<Halfedge_const_handle> Halfedge_handle_container;
typedef typename Halfedge_handle_container::iterator
Halfedge_handle_iterator;
typedef Trapezoidal_decomposition_2<Td_traits>
Trapezoidal_decomposition;
typedef std::vector<Halfedge_const_handle>
Halfedge_handle_container;
typedef typename Halfedge_handle_container::iterator
Halfedge_handle_iterator;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> Result;
typedef typename Result::Type Result_type;
// Support boost::result_of
typedef Result_type result_type;
protected:
typedef Trapezoidal_decomposition TD;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
typedef Trapezoidal_decomposition TD;
// Data members:
const Traits_adaptor_2* m_traits; // Its associated traits object.
@ -174,8 +150,11 @@ protected:
X_monotone_curve_2 m_curve_before_merge1;
X_monotone_curve_2 m_curve_before_merge2;
public:
template<typename T>
Result_type result_return(T t) const { return Result()(t); }
inline Result_type result_return() const { return Result()(); }
public:
/*! Default constructor. */
Arr_trapezoid_ric_point_location(bool rebuild = true) :
m_traits(NULL),
@ -322,14 +301,12 @@ public:
//@}
public:
#ifdef CGAL_TD_DEBUG
void debug()
{ td.debug(); }
#endif
protected:
/*! Clear the trapezoidal decomposition. */
inline void clear_trapezoid_ric()
{ td.clear(); }

View File

@ -26,11 +26,8 @@
* Definition of the Arr_walk_along_line_point_location<Arrangement> template.
*/
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Object.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
namespace CGAL {
@ -57,48 +54,30 @@ public:
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
typedef Arr_point_location_result<Arrangement_2> Result;
typedef typename Result::Type Result_type;
// Support boost::result_of
typedef Result_type result_type;
protected:
typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
Ccb_halfedge_const_circulator;
Ccb_halfedge_const_circulator;
typedef typename Arrangement_2::Inner_ccb_const_iterator
Inner_ccb_const_iterator;
Inner_ccb_const_iterator;
typedef typename Arrangement_2::Isolated_vertex_const_iterator
Isolated_vertex_const_iterator;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
Isolated_vertex_const_iterator;
// Data members:
const Arrangement_2* p_arr; // The associated arrangement.
const Traits_adaptor_2* geom_traits; // Its associated geometry traits.
const Topology_traits* top_traits; // Its associated topology traits.
template<typename T>
Result_type result_return(T t) const { return Result()(t); }
inline Result_type result_return() const { return Result()(); }
public:
/*! Default constructor. */
Arr_walk_along_line_point_location() :

View File

@ -25,7 +25,7 @@
* Definition of the Arr_batched_pl_sl_visitor class-template.
*/
#include <CGAL/Arr_point_location/Arr_point_location.h>
#include <CGAL/Arr_point_location_result.h>
#include <CGAL/Object.h>
#include <boost/variant.hpp>
@ -52,42 +52,21 @@ public:
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
#if CGAL_POINT_LOCATION_VERSION < 2
typedef CGAL::Object result_type;
#else
typedef typename boost::variant<Vertex_const_handle,
Halfedge_const_handle,
Face_const_handle> variant_type;
typedef typename boost::optional<variant_type> result_type;
#endif
protected:
typedef typename Helper::Base_visitor Base;
typedef typename Base::Status_line_iterator Status_line_iterator;
// This function returns either make_object() or a result_type constructor
// to generate return values. The Object version takes a dummy template
// argument, which is needed for the return of the other option, e.g.,
// boost::optional<boost::variant> >.
// In theory a one parameter variant could be returned, but this _could_
// lead to conversion overhead, and so we rather go for the real type.
// Overloads for empty returns are also provided.
#if CGAL_POINT_LOCATION_VERSION < 2
template<typename T>
inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); }
inline CGAL::Object result_return() const { return CGAL::Object(); }
#else
template<typename T>
inline result_type result_return(T t) const { return result_type(t); }
inline result_type result_return() const { return result_type(); }
#endif // CGAL_POINT_LOCATION_VERSION < 2
typedef Arr_point_location_result<Arrangement_2> Pl_result;
typedef typename Pl_result::Type Pl_result_type;
// Data members:
Helper m_helper; // The helper class.
OutputIterator& m_out; // An output iterator for the result.
template<typename T>
Pl_result_type pl_result_return(T t) { return Pl_result()(t); }
inline Pl_result_type pl_result_return() { return Pl_result()(); }
public:
/*!
* Constructor.
@ -148,7 +127,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
if (event->is_action()) {
// The query point coincides with an isolated arrangement vertex:
Vertex_const_handle vh = event->point().vertex_handle();
*m_out++ = std::make_pair(event->point().base(), result_return(vh));
*m_out++ = std::make_pair(event->point().base(), pl_result_return(vh));
return true;
}
@ -171,15 +150,15 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
vh = he->source();
}
*m_out++ = std::make_pair(event->point().base(), result_return(vh));
*m_out++ = std::make_pair(event->point().base(), pl_result_return(vh));
return true;
}
if (above == this->status_line_end()) {
// There are no valid edges above the query point, so we use the helper
// class to obtain the current top face.
*m_out++ =
std::make_pair(event->point().base(), result_return(m_helper.top_face()));
*m_out++ = std::make_pair(event->point().base(),
pl_result_return(m_helper.top_face()));
return true;
}
@ -187,7 +166,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
// The query point lies on the halfedge associated with the subcurve
// that the status-line iterator refers to.
Halfedge_const_handle he = (*above)->last_curve().halfedge_handle();
*m_out++ = std::make_pair(event->point().base(), result_return(he));
*m_out++ = std::make_pair(event->point().base(), pl_result_return(he));
return true;
}
@ -195,7 +174,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
// the query point, such that the query point is located in the incident
// face of this halfedge.
Halfedge_const_handle he = (*above)->last_curve().halfedge_handle();
*m_out++ = std::make_pair(event->point().base(), result_return(he->face()));
*m_out++ = std::make_pair(event->point().base(), pl_result_return(he->face()));
return true;
}