mirror of https://github.com/CGAL/cgal
wip copy
This commit is contained in:
parent
182e524200
commit
6cc05e3920
|
|
@ -159,7 +159,7 @@ namespace CGAL {
|
|||
* @post *this is valid.
|
||||
*/
|
||||
template <typename CMap2, typename Converters>
|
||||
void copy(const CMap2& amap, Converters& converters)
|
||||
void copy(const CMap2& amap, const Converters& converters)
|
||||
{
|
||||
this->clear();
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
template <typename CMap2>
|
||||
void copy(const CMap2 & amap)
|
||||
void copy(const CMap2& amap)
|
||||
{
|
||||
CGAL::cpp11::tuple<> converters;
|
||||
return copy< CMap2, CGAL::cpp11::tuple<> >(amap, converters);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ namespace internal
|
|||
// ****************************************************************************
|
||||
// Map1 is the existing map, to convert into map2.
|
||||
// Case where the two i-attributes are non void.
|
||||
template< typename Map1, typename Map2, unsigned int i, typename Info1, typename Info2 >
|
||||
template< typename Map1, typename Map2, unsigned int i,
|
||||
typename Info1, typename Info2 >
|
||||
struct Default_converter_two_non_void_attributes_cmap
|
||||
{
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
|
|
@ -88,10 +89,12 @@ template<typename Map1, typename Map2, typename Converters, unsigned int i,
|
|||
struct Convert_attribute_functor
|
||||
{
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
run( Map2* cmap2, typename Map1::Dart_const_handle dh1,
|
||||
const Converters& converters)
|
||||
run( const Map1* cmap1, Map2* cmap2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2, const Converters& converters)
|
||||
{
|
||||
return CGAL::Default_converter_cmap_attributes<Map1, Map2, i>() (*cmap2, dh1);
|
||||
return
|
||||
CGAL::Default_converter_cmap_attributes<Map1, Map2, i>()
|
||||
(*cmap1, *cmap2, dh1, dh2);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -99,10 +102,10 @@ template<typename Map1, typename Map2, typename Converters, unsigned int i>
|
|||
struct Convert_attribute_functor<Map1,Map2,Converters,i,false>
|
||||
{
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
run( Map2* cmap2, typename Map1::Dart_const_handle dh1,
|
||||
const Converters& converters)
|
||||
run( const Map1* cmap1, Map2* cmap2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2, const Converters& converters)
|
||||
{
|
||||
return CGAL::cpp11::get<i>(converters) (*cmap2, dh1);
|
||||
return CGAL::cpp11::get<i>(converters) (*cmap1, *cmap2, dh1, dh2);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -122,7 +125,7 @@ struct Copy_attributes_functor
|
|||
{
|
||||
typename Map2::template Attribute_handle<i>::type
|
||||
res=Convert_attribute_functor<Map1,Map2,Converters,i>::
|
||||
run(cmap2,dh1,converters);
|
||||
run(cmap1, cmap2, dh1, dh2, converters);
|
||||
|
||||
if ( res!=NULL )
|
||||
cmap2->template set_attribute<i>(dh2, res);
|
||||
|
|
@ -140,7 +143,8 @@ template< typename Map1, typename Map2, unsigned int i,
|
|||
struct Default_converter_cmap_attributes
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type operator()
|
||||
(Map2& map2, typename Map1::Dart_const_handle dh1) const
|
||||
(const Map1& map1, Map2& map2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2) const
|
||||
{ return internal::Default_converter_two_non_void_attributes_cmap
|
||||
<Map1,Map2,i,typename Attr1::Info,typename Attr2::Info>::
|
||||
run(map2, dh1->template attribute<i>()); }
|
||||
|
|
@ -151,7 +155,8 @@ template< typename Map1, typename Map2, unsigned int i,
|
|||
struct Default_converter_cmap_attributes<Map1, Map2, i, Attr1, CGAL::Void>
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type operator()
|
||||
(Map2&, typename Map1::Dart_const_handle) const
|
||||
(const Map1& map1, Map2& map2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2) const
|
||||
{ return NULL; }
|
||||
};
|
||||
|
||||
|
|
@ -160,7 +165,8 @@ template< typename Map1, typename Map2, unsigned int i,
|
|||
struct Default_converter_cmap_attributes<Map1, Map2, i, CGAL::Void, Attr2>
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type operator()
|
||||
(Map2&, typename Map1::Dart_const_handle) const
|
||||
(const Map1& map1, Map2& map2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2) const
|
||||
{ return NULL; }
|
||||
};
|
||||
|
||||
|
|
@ -168,7 +174,8 @@ template< typename Map1, typename Map2, unsigned int i>
|
|||
struct Default_converter_cmap_attributes<Map1, Map2, i, CGAL::Void, CGAL::Void>
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type operator()
|
||||
(Map2&, typename Map1::Dart_const_handle) const
|
||||
(const Map1& map1, Map2& map2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2) const
|
||||
{ return NULL; }
|
||||
};
|
||||
|
||||
|
|
@ -181,12 +188,13 @@ template< typename Map1, typename Map2, unsigned int i>
|
|||
struct Cast_converter_cmap_attributes
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type operator()
|
||||
(Map2& map2, typename Map1::Dart_const_handle dh) const
|
||||
(const Map1& map1, Map2& map2, typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_handle dh2) const
|
||||
{
|
||||
if ( dh->template attribute<i>()!=NULL )
|
||||
if ( dh1->template attribute<i>()!=NULL )
|
||||
return map2.template create_attribute<i>
|
||||
((typename Map2::template Attribute_type<i>::type::Info)
|
||||
dh->template attribute<i>()->info());
|
||||
dh1->template attribute<i>()->info());
|
||||
|
||||
return map2.template create_attribute<i>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -459,8 +459,8 @@ template<typename Map1, typename Map2,
|
|||
typename T1, typename T2, int i>
|
||||
struct Is_same_attribute_functor
|
||||
{
|
||||
static bool const run(typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_const_handle dh2)
|
||||
static bool run(typename Map1::Dart_const_handle dh1,
|
||||
typename Map2::Dart_const_handle dh2)
|
||||
{
|
||||
if (dh1->template attribute<i>()==NULL &&
|
||||
dh2->template attribute<i>()==NULL)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <CGAL/Combinatorial_map_constructors.h>
|
||||
#include <CGAL/Linear_cell_complex_min_items.h>
|
||||
#include <CGAL/Linear_cell_complex_traits.h>
|
||||
#include <CGAL/internal/Linear_cell_complex_copy_functors.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -81,6 +82,8 @@ namespace CGAL {
|
|||
typedef typename Base::template Attribute_const_range<0>::type
|
||||
Vertex_attribute_const_range;
|
||||
|
||||
typedef typename Base::size_type size_type;
|
||||
|
||||
/// To use previous definition of create_dart methods.
|
||||
using Base::create_dart;
|
||||
|
||||
|
|
@ -92,114 +95,34 @@ namespace CGAL {
|
|||
* @param alcc the linear cell complex to copy.
|
||||
* @post *this is valid.
|
||||
*/
|
||||
template <unsigned int dbis, unsigned int ambientdimbis, typename Traitsbis,
|
||||
typename Itemsbis, class Allocbis, typename CMapbis, typename Converters>
|
||||
void copy(const Linear_cell_complex<dbis,ambientdimbis,Traitsbis,
|
||||
Itemsbis,Allocbis,CMapbis> & alcc,
|
||||
Converters& converters)
|
||||
template <typename LCC2, typename Converters>
|
||||
void copy(const LCC2& alcc, const Converters& converters)
|
||||
{
|
||||
typedef Linear_cell_complex<dbis,ambientdimbis,Traitsbis,Itemsbis,Allocbis,
|
||||
CMapbis> LCC2;
|
||||
typedef typename CGAL::internal::Modify_tuple_of_converter_for_vertex_attribute
|
||||
<Self, LCC2, Converters>::type Converters2;
|
||||
|
||||
this->clear();
|
||||
|
||||
this->mnb_used_marks = amap.mnb_used_marks;
|
||||
this->mmask_marks = amap.mmask_marks;
|
||||
|
||||
for (size_type i = 0; i < NB_MARKS; ++i)
|
||||
{
|
||||
this->mfree_marks_stack[i] = amap.mfree_marks_stack[i];
|
||||
this->mindex_marks[i] = amap.mindex_marks[i];
|
||||
this->mnb_marked_darts[i] = amap.mnb_marked_darts[i];
|
||||
this->mnb_times_reserved_marks[i] = amap.mnb_times_reserved_marks[i];
|
||||
}
|
||||
|
||||
// We must do this ony once, but problem because null_dart_handle
|
||||
// is static !
|
||||
if (mnull_dart_container.empty())
|
||||
{
|
||||
null_dart_handle =
|
||||
mnull_dart_container.emplace(amap.null_dart_handle->mmarks);
|
||||
|
||||
for (unsigned int i = 0; i <= dimension; ++i)
|
||||
{
|
||||
null_dart_handle->unlink_beta(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
null_dart_handle->mmarks = amap.null_dart_handle->mmarks;
|
||||
|
||||
// Create an mapping between darts of the two maps (originals->copies).
|
||||
std::map<typename CMap2::Dart_const_handle, Dart_handle> dartmap;
|
||||
|
||||
for (typename CMap2::Dart_const_range::const_iterator
|
||||
it=amap.darts().begin(), itend=amap.darts().end();
|
||||
it!=itend; ++it)
|
||||
{
|
||||
dartmap[it]=mdarts.emplace(it->mmarks);
|
||||
}
|
||||
|
||||
unsigned int min_dim=
|
||||
(dimension<amap.dimension?dimension:amap.dimension);
|
||||
|
||||
typename std::map<typename CMap2::Dart_const_handle,Dart_handle>
|
||||
::iterator dartmap_iter, dartmap_iter_end=dartmap.end();
|
||||
for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
|
||||
++dartmap_iter)
|
||||
{
|
||||
for (unsigned int i=0; i<=min_dim; i++)
|
||||
{
|
||||
if (dartmap_iter->first->beta(i)!=CMap2::null_dart_handle &&
|
||||
(dartmap_iter->first)<(dartmap_iter->first->beta(i)))
|
||||
{
|
||||
basic_link_beta(dartmap_iter->second,
|
||||
dartmap[dartmap_iter->first->beta(i)], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Copy attributes */
|
||||
for (dartmap_iter=dartmap.begin(); dartmap_iter!=dartmap_iter_end;
|
||||
++dartmap_iter)
|
||||
{
|
||||
Helper::template Foreach_enabled_attributes
|
||||
< internal::Copy_attributes_functor <CMap2, Self, Converters> >::
|
||||
run(&amap, this, dartmap_iter->first, dartmap_iter->second,
|
||||
converters);
|
||||
// Ici tester si pas attribut alors le créer et associer le Point
|
||||
if ( dartmap_iter->second->attribute<0>()==NULL )
|
||||
{
|
||||
set_attribute<0>(dartmap_iter->second, create_attribute<0>());
|
||||
Set_point_if_exist<Attribute_type<0>::type,
|
||||
typename LCC2::template Attribute_type<0>::type>::
|
||||
run( dartmap_iter->first->template attribute<0>(),
|
||||
dartmap_iter->second->template attribute<0>() );
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_assertion (is_valid () == 1);
|
||||
Converters2 converters2=CGAL::internal::Modify_tuple_of_converter_for_vertex_attribute
|
||||
<Self, LCC2, Converters>::run(converters);
|
||||
Base::template copy<LCC2, Converters2>(alcc, converters2);
|
||||
}
|
||||
|
||||
template <unsigned int dbis, unsigned int ambientdimbis, typename Traitsbis,
|
||||
typename Itemsbis, class Allocbis, typename CMapbis>
|
||||
void copy(const Linear_cell_complex<dbis,ambientdimbis,Traitsbis,
|
||||
Itemsbis,Allocbis,CMapbis> & alcc)
|
||||
template <typename LCC2>
|
||||
void copy(const LCC2& alcc)
|
||||
{
|
||||
CGAL::cpp11::tuple<> converters;
|
||||
return copy< dbis,Refsbis,Itemsbis,Allocbis,CGAL::cpp11::tuple<> >
|
||||
(amap, converters);
|
||||
return copy<LCC2, CGAL::cpp11::tuple<> >(alcc, converters);
|
||||
}
|
||||
|
||||
Linear_cell_complex(const Self & alcc)
|
||||
{ copy<dimension, ambientdimbis>(alcc); }
|
||||
{ copy<Self>(alcc); }
|
||||
|
||||
template < class LCC >
|
||||
Linear_cell_complex(const LCC & alcc)
|
||||
{ Base::copy(alcc);}
|
||||
template < class LCC2 >
|
||||
Linear_cell_complex(const LCC2& alcc)
|
||||
{ copy<LCC2>(alcc);}
|
||||
|
||||
template < class LCC, typename Converters >
|
||||
Linear_cell_complex(const LCC & alcc, Converters& converters)
|
||||
{ Base::copy(alcc, converters);}
|
||||
template < class LCC2, typename Converters >
|
||||
Linear_cell_complex(const LCC2& alcc, Converters& converters)
|
||||
{ copy<LCC2, Converters>(alcc, converters);}
|
||||
|
||||
/** Create a vertex attribute.
|
||||
* @return an handle on the new attribute.
|
||||
|
|
@ -808,7 +731,7 @@ namespace CGAL {
|
|||
{ return insert_point_in_cell<i>(dh, barycenter<i>(dh)); }
|
||||
|
||||
/** Compute the dual of a Linear_cell_complex.
|
||||
* @param amap the lcc in which we build the dual of this lcc.
|
||||
* @param alcc the lcc in which we build the dual of this lcc.
|
||||
* @param adart a dart of the initial lcc, NULL by default.
|
||||
* @return adart of the dual lcc, the dual of adart if adart!=NULL,
|
||||
* any dart otherwise.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@
|
|||
*/
|
||||
namespace CGAL
|
||||
{
|
||||
template< typename LCC1, typename LCC2>
|
||||
struct Attribute_converter_lcc_vertex_attributes;
|
||||
|
||||
template< typename Functor, typename LCC1, typename LCC2>
|
||||
struct Modify_attribute_converter_lcc_vertex_attributes;
|
||||
// ****************************************************************************
|
||||
namespace internal
|
||||
{
|
||||
|
|
@ -62,7 +67,8 @@ struct Set_point_if_possible
|
|||
};
|
||||
|
||||
template<typename Point1, typename Point2>
|
||||
struct Set_point_if_possible<Point1, Point2, Dimension_tag<2>, Dimension_tag<2> >
|
||||
struct Set_point_if_possible<Point1, Point2,
|
||||
Dimension_tag<2>, Dimension_tag<2> >
|
||||
{
|
||||
static void run(const Point1& p1, Point2& p2)
|
||||
{
|
||||
|
|
@ -72,7 +78,8 @@ struct Set_point_if_possible<Point1, Point2, Dimension_tag<2>, Dimension_tag<2>
|
|||
};
|
||||
|
||||
template<typename Point1, typename Point2>
|
||||
struct Set_point_if_possible<Point1, Point2, Dimension_tag<3>, Dimension_tag<3> >
|
||||
struct Set_point_if_possible<Point1, Point2,
|
||||
Dimension_tag<3>, Dimension_tag<3> >
|
||||
{
|
||||
static void run(const Point1& p1, Point2& p2)
|
||||
{
|
||||
|
|
@ -111,68 +118,329 @@ struct Set_point_if_exist<Attr1, Attr2, Point1, CGAL::Void>
|
|||
{}
|
||||
};
|
||||
// ****************************************************************************
|
||||
// Map1 is the existing map, to convert into map2.
|
||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
template <typename LCC1, typename LCC2, class Tuple,
|
||||
class Res=CGAL::cpp11::tuple<> >
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute;
|
||||
|
||||
// empty tuple and empty res: res is a tuple with only
|
||||
// Point_converter_lcc_vertex_attributes
|
||||
template <typename LCC1, typename LCC2>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<>, CGAL::cpp11::tuple<> >
|
||||
{
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Point_converter_lcc_vertex_attributes<LCC1, LCC2> > type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<>&)
|
||||
{ return type(); }
|
||||
};
|
||||
|
||||
// empty tuple but non empty res: we already have modified vertex attribute
|
||||
template < typename LCC1, typename LCC2, class ... Res >
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<>, CGAL::cpp11::tuple<Res...> >
|
||||
{
|
||||
typedef CGAL::cpp11::tuple<Res...> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<>&)
|
||||
{ CGAL_assertion(false); return type(); }
|
||||
};
|
||||
|
||||
// empty res but non empty empty tuple, Firsttype is vertex attribute.
|
||||
template < typename LCC1, typename LCC2, class Firsttype, class ... Tuple >
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<Firstype, Tuple...>, CGAL::cpp11::tuple<> >
|
||||
{
|
||||
typedef typename Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<Tuple...>,
|
||||
CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<Firsttype, LCC1, LCC2> >::
|
||||
type type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<Firsttype, Tuple...>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<Firsttype, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
// non empty res, non empty tuple, we copy
|
||||
template < typename LCC1, typename LCC2, class Firsttype,
|
||||
class ... Tuple, class ... Res >
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<Firsttype,Tuple...>,
|
||||
CGAL::cpp11::tuple<Res...> >
|
||||
{
|
||||
typedef typename Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1, LCC2, CGAL::cpp11::tuple<Tuple...>,
|
||||
CGAL::cpp11::tuple<Res...,Functor> >::type type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<>&)
|
||||
{ CGAL_assertion(false); return type; }
|
||||
};
|
||||
#else // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
template <class LCC1, class LCC2, class Tuple>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute;
|
||||
|
||||
template <class LCC1, class LCC2>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Attribute_converter_lcc_vertex_attributes<LCC1, LCC2> > type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<>&)
|
||||
{ return type(); }
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2> > type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3>
|
||||
type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4>
|
||||
type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4,
|
||||
class T5>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4,T5> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4,
|
||||
T5> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4,T5>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4,
|
||||
class T5, class T6>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4,
|
||||
T5,T6> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4,
|
||||
class T5, class T6, class T7>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4,
|
||||
T5,T6,T7> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4,
|
||||
class T5, class T6, class T7, class T8>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7,T8> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4,
|
||||
T5,T6,T7,T8> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7,T8>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
|
||||
template <class LCC1, class LCC2, class T1, class T2, class T3, class T4,
|
||||
class T5, class T6, class T7, class T8, class T9>
|
||||
struct Modify_tuple_of_converter_for_vertex_attribute
|
||||
<LCC1,LCC2,CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> > {
|
||||
typedef CGAL::cpp11::tuple
|
||||
<Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>,T2,T3,T4,
|
||||
T5,T6,T7,T8,T9> type;
|
||||
|
||||
static type run(const CGAL::cpp11::tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9>& t)
|
||||
{
|
||||
return type
|
||||
(Modify_attribute_converter_lcc_vertex_attributes<T1, LCC1, LCC2>
|
||||
(t.get_head()),
|
||||
t.get_tail());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
// ****************************************************************************
|
||||
} // namespace internal
|
||||
// LCC1 is the existing map, to convert into map2.
|
||||
// ****************************************************************************
|
||||
template< typename LCC1, typename LCC2>
|
||||
struct Attribute_converter_lcc_vertex_attributes
|
||||
{
|
||||
typename LCC2::Vertex_attribute_handle operator()
|
||||
(const LCC1& map1, LCC2& map2, typename LCC1::Dart_const_handle dh1,
|
||||
typename LCC2::Dart_handle dh2) const
|
||||
{
|
||||
map2.set_vertex_attribute(dh2, map2.create_vertex_attribute());
|
||||
internal::Set_point_if_exist<typename LCC1::Vertex_attribute,
|
||||
typename LCC2::Vertex_attribute>::
|
||||
run( dh1->vertex_attribute(), dh2->vertex_attribute() );
|
||||
return dh2->vertex_attribute();
|
||||
}
|
||||
};
|
||||
// ****************************************************************************
|
||||
template< typename Functor, typename LCC1, typename LCC2>
|
||||
struct Modify_attribute_converter_lcc_vertex_attributes
|
||||
{
|
||||
Modify_attribute_converter_lcc_vertex_attributes(const Functor& f): myf(f)
|
||||
{}
|
||||
|
||||
typename LCC2::Vertex_attribute_handle operator()
|
||||
(const LCC1& map1, LCC2& map2, typename LCC1::Dart_const_handle dh1,
|
||||
typename LCC2::Dart_handle dh2) const
|
||||
{
|
||||
myf(map1, map2, dh1, dh2);
|
||||
if ( dh2->vertex_attribute()==NULL )
|
||||
map2.set_vertex_attribute(dh2, map2.create_vertex_attribute());
|
||||
internal::Set_point_if_exist<typename LCC1::Vertex_attribute,
|
||||
typename LCC2::Vertex_attribute>::
|
||||
run( dh1->vertex_attribute(), dh2->vertex_attribute() );
|
||||
return dh2->vertex_attribute();
|
||||
}
|
||||
private:
|
||||
Functor myf;
|
||||
};
|
||||
// Case where the two i-attributes are non void.
|
||||
template< typename Map1, typename Map2, unsigned int i,
|
||||
template< typename LCC1, typename LCC2, unsigned int i,
|
||||
typename Info1, typename Info2,
|
||||
typename Point2 >
|
||||
struct Default_converter_two_non_void_attributes_lcc
|
||||
{ // Here Info1!=Info2 but Point2!=CGAL::Void (thus Linear_cell_complex)
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
run(Map2& map2, typename Map1::template Attribute_const_handle<i>::type ah)
|
||||
static typename LCC2::template Attribute_handle<i>::type
|
||||
run(LCC2& map2, typename LCC1::template Attribute_const_handle<i>::type ah)
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type
|
||||
typename LCC2::template Attribute_handle<i>::type
|
||||
res=map2.template create_attribute<i>();
|
||||
if ( ah!=NULL )
|
||||
{
|
||||
// Copy the point of ah if it exists and have same dimension
|
||||
Set_point_if_exist<typename Map1::template Attribute_type<i>::type,
|
||||
typename Map2::template Attribute_type<i>::type>::run( *ah, *res );
|
||||
CGAL::internal::Set_point_if_exist<typename LCC1::template Attribute_type<i>::type,
|
||||
typename LCC2::template Attribute_type<i>::type>::run( *ah, *res );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename Map1, typename Map2, unsigned int i, typename Info, typename Point2 >
|
||||
struct Default_converter_two_non_void_attributes_lcc<Map1, Map2, i, Info, Info, Point2>
|
||||
template< typename LCC1, typename LCC2, unsigned int i, typename Info, typename Point2 >
|
||||
struct Default_converter_two_non_void_attributes_lcc<LCC1, LCC2, i, Info, Info, Point2>
|
||||
{ // Here Info1==Info2 but Point2!=CGAL::Void (thus Linear_cell_complex)
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
run(Map2& map2, typename Map1::template Attribute_const_handle<i>::type ah)
|
||||
static typename LCC2::template Attribute_handle<i>::type
|
||||
run(LCC2& map2, typename LCC1::template Attribute_const_handle<i>::type ah)
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type
|
||||
typename LCC2::template Attribute_handle<i>::type
|
||||
res=map2.template create_attribute<i>();
|
||||
if ( ah!=NULL )
|
||||
{
|
||||
res->info()=ah->info();
|
||||
// Copy the point of ah if it exists and have same dimension
|
||||
Set_point_if_exist<typename Map1::template Attribute_type<i>::type,
|
||||
typename Map2::template Attribute_type<i>::type>::run( *ah, *res );
|
||||
CGAL::internal::Set_point_if_exist<typename LCC1::template Attribute_type<i>::type,
|
||||
typename LCC2::template Attribute_type<i>::type>::run( *ah, *res );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename Map1, typename Map2, unsigned int i, typename Point2 >
|
||||
struct Default_converter_two_non_void_attributes_lcc<Map1, Map2, i, void, void, Point2>
|
||||
template< typename LCC1, typename LCC2, unsigned int i, typename Point2 >
|
||||
struct Default_converter_two_non_void_attributes_lcc<LCC1, LCC2, i, void, void, Point2>
|
||||
{ // Here Info1==Info2==void but Point2!=CGAL::Void (thus Linear_cell_complex)
|
||||
static typename Map2::template Attribute_handle<i>::type
|
||||
run(Map2& map2, typename Map1::template Attribute_const_handle<i>::type ah)
|
||||
static typename LCC2::template Attribute_handle<i>::type
|
||||
run(LCC2& map2, typename LCC1::template Attribute_const_handle<i>::type ah)
|
||||
{
|
||||
typename Map2::template Attribute_handle<i>::type res=
|
||||
typename LCC2::template Attribute_handle<i>::type res=
|
||||
map2.template create_attribute<i>();
|
||||
if ( ah!=NULL )
|
||||
{
|
||||
// Copy the point of ah if it exists and have same dimension
|
||||
Set_point_if_exist<typename Map1::template Attribute_type<i>::type,
|
||||
typename Map2::template Attribute_type<i>::type>::
|
||||
CGAL::internal::Set_point_if_exist<typename LCC1::template Attribute_type<i>::type,
|
||||
typename LCC2::template Attribute_type<i>::type>::
|
||||
run( *ah, *res );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
// ****************************************************************************
|
||||
} // namespace internal
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_LINEAR_CELL_COMPLEX_COPY_FUNCTORS_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue