Commit 24f68a94 authored by Yumin Yuan's avatar Yumin Yuan
Browse files

A new method to return parent collection of meshset

parent 3fbf7353
......@@ -166,7 +166,7 @@ smtk::model::OperatorResult SetProperty::operateInternal()
smtk::attribute::MeshItem::const_mesh_it it;
for(it = meshItem->begin(); it != meshItem->end(); ++it)
{
smtk::mesh::CollectionPtr c = meshmgr->collection(it->collectionId());
smtk::mesh::CollectionPtr c = it->collection();
if(!c)
continue;
SetMeshPropertyValue<String,StringList,StringData,StringItem>(
......
......@@ -1048,7 +1048,6 @@ void qtModelView::toggleEntityVisibility( const QModelIndex& idx)
{
return; // nothing to do
}
smtk::mesh::ManagerPtr meshMgr = brOp->manager()->meshes();
smtk::mesh::CollectionPtr c;
if(dp->phraseType() == MESH_SUMMARY)
{
......@@ -1056,15 +1055,15 @@ void qtModelView::toggleEntityVisibility( const QModelIndex& idx)
smtk::mesh::MeshSet meshkey;
if(!mphrase->relatedMesh().is_empty())
{
c = meshMgr->collection(mphrase->relatedMesh().collectionId());
meshkey = mphrase->relatedMesh();
c = meshkey.collection();
}
else
{
c = mphrase->relatedMeshCollection();
meshkey = c->meshes();
}
if(c && !meshkey.is_empty())
if(c && !meshkey.is_empty() && c->hasIntegerProperty(meshkey, "visible"))
{
const IntegerList& prop(c->integerProperty(meshkey, "visible"));
if(!prop.empty())
......@@ -1163,7 +1162,7 @@ void qtModelView::changeEntityColor( const QModelIndex& idx)
smtk::mesh::MeshSet meshkey;
if(!mphrase->relatedMesh().is_empty())
{
c = meshMgr->collection(mphrase->relatedMesh().collectionId());
c = mphrase->relatedMesh().collection();
meshkey = mphrase->relatedMesh();
}
else
......
......@@ -47,7 +47,7 @@
#include "smtk/model/Group.h"
#include "smtk/model/Manager.h"
#include "smtk/model/StringData.h"
#include "smtk/mesh/MeshSet.h"
#include "smtk/mesh/Collection.h"
#include <sstream>
#include "cJSON.h"
......@@ -1226,7 +1226,8 @@ void XmlV2StringWriter::processMeshEntityItem(pugi::xml_node &node,
for(it = item->begin(); it != item->end(); ++it)
{
val = values.append_child("Val");
val.append_attribute("collectionid").set_value(it->collectionId().toString().c_str());
val.append_attribute("collectionid").set_value(
it->collection()->entity().toString().c_str());
cJSON* jrange = smtk::mesh::to_json(it->range());
char* json = cJSON_Print(jrange);
cJSON_Delete(jrange);
......
......@@ -234,12 +234,12 @@ bool MeshSet::setModelEntities(const smtk::model::EntityRef& ent)
return iface->setModelEntity(this->m_range, ent.entity());
}
/**\brief Get the parent collection entity that this meshset belongs to.
/**\brief Get the parent collection that this meshset belongs to.
*
*/
const smtk::common::UUID MeshSet::collectionId() const
const smtk::mesh::CollectionPtr& MeshSet::collection() const
{
return this->m_parent->entity();
return this->m_parent;
}
//----------------------------------------------------------------------------
......
......@@ -141,8 +141,8 @@ public:
//get the underlying HandleRange that this MeshSet represents
const smtk::mesh::HandleRange& range() const { return this->m_range; }
//get the underlying collection uuid that this MeshSet belongs to
const smtk::common::UUID collectionId() const;
//get the underlying collection that this MeshSet belongs to
const smtk::mesh::CollectionPtr& collection() const;
private:
smtk::mesh::CollectionPtr m_parent;
......
......@@ -105,12 +105,10 @@ smtk::model::OperatorResult SetProperty::operateInternal()
smtk::mesh::MeshList modifiedMeshes;
if(meshItem)
{
smtk::model::ManagerPtr modelmgr = this->manager();
smtk::mesh::ManagerPtr meshmgr = modelmgr->meshes();
smtk::attribute::MeshItem::const_mesh_it it;
for(it = meshItem->begin(); it != meshItem->end(); ++it)
{
smtk::mesh::CollectionPtr c = meshmgr->collection(it->collectionId());
smtk::mesh::CollectionPtr c = it->collection();
if(!c)
continue;
SetMeshPropertyValue<String,StringList,StringData,StringItem>(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment