X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_GroupDlg.cxx;h=36534f31ad8da3093cd5d62c3065f7f3c60e9dfe;hp=0b2cbb975fc1fdd221592a962687deb4986afdd5;hb=35012b0a3d7a04ff4af9f1622340a814b3f1300b;hpb=678b908f16db09e6c5b38edddcd5b6081e1d4936 diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 0b2cbb975..36534f31a 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -192,7 +192,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create) QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) ); - myHelpFileName = create ? "creating_groups_page.html" : "editing_groups_page.html"; + myHelpFileName = create ? "creating_groups.html" : "editing_groups.html"; setSizeGripEnabled( true); @@ -498,10 +498,7 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) QString aName = ""; // collect all object names of SMESH component - SalomeApp_Study* appStudy = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return aName; - _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(Study) aStudy = SMESH::getStudy(); std::set aSet; _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" )); @@ -519,7 +516,7 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) bool isUnique = false; while (!isUnique) { aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(std::string(SMESH::toUtf8(aName))) == 0); + isUnique = (aSet.count(std::string(aName.toUtf8().constData())) == 0); } return aName; @@ -528,14 +525,13 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) void SMESHGUI_GroupDlg::setDefaultName() const { QString aResName; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); int i=1; QString aPrefix ="Group_"; _PTR(SObject) anObj; do { aResName = aPrefix + QString::number( i++ ); - anObj = aStudy->FindObject( SMESH::toUtf8(aResName) ); + anObj = SMESH::getStudy()->FindObject( aResName.toUtf8().constData() ); } while ( anObj ); myName->setText(aResName); @@ -601,7 +597,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, SALOMEDS::Color aColor = theGroup->GetColor(); setGroupColor( aColor ); - myMeshGroupLine->setText(SMESH::fromUtf8(theGroup->GetName())); + myMeshGroupLine->setText(theGroup->GetName()); int aType = 0; switch(theGroup->GetType()) { @@ -664,7 +660,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, else if ( grpType == 1 ) // group on geom { QString aShapeName( "" ); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape(); if (!aGroupShape->_is_nil()) { @@ -688,7 +684,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, { myNameChanged = true; myName->blockSignals(true); - myName->setText(SMESH::fromUtf8(theGroup->GetName())); + myName->setText(theGroup->GetName()); myName->blockSignals(false); } @@ -915,7 +911,7 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode) //================================================================================= bool SMESHGUI_GroupDlg::onApply() { - if (mySMESHGUI->isActiveStudyLocked()) + if (SMESHGUI::isStudyLocked()) return false; if (myName->text().trimmed().isEmpty()) @@ -1050,11 +1046,11 @@ bool SMESHGUI_GroupDlg::onApply() if (myMesh->_is_nil() || !myGeomObjects->length()) return false; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); if (myGeomObjects->length() == 1) { myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, - SMESH::toUtf8(myName->text()), + myName->text().toUtf8(), myGeomObjects[0]); } else { @@ -1064,12 +1060,11 @@ bool SMESHGUI_GroupDlg::onApply() // create a geometry group GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if (geomGen->_is_nil() || !aStudy) + if (geomGen->_is_nil()) return false; - GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId()); + GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); if (op->_is_nil()) return false; @@ -1095,12 +1090,12 @@ bool SMESHGUI_GroupDlg::onApply() QString aNewGeomGroupName ( "Auto_group_for_" ); aNewGeomGroupName += myName->text(); SALOMEDS::SObject_var aNewGroupSO = - geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, - SMESH::toUtf8(aNewGeomGroupName), aMeshShape); + geomGen->AddInStudy(aGroupVar, + aNewGeomGroupName.toUtf8(), aMeshShape); } myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, - SMESH::toUtf8(myName->text()), + myName->text().toUtf8(), aGroupVar); } resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom ); @@ -1124,7 +1119,7 @@ bool SMESHGUI_GroupDlg::onApply() return false; myGroupOnFilter = myMesh->CreateGroupFromFilter(aType, - SMESH::toUtf8(myName->text()), + myName->text().toUtf8(), myFilter); resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter ); isCreation = true; @@ -1148,7 +1143,7 @@ bool SMESHGUI_GroupDlg::onApply() if( aMeshGroupSO ) anEntryList.append( aMeshGroupSO->GetID().c_str() ); - resultGroup->SetName(SMESH::toUtf8(myName->text().trimmed())); + resultGroup->SetName(myName->text().trimmed().toUtf8()); if ( isCreation ) { @@ -1179,7 +1174,7 @@ bool SMESHGUI_GroupDlg::onApply() if ( !anActor ) return false; myActorsList.append( anActor ); } - anActor->setName(SMESH::toUtf8(myName->text())); + anActor->setName(myName->text().toUtf8()); QColor c; int delta; switch ( myTypeId ) { @@ -1197,7 +1192,7 @@ bool SMESHGUI_GroupDlg::onApply() anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break; break; } - // update a visible group accoding to a changed contents + // update a visible group according to a changed contents if ( !isConversion && anActor->GetVisibility() ) { SMESH::Update( anIO, true ); @@ -1412,13 +1407,12 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() continue; // Check if group constructed on the same shape as a mesh or on its child - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); // The main shape of the group GEOM::GEOM_Object_var aGroupMainShape; if (aGeomGroup->GetType() == 37) { GEOM::GEOM_IGroupOperations_wrap anOp = - SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + SMESH::GetGEOMGen()->GetIGroupOperations(); aGroupMainShape = anOp->GetMainShape(aGeomGroup); // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap } @@ -1426,8 +1420,9 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() aGroupMainShape = aGeomGroup; aGroupMainShape->Register(); } + CORBA::String_var entry = aGroupMainShape->GetStudyEntry(); _PTR(SObject) aGroupMainShapeSO = - aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()); + SMESH::getStudy()->FindObjectID( entry.in() ); _PTR(SObject) anObj, aRef; bool isRefOrSubShape = false; @@ -1451,10 +1446,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myGeomObjects->length(i); if ( i == 0 ) - { - myIsBusy = false; - return; - } + { + myIsBusy = false; + return; + } aNbSel = i; } @@ -2006,9 +2001,8 @@ void SMESHGUI_GroupDlg::onAdd() onListSelectionChanged(); } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) { - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); GEOM::GEOM_IGroupOperations_wrap aGroupOp = - SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + SMESH::GetGEOMGen()->GetIGroupOperations(); SMESH::ElementType aGroupType = SMESH::ALL; switch(aGroupOp->GetType(myGeomObjects[0])) { @@ -2021,8 +2015,8 @@ void SMESHGUI_GroupDlg::onAdd() if (aGroupType == aType) { _PTR(SObject) aGroupSO = - //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup)); - aStudy->FindObjectID(myGeomObjects[0]->GetStudyEntry()); + //SMESH::getStudy()->FindObjectIOR(SMESH::getStudy()->ConvertObjectToIOR(myGeomGroup)); + SMESH::getStudy()->FindObjectID(myGeomObjects[0]->GetStudyEntry()); // Construct filter SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager(); SMESH::Filter_var aFilter = aFilterMgr->CreateFilter(); @@ -2310,7 +2304,7 @@ void SMESHGUI_GroupDlg::onHelp() //================================================================================= // function : SMESHGUI_GroupDlg::onDeactivate -// purpose : SLOT called when dialog must be deativated +// purpose : SLOT called when dialog must be deactivated //================================================================================= void SMESHGUI_GroupDlg::onDeactivate() { @@ -2454,8 +2448,7 @@ void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op) if ( !aGeomVar->_is_nil() ) { QString ID = aGeomVar->GetStudyEntry(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) { + if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) { SALOME_ListIO anIOList; Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );