diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl index 37657674b..3cbb606da 100644 --- a/idl/SMESH_Group.idl +++ b/idl/SMESH_Group.idl @@ -84,6 +84,16 @@ module SMESH * Returns the mesh object this group belongs to */ SMESH_Mesh GetMesh(); + + /*! + * Sets group color number + */ + void SetColorNumber( in long color ); + + /*! + * Returns group color number + */ + long GetColorNumber(); }; /*! diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index 47a923dbd..0da2c4cff 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -32,6 +32,103 @@ using namespace std; +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +DriverMED_Family +::DriverMED_Family(): + myGroupAttributVal(0) +{} + + +//============================================================================= +const ElementsSet& +DriverMED_Family +::GetElements () const +{ + return myElements; +} + +int +DriverMED_Family +::GetId () const +{ + return myId; +} + +void +DriverMED_Family +::SetId (const int theId) +{ + myId = theId; +} + +void +DriverMED_Family +::AddElement(const SMDS_MeshElement* theElement) +{ + myElements.insert(theElement); +} + +void +DriverMED_Family +::AddGroupName(std::string theGroupName) +{ + myGroupNames.insert(theGroupName); +} + +void +DriverMED_Family +::SetType(const SMDSAbs_ElementType theType) +{ + myType = theType; +} + +SMDSAbs_ElementType +DriverMED_Family +::GetType() +{ + return myType; +} + +bool +DriverMED_Family +::MemberOf(std::string theGroupName) const +{ + return myGroupNames.find(theGroupName) != myGroupNames.end(); +} + +const MED::TStringSet& +DriverMED_Family +::GetGroupNames () const +{ + return myGroupNames; +} + + +int +DriverMED_Family +::GetGroupAttributVal() const +{ + return myGroupAttributVal; +} + +void +DriverMED_Family +::SetGroupAttributVal( int theValue) +{ + myGroupAttributVal = theValue; +} + +bool +DriverMED_Family +::IsEmpty () const +{ + return myElements.empty(); +} + //============================================================================= /*! * Split each group from list on some parts (families) @@ -39,15 +136,16 @@ using namespace std; * Resulting families have no common elements. */ //============================================================================= -list DriverMED_Family::MakeFamilies - (const map & theSubMeshes, - const list& theGroups, - const bool doGroupOfNodes, - const bool doGroupOfEdges, - const bool doGroupOfFaces, - const bool doGroupOfVolumes) +DriverMED_FamilyPtrList +DriverMED_Family +::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes, + const SMESHDS_GroupBasePtrList& theGroups, + const bool doGroupOfNodes, + const bool doGroupOfEdges, + const bool doGroupOfFaces, + const bool doGroupOfVolumes) { - list aFamilies; + DriverMED_FamilyPtrList aFamilies; string anAllNodesGroupName = "Group_Of_All_Nodes"; string anAllEdgesGroupName = "Group_Of_All_Edges"; @@ -61,22 +159,23 @@ list DriverMED_Family::MakeFamilies int aElemFamId = FIRST_ELEM_FAMILY; // Process sub-meshes - map::const_iterator aSMIter = theSubMeshes.begin(); + SMESHDS_SubMeshPtrMap::const_iterator aSMIter = theSubMeshes.begin(); for (; aSMIter != theSubMeshes.end(); aSMIter++) { - if ( aSMIter->second->IsComplexSubmesh() ) + const int anId = aSMIter->first; + SMESHDS_SubMesh* aSubMesh = aSMIter->second; + if ( aSubMesh->IsComplexSubmesh() ) continue; // submesh containing other submeshs - list aSMFams = SplitByType((*aSMIter).second, (*aSMIter).first); - list::iterator aSMFamsIter = aSMFams.begin(); + DriverMED_FamilyPtrList aSMFams = SplitByType(aSubMesh,anId); + DriverMED_FamilyPtrList::iterator aSMFamsIter = aSMFams.begin(); for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++) { DriverMED_FamilyPtr aFam2 = (*aSMFamsIter); - - list::iterator aFamsIter = aFamilies.begin(); + DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin(); while (aFamsIter != aFamilies.end()) { DriverMED_FamilyPtr aFam1 = *aFamsIter; - list::iterator aCurrIter = aFamsIter++; + DriverMED_FamilyPtrList::iterator aCurrIter = aFamsIter++; if (aFam1->myType == aFam2->myType) { DriverMED_FamilyPtr aCommon (new DriverMED_Family); @@ -89,7 +188,8 @@ list DriverMED_Family::MakeFamilies { aFamilies.erase(aCurrIter); } - if (aFam2->IsEmpty()) break; + if (aFam2->IsEmpty()) + break; } } // The rest elements of family @@ -101,30 +201,32 @@ list DriverMED_Family::MakeFamilies } // Process groups - list::const_iterator aGroupsIter = theGroups.begin(); + SMESHDS_GroupBasePtrList::const_iterator aGroupsIter = theGroups.begin(); for (; aGroupsIter != theGroups.end(); aGroupsIter++) { DriverMED_FamilyPtr aFam2 (new DriverMED_Family); aFam2->Init(*aGroupsIter); - list::iterator aFamsIter = aFamilies.begin(); + DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin(); while (aFamsIter != aFamilies.end()) { DriverMED_FamilyPtr aFam1 = *aFamsIter; - list::iterator aCurrIter = aFamsIter++; + DriverMED_FamilyPtrList::iterator aCurrIter = aFamsIter++; if (aFam1->myType == aFam2->myType) { DriverMED_FamilyPtr aCommon (new DriverMED_Family); aFam1->Split(aFam2, aCommon); if (!aCommon->IsEmpty()) { + aCommon->SetGroupAttributVal(0); aFamilies.push_back(aCommon); } if (aFam1->IsEmpty()) { aFamilies.erase(aCurrIter); } - if (aFam2->IsEmpty()) break; + if (aFam2->IsEmpty()) + break; } } // The rest elements of group @@ -134,7 +236,7 @@ list DriverMED_Family::MakeFamilies } } - list::iterator aFamsIter = aFamilies.begin(); + DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin(); for (; aFamsIter != aFamilies.end(); aFamsIter++) { DriverMED_FamilyPtr aFam = *aFamsIter; @@ -210,33 +312,33 @@ MED::PFamilyInfo DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, const MED::PMeshInfo& theMeshInfo) const { - string aValue; - ostringstream aStr; - aStr << "FAM_" << myId; set::const_iterator aGrIter = myGroupNames.begin(); - for (; aGrIter != myGroupNames.end(); aGrIter++) - { + for(; aGrIter != myGroupNames.end(); aGrIter++){ aStr << "_" << *aGrIter; } - aValue = aStr.str(); - /* - MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, - MED::TIntVector anAttrIds (1, myId); // Id=0, - MED::TIntVector anAttrVals (1, myId); // Value=0 - */ - - MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo, - aValue, - myId, - myGroupNames); -/* - anAttrDescs, - anAttrIds, - anAttrVals); -*/ + MED::PFamilyInfo anInfo; + string aValue = aStr.str(); + if(myId == 0){ + anInfo = theWrapper->CrFamilyInfo(theMeshInfo, + aValue, + myId, + myGroupNames); + }else{ + MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, + MED::TIntVector anAttrIds (1, myId); // Id=0, + MED::TIntVector anAttrVals (1); + anAttrVals[0] = myGroupAttributVal != 0? myGroupAttributVal: myId; + anInfo = theWrapper->CrFamilyInfo(theMeshInfo, + aValue, + myId, + myGroupNames, + anAttrDescs, + anAttrIds, + anAttrVals); + } // cout << endl; // cout << "Groups: "; @@ -279,6 +381,14 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) // Groups list myGroupNames.clear(); myGroupNames.insert(string(theGroup->GetStoreName())); + + myGroupAttributVal = 0; + + if (theGroup->GetColorGroup()!=0) + { + myGroupAttributVal = theGroup->GetColorGroup(); + } + } //============================================================================= @@ -287,10 +397,12 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) * on the basis of the elements type. */ //============================================================================= -list DriverMED_Family::SplitByType (SMESHDS_SubMesh* theSubMesh, - const int theId) +DriverMED_FamilyPtrList +DriverMED_Family +::SplitByType (SMESHDS_SubMesh* theSubMesh, + const int theId) { - list aFamilies; + DriverMED_FamilyPtrList aFamilies; DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family); DriverMED_FamilyPtr anEdgesFamily (new DriverMED_Family); DriverMED_FamilyPtr aFacesFamily (new DriverMED_Family); @@ -361,7 +473,7 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by, DriverMED_FamilyPtr common) { // Elements - set::iterator anIter = by->myElements.begin(); + ElementsSet::iterator anIter = by->myElements.begin(); while ( anIter != by->myElements.end()) { if (myElements.find(*anIter) != myElements.end()) @@ -378,7 +490,7 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by, { // Groups list common->myGroupNames = myGroupNames; - set::iterator aGrNamesIter = by->myGroupNames.begin(); + MED::TStringSet::iterator aGrNamesIter = by->myGroupNames.begin(); for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++) { common->myGroupNames.insert(*aGrNamesIter); diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h index 1632ccb3b..6a3622755 100644 --- a/src/DriverMED/DriverMED_Family.h +++ b/src/DriverMED/DriverMED_Family.h @@ -45,76 +45,92 @@ class DriverMED_Family; typedef boost::shared_ptr DriverMED_FamilyPtr; +typedef std::list DriverMED_FamilyPtrList; +typedef std::map SMESHDS_SubMeshPtrMap; +typedef std::list SMESHDS_GroupBasePtrList; +typedef std::set ElementsSet; class DriverMED_Family { public: - // Methods for groups storing to MED + DriverMED_Family(); - static std::list MakeFamilies (const std::map & theSubMeshes, - const std::list& theGroups, - const bool doGroupOfNodes, - const bool doGroupOfEdges, - const bool doGroupOfFaces, - const bool doGroupOfVolumes); - // Split each group from list and each sub-mesh from list - // on some parts (families) on the basis of the elements membership in other groups - // from and other sub-meshes from . - // Resulting families have no common elements. + //! Methods for groups storing to MED + /*! + Split each group from list and each sub-mesh from list + on some parts (families) on the basis of the elements membership in other groups + from and other sub-meshes from . + Resulting families have no common elements. + */ + static + DriverMED_FamilyPtrList + MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes, + const SMESHDS_GroupBasePtrList& theGroups, + const bool doGroupOfNodes, + const bool doGroupOfEdges, + const bool doGroupOfFaces, + const bool doGroupOfVolumes); - MED::PFamilyInfo GetFamilyInfo (const MED::PWrapper& theWrapper, - const MED::PMeshInfo& theMeshInfo) const; - // Create TFamilyInfo for this family + //! Create TFamilyInfo for this family + MED::PFamilyInfo + GetFamilyInfo (const MED::PWrapper& theWrapper, + const MED::PMeshInfo& theMeshInfo) const; - const std::set& GetElements () const { return myElements; } - // Returns elements of this family + //! Returns elements of this family + const ElementsSet& GetElements () const; - int GetId () const { return myId; } - // Returns a family ID + //! Returns a family ID + int GetId () const; + + //! Sets a family ID + void SetId (const int theId); public: // Methods for groups reading from MED - void AddElement (const SMDS_MeshElement* theElement) { myElements.insert(theElement); } + void AddElement(const SMDS_MeshElement* theElement); - void AddGroupName (std::string theGroupName) { myGroupNames.insert(theGroupName); } + const MED::TStringSet& GetGroupNames() const; + void AddGroupName(std::string theGroupName); - void SetType (const SMDSAbs_ElementType theType) { myType = theType; } - SMDSAbs_ElementType GetType () { return myType; } + void SetType(const SMDSAbs_ElementType theType); + SMDSAbs_ElementType GetType(); - bool MemberOf (std::string theGroupName) const - { return (myGroupNames.find(theGroupName) != myGroupNames.end()); } + bool MemberOf(std::string theGroupName) const; - const MED::TStringSet& GetGroupNames () const { return myGroupNames; } - - void SetId (const int theId) { myId = theId; } - // Sets a family ID + int GetGroupAttributVal() const; + void SetGroupAttributVal( int theValue); private: + //! Initialize the tool by SMESHDS_GroupBase void Init (SMESHDS_GroupBase* group); - // Initialize the tool by SMESHDS_GroupBase - static std::list SplitByType (SMESHDS_SubMesh* theSubMesh, - const int theId); - // Split on some parts (families) - // on the basis of the elements type. + //! Split on some parts (families) on the basis of the elements type. + static + DriverMED_FamilyPtrList + SplitByType(SMESHDS_SubMesh* theSubMesh, + const int theId); + + /*! Remove from elements, common with , + Remove from elements, common with , + Create family from common elements, with combined groups list. + */ void Split (DriverMED_FamilyPtr by, DriverMED_FamilyPtr common); - // Remove from elements, common with , - // Remove from elements, common with , - // Create family from common elements, with combined groups list. - bool IsEmpty () const { return myElements.empty(); } - // Check, if this family has empty list of elements + //! Check, if this family has empty list of elements + bool IsEmpty () const; + private: int myId; SMDSAbs_ElementType myType; - std::set myElements; + ElementsSet myElements; MED::TStringSet myGroupNames; + int myGroupAttributVal; }; #endif diff --git a/src/SMESH/SMESH_Group.hxx b/src/SMESH/SMESH_Group.hxx index 26493e4e0..3819cd4aa 100644 --- a/src/SMESH/SMESH_Group.hxx +++ b/src/SMESH/SMESH_Group.hxx @@ -53,6 +53,9 @@ class SMESH_Group SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; } + void SetColorNumber (int theColorNumber) { myColorNumber = theColorNumber; } + int GetColorNumber() const { return myColorNumber; } + private: SMESH_Group (const SMESH_Group& theOther); // prohibited copy constructor @@ -61,7 +64,7 @@ class SMESH_Group SMESHDS_GroupBase * myGroupDS; std::string myName; - + int myColorNumber; }; #endif diff --git a/src/SMESHDS/SMESHDS_GroupBase.hxx b/src/SMESHDS/SMESHDS_GroupBase.hxx index a7aa87ced..1902f8e9d 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.hxx +++ b/src/SMESHDS/SMESHDS_GroupBase.hxx @@ -66,6 +66,12 @@ class SMESHDS_GroupBase virtual ~SMESHDS_GroupBase() {} + void SetColorGroup (int theColorGroup) + { myColorGroup = theColorGroup;} + + int GetColorGroup() const + { return myColorGroup;} + protected: const SMDS_MeshElement* findInMesh (const int theID) const; void resetIterator(); @@ -84,7 +90,7 @@ class SMESHDS_GroupBase int myCurIndex; int myCurID; SMDS_ElemIteratorPtr myIterator; - + int myColorGroup; }; #endif diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index c9cd3a442..1c2009ff9 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -259,7 +259,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create) myGroupLine = new QLineEdit(aSelectBox, "group line"); myGroupLine->setReadOnly(true); onSelectGroup(false); - + /***************************************************************/ QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 ); wg1Layout->addWidget(aContentBox, 0, 0); @@ -291,6 +291,26 @@ void SMESHGUI_GroupDlg::initDialog(bool create) myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) ); /***************************************************************/ + QGroupBox* aColorBox = new QGroupBox(this, "color box"); + aColorBox->setTitle(tr("SMESH_SET_COLOR")); + + mySelectColorGroup = new QCheckBox(aColorBox, "color checkbox"); + mySelectColorGroup->setText(tr("SMESH_CHECK_COLOR")); + mySelectColorGroup->setMinimumSize(50, 0); + + myColorGroupLine = new QLineEdit(aColorBox, "color line"); + myColorGroupLine->setReadOnly(false); + onSelectColorGroup(false); + + /***************************************************************/ + QHBoxLayout* aColorLayout = new QHBoxLayout(aColorBox, 15, 20); + aColorLayout->setAutoAdd(false); + + aColorLayout->addWidget(mySelectColorGroup); + aColorLayout->addWidget(myColorGroupLine); + + /***************************************************************/ + QFrame* aButtons = new QFrame(this, "button box"); aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken); QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6); @@ -322,7 +342,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create) aMainLayout->addMultiCellWidget(myGrpTypeGroup, 3, 3, 0, 2); aMainLayout->addMultiCellWidget(myWGStack, 4, 4, 0, 2); aMainLayout->setRowStretch( 5, 5 ); - aMainLayout->addMultiCellWidget(aButtons, 6, 6, 0, 2); + aMainLayout->addMultiCellWidget(aColorBox, 6, 6, 0, 2); + aMainLayout->addMultiCellWidget(aButtons, 7, 7, 0, 2); /* signals and slots connections */ connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); @@ -344,6 +365,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create) connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool))); + connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); @@ -439,6 +462,10 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup) myName->setText(myGroup->GetName()); myName->home(false); + + myColorGroupLine->setText(QString::number(myGroup->GetColorNumber())); + myColorGroupLine->home(false); + myMeshGroupLine->setText(myGroup->GetName()); myCurrentLineEdit = 0; @@ -595,6 +622,20 @@ bool SMESHGUI_GroupDlg::onApply() myGroup = SMESH::AddGroup(myMesh, aType, myName->text()); myGroup->Add(anIdList.inout()); + + int aColorNumber = myColorGroupLine->text().toInt(); + myGroup->SetColorNumber(aColorNumber); + + _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup); + + SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text()); + + SMESH::setFileType (aMeshGroupSO,"COULEURGROUP"); + + /* init for next operation */ + myName->setText(""); + + myColorGroupLine->setText(""); /* init for next operation */ myName->setText(""); @@ -603,6 +644,9 @@ bool SMESHGUI_GroupDlg::onApply() } else { myGroup->SetName(myName->text()); + + int aColorNumber = myColorGroupLine->text().toInt(); + myGroup->SetColorNumber(aColorNumber); QValueList aAddList; QValueList::iterator anIt; @@ -660,10 +704,20 @@ bool SMESHGUI_GroupDlg::onApply() SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup); + int aColorNumber = myColorGroupLine->text().toInt(); + aGroupOnGeom->SetColorNumber(aColorNumber); + + _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(aGroupOnGeom); + + SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text()); + + SMESH::setFileType (aMeshGroupSO,"COULEURGROUP"); + mySMESHGUI->updateObjBrowser(true); mySelectionMgr->clearSelected(); /* init for next operation */ myName->setText(""); + myColorGroupLine->setText(""); return true; } @@ -986,6 +1040,23 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on) } } +//================================================================================= +// function : (onSelectColorGroup) +// purpose : Called when setting a color on group +//================================================================================= +void SMESHGUI_GroupDlg::onSelectColorGroup(bool on) +{ + if (on) { + setSelectionMode(7); + } + else { + myColorGroupLine->setText(""); + myCurrentLineEdit = 0; + if (myTypeId != -1) + setSelectionMode(myTypeId); + } + myColorGroupLine->setEnabled(on); +} //================================================================================= // function : setCurrentSelection() diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index af101fcff..e33e84639 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -95,6 +95,7 @@ private slots: void onSelectSubMesh(bool on); void onSelectGroup(bool on); void onSelectGeomGroup(bool on); + void onSelectColorGroup(bool on); void setCurrentSelection(); void setFilters(); @@ -141,6 +142,9 @@ private: QPushButton* myGroupBtn; QLineEdit* myGroupLine; + QCheckBox* mySelectColorGroup; + QLineEdit* myColorGroupLine; + QCheckBox* mySelectGeomGroup; QPushButton* myGeomGroupBtn; QLineEdit* myGeomGroupLine; diff --git a/src/SMESHGUI/SMESHGUI_Utils.cxx b/src/SMESHGUI/SMESHGUI_Utils.cxx index 94714bcd7..383b02c5c 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.cxx +++ b/src/SMESHGUI/SMESHGUI_Utils.cxx @@ -153,6 +153,32 @@ namespace SMESH{ if (aComment) aComment->SetValue(theValue); } + + void setFileName (_PTR(SObject) theSObject, const char* theValue) + { + _PTR(Study) aStudy = GetActiveStudyDocument(); + if (aStudy->GetProperties()->IsLocked()) + return; + _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); + _PTR(GenericAttribute) anAttr = + aBuilder->FindOrCreateAttribute(theSObject, "AttributeExternalFileDef"); + _PTR(AttributeExternalFileDef) aFileName = anAttr; + if (aFileName) + aFileName->SetValue(theValue); + } + + void setFileType (_PTR(SObject) theSObject, const char* theValue) + { + _PTR(Study) aStudy = GetActiveStudyDocument(); + if (aStudy->GetProperties()->IsLocked()) + return; + _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); + _PTR(GenericAttribute) anAttr = + aBuilder->FindOrCreateAttribute(theSObject, "AttributeFileType"); + _PTR(AttributeFileType) aFileType = anAttr; + if (aFileType) + aFileType->SetValue(theValue); + } CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject, _PTR(Study) theStudy) diff --git a/src/SMESHGUI/SMESHGUI_Utils.h b/src/SMESHGUI/SMESHGUI_Utils.h index 83278e4a5..d236533fe 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.h +++ b/src/SMESHGUI/SMESHGUI_Utils.h @@ -81,6 +81,8 @@ namespace SMESH { void SetName (_PTR(SObject) theSObject, const char* theName); void SetValue (_PTR(SObject) theSObject, const char* theValue); + void setFileType (_PTR(SObject) theSObject, const char* theValue); + void setFileName (_PTR(SObject) theSObject, const char* theValue); CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject, _PTR(Study) theStudy); diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index 93628ae79..3fcce77ae 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -918,6 +918,14 @@ msgstr "Group on geometry" msgid "SMESH_GEOM_GROUP" msgstr "Geometry group" +#Color group +msgid "SMESH_SET_COLOR" +msgstr "Color group" + +#Check color group +msgid "SMESH_CHECK_COLOR" +msgstr "Color number" + #%1 SubMeshes msgid "SMESH_SUBMESH_SELECTED" msgstr "%1 SubMeshes" diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 2720a60f5..9c0a2f52f 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -419,3 +419,33 @@ GEOM::GEOM_Object_ptr SMESH_GroupOnGeom_i::GetShape() return aGeomObj._retn(); } +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_GroupBase_i::GetColorNumber() +{ + SMESHDS_GroupBase* aGroupDS = GetGroupDS(); + if (aGroupDS) + return aGroupDS->GetColorGroup(); + MESSAGE("get color number of a vague group"); + return 0; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color) +{ + SMESHDS_GroupBase* aGroupDS = GetGroupDS(); + if (aGroupDS) + return aGroupDS->SetColorGroup(color); + MESSAGE("set color number of a vague group"); + return ; +} + + + diff --git a/src/SMESH_I/SMESH_Group_i.hxx b/src/SMESH_I/SMESH_Group_i.hxx index e9801b258..cc7dabe72 100644 --- a/src/SMESH_I/SMESH_Group_i.hxx +++ b/src/SMESH_I/SMESH_Group_i.hxx @@ -73,6 +73,9 @@ class SMESH_GroupBase_i: SMESH_Group* GetSmeshGroup() const; SMESHDS_GroupBase* GetGroupDS() const; + void SetColorNumber(CORBA::Long color); + CORBA::Long GetColorNumber(); + private: SMESH_Mesh_i* myMeshServant; int myLocalID;