//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
- grpBallSelection = 1,
- grpEdgeSelection = 2,
- grpFaceSelection = 3,
- grpVolumeSelection = 4,
- grpSubMeshSelection = 5,
- grpGroupSelection = 6,
- grpMeshSelection = 7,
- grpGeomSelection = 8,
- grpAllSelection = 9,
+ grp0DSelection = 1,
+ grpBallSelection = 2,
+ grpEdgeSelection = 3,
+ grpFaceSelection = 4,
+ grpVolumeSelection = 5,
+ grpSubMeshSelection = 6,
+ grpGroupSelection = 7,
+ grpMeshSelection = 8,
+ grpGeomSelection = 9,
+ grpAllSelection = 10,
SMESH::SMESH_Mesh_ptr theMesh )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
SMESH::SMESH_Mesh_ptr theMesh )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- myIsApplyAndClose( false ),
- myNbChangesOfContents(0)
+ myNbChangesOfContents(0),
+ myIsApplyAndClose( false )
const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
types.append( tr( "SMESH_BALL_ELEM" ) );
types.append( tr( "SMESH_EDGE" ) );
types.append( tr( "SMESH_FACE" ) );
types.append( tr( "SMESH_BALL_ELEM" ) );
types.append( tr( "SMESH_EDGE" ) );
types.append( tr( "SMESH_FACE" ) );
connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
- connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
+ connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
connect(myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
/* Init selection */
mySMESHGUI->SetActiveDialogBox(this);
connect(myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
/* Init selection */
mySMESHGUI->SetActiveDialogBox(this);
mySubMeshFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
SMESH_LogicalFilter::LO_OR,
/*takeOwnership=*/true);
mySubMeshFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
SMESH_LogicalFilter::LO_OR,
/*takeOwnership=*/true);
- myGroupFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
- SMESH_LogicalFilter::LO_OR,
- /*takeOwnership=*/true);
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
- myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
+ myGroupFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
+ SMESH_LogicalFilter::LO_OR,
+ /*takeOwnership=*/true);
+ myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
+ connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged()));
+ connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView()));
+ connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
- SalomeApp_Study* appStudy =
- dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if ( !appStudy ) return aName;
- _PTR(Study) aStudy = appStudy->studyDS();
+ _PTR(Study) aStudy = SMESH::getStudy();
+void SMESHGUI_GroupDlg::setDefaultName() const
+{
+ QString aResName;
+ int i=1;
+ QString aPrefix ="Group_";
+ _PTR(SObject) anObj;
+ do
+ {
+ aResName = aPrefix + QString::number( i++ );
+ anObj = SMESH::getStudy()->FindObject( SMESH::toUtf8(aResName) );
+ }
+ while ( anObj );
+ myName->setText(aResName);
+}
+
- case SMESH::NODE: aType = 0; break;
- case SMESH::BALL: aType = 1; break;
- case SMESH::EDGE: aType = 2; break;
- case SMESH::FACE: aType = 3; break;
- case SMESH::VOLUME: aType = 4; break;
+ case SMESH::NODE: aType = grpNodeSelection; break;
+ case SMESH::ELEM0D: aType = grp0DSelection; break;
+ case SMESH::BALL: aType = grpBallSelection; break;
+ case SMESH::EDGE: aType = grpEdgeSelection; break;
+ case SMESH::FACE: aType = grpFaceSelection; break;
+ case SMESH::VOLUME: aType = grpVolumeSelection; break;
+ case SMESH::ALL:
+ case SMESH::NB_ELEMENT_TYPES: break;
+ bool meshHasGeom = ( myMesh->_is_nil() || myMesh->HasShapeToMesh() );
+ if ( myGrpTypeId != 1 )
+ {
+ myGrpTypeGroup->button(1)->setEnabled( meshHasGeom );
+ }
+ else
+ {
+ myGeomGroupBtn->setEnabled( meshHasGeom );
+ myGeomGroupLine->setEnabled( meshHasGeom );
+ }
+
- case grpNodeSelection: f = new SMESH_TypeFilter(SUBMESH); break;
- case grpEdgeSelection: f = new SMESH_TypeFilter(SUBMESH_EDGE); break;
- case grpFaceSelection: f = new SMESH_TypeFilter(SUBMESH_FACE); break;
- case grpVolumeSelection: f = new SMESH_TypeFilter(SUBMESH_SOLID); break;
- default: f = new SMESH_TypeFilter(SUBMESH);
+ case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH); break;
+ case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_EDGE); break;
+ case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_FACE); break;
+ case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::SUBMESH_SOLID); break;
+ default: f = new SMESH_TypeFilter(SMESH::SUBMESH);
- case grpNodeSelection: f = new SMESH_TypeFilter(GROUP_NODE); break;
- case grpBallSelection: f = new SMESH_TypeFilter(GROUP_BALL); break;
- case grpEdgeSelection: f = new SMESH_TypeFilter(GROUP_EDGE); break;
- case grpFaceSelection: f = new SMESH_TypeFilter(GROUP_FACE); break;
- case grpVolumeSelection: f = new SMESH_TypeFilter(GROUP_VOLUME); break;
- default: f = new SMESH_TypeFilter(GROUP);
+ case grpNodeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_NODE); break;
+ case grp0DSelection: f = new SMESH_TypeFilter(SMESH::GROUP_0D); break;
+ case grpBallSelection: f = new SMESH_TypeFilter(SMESH::GROUP_BALL); break;
+ case grpEdgeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_EDGE); break;
+ case grpFaceSelection: f = new SMESH_TypeFilter(SMESH::GROUP_FACE); break;
+ case grpVolumeSelection: f = new SMESH_TypeFilter(SMESH::GROUP_VOLUME); break;
+ default: f = new SMESH_TypeFilter(SMESH::GROUP);
//=================================================================================
bool SMESHGUI_GroupDlg::onApply()
{
//=================================================================================
bool SMESHGUI_GroupDlg::onApply()
{
- case grpNodeSelection: aType = SMESH::NODE; break;
- case grpBallSelection: aType = SMESH::BALL; break;
- case grpEdgeSelection: aType = SMESH::EDGE; break;
- case grpFaceSelection: aType = SMESH::FACE; break;
+ case grpNodeSelection: aType = SMESH::NODE; break;
+ case grp0DSelection: aType = SMESH::ELEM0D; break;
+ case grpBallSelection: aType = SMESH::BALL; break;
+ case grpEdgeSelection: aType = SMESH::EDGE; break;
+ case grpFaceSelection: aType = SMESH::FACE; break;
if (myGrpTypeId == 0) // standalone
{
if (!mySelectAll->isChecked() && !myElements->count() && myAllowElemsModif->isChecked())
if (myGrpTypeId == 0) // standalone
{
if (!mySelectAll->isChecked() && !myElements->count() && myAllowElemsModif->isChecked())
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+ _PTR(Study) aStudy = SMESH::getStudy();
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
if (op->_is_nil())
return false;
// check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
if (op->_is_nil())
return false;
// check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
if (i == 0)
aGroupType = aSubShapeType;
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
if (i == 0)
aGroupType = aSubShapeType;
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
- GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
+ GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
+ GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
QString aNewGeomGroupName ( "Auto_group_for_" );
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
QString aNewGeomGroupName ( "Auto_group_for_" );
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
- aNewGeomGroupName.toLatin1().data(), aMeshShape);
+ geomGen->AddInStudy(aGroupVar,
+ SMESH::toUtf8(aNewGeomGroupName), aMeshShape);
if ( isCreation )
{
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
/* init for the next operation */
if ( isCreation )
{
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
/* init for the next operation */
myElements->clear();
myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
myFilter = SMESH::Filter::_nil();
myElements->clear();
myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
myFilter = SMESH::Filter::_nil();
- if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
- anActor->setName(myName->text().toLatin1().data());
- QColor c;
- int delta;
+ {
+ if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
+ {
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if ( isConversion ) { // need to reset TVisualObj and actor
+ SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
+ SMESH::Update( anIO,true);
+ myActorsList.clear();
+ anActor = SMESH::FindActorByEntry( anIO->getEntry() );
+ if ( !anActor ) return false;
+ myActorsList.append( anActor );
+ }
+ anActor->setName(SMESH::toUtf8(myName->text()));
+ QColor c;
+ int delta;
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpVolumeSelection:
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case grpVolumeSelection:
- SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
- anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
- break;
+ SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
+ anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
+ break;
- SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
- break;
+ SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
+ break;
+ }
+ // update a visible group accoding to a changed contents
+ if ( !isConversion && anActor->GetVisibility() )
+ {
+ SMESH::Update( anIO, true );
+ SMESH::RepaintCurrentView();
aString = aList.First()->getName();
myMeshGroupLine->setText(aString);
myMeshGroupLine->home( false );
aString = aList.First()->getName();
myMeshGroupLine->setText(aString);
myMeshGroupLine->home( false );
- else
- aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
+ // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
+ }
+ else {
+ aGroupMainShape = aGeomGroup;
+ aGroupMainShape->Register();
+ }
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
myAddBtn->setEnabled ( !noElemsModif );
myRemoveBtn->setEnabled ( !noElemsModif );
mySortBtn->setEnabled ( !noElemsModif );
mySelectBox->setEnabled ( !noElemsModif );
myAllowElemsModif->setEnabled( !mySelectAll->isChecked() );
myAddBtn->setEnabled ( !noElemsModif );
myRemoveBtn->setEnabled ( !noElemsModif );
mySortBtn->setEnabled ( !noElemsModif );
mySelectBox->setEnabled ( !noElemsModif );
myAllowElemsModif->setEnabled( !mySelectAll->isChecked() );
//=================================================================================
// function : (onSelectGeomGroup)
//=================================================================================
// function : (onSelectGeomGroup)
//=================================================================================
void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
{
//=================================================================================
void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
{
- case grpNodeSelection: aType = SMESH::NODE; break;
- case grpBallSelection: aType = SMESH::BALL; break;
- case grpEdgeSelection: aType = SMESH::EDGE; break;
- case grpFaceSelection: aType = SMESH::FACE; break;
+ case grpNodeSelection: aType = SMESH::NODE; break;
+ case grp0DSelection: aType = SMESH::ELEM0D; break;
+ case grpBallSelection: aType = SMESH::BALL; break;
+ case grpEdgeSelection: aType = SMESH::EDGE; break;
+ case grpFaceSelection: aType = SMESH::FACE; break;
- myFilterDlg->SetSelection();
+ bool isStandalone = ( sender() == myFilterBtn );
+ myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone,
+ /*diffSources=*/isStandalone );
onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+ GEOM::GEOM_IGroupOperations_wrap aGroupOp =
+ SMESH::GetGEOMGen()->GetIGroupOperations();
- //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();
// Construct filter
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
- case grpNodeSelection: aType = SMESH::NODE; break;
- case grpBallSelection: aType = SMESH::BALL; break;
- case grpEdgeSelection: aType = SMESH::EDGE; break;
- case grpFaceSelection: aType = SMESH::FACE; break;
+ case grpNodeSelection: aType = SMESH::NODE; break;
+ case grp0DSelection: aType = SMESH::ELEM0D; break;
+ case grpBallSelection: aType = SMESH::BALL; break;
+ case grpEdgeSelection: aType = SMESH::EDGE; break;
+ case grpFaceSelection: aType = SMESH::FACE; break;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
SMESH::long_array_var anElements = aGroup->GetListOfID();
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
SMESH::long_array_var anElements = aGroup->GetListOfID();
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
-{
- onClose();
-}
-
//=================================================================================
// function : onVisibilityChanged()
// purpose :
//=================================================================================
// function : onVisibilityChanged()
// purpose :
// purpose : SLOT called when "Close" button pressed. Close dialog
//=================================================================================
// purpose : SLOT called when "Close" button pressed. Close dialog
//=================================================================================
{
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
{
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ QDialog::reject();
+
+ if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
+}
+
+//=================================================================================
+// function : onOpenView()
+// purpose :
+//=================================================================================
+void SMESHGUI_GroupDlg::onOpenView()
+{
+ if ( mySelector ) {
+ SMESH::SetPointRepresentation(false);
+ }
+ else {
+ mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
+ mySMESHGUI->EmitSignalDeactivateDialog();
+ setEnabled(true);
+ }
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose :
+//=================================================================================
+void SMESHGUI_GroupDlg::onCloseView()
+{
+ onDeactivate();
+ mySelector = 0;
- app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString( "" ), myHelpFileName);
- else {
- QString platform;
+ {
+ app->onHelpContextModule
+ ( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString(""), myHelpFileName );
+ }
+ else
+ {
#endif
SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
#endif
SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true);
mySelectionMode = grpNoSelection;
setSelectionMode(myTypeId);
mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true);
mySelectionMode = grpNoSelection;
setSelectionMode(myTypeId);
-//=================================================================================
-// function : hideEvent
-// purpose : caused by ESC key
-//=================================================================================
-void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)
-{
- if (!isMinimized() && !myIsBusy)
- onClose();
-}
-
//=================================================================================
// function : keyPressEvent()
// purpose :
//=================================================================================
// function : keyPressEvent()
// purpose :
}
//================================================================================
/*!
* \brief Enable showing of the popup when Geometry selection btn is clicked
}
//================================================================================
/*!
* \brief Enable showing of the popup when Geometry selection btn is clicked
- {
- myCurrentLineEdit = myGeomGroupLine;
- QAction* a = myGeomPopup->exec( QCursor::pos() );
- if (!a || myActions[a] == DIRECT_GEOM_INDEX)
- setSelectionMode(grpGeomSelection);
- }
+ {
+ myCurrentLineEdit = myGeomGroupLine;
+ QAction* a = myGeomPopup->exec( QCursor::pos() );
+ if (!a || myActions[a] == DIRECT_GEOM_INDEX)
+ setSelectionMode(grpGeomSelection);
+ }
- {
- mySelectionMode = grpNoSelection;
- if ( !myShapeByMeshOp ) {
- myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
- connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
- SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
- connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
- SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
- }
- // set mesh object to SMESHGUI_ShapeByMeshOp and start it
- if ( !myMesh->_is_nil() ) {
- myIsBusy = true;
- hide(); // stop processing selection
- myIsBusy = false;
- myShapeByMeshOp->setModule( mySMESHGUI );
- myShapeByMeshOp->setStudy( 0 ); // it's really necessary
- myShapeByMeshOp->SetMesh( myMesh );
- myShapeByMeshOp->start();
- }
+ {
+ mySelectionMode = grpNoSelection;
+ if ( !myShapeByMeshOp ) {
+ myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
+ connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
+ SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
+ connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
+ SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
+ }
+ // set mesh object to SMESHGUI_ShapeByMeshOp and start it
+ if ( !myMesh->_is_nil() ) {
+ myIsBusy = true;
+ hide(); // stop processing selection
+ myIsBusy = false;
+ myShapeByMeshOp->setModule( mySMESHGUI );
+ myShapeByMeshOp->setStudy( 0 ); // it's really necessary
+ myShapeByMeshOp->SetMesh( myMesh );
+ myShapeByMeshOp->start();
SALOME_ListIO anIOList;
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
SALOME_ListIO anIOList;
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
- int r = 0, g = 0, b = 0;
- SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
- aQColor.setRgb( r, g, b );
+ if ( !aQColor.isValid() ) {
+ int r = 0, g = 0, b = 0;
+ SMESH::GetColor( "SMESH", "default_grp_color", r, g, b, QColor( 255, 170, 0 ) );
+ aQColor.setRgb( r, g, b );
+ }
aQColor.setRgb( (int)( aColor.R * 255.0 ),
(int)( aColor.G * 255.0 ),
(int)( aColor.B * 255.0 ) );
aQColor.setRgb( (int)( aColor.R * 255.0 ),
(int)( aColor.G * 255.0 ),
(int)( aColor.B * 255.0 ) );
// function : SetAppropriateActor()
// purpose : Find more appropriate of visible actors, set it to myActor, allow picking
// NPAL19389: create a group with a selection in another group.
// function : SetAppropriateActor()
// purpose : Find more appropriate of visible actors, set it to myActor, allow picking
// NPAL19389: create a group with a selection in another group.
//=================================================================================
bool SMESHGUI_GroupDlg::SetAppropriateActor()
{
//=================================================================================
bool SMESHGUI_GroupDlg::SetAppropriateActor()
{
- if (myGeomGroupBtn->isChecked()) { // try current group on geometry actor
- if (!isActor) {
- if (!myGroupOnGeom->_is_nil()) {
- SMESH_Actor* anActor = SMESH::FindActorByObject(myGroupOnGeom);
- if (anActor && anActor->hasIO())
- {
- isActor = true;
- if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
- isActor = false;
- else
- myActorsList.append(anActor);
- }
- }
+ if (myGrpTypeGroup->checkedId() > 0) { // try current group on geometry actor
+ SMESH_Actor* anActor = 0;
+ if (!myGroupOnGeom->_is_nil())
+ anActor = SMESH::FindActorByObject(myGroupOnGeom);
+ if (!myGroupOnFilter->_is_nil())
+ anActor = SMESH::FindActorByObject(myGroupOnFilter);
+ if (anActor && anActor->hasIO())
+ {
+ isActor = true;
+ if (aViewWindow && !aViewWindow->isVisible(anActor->getIO()))
+ isActor = false;
+ else
+ myActorsList.append(anActor);
- SMESH_Actor* anActor = SMESH::FindActorByObject(myGroup);
- if (anActor && anActor->hasIO())
- myActorsList.append(anActor);
+ aGroupActor = SMESH::FindActorByObject(myGroup);
+ if (aGroupActor && aGroupActor->hasIO())
+ myActorsList.append(aGroupActor);
if (aViewWindow) {
// mesh entry
_PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
if (aSObject) {
CORBA::String_var meshEntry = aSObject->GetID().c_str();
int len = strlen(meshEntry);
if (aViewWindow) {
// mesh entry
_PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
if (aSObject) {
CORBA::String_var meshEntry = aSObject->GetID().c_str();
int len = strlen(meshEntry);
// iterate on all actors in current view window, search for
// any visible actor, that belongs to group or submesh of current mesh
VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors();
int nbItems = aCollection->GetNumberOfItems();
for (int i=0; i<nbItems && !isActor; i++)
// iterate on all actors in current view window, search for
// any visible actor, that belongs to group or submesh of current mesh
VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors();
int nbItems = aCollection->GetNumberOfItems();
for (int i=0; i<nbItems && !isActor; i++)
- {
- SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
- if (anActor && anActor->hasIO()) {
- Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
- if (aViewWindow->isVisible(anIO)) {
- if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0 && !myActorsList.contains(anActor) )
- myActorsList.append(anActor);
- }
+ {
+ SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(aCollection->GetItemAsObject(i));
+ if (anActor && anActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if (aViewWindow->isVisible(anIO)) {
+ if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0 && !myActorsList.contains(anActor) )
+ myActorsList.append(anActor);
+
+ // Show a standalone group if nothing else is visible (IPAL52227)
+ if ( myActorsList.count() == 1 &&
+ myActorsList[0] == aGroupActor &&
+ aViewWindow && !aViewWindow->isVisible(aGroupActor->getIO()))
+ SMESH::UpdateView( aViewWindow, SMESH::eDisplay, aGroupActor->getIO()->getEntry() );
//=======================================================================
//function : setShowEntityMode
//purpose : make shown only entity corresponding to my type
//=======================================================================
//function : setShowEntityMode
//purpose : make shown only entity corresponding to my type
- case grpNodeSelection: restoreShowEntityMode(); break;
- case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
- case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
- case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
- case grpVolumeSelection: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
+ case grpNodeSelection: restoreShowEntityMode(); break;
+ case grp0DSelection: actor->SetEntityMode( SMESH_Actor::e0DElements ); break;
+ case grpBallSelection: actor->SetEntityMode( SMESH_Actor::eBallElem ); break;
+ case grpEdgeSelection: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
+ case grpFaceSelection: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
+ case grpVolumeSelection: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;