diff --git a/src/common/meshmodel.cpp b/src/common/meshmodel.cpp index 16b7a4895..51e1bbe2a 100644 --- a/src/common/meshmodel.cpp +++ b/src/common/meshmodel.cpp @@ -64,6 +64,19 @@ MeshModel *MeshDocument::getMesh(const char *name) return 0; } +QList MeshDocument::getMeshTags(int meshId) +{ + QList 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; diff --git a/src/common/meshmodel.h b/src/common/meshmodel.h index d0c0336d3..b9d0dcbc2 100644 --- a/src/common/meshmodel.h +++ b/src/common/meshmodel.h @@ -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 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 {