float total_len = 0;
list<TrackOrder> order;
- Track *cur = *neighbors.begin();
+ Track *cur = dynamic_cast<Track *>(*neighbors.begin());
while(tracks2.size())
{
bool rev = false;
total_len += cur->get_type().get_total_length();
}
- set<Track *>::iterator nb = neighbors.begin();
+ set<Object *>::iterator nb = neighbors.begin();
int epi = (*nb)->get_link_slot(*order.front().track);
float start_z = (*nb)->get_snap_node(epi).position.z;
++nb;
if(m!=EXTEND)
{
- for(set<Track *>::iterator i=neighbors.begin(); i!=neighbors.end(); ++i)
+ for(set<Object *>::iterator i=neighbors.begin(); i!=neighbors.end(); ++i)
for(vector<MObject>::iterator j=objects.begin(); j!=objects.end(); ++j)
j->object->break_link(**i);
}
neighbors.clear();
for(vector<MObject>::iterator i=objects.begin(); i!=objects.end(); ++i)
{
- Track *track = dynamic_cast<Track *>(i->object);
- if(!track)
- continue;
-
- const vector<Track *> &links = track->get_links();
- for(vector<Track *>::const_iterator j=links.begin(); j!=links.end(); ++j)
+ unsigned nls = i->object->get_n_link_slots();
+ for(unsigned j=0; j<nls; ++j)
{
- if(!*j)
+ Object *linked = i->object->get_link(j);
+ if(!linked)
continue;
- if(neighbors.count(*j))
+ if(neighbors.count(linked))
continue;
bool ok = true;
for(vector<MObject>::iterator k=objects.begin(); (k!=objects.end() && ok); ++k)
- ok = (k->object!=*j);
+ ok = (k->object!=linked);
if(ok)
- neighbors.insert(*j);
+ neighbors.insert(linked);
}
}
}