X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_GroupDlg.cxx;h=4b33a586b5462396fb917097c7853be4b042fdcf;hp=60095ebe2a7651a7ec543801ba34316e50278c05;hb=38a77c4a9810f4715212368ac53315689ba9150f;hpb=63a442b2c3cbc5e2155d83e86dfdb77d6961fab3 diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 60095ebe2..4b33a586b 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -61,7 +61,6 @@ #include #include -#include #include @@ -520,7 +519,7 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) bool isUnique = false; while (!isUnique) { aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.toUtf8().data()) == 0); + isUnique = (aSet.count(std::string(SMESH::toUtf8(aName))) == 0); } return aName; @@ -536,7 +535,7 @@ void SMESHGUI_GroupDlg::setDefaultName() const do { aResName = aPrefix + QString::number( i++ ); - anObj = aStudy->FindObject( aResName.toUtf8().data() ); + anObj = aStudy->FindObject( SMESH::toUtf8(aResName) ); } while ( anObj ); myName->setText(aResName); @@ -595,14 +594,14 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, myNameChanged = true; myName->blockSignals(true); - myName->setText(QString::fromUtf8(theGroup->GetName())); + myName->setText(SMESH::fromUtf8(theGroup->GetName())); myName->blockSignals(false); myName->home(false); SALOMEDS::Color aColor = theGroup->GetColor(); setGroupColor( aColor ); - myMeshGroupLine->setText(QString::fromUtf8(theGroup->GetName())); + myMeshGroupLine->setText(SMESH::fromUtf8(theGroup->GetName())); int aType = 0; switch(theGroup->GetType()) { @@ -687,7 +686,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup, { myNameChanged = true; myName->blockSignals(true); - myName->setText(QString::fromUtf8(theGroup->GetName())); + myName->setText(SMESH::fromUtf8(theGroup->GetName())); myName->blockSignals(false); } @@ -731,6 +730,17 @@ void SMESHGUI_GroupDlg::updateButtons() } } + bool meshHasGeom = ( myMesh->_is_nil() || myMesh->HasShapeToMesh() ); + if ( myGrpTypeId != 1 ) + { + myGrpTypeGroup->button(1)->setEnabled( meshHasGeom ); + } + else + { + myGeomGroupBtn->setEnabled( meshHasGeom ); + myGeomGroupLine->setEnabled( meshHasGeom ); + } + myOKBtn->setEnabled(enable); myApplyBtn->setEnabled(enable); } @@ -1042,7 +1052,7 @@ bool SMESHGUI_GroupDlg::onApply() if (myGeomObjects->length() == 1) { myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, - myName->text().toUtf8().data(), + SMESH::toUtf8(myName->text()), myGeomObjects[0]); } else { @@ -1084,11 +1094,11 @@ bool SMESHGUI_GroupDlg::onApply() aNewGeomGroupName += myName->text(); SALOMEDS::SObject_var aNewGroupSO = geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, - aNewGeomGroupName.toUtf8().data(), aMeshShape); + SMESH::toUtf8(aNewGeomGroupName), aMeshShape); } myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, - myName->text().toUtf8().data(), + SMESH::toUtf8(myName->text()), aGroupVar); } resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom ); @@ -1111,7 +1121,7 @@ bool SMESHGUI_GroupDlg::onApply() return false; myGroupOnFilter = myMesh->CreateGroupFromFilter(aType, - myName->text().toUtf8().data(), + SMESH::toUtf8(myName->text()), myFilter); resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter ); @@ -1136,6 +1146,8 @@ bool SMESHGUI_GroupDlg::onApply() if( aMeshGroupSO ) anEntryList.append( aMeshGroupSO->GetID().c_str() ); + resultGroup->SetName(SMESH::toUtf8(myName->text().trimmed())); + if ( isCreation ) { SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" ); @@ -1152,8 +1164,6 @@ bool SMESHGUI_GroupDlg::onApply() } else { - resultGroup->SetName(myName->text().toUtf8().data()); - if ( aMeshGroupSO ) { if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) @@ -1167,7 +1177,7 @@ bool SMESHGUI_GroupDlg::onApply() if ( !anActor ) return false; myActorsList.append( anActor ); } - anActor->setName(myName->text().toUtf8().data()); + anActor->setName(SMESH::toUtf8(myName->text())); QColor c; int delta; switch ( myTypeId ) { @@ -1187,7 +1197,10 @@ bool SMESHGUI_GroupDlg::onApply() } // update a visible group accoding to a changed contents if ( !isConversion && anActor->GetVisibility() ) + { SMESH::Update( anIO, true ); + SMESH::RepaintCurrentView(); + } } } } @@ -1316,6 +1329,9 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() // any visible actor of group or submesh of myMesh SetAppropriateActor(); + setDefaultGroupColor(); + setDefaultName(); + aString = aList.First()->getName(); myMeshGroupLine->setText(aString); myMeshGroupLine->home( false ); @@ -1752,10 +1768,10 @@ void SMESHGUI_GroupDlg::setFilters() myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone, /*diffSources=*/isStandalone ); myFilterDlg->SetMesh( myMesh ); + myFilterDlg->SetGroup( myGroupOnFilter ); myFilterDlg->SetSelection(); myFilterDlg->SetSourceWg( myElements, false ); - myFilterDlg->show(); }