+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::~Mesh_i()
+{
+ if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable*
+VISU::Mesh_i
+::Build(int theRestoring)
+{
+ SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+ try {
+ if (GetCResult()->GetInput() == NULL)
+ throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
+ if (!theRestoring) {
+ myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
+ myIsShrank = (myPresentType == VISU::SHRINK);
+
+ if(myEntity == VISU::NODE_ENTITY)
+ myPresentType = VISU::POINT;
+ SetName((const char*)GenerateName().toLatin1(), false);
+ myCellColor.R = 0.0; myCellColor.G = myCellColor.B = 1.0;
+ myNodeColor.R = myNodeColor.G = 1.0; myNodeColor.B = 1.0;
+
+ QColor aColor = VISU::GetResourceMgr()->colorValue( "VISU", "edge_color", QColor( 255, 255, 255 ) );
+ SALOMEDS::Color aLinkColor;
+ aLinkColor.R = aColor.red()/255.;
+ aLinkColor.G = aColor.green()/255.;
+ aLinkColor.B = aColor.blue()/255.;
+ SetLinkColor(aLinkColor);
+
+ my2DQuadPrsType = VISU::Quadratic2DPresentationType(VISU::GetResourceMgr()->integerValue( "VISU", "quadratic_mode", 0));
+ }
+
+ if(myEntity >= 0)
+ if(mySubMeshName == "")
+ myType = VISU::TENTITY;
+ else
+ myType = VISU::TFAMILY;
+ else
+ myType = VISU::TGROUP;
+
+ if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
+ QString aComment,aTmp;
+
+ std::string aMeshName = GetCMeshName();
+ VISU::TEntity anEntity = VISU::TEntity(myEntity);
+
+ VISU::Storable::TRestoringMap aRestoringMap;
+ aRestoringMap["myMeshName"] = GetCMeshName().c_str();
+
+ VISU::PUnstructuredGridIDMapper anIDMapper;
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput();
+ switch(myType){
+ case VISU::TENTITY :
+ anIDMapper = anInput->GetMeshOnEntity(aMeshName,
+ anEntity);//jfa IPAL9284
+ aRestoringMap["myComment"] = "ENTITY";
+ aRestoringMap["myId"] = QString::number(anEntity);
+ break;
+ case VISU::TFAMILY :
+ anIDMapper = anInput->GetFamilyOnEntity(aMeshName,
+ anEntity,
+ mySubMeshName);
+ aRestoringMap["myComment"] = "FAMILY";
+ aRestoringMap["myEntityId"] = QString::number(anEntity);
+ aRestoringMap["myName"] = mySubMeshName.c_str();
+ break;
+ case VISU::TGROUP :
+ anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
+ mySubMeshName);
+ aRestoringMap["myComment"] = "GROUP";
+ aRestoringMap["myName"] = mySubMeshName.c_str();
+ break;
+ }
+ if(!anIDMapper)
+ throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
+
+ myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
+
+ string anEntry = GetCResult()->GetEntry(aRestoringMap);
+ if(anEntry == "")
+ throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
+ SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
+
+ if(!theRestoring) { //Setting IOR on the label
+ myMeshPL->Init();
+ string aResultEntry = GetCResult()->GetEntry();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ CORBA::String_var aString = GetID();
+ anIOR->SetValue(aString);
+ }
+
+ // Set icon
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributePixMap_var aPixmap;
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributePixMap");
+ aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ aPixmap->SetPixMap("ICON_TREE_MESH");
+
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ return NULL;
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ return NULL;
+ }
+ aStudyBuilder->CommitCommand();
+ return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::SameAs(const VISU::Prs3d_i* theOrigin)
+{
+ return; // "SameAs" command for mesh is not valid in current architecture
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::RemoveFromStudy()
+{
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Mesh_i* myRemovable;
+ TRemoveFromStudy(VISU::Mesh_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject());
+ myRemovable->TSuperClass::RemoveFromStudy();
+ }
+ };
+
+ // Unset icon
+ SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+ aStudyBuilder->RemoveAttribute(GetSObject(), "AttributePixMap");
+
+ ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::SetCellColor(const SALOMEDS::Color& theColor)
+{
+ if(IsSameColor(myCellColor, theColor))
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myCellColor = theColor;
+ myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color
+VISU::Mesh_i
+::GetCellColor()
+{
+ return myCellColor;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::SetNodeColor(const SALOMEDS::Color& theColor)
+{
+ if(IsSameColor(myNodeColor, theColor))
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myNodeColor = theColor;
+ myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color
+VISU::Mesh_i
+::GetNodeColor()
+{
+ return myNodeColor;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::SetLinkColor(const SALOMEDS::Color& theColor)
+{
+ if(IsSameColor(myLinkColor, theColor))
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myLinkColor = theColor;
+ myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color
+VISU::Mesh_i
+::GetLinkColor()
+{
+ return myLinkColor;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::SetPresentationType(VISU::PresentationType theType)
+{
+ if(myPresentType == theType)
+ return;
+
+ VISU::TSetModified aModified(this);
+ if (theType == VISU::SHRINK) {
+ myIsShrank = true;
+ }
+ myPresentType = theType;
+ myParamsTime.Modified();
+}
+
+
+void
+VISU::Mesh_i
+::SetQuadratic2DPresentationType(VISU::Quadratic2DPresentationType theType)