mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
Fix PAL7864 : Impossible to change orientation for group of volumes.
Corrected selection of objects in the dialog box. Two SMESHGUI filter have been added: one to select any faces and other for the volumes.
This commit is contained in:
parent
0c22c61f19
commit
cca99353e8
@ -50,6 +50,12 @@ IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter)
|
||||
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_FacesFilter, SMESHGUI_Filter)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_FacesFilter, SMESHGUI_Filter)
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_VolumesFilter, SMESHGUI_Filter)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_VolumesFilter, SMESHGUI_Filter)
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_PredicateFilter
|
||||
Description : Selection filter for VTK viewer. This class aggregate object
|
||||
@ -212,7 +218,7 @@ bool SMESHGUI_QuadrangleFilter::IsValid( const int theCellId ) const
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
|
||||
|
||||
return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 4 : false;
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -231,7 +237,7 @@ bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
|
||||
|
||||
return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 4 : false;
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -289,7 +295,7 @@ bool SMESHGUI_TriangleFilter::IsValid( const int theCellId ) const
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
|
||||
|
||||
return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 3 : false;
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -308,7 +314,7 @@ bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
|
||||
|
||||
return anElem != 0 ? anElem->GetType() != SMDSAbs_Face || anElem->NbNodes() == 3 : false;
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -330,6 +336,159 @@ bool SMESHGUI_TriangleFilter::IsNodeFilter() const
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_FacesFilter
|
||||
Description : Verify whether selected cell is any face
|
||||
*/
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FacesFilter::SMESHGUI_FacesFilter
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESHGUI_FacesFilter::SMESHGUI_FacesFilter()
|
||||
: SMESHGUI_Filter()
|
||||
{
|
||||
}
|
||||
|
||||
SMESHGUI_FacesFilter::~SMESHGUI_FacesFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FacesFilter::IsValid
|
||||
// Purpose : Verify whether selected cell is face
|
||||
//=======================================================================
|
||||
bool SMESHGUI_FacesFilter::IsValid( const int theCellId ) const
|
||||
{
|
||||
if ( myActor == 0 )
|
||||
return false;
|
||||
|
||||
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
|
||||
if ( anActor->GetObject() == 0 )
|
||||
return false;
|
||||
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
|
||||
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FacesFilter::IsValid
|
||||
// Purpose : Verify whether selected cell is face
|
||||
//=======================================================================
|
||||
bool SMESHGUI_FacesFilter::IsObjValid( const int theObjId ) const
|
||||
{
|
||||
if ( myActor == 0 )
|
||||
return false;
|
||||
|
||||
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
|
||||
if ( anActor->GetObject() == 0 )
|
||||
return false;
|
||||
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
|
||||
|
||||
return anElem && anElem->GetType() == SMDSAbs_Face;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FacesFilter::GetId
|
||||
// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
|
||||
// enumeration. All filters must have different ids
|
||||
//=======================================================================
|
||||
int SMESHGUI_FacesFilter::GetId() const
|
||||
{
|
||||
return SMESHGUI_FaceFilter;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_FacesFilter::IsNodeFilter
|
||||
// Purpose : Returns true if filter is intended for nodes
|
||||
//=======================================================================
|
||||
bool SMESHGUI_FacesFilter::IsNodeFilter() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_VolumesFilter
|
||||
Description : Verify whether selected cell is any volume
|
||||
*/
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_VolumesFilter::SMESHGUI_VolumesFilter
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESHGUI_VolumesFilter::SMESHGUI_VolumesFilter()
|
||||
: SMESHGUI_Filter()
|
||||
{
|
||||
}
|
||||
|
||||
SMESHGUI_VolumesFilter::~SMESHGUI_VolumesFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_VolumesFilter::IsValid
|
||||
// Purpose : Verify whether selected cell is volume
|
||||
//=======================================================================
|
||||
bool SMESHGUI_VolumesFilter::IsValid( const int theCellId ) const
|
||||
{
|
||||
if ( myActor == 0 )
|
||||
return false;
|
||||
|
||||
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
|
||||
if ( anActor->GetObject() == 0 )
|
||||
return false;
|
||||
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
|
||||
|
||||
return anElem && anElem->GetType() == SMDSAbs_Volume;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_VolumesFilter::IsValid
|
||||
// Purpose : Verify whether selected cell is volume
|
||||
//=======================================================================
|
||||
bool SMESHGUI_VolumesFilter::IsObjValid( const int theObjId ) const
|
||||
{
|
||||
if ( myActor == 0 )
|
||||
return false;
|
||||
|
||||
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
|
||||
if ( anActor->GetObject() == 0 )
|
||||
return false;
|
||||
|
||||
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||
const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
|
||||
|
||||
return anElem && anElem->GetType() == SMDSAbs_Volume;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_VolumesFilter::GetId
|
||||
// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
|
||||
// enumeration. All filters must have different ids
|
||||
//=======================================================================
|
||||
int SMESHGUI_VolumesFilter::GetId() const
|
||||
{
|
||||
return SMESHGUI_VolumeFilter;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_VolumesFilter::IsNodeFilter
|
||||
// Purpose : Returns true if filter is intended for nodes
|
||||
//=======================================================================
|
||||
bool SMESHGUI_VolumesFilter::IsNodeFilter() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -141,4 +141,50 @@ public:
|
||||
DEFINE_STANDARD_RTTI(SMESHGUI_TriangleFilter)
|
||||
};
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_FacesFilter
|
||||
Description : Verify whether selected cell is any face
|
||||
*/
|
||||
|
||||
DEFINE_STANDARD_HANDLE(SMESHGUI_FacesFilter, SMESHGUI_Filter)
|
||||
|
||||
class SMESHGUI_FacesFilter : public SMESHGUI_Filter
|
||||
{
|
||||
|
||||
public:
|
||||
SMESHGUI_FacesFilter();
|
||||
virtual ~SMESHGUI_FacesFilter();
|
||||
|
||||
virtual bool IsValid( const int theCellId ) const;
|
||||
virtual bool IsObjValid( const int theObjId ) const;
|
||||
virtual int GetId() const;
|
||||
virtual bool IsNodeFilter() const;
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI(SMESHGUI_FacesFilter)
|
||||
};
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_VolumesFilter
|
||||
Description : Verify whether selected cell is any volume
|
||||
*/
|
||||
|
||||
DEFINE_STANDARD_HANDLE(SMESHGUI_VolumesFilter, SMESHGUI_Filter)
|
||||
|
||||
class SMESHGUI_VolumesFilter : public SMESHGUI_Filter
|
||||
{
|
||||
|
||||
public:
|
||||
SMESHGUI_VolumesFilter();
|
||||
virtual ~SMESHGUI_VolumesFilter();
|
||||
|
||||
virtual bool IsValid( const int theCellId ) const;
|
||||
virtual bool IsObjValid( const int theObjId ) const;
|
||||
virtual int GetId() const;
|
||||
virtual bool IsNodeFilter() const;
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI(SMESHGUI_VolumesFilter)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -372,6 +372,9 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
|
||||
if ( myBusy || !isEnabled() ) return;
|
||||
myBusy = true;
|
||||
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
myActor = 0;
|
||||
|
||||
int nbSel = mySelection->IObjectCount();
|
||||
myListBox->clearSelection();
|
||||
|
||||
@ -428,17 +431,14 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
|
||||
|
||||
if ( nbSel == 1 ) {
|
||||
myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
|
||||
if (!myActor)
|
||||
if ( !myActor && !myMesh->_is_nil() )
|
||||
myActor = SMESH::FindActorByObject( myMesh );
|
||||
VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
|
||||
Handle(VTKViewer_Filter) aFilter1 = aStyle->GetFilter( myFilterType );
|
||||
Handle(VTKViewer_Filter) aFilter2 = aStyle->GetFilter( SMESHGUI_FaceFilter );
|
||||
if ( !aFilter1.IsNull() )
|
||||
aFilter1->SetActor( myActor );
|
||||
if ( !aFilter2.IsNull() )
|
||||
aFilter2->SetActor( myActor );
|
||||
if ( myActor )
|
||||
SMESH::SetPickable(myActor);
|
||||
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter( myFilterType );
|
||||
if ( !aFilter.IsNull() && myActor ) {
|
||||
aFilter->SetActor( myActor );
|
||||
//SMESH::SetPickable( myActor );
|
||||
}
|
||||
}
|
||||
myBusy = false;
|
||||
|
||||
@ -535,18 +535,15 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted()
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_MultiEditDlg::onAddBtn
|
||||
// name : SMESHGUI_MultiEditDlg::isIdValid
|
||||
// Purpose : Verify whether Id of element satisfies to filters from viewer
|
||||
//=======================================================================
|
||||
bool SMESHGUI_MultiEditDlg::isIdValid( const int theId ) const
|
||||
{
|
||||
VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
|
||||
Handle(SMESHGUI_Filter) aFilter1 =
|
||||
Handle(SMESHGUI_Filter) aFilter =
|
||||
Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( myFilterType ) );
|
||||
Handle(SMESHGUI_Filter) aFilter2 =
|
||||
Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( SMESHGUI_FaceFilter ) );
|
||||
return ( aFilter1.IsNull() || aFilter1->IsObjValid( theId ) ) &&
|
||||
( aFilter2.IsNull() || aFilter2->IsObjValid( theId ) );
|
||||
return ( !aFilter.IsNull() && aFilter->IsObjValid( theId ) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -575,7 +572,7 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Value() );
|
||||
if ( !aSubMesh->_is_nil() )
|
||||
{
|
||||
if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
|
||||
if ( !myMesh->_is_nil() && aSubMesh->GetFather()->GetId() == myMesh->GetId() )
|
||||
{
|
||||
SMESH::long_array_var anIds = aSubMesh->GetElementsId();
|
||||
for ( int i = 0, n = anIds->length(); i < n; i++ )
|
||||
@ -594,9 +591,9 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
|
||||
{
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
|
||||
if ( !aGroup->_is_nil() && aGroup->GetType() == SMESH::FACE )
|
||||
if ( !aGroup->_is_nil() && ( aGroup->GetType() == SMESH::FACE || aGroup->GetType() == SMESH::VOLUME ) )
|
||||
{
|
||||
if ( aGroup->GetMesh()->GetId() == myMesh->GetId() )
|
||||
if ( !myMesh->_is_nil() && aGroup->GetMesh()->GetId() == myMesh->GetId() )
|
||||
{
|
||||
SMESH::long_array_var anIds = aGroup->GetListOfID();
|
||||
for ( int i = 0, n = anIds->length(); i < n; i++ )
|
||||
@ -854,18 +851,18 @@ void SMESHGUI_MultiEditDlg::setSelectionMode()
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
|
||||
mySelection->AddFilter( myGroupFilter );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( myFilterType == SMESHGUI_VolumeFilter ) {
|
||||
QAD_Application::getDesktop()->SetSelectionMode( VolumeSelection, true );
|
||||
}
|
||||
else {
|
||||
QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
|
||||
if ( myFilterType == SMESHGUI_TriaFilter )
|
||||
SMESH::SetFilter( new SMESHGUI_TriangleFilter() );
|
||||
else if ( myFilterType == SMESHGUI_QuadFilter )
|
||||
SMESH::SetFilter( new SMESHGUI_QuadrangleFilter() );
|
||||
}
|
||||
if ( myFilterType == SMESHGUI_VolumeFilter ) {
|
||||
QAD_Application::getDesktop()->SetSelectionMode( VolumeSelection, true );
|
||||
SMESH::SetFilter( new SMESHGUI_VolumesFilter() );
|
||||
}
|
||||
else {
|
||||
QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
|
||||
if ( myFilterType == SMESHGUI_TriaFilter )
|
||||
SMESH::SetFilter( new SMESHGUI_TriangleFilter() );
|
||||
else if ( myFilterType == SMESHGUI_QuadFilter )
|
||||
SMESH::SetFilter( new SMESHGUI_QuadrangleFilter() );
|
||||
else
|
||||
SMESH::SetFilter( new SMESHGUI_FacesFilter() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -884,6 +881,8 @@ bool SMESHGUI_MultiEditDlg::onApply()
|
||||
if ( aMeshEditor->_is_nil() )
|
||||
return false;
|
||||
|
||||
myBusy = true;
|
||||
|
||||
SMESH::long_array_var anIds = getIds();
|
||||
|
||||
bool aResult = process( aMeshEditor, anIds.inout() );
|
||||
@ -903,6 +902,7 @@ bool SMESHGUI_MultiEditDlg::onApply()
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
return aResult;
|
||||
}
|
||||
|
||||
@ -928,8 +928,7 @@ void SMESHGUI_MultiEditDlg::on3d2dChanged(int type)
|
||||
myFilterType = SMESHGUI_FaceFilter;
|
||||
setSelectionMode();
|
||||
|
||||
if ( myActor )
|
||||
mySelection->AddIObject( myActor->getIO(), true );
|
||||
myActor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user