Inserted Tags Management

This commit is contained in:
Michele Sottile sottile 2010-07-26 13:49:56 +00:00
parent f622c6a24a
commit d05642f4cb
2 changed files with 31 additions and 4 deletions

View File

@ -64,6 +64,19 @@ MeshModel *MeshDocument::getMesh(const char *name)
return 0;
}
QList<TagBase *> MeshDocument::getMeshTags(int meshId)
{
QList<TagBase *> meshTags;
foreach(TagBase *tag, tagList)
foreach(int id, tag->referringMeshes)
{
if(id==meshId)
meshTags.append(tag);
}
return meshTags;
}
void MeshDocument::setCurrentMesh(unsigned int i)
{
foreach(MeshModel *mmp, meshList)
@ -142,6 +155,16 @@ bool MeshDocument::delMesh(MeshModel *mmToDel)
return true;
}
void MeshDocument::addNewTag(TagBase *newTag)
{
tagList.append(newTag);
}
void MeshDocument::removeTag(int id){
foreach(TagBase *tag, tagList)
if(tag->id() ==id)
delete tag;
}
MeshModel::MeshModel(MeshDocument *parent, const char *meshName) {
glw.m=&cm;

View File

@ -359,16 +359,20 @@ public:
int size() const {return meshList.size();}
bool busy; // used in processing. To disable access to the mesh by the rendering thread
///add a new mesh with the given name
///Returns for mesh whose id is 'meshId' the list of the associated tags
QList<TagBase *> getMeshTags(int meshId);
///add a new mesh with the given name
MeshModel *addNewMesh(const char *meshName,MeshModel *newMesh=0, bool setAsCurrent=true);
///remove the mesh from the list and delete it from memory
bool delMesh(MeshModel *mmToDel);
///add a new mesh with the given name
MeshModel *addNewTag(TagBase *newTag);
///add a new tag in the tagList
void addNewTag(TagBase *newTag);
///remove the tag with the given id
void removeTag(int id);
int vn() /// Sum of all the vertices of all the meshes
{