mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
IPAL52924: Edit Group Standalone: Filters with Source: Mesh, Initial selection does not work
+ Enable "New Mesh" option in Create Boundary Elements dialog independently of type of selected object (SMESHGUI_Make2DFrom3DOp.cxx)
This commit is contained in:
parent
3369d458ea
commit
d4c5851320
@ -870,8 +870,8 @@ SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule,
|
||||
QWidget* parent,
|
||||
const int type )
|
||||
: QWidget( parent ),
|
||||
myIsLocked( false ),
|
||||
mySMESHGUI( theModule )
|
||||
mySMESHGUI( theModule ),
|
||||
myIsLocked( false )
|
||||
{
|
||||
myEntityType = -1;
|
||||
|
||||
@ -888,8 +888,8 @@ SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule,
|
||||
QWidget* parent,
|
||||
const QList<int>& types )
|
||||
: QWidget( parent ),
|
||||
myIsLocked( false ),
|
||||
mySMESHGUI( theModule )
|
||||
mySMESHGUI( theModule ),
|
||||
myIsLocked( false )
|
||||
{
|
||||
myEntityType = -1;
|
||||
Init(types);
|
||||
@ -1155,7 +1155,7 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType)
|
||||
bool aRes = false;
|
||||
bool isSignalsBlocked = aTable->signalsBlocked();
|
||||
aTable->blockSignals(true);
|
||||
double aThreshold = (int)aTable->text(i, 2).toDouble(&aRes);
|
||||
/*double aThreshold =*/ aTable->text(i, 2).toDouble( &aRes );
|
||||
aTable->blockSignals(isSignalsBlocked);
|
||||
|
||||
if (!aRes && aTable->isEditable(i, 2))
|
||||
@ -3365,7 +3365,7 @@ bool SMESHGUI_FilterDlg::onApply()
|
||||
|
||||
if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
|
||||
//
|
||||
bool toFilter = (( SMESH::FindActorByObject( myMesh )) ||
|
||||
bool toFilter = (( getActor() ) ||
|
||||
( myInitSourceWgOnApply && mySourceWg ) ||
|
||||
( mySourceGrp->checkedId() == Dialog && mySourceWg ));
|
||||
if ( toFilter ) {
|
||||
@ -3416,7 +3416,7 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
|
||||
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
|
||||
aPrecision = mgr->integerValue( "SMESH", "controls_precision", aPrecision );
|
||||
|
||||
for (CORBA::ULong i = 0; i < n; i++) {
|
||||
for ( int i = 0; i < n; i++) {
|
||||
SMESH::Filter::Criterion aCriterion = createCriterion();
|
||||
myTable->GetCriterion(i, aCriterion);
|
||||
aCriterion.Precision = aPrecision;
|
||||
@ -3622,6 +3622,35 @@ void SMESHGUI_FilterDlg::filterSelectionSource (const int theType,
|
||||
theResIds.append(aResIter.Key());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getActor
|
||||
//purpose : Returns an actor to show filtered entities
|
||||
//=======================================================================
|
||||
|
||||
SMESH_Actor* SMESHGUI_FilterDlg::getActor()
|
||||
{
|
||||
SMESH_Actor* meshActor = SMESH::FindActorByObject( myMesh );
|
||||
if ( meshActor && meshActor->GetVisibility() )
|
||||
return meshActor;
|
||||
|
||||
SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter(myIObjects);
|
||||
for ( ; anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) io = anIter.Key();
|
||||
if ( io->hasEntry() )
|
||||
{
|
||||
SMESH_Actor* actor = SMESH::FindActorByEntry( io->getEntry() );
|
||||
if ( !actor )
|
||||
continue;
|
||||
if ( actor->GetVisibility() )
|
||||
return actor;
|
||||
if ( !meshActor )
|
||||
meshActor = actor;
|
||||
}
|
||||
}
|
||||
return meshActor;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FilterDlg::selectInViewer
|
||||
// Purpose : Select given entities in viewer
|
||||
@ -3644,8 +3673,8 @@ void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QList<int>& th
|
||||
}
|
||||
|
||||
// Clear selection
|
||||
SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
|
||||
if (!anActor || !anActor->hasIO())
|
||||
SMESH_Actor* anActor = getActor();
|
||||
if ( !anActor || !anActor->hasIO() )
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
|
||||
|
@ -45,17 +45,18 @@
|
||||
#include CORBA_SERVER_HEADER(SMESH_Filter)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QFrame;
|
||||
class LightApp_SelectionMgr;
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
class QFrame;
|
||||
class QGroupBox;
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
class QTableWidget;
|
||||
class QTableWidgetItem;
|
||||
class QStackedWidget;
|
||||
class LightApp_SelectionMgr;
|
||||
class SMESHGUI;
|
||||
class SMESHGUI_FilterLibraryDlg;
|
||||
class SMESH_Actor;
|
||||
class SVTK_Selector;
|
||||
|
||||
/*!
|
||||
@ -282,6 +283,7 @@ private:
|
||||
void setIdsToWg( QWidget*, const QList<int>& );
|
||||
Selection_Mode getSelMode( const int ) const;
|
||||
void updateSelection();
|
||||
SMESH_Actor* getActor();
|
||||
|
||||
private:
|
||||
// widgets
|
||||
|
@ -128,8 +128,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
|
||||
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
|
||||
myIsBusy( false ),
|
||||
myNameChanged( false ),
|
||||
myIsApplyAndClose( false ),
|
||||
myNbChangesOfContents(0)
|
||||
myNbChangesOfContents(0),
|
||||
myIsApplyAndClose( false )
|
||||
{
|
||||
initDialog( true );
|
||||
if ( !theMesh->_is_nil() )
|
||||
@ -612,6 +612,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
|
||||
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;
|
||||
}
|
||||
myTypeGroup->button(aType)->setChecked(true);
|
||||
|
||||
@ -1075,7 +1077,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
// 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;
|
||||
for ( int i =0; i < myGeomObjects->length(); i++) {
|
||||
for ( int i =0; i < (int)myGeomObjects->length(); i++) {
|
||||
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
|
||||
if (i == 0)
|
||||
aGroupType = aSubShapeType;
|
||||
@ -1809,6 +1811,10 @@ void SMESHGUI_GroupDlg::onFilterAccepted()
|
||||
mesh = myGroupOnFilter->GetMesh();
|
||||
}
|
||||
myFilter->SetMesh( mesh );
|
||||
|
||||
// highlight ids if selection changed in the Viewer (IPAL52924)
|
||||
myCurrentLineEdit = 0;
|
||||
onObjectSelectionChanged();
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
@ -2139,15 +2145,13 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
}
|
||||
}
|
||||
else if (myCurrentLineEdit == myGroupLine) {
|
||||
Standard_Boolean aRes;
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
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());
|
||||
if (aRes && !aGroup->_is_nil()) {
|
||||
if (!aGroup->_is_nil()) {
|
||||
// check if mesh is the same
|
||||
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
|
||||
SMESH::long_array_var anElements = aGroup->GetListOfID();
|
||||
@ -2285,18 +2289,20 @@ void SMESHGUI_GroupDlg::onHelp()
|
||||
{
|
||||
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
||||
if (app)
|
||||
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString( "" ), myHelpFileName);
|
||||
else {
|
||||
QString platform;
|
||||
{
|
||||
app->onHelpContextModule
|
||||
( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString(""), myHelpFileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
platform = "winapplication";
|
||||
QString platform = "winapplication";
|
||||
#else
|
||||
platform = "application";
|
||||
QString platform = "application";
|
||||
#endif
|
||||
SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
|
||||
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
|
||||
arg(app->resourceMgr()->stringValue( "ExternalBrowser",
|
||||
platform)).
|
||||
arg(app->resourceMgr()->stringValue( "ExternalBrowser", platform)).
|
||||
arg(myHelpFileName));
|
||||
}
|
||||
}
|
||||
@ -2343,16 +2349,16 @@ void SMESHGUI_GroupDlg::keyPressEvent( QKeyEvent* e )
|
||||
return;
|
||||
|
||||
if ( e->key() == Qt::Key_F1 )
|
||||
{
|
||||
e->accept();
|
||||
onHelp();
|
||||
}
|
||||
{
|
||||
e->accept();
|
||||
onHelp();
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Enable showing of the popup when Geometry selection btn is clicked
|
||||
* \param enable - true to enable
|
||||
* \param enable - true to enable
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
@ -2388,17 +2394,17 @@ void SMESHGUI_GroupDlg::updateGeomPopup()
|
||||
void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn)
|
||||
{
|
||||
if ( myGeomPopup && isBtnOn )
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (!isBtnOn)
|
||||
{
|
||||
myCurrentLineEdit = 0;
|
||||
setSelectionMode(grpAllSelection);
|
||||
}
|
||||
{
|
||||
myCurrentLineEdit = 0;
|
||||
setSelectionMode(grpAllSelection);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -2409,26 +2415,26 @@ void SMESHGUI_GroupDlg::onGeomPopup( QAction* a )
|
||||
{
|
||||
int index = myActions[a];
|
||||
if ( index == GEOM_BY_MESH_INDEX )
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -2469,10 +2475,10 @@ void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op)
|
||||
void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
|
||||
{
|
||||
if ( myShapeByMeshOp == op )
|
||||
{
|
||||
show();
|
||||
setSelectionMode(grpGeomSelection);
|
||||
}
|
||||
{
|
||||
show();
|
||||
setSelectionMode(grpGeomSelection);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -299,14 +299,14 @@ void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
||||
myDlg->selectObject( names, types, ids );
|
||||
|
||||
// enable/desable "new mesh" button
|
||||
bool isMesh = true;
|
||||
for ( int i = 0; i < ids.count() && isMesh; ++i )
|
||||
{
|
||||
_PTR(SObject) sobj =
|
||||
SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
|
||||
mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );
|
||||
isMesh = !mySrcMesh->_is_nil();
|
||||
}
|
||||
bool isMesh = true; // EAP - it's sometimes necessary to copy to a new mesh
|
||||
// for ( int i = 0; i < ids.count() && isMesh; ++i )
|
||||
// {
|
||||
// _PTR(SObject) sobj =
|
||||
// SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
|
||||
// mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );
|
||||
// isMesh = !mySrcMesh->_is_nil();
|
||||
// }
|
||||
myDlg->setNewMeshEnabled( isMesh );
|
||||
}
|
||||
catch ( const SALOME::SALOME_Exception& S_ex ) {
|
||||
@ -374,7 +374,7 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
|
||||
idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
|
||||
if ( !idSource->_is_nil() ) {
|
||||
SMESH::array_of_ElementType_var types = idSource->GetTypes();
|
||||
for ( int j = 0; j < types->length(); ++j )
|
||||
for ( int j = 0; j < (int) types->length(); ++j )
|
||||
if ( types[j] == SMESH::VOLUME )
|
||||
hasVolumes = true;
|
||||
else if ( types[j] == SMESH::FACE )
|
||||
|
Loading…
Reference in New Issue
Block a user