mirror of https://github.com/CGAL/cgal
change Constraint_id to ensure backward compatibility
This commit is contained in:
parent
81611f015a
commit
d4af8c8d48
|
|
@ -148,6 +148,7 @@ public:
|
||||||
using Triangulation::geom_traits;
|
using Triangulation::geom_traits;
|
||||||
using Triangulation::cw;
|
using Triangulation::cw;
|
||||||
using Triangulation::ccw;
|
using Triangulation::ccw;
|
||||||
|
using Triangulation::incident_faces;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Constraint_hierarchy hierarchy;
|
Constraint_hierarchy hierarchy;
|
||||||
|
|
@ -185,6 +186,7 @@ public:
|
||||||
|
|
||||||
Constrained_triangulation_plus_2(std::list<std::pair<Point,Point> > constraints,
|
Constrained_triangulation_plus_2(std::list<std::pair<Point,Point> > constraints,
|
||||||
const Geom_traits& gt=Geom_traits() )
|
const Geom_traits& gt=Geom_traits() )
|
||||||
|
: Triangulation(gt)
|
||||||
{
|
{
|
||||||
insert_constraints(constraints.begin(), constraints.end());
|
insert_constraints(constraints.begin(), constraints.end());
|
||||||
CGAL_triangulation_postcondition( this->is_valid() );
|
CGAL_triangulation_postcondition( this->is_valid() );
|
||||||
|
|
@ -359,11 +361,11 @@ public:
|
||||||
hierarchy.swap(cid, aux);
|
hierarchy.swap(cid, aux);
|
||||||
remove_constraint(aux, std::back_inserter(fc));
|
remove_constraint(aux, std::back_inserter(fc));
|
||||||
|
|
||||||
if(head){
|
if(head.vl_ptr()){
|
||||||
hierarchy.concatenate2(head, cid);
|
hierarchy.concatenate2(head, cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tail){
|
if(tail.vl_ptr()){
|
||||||
hierarchy.concatenate(cid, tail);
|
hierarchy.concatenate(cid, tail);
|
||||||
}
|
}
|
||||||
fc.write_faces(out);
|
fc.write_faces(out);
|
||||||
|
|
@ -446,7 +448,7 @@ public:
|
||||||
pos = vertices_in_constraint_begin(aux2);
|
pos = vertices_in_constraint_begin(aux2);
|
||||||
concatenate(aux1, aux2);
|
concatenate(aux1, aux2);
|
||||||
|
|
||||||
if(head){
|
if(head.vl_ptr()){
|
||||||
//std::cout << "concatenate head" << std::endl;
|
//std::cout << "concatenate head" << std::endl;
|
||||||
remove_constraint(cid, std::back_inserter(fc));
|
remove_constraint(cid, std::back_inserter(fc));
|
||||||
hierarchy.concatenate(head, aux1);
|
hierarchy.concatenate(head, aux1);
|
||||||
|
|
@ -456,7 +458,7 @@ public:
|
||||||
head = cid;
|
head = cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tail){
|
if(tail.vl_ptr()){
|
||||||
//std::cout << "concatenate tail" << std::endl;
|
//std::cout << "concatenate tail" << std::endl;
|
||||||
concatenate(head, tail);
|
concatenate(head, tail);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,39 +103,42 @@ public:
|
||||||
|
|
||||||
typedef typename Constraint_list::iterator Constraint_it;
|
typedef typename Constraint_list::iterator Constraint_it;
|
||||||
|
|
||||||
#if 1
|
|
||||||
typedef Vertex_list* Constraint_id;
|
|
||||||
#else
|
|
||||||
struct Constraint_id {
|
struct Constraint_id {
|
||||||
Vertex_list* vl;
|
// first and second are publicly exposed for backward compatibility
|
||||||
|
std::pair<Vertex_handle, Vertex_handle> first;
|
||||||
|
Vertex_list* second;
|
||||||
|
|
||||||
|
Constraint_id(): second(NULL) {}
|
||||||
|
|
||||||
Constraint_id(Vertex_list* vl)
|
Constraint_id(Vertex_list* vl)
|
||||||
: vl(vl)
|
: second(vl)
|
||||||
{}
|
|
||||||
|
|
||||||
operator std::pair<Vertex_handle, Vertex_handle>()
|
|
||||||
{
|
{
|
||||||
return std::make_pair(vl->skip_begin(), vl->skip_end());
|
if (second!=NULL)
|
||||||
|
first=std::pair<Vertex_handle, Vertex_handle>(vl->front().vertex(),
|
||||||
|
vl->back().vertex());
|
||||||
}
|
}
|
||||||
const Vertex_list& operator*() const { return *vl; }
|
|
||||||
Vertex_list& operator*() { return *vl; }
|
|
||||||
const Vertex_list* operator->() const { return vl; }
|
|
||||||
Vertex_list* operator->() { return vl; }
|
|
||||||
|
|
||||||
operator Vertex_list* (){ return vl; }
|
Vertex_list* vl_ptr() const {return second;}
|
||||||
operator const Vertex_list* () const { return vl; }
|
|
||||||
|
operator std::pair< std::pair<Vertex_handle, Vertex_handle>, Vertex_list* >()
|
||||||
|
{
|
||||||
|
return std::make_pair(first, second);
|
||||||
|
}
|
||||||
|
|
||||||
bool operator == (const Constraint_id& other) const
|
bool operator == (const Constraint_id& other) const
|
||||||
{
|
{
|
||||||
return vl == other.vl;
|
return second == other.second;
|
||||||
}
|
}
|
||||||
bool operator != (const Constraint_id& other) const
|
bool operator != (const Constraint_id& other) const
|
||||||
{
|
{
|
||||||
return vl != other.vl;
|
return second != other.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const Constraint_id& other) const{
|
||||||
|
return second < other.second;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Cmp {
|
struct Cmp {
|
||||||
bool operator()(const std::pair<Vertex_handle, Vertex_handle>& e0,
|
bool operator()(const std::pair<Vertex_handle, Vertex_handle>& e0,
|
||||||
const std::pair<Vertex_handle, Vertex_handle>& e1) const
|
const std::pair<Vertex_handle, Vertex_handle>& e1) const
|
||||||
|
|
@ -204,22 +207,22 @@ public:
|
||||||
Vertex_it& v_first,
|
Vertex_it& v_first,
|
||||||
Vertex_it& v_past) const;
|
Vertex_it& v_past) const;
|
||||||
Vertex_it vertices_in_constraint_begin(Constraint_id cid) const
|
Vertex_it vertices_in_constraint_begin(Constraint_id cid) const
|
||||||
{ return cid->skip_begin(); }
|
{ return cid.vl_ptr()->skip_begin(); }
|
||||||
Vertex_it vertices_in_constraint_end(Constraint_id cid) const
|
Vertex_it vertices_in_constraint_end(Constraint_id cid) const
|
||||||
{ return cid->skip_end(); }
|
{ return cid.vl_ptr()->skip_end(); }
|
||||||
|
|
||||||
Vertex_it vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
|
Vertex_it vertices_in_constraint_begin(Vertex_handle va, Vertex_handle vb) const
|
||||||
{ Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
|
{ Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
|
||||||
return cid->skip_begin(); }
|
return cid.vl_ptr()->skip_begin(); }
|
||||||
|
|
||||||
Vertex_it vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
|
Vertex_it vertices_in_constraint_end(Vertex_handle va, Vertex_handle vb) const
|
||||||
{ Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
|
{ Constraint_id cid = constraint_map.find(make_edge(va,vb))->second;
|
||||||
return cid->skip_end(); }
|
return cid.vl_ptr()->skip_end(); }
|
||||||
|
|
||||||
Point_it points_in_constraint_begin(Constraint_id cid) const
|
Point_it points_in_constraint_begin(Constraint_id cid) const
|
||||||
{ return cid->all_begin(); }
|
{ return cid.vl_ptr()->all_begin(); }
|
||||||
Point_it points_in_constraint_end(Constraint_id cid) const
|
Point_it points_in_constraint_end(Constraint_id cid) const
|
||||||
{ return cid->all_end(); }
|
{ return cid.vl_ptr()->all_end(); }
|
||||||
|
|
||||||
bool enclosing_constraint(Edge he, Constraint& hc) const;
|
bool enclosing_constraint(Edge he, Constraint& hc) const;
|
||||||
bool enclosing_constraint(T vaa, T vbb, T& va, T& vb) const;
|
bool enclosing_constraint(T vaa, T vbb, T& va, T& vb) const;
|
||||||
|
|
@ -238,7 +241,7 @@ public:
|
||||||
// insert/remove
|
// insert/remove
|
||||||
void add_Steiner(T va, T vb, T vx);
|
void add_Steiner(T va, T vb, T vx);
|
||||||
Vertex_list* insert_constraint(T va, T vb);
|
Vertex_list* insert_constraint(T va, T vb);
|
||||||
void append_constraint(Constraint_id vl, T va, T vb);
|
void append_constraint(Constraint_id cid, T va, T vb);
|
||||||
void swap(Constraint_id first, Constraint_id second);
|
void swap(Constraint_id first, Constraint_id second);
|
||||||
void remove_constraint(Constraint_id cid);
|
void remove_constraint(Constraint_id cid);
|
||||||
|
|
||||||
|
|
@ -343,7 +346,7 @@ copy(const Polyline_constraint_hierarchy_2& ch1, std::map<Vertex_handle,Vertex_h
|
||||||
// copy constraint_set
|
// copy constraint_set
|
||||||
C_iterator cit1 = ch1.c_begin();
|
C_iterator cit1 = ch1.c_begin();
|
||||||
for( ; cit1 != ch1.c_end(); ++cit1) {
|
for( ; cit1 != ch1.c_end(); ++cit1) {
|
||||||
Vertex_list* hvl1 = *cit1;
|
Vertex_list* hvl1 = cit1->vl_ptr();
|
||||||
Vertex_list* hvl2 = new Vertex_list;
|
Vertex_list* hvl2 = new Vertex_list;
|
||||||
vlmap[hvl1] = hvl2;
|
vlmap[hvl1] = hvl2;
|
||||||
Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end();
|
Vertex_it vit = hvl1->skip_begin(), end = hvl1->skip_end();
|
||||||
|
|
@ -439,7 +442,7 @@ enclosing_constraint(T vaa, T vbb, T& va, T& vb) const
|
||||||
if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
|
if ( !get_contexts(vaa,vbb, hcit ,past)) return false;
|
||||||
// va = hcit->enclosing->front().vertex();
|
// va = hcit->enclosing->front().vertex();
|
||||||
// vb = hcit->enclosing->back().vertex();
|
// vb = hcit->enclosing->back().vertex();
|
||||||
Vertex_list* vl = hcit->enclosing;
|
// Vertex_list* vl = hcit->enclosing;
|
||||||
Vertex_it pos = hcit->pos;
|
Vertex_it pos = hcit->pos;
|
||||||
if(vaa != *pos){
|
if(vaa != *pos){
|
||||||
std::swap(vaa,vbb);
|
std::swap(vaa,vbb);
|
||||||
|
|
@ -517,7 +520,7 @@ void
|
||||||
Polyline_constraint_hierarchy_2<T,Data>::
|
Polyline_constraint_hierarchy_2<T,Data>::
|
||||||
swap(Constraint_id first, Constraint_id second){
|
swap(Constraint_id first, Constraint_id second){
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = first->skip_begin(), succ = it, end = first->skip_end();
|
for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -526,14 +529,14 @@ swap(Constraint_id first, Constraint_id second){
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == first){
|
if(ctit->enclosing == first.vl_ptr()){
|
||||||
ctit->enclosing = 0;
|
ctit->enclosing = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end();
|
for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -542,14 +545,14 @@ swap(Constraint_id first, Constraint_id second){
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == second){
|
if(ctit->enclosing == second.vl_ptr()){
|
||||||
ctit->enclosing = first;
|
ctit->enclosing = first.vl_ptr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = first->skip_begin(), succ = it, end = first->skip_end();
|
for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -559,23 +562,23 @@ swap(Constraint_id first, Constraint_id second){
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == 0){
|
if(ctit->enclosing == 0){
|
||||||
ctit->enclosing = second;
|
ctit->enclosing = second.vl_ptr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
first->swap(*second);
|
first.vl_ptr()->swap(*second.vl_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T, class Data>
|
template <class T, class Data>
|
||||||
void
|
void
|
||||||
Polyline_constraint_hierarchy_2<T,Data>::
|
Polyline_constraint_hierarchy_2<T,Data>::
|
||||||
remove_constraint(Constraint_id hvl){
|
remove_constraint(Constraint_id cid){
|
||||||
constraint_set.erase(hvl);
|
constraint_set.erase(cid);
|
||||||
|
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = hvl->skip_begin(), succ = it, end = hvl->skip_end();
|
for(Vertex_it it = cid.vl_ptr()->skip_begin(), succ = it, end = cid.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -584,7 +587,7 @@ remove_constraint(Constraint_id hvl){
|
||||||
|
|
||||||
// and remove the context of the constraint
|
// and remove the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == hvl){
|
if(ctit->enclosing == cid.vl_ptr()){
|
||||||
hcl->erase(ctit);
|
hcl->erase(ctit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -598,7 +601,7 @@ remove_constraint(Constraint_id hvl){
|
||||||
delete hcl;
|
delete hcl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete hvl;
|
delete cid.vl_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -632,8 +635,8 @@ void Polyline_constraint_hierarchy_2<T,Data>::simplify(Vertex_it uc,
|
||||||
CGAL_assertion_msg( vw_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
|
CGAL_assertion_msg( vw_sc_iter != sc_to_c_map.end(), "not a subconstraint" );
|
||||||
Context_list* vw_hcl = vw_sc_iter->second;
|
Context_list* vw_hcl = vw_sc_iter->second;
|
||||||
CGAL_assertion_msg(vw_hcl->size() == 1, "more than one constraint passing through the subconstraint" );
|
CGAL_assertion_msg(vw_hcl->size() == 1, "more than one constraint passing through the subconstraint" );
|
||||||
Vertex_list* vertex_list = uv_hcl->front().id();
|
Vertex_list* vertex_list = uv_hcl->front().id().vl_ptr();
|
||||||
CGAL_assertion_msg(vertex_list == vw_hcl->front().id(), "subconstraints from different polyline constraints" );
|
CGAL_assertion_msg(vertex_list == vw_hcl->front().id().vl_ptr(), "subconstraints from different polyline constraints" );
|
||||||
// Remove the list item which points to v
|
// Remove the list item which points to v
|
||||||
vertex_list->skip(vc.base());
|
vertex_list->skip(vc.base());
|
||||||
|
|
||||||
|
|
@ -653,8 +656,8 @@ Polyline_constraint_hierarchy_2<T,Data>::remove_points_without_corresponding_ver
|
||||||
std::size_t n = 0;
|
std::size_t n = 0;
|
||||||
for(Point_it it = points_in_constraint_begin(cid);
|
for(Point_it it = points_in_constraint_begin(cid);
|
||||||
it != points_in_constraint_end(cid); ++it) {
|
it != points_in_constraint_end(cid); ++it) {
|
||||||
if(cid->is_skipped(it.base())) {
|
if(cid.vl_ptr()->is_skipped(it.base())) {
|
||||||
it = cid->erase(it.base());
|
it = cid.vl_ptr()->erase(it.base());
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -680,7 +683,7 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate(Constraint_id first, Constr
|
||||||
constraint_set.erase(first);
|
constraint_set.erase(first);
|
||||||
constraint_set.erase(second);
|
constraint_set.erase(second);
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = second->skip_begin(), succ = it, end = second->skip_end();
|
for(Vertex_it it = second.vl_ptr()->skip_begin(), succ = it, end = second.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -689,8 +692,8 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate(Constraint_id first, Constr
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == second){
|
if(ctit->enclosing == second.vl_ptr()){
|
||||||
ctit->enclosing = first;
|
ctit->enclosing = first.vl_ptr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -698,14 +701,14 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate(Constraint_id first, Constr
|
||||||
// now we really concatenate the vertex lists
|
// now we really concatenate the vertex lists
|
||||||
// Note that all iterators pointing into second remain valid.
|
// Note that all iterators pointing into second remain valid.
|
||||||
// This concerns user code, as well as the data member "pos" of the Context class
|
// This concerns user code, as well as the data member "pos" of the Context class
|
||||||
first->pop_back(); // because it is the same as second.front()
|
first.vl_ptr()->pop_back(); // because it is the same as second.front()
|
||||||
Vertex_it back_it = first->skip_end();
|
Vertex_it back_it = first.vl_ptr()->skip_end();
|
||||||
--back_it;
|
--back_it;
|
||||||
first->splice(first->skip_end(), *second, second->skip_begin(), second->skip_end());
|
first.vl_ptr()->splice(first.vl_ptr()->skip_end(), *(second.vl_ptr()), second.vl_ptr()->skip_begin(), second.vl_ptr()->skip_end());
|
||||||
|
|
||||||
// Note that for VC8 with iterator debugging the iterators pointing into second
|
// Note that for VC8 with iterator debugging the iterators pointing into second
|
||||||
// are NOT valid So we have to update them
|
// are NOT valid So we have to update them
|
||||||
for(Vertex_it it = back_it, succ = it, end = first->skip_end();
|
for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -714,7 +717,7 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate(Constraint_id first, Constr
|
||||||
|
|
||||||
// and update pos in the context of the constraint
|
// and update pos in the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == first){
|
if(ctit->enclosing == first.vl_ptr()){
|
||||||
ctit->pos = it;
|
ctit->pos = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -722,7 +725,7 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate(Constraint_id first, Constr
|
||||||
}
|
}
|
||||||
constraint_set.insert(first);
|
constraint_set.insert(first);
|
||||||
|
|
||||||
delete second;
|
delete second.vl_ptr();
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -733,7 +736,7 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate2(Constraint_id first, Const
|
||||||
constraint_set.erase(first);
|
constraint_set.erase(first);
|
||||||
constraint_set.erase(second);
|
constraint_set.erase(second);
|
||||||
// We have to look at all subconstraints
|
// We have to look at all subconstraints
|
||||||
for(Vertex_it it = first->skip_begin(), succ = it, end = first->skip_end();
|
for(Vertex_it it = first.vl_ptr()->skip_begin(), succ = it, end = first.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -742,22 +745,22 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate2(Constraint_id first, Const
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == first){
|
if(ctit->enclosing == first.vl_ptr()){
|
||||||
ctit->enclosing = second;
|
ctit->enclosing = second.vl_ptr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now we really concatenate the vertex lists
|
// now we really concatenate the vertex lists
|
||||||
// Note that all iterators pointing into second remain valid.
|
// Note that all iterators pointing into second remain valid.
|
||||||
first->pop_back(); // because it is the same as second.front()
|
first.vl_ptr()->pop_back(); // because it is the same as second.front()
|
||||||
Vertex_it back_it = first->skip_end();
|
Vertex_it back_it = first.vl_ptr()->skip_end();
|
||||||
--back_it;
|
--back_it;
|
||||||
second->splice(second->skip_begin(), *first, first->skip_begin(), first->skip_end());
|
second.vl_ptr()->splice(second.vl_ptr()->skip_begin(), *(first.vl_ptr()), first.vl_ptr()->skip_begin(), first.vl_ptr()->skip_end());
|
||||||
|
|
||||||
// Note that for VC8 with iterator debugging the iterators pointing into second
|
// Note that for VC8 with iterator debugging the iterators pointing into second
|
||||||
// are NOT valid So we have to update them
|
// are NOT valid So we have to update them
|
||||||
for(Vertex_it it = back_it, succ = it, end = first->skip_end();
|
for(Vertex_it it = back_it, succ = it, end = first.vl_ptr()->skip_end();
|
||||||
++succ != end;
|
++succ != end;
|
||||||
++it){
|
++it){
|
||||||
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ));
|
||||||
|
|
@ -766,7 +769,7 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate2(Constraint_id first, Const
|
||||||
|
|
||||||
// and update pos in the context of the constraint
|
// and update pos in the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == second){
|
if(ctit->enclosing == second.vl_ptr()){
|
||||||
ctit->pos = it;
|
ctit->pos = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -774,8 +777,8 @@ Polyline_constraint_hierarchy_2<T,Data>::concatenate2(Constraint_id first, Const
|
||||||
}
|
}
|
||||||
constraint_set.insert(second);
|
constraint_set.insert(second);
|
||||||
|
|
||||||
delete first;
|
delete first.vl_ptr();
|
||||||
return second;
|
return second.vl_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -788,11 +791,11 @@ Polyline_constraint_hierarchy_2<T,Data>::split(Constraint_id first, Vertex_it vc
|
||||||
{
|
{
|
||||||
constraint_set.erase(first);
|
constraint_set.erase(first);
|
||||||
Vertex_list* second = new Vertex_list;
|
Vertex_list* second = new Vertex_list;
|
||||||
second->splice(second->skip_end(), *first, vcit.base(), first->skip_end());
|
second->splice(second->skip_end(), *(first.vl_ptr()), vcit.base(), first.vl_ptr()->skip_end());
|
||||||
first->push_back(second->front()); // Duplicate the common vertex
|
first.vl_ptr()->push_back(second->front()); // Duplicate the common vertex
|
||||||
Vertex_it vit = second->skip_begin();
|
Vertex_it vit = second->skip_begin();
|
||||||
vit.input() = true;
|
vit.input() = true;
|
||||||
vit = first->skip_end();
|
vit = first.vl_ptr()->skip_end();
|
||||||
--vit;
|
--vit;
|
||||||
vit.input() = true;
|
vit.input() = true;
|
||||||
constraint_set.insert(first);
|
constraint_set.insert(first);
|
||||||
|
|
@ -807,7 +810,7 @@ Polyline_constraint_hierarchy_2<T,Data>::split(Constraint_id first, Vertex_it vc
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == first){
|
if(ctit->enclosing == first.vl_ptr()){
|
||||||
ctit->enclosing = second;
|
ctit->enclosing = second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -822,12 +825,12 @@ Polyline_constraint_hierarchy_2<T,Data>::split2(Constraint_id first, Vertex_it v
|
||||||
{
|
{
|
||||||
constraint_set.erase(first);
|
constraint_set.erase(first);
|
||||||
Vertex_list* second = new Vertex_list;
|
Vertex_list* second = new Vertex_list;
|
||||||
second->splice(second->skip_end(), *first, first->skip_begin(), vcit.base());
|
second->splice(second->skip_end(), *first.vl_ptr(), first.vl_ptr()->skip_begin(), vcit.base());
|
||||||
second->push_back(first->front()); // Duplicate the common vertex
|
second->push_back(first.vl_ptr()->front()); // Duplicate the common vertex
|
||||||
Vertex_it vit = second->skip_end();
|
Vertex_it vit = second->skip_end();
|
||||||
--vit;
|
--vit;
|
||||||
vit.input() = true;
|
vit.input() = true;
|
||||||
vit = first->skip_begin();
|
vit = first.vl_ptr()->skip_begin();
|
||||||
vit.input() = true;
|
vit.input() = true;
|
||||||
constraint_set.insert(first);
|
constraint_set.insert(first);
|
||||||
constraint_set.insert(second);
|
constraint_set.insert(second);
|
||||||
|
|
@ -841,7 +844,7 @@ Polyline_constraint_hierarchy_2<T,Data>::split2(Constraint_id first, Vertex_it v
|
||||||
|
|
||||||
// and replace the context of the constraint
|
// and replace the context of the constraint
|
||||||
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
for(Context_iterator ctit=hcl->begin(); ctit != hcl->end(); ctit++) {
|
||||||
if(ctit->enclosing == first){
|
if(ctit->enclosing == first.vl_ptr()){
|
||||||
ctit->enclosing = second;
|
ctit->enclosing = second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -887,7 +890,7 @@ insert_constraint(T va, T vb){
|
||||||
template <class T, class Data>
|
template <class T, class Data>
|
||||||
void
|
void
|
||||||
Polyline_constraint_hierarchy_2<T,Data>::
|
Polyline_constraint_hierarchy_2<T,Data>::
|
||||||
append_constraint(Constraint_id vl, T va, T vb){
|
append_constraint(Constraint_id cid, T va, T vb){
|
||||||
Edge he = make_edge(va, vb);
|
Edge he = make_edge(va, vb);
|
||||||
Context_list* fathers;
|
Context_list* fathers;
|
||||||
|
|
||||||
|
|
@ -899,11 +902,11 @@ append_constraint(Constraint_id vl, T va, T vb){
|
||||||
fathers = scit->second;
|
fathers = scit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename Vertex_list::skip_iterator bit = vl->skip_end();
|
typename Vertex_list::skip_iterator bit = cid.vl_ptr()->skip_end();
|
||||||
--bit;
|
--bit;
|
||||||
vl->push_back(Node(vb, true));
|
cid.vl_ptr()->push_back(Node(vb, true));
|
||||||
Context ctxt;
|
Context ctxt;
|
||||||
ctxt.enclosing = vl;
|
ctxt.enclosing = cid.vl_ptr();
|
||||||
ctxt.pos = bit;
|
ctxt.pos = bit;
|
||||||
fathers->push_front(ctxt);
|
fathers->push_front(ctxt);
|
||||||
}
|
}
|
||||||
|
|
@ -917,9 +920,8 @@ clear()
|
||||||
Sc_iterator scit;
|
Sc_iterator scit;
|
||||||
// clean and delete vertices lists
|
// clean and delete vertices lists
|
||||||
for(cit=constraint_set.begin(); cit != constraint_set.end(); cit++){
|
for(cit=constraint_set.begin(); cit != constraint_set.end(); cit++){
|
||||||
Constraint_id cid = *cit;
|
cit->vl_ptr()->clear();
|
||||||
cid->clear();
|
delete cit->vl_ptr();
|
||||||
delete cid;
|
|
||||||
}
|
}
|
||||||
// clean and delete context lists
|
// clean and delete context lists
|
||||||
for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){
|
for(scit=sc_to_c_map.begin(); scit != sc_to_c_map.end(); scit++){
|
||||||
|
|
@ -1125,7 +1127,7 @@ print() const
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(hcit = c_begin(); hcit != c_end(); hcit++) {
|
for(hcit = c_begin(); hcit != c_end(); hcit++) {
|
||||||
Constraint_id cid = (*hcit);
|
Constraint_id cid = (*hcit);
|
||||||
Vertex_it vit =cid->skip_begin(), end = cid->skip_end();
|
Vertex_it vit =cid.vl_ptr()->skip_begin(), end = cid.vl_ptr()->skip_end();
|
||||||
for (;vit != end; vit++){
|
for (;vit != end; vit++){
|
||||||
num ++;
|
num ++;
|
||||||
vertex_num.insert(std::make_pair((*vit), num));
|
vertex_num.insert(std::make_pair((*vit), num));
|
||||||
|
|
@ -1144,13 +1146,13 @@ print() const
|
||||||
for(; cit != c_end(); cit++){
|
for(; cit != c_end(); cit++){
|
||||||
std::cout << std::endl ;
|
std::cout << std::endl ;
|
||||||
std::cout << "constraint " ;
|
std::cout << "constraint " ;
|
||||||
std::cout << (unsigned int)*cit;
|
std::cout << cit->vl_ptr();
|
||||||
std::cout << " subconstraints " ;
|
std::cout << " subconstraints " ;
|
||||||
Vertex_it vit = (*cit)->skip_begin(), end = (*cit)->skip_end();
|
Vertex_it vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
|
||||||
for(; vit != end; vit++){
|
for(; vit != end; vit++){
|
||||||
std::cout << vertex_num[*vit] <<" ";
|
std::cout << vertex_num[*vit] <<" ";
|
||||||
}
|
}
|
||||||
vit = (*cit)->skip_begin(), end = (*cit)->skip_end();
|
vit = (*cit).vl_ptr()->skip_begin(), end = (*cit).vl_ptr()->skip_end();
|
||||||
for(; vit != end; vit++){
|
for(; vit != end; vit++){
|
||||||
std::cout << (*vit)->point() <<" ";
|
std::cout << (*vit)->point() <<" ";
|
||||||
}
|
}
|
||||||
|
|
@ -1165,7 +1167,7 @@ print() const
|
||||||
|
|
||||||
std::cout << " enclosing " ;
|
std::cout << " enclosing " ;
|
||||||
for(; cb != ce; cb++) {
|
for(; cb != ce; cb++) {
|
||||||
std::cout << (unsigned int) cb->id();
|
std::cout << cb->id().vl_ptr();
|
||||||
std::cout << " " ;
|
std::cout << " " ;
|
||||||
}
|
}
|
||||||
std::cout << std::endl ;
|
std::cout << std::endl ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue