Added function CleanAttributes() to delete all attributes (vertex, face, edge and mesh attributes)

This commit is contained in:
Gianpaolo Palma 2015-10-29 10:45:06 +00:00
parent ed0136c5bd
commit 499dc72c51
1 changed files with 23 additions and 20 deletions

View File

@ -357,25 +357,6 @@ public:
/// Function to destroy the mesh
void Clear()
{
// Clear attributes
typename std::set< PointerToAttribute>::iterator i;
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
vert_attr.clear();
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
edge_attr.clear();
for( i = face_attr.begin(); i != face_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
face_attr.clear();
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
mesh_attr.clear();
for(FaceIterator fi = face.begin(); fi != face.end(); ++fi)
(*fi).Dealloc();
vert.clear();
@ -388,10 +369,32 @@ public:
fn = 0;
hn = 0;
imark = 0;
attrn = 0;
C()=Color4b::Gray;
}
void ClearAttributes()
{
// Clear attributes
typename std::set< PointerToAttribute>::iterator i;
for (i = vert_attr.begin(); i != vert_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
vert_attr.clear();
for (i = edge_attr.begin(); i != edge_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
edge_attr.clear();
for (i = face_attr.begin(); i != face_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
face_attr.clear();
for (i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
delete ((SimpleTempDataBase*)(*i)._handle);
mesh_attr.clear();
attrn = 0;
}
bool IsEmpty() const
{
return vert.empty() && edge.empty() && face.empty();