mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 17:50:34 +05:00
Fix crash after 'Belong to' filter creation if there are no mesh in the study
This commit is contained in:
parent
694e1d2360
commit
8ad9cef463
@ -805,8 +805,8 @@ SalomeApp_Module( "SMESH" )
|
|||||||
myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
|
myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
|
||||||
}
|
}
|
||||||
|
|
||||||
myActiveDialogBox = 0 ;
|
myActiveDialogBox = 0;
|
||||||
myState = -1 ;
|
myState = -1;
|
||||||
myDisplayer = 0;
|
myDisplayer = 0;
|
||||||
|
|
||||||
SMESH::GetFilterManager();
|
SMESH::GetFilterManager();
|
||||||
@ -1059,6 +1059,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
if( !mgr )
|
if( !mgr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
|
||||||
|
GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
|
||||||
|
}
|
||||||
|
|
||||||
SUIT_ViewWindow* view = application()->desktop()->activeWindow();
|
SUIT_ViewWindow* view = application()->desktop()->activeWindow();
|
||||||
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
|
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
|
||||||
|
|
||||||
@ -2754,8 +2758,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type());
|
QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type());
|
||||||
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
|
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
|
||||||
|
|
||||||
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " + aType + " and " + aSelCount +
|
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
|
||||||
" and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
|
aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
|
||||||
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
|
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
|
||||||
popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true);
|
popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true);
|
||||||
|
|
||||||
|
@ -276,10 +276,10 @@ GetMeshDS() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS,
|
bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const SMDS_MeshElement* theElem,
|
const SMDS_MeshElement* theElem,
|
||||||
TopAbs_ShapeEnum theFindShapeEnum,
|
TopAbs_ShapeEnum theFindShapeEnum,
|
||||||
TopAbs_ShapeEnum theAvoidShapeEnum )
|
TopAbs_ShapeEnum theAvoidShapeEnum )
|
||||||
{
|
{
|
||||||
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
|
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
|
||||||
return true;
|
return true;
|
||||||
@ -288,27 +288,27 @@ bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS,
|
|||||||
TopExp::MapShapes( theShape, aSubShapes );
|
TopExp::MapShapes( theShape, aSubShapes );
|
||||||
|
|
||||||
for (int i = 1; i <= aSubShapes.Extent(); i++)
|
for (int i = 1; i <= aSubShapes.Extent(); i++)
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
|
const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
|
||||||
|
|
||||||
if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
|
if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
|
||||||
if( aSubMesh->Contains( theElem ) )
|
if( aSubMesh->Contains( theElem ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
|
SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
|
||||||
while ( aNodeIt->more() )
|
while ( aNodeIt->more() )
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
|
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
|
||||||
SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
|
||||||
while ( anElemIt->more() )
|
while ( anElemIt->more() )
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
|
const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
|
||||||
if (anElement == theElem)
|
if (anElement == theElem)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ static TopoDS_Shape getShapeByName( const char* theName )
|
|||||||
{
|
{
|
||||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||||
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
|
SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
|
||||||
if ( aStudy != 0 )
|
if (!CORBA::is_nil(aStudy))
|
||||||
{
|
{
|
||||||
SALOMEDS::Study::ListOfSObject_var aList =
|
SALOMEDS::Study::ListOfSObject_var aList =
|
||||||
aStudy->FindObjectByName( theName, "GEOM" );
|
aStudy->FindObjectByName( theName, "GEOM" );
|
||||||
@ -385,7 +385,7 @@ static TopoDS_Shape getShapeByName( const char* theName )
|
|||||||
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
|
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
|
||||||
if ( !aGeomObj->_is_nil() )
|
if ( !aGeomObj->_is_nil() )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
|
GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
|
||||||
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj );
|
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj );
|
||||||
return aLocShape;
|
return aLocShape;
|
||||||
}
|
}
|
||||||
@ -614,7 +614,6 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
|
|||||||
aValue.myLength = aVal.myLength;
|
aValue.myLength = aVal.myLength;
|
||||||
aValue.myPnt1 = aVal.myPntId[ 0 ];
|
aValue.myPnt1 = aVal.myPntId[ 0 ];
|
||||||
aValue.myPnt2 = aVal.myPntId[ 1 ];
|
aValue.myPnt2 = aVal.myPntId[ 1 ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INFOS("Length2D_i::GetValuess~");
|
INFOS("Length2D_i::GetValuess~");
|
||||||
@ -670,7 +669,6 @@ SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
|
|||||||
aValue.myPnt1 = aVal.myPntId[ 0 ];
|
aValue.myPnt1 = aVal.myPntId[ 0 ];
|
||||||
aValue.myPnt2 = aVal.myPntId[ 1 ];
|
aValue.myPnt2 = aVal.myPntId[ 1 ];
|
||||||
aValue.myNbConnects = (*anIter).second;
|
aValue.myNbConnects = (*anIter).second;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INFOS("Multiconnection2D_i::GetValuess~");
|
INFOS("Multiconnection2D_i::GetValuess~");
|
||||||
@ -1645,8 +1643,8 @@ GetIDs()
|
|||||||
void
|
void
|
||||||
Filter_i::
|
Filter_i::
|
||||||
GetElementsId( Predicate_i* thePredicate,
|
GetElementsId( Predicate_i* thePredicate,
|
||||||
const SMDS_Mesh* theMesh,
|
const SMDS_Mesh* theMesh,
|
||||||
Controls::Filter::TIdSequence& theSequence )
|
Controls::Filter::TIdSequence& theSequence )
|
||||||
{
|
{
|
||||||
Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
|
Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
|
||||||
}
|
}
|
||||||
@ -1654,8 +1652,8 @@ GetElementsId( Predicate_i* thePredicate,
|
|||||||
void
|
void
|
||||||
Filter_i::
|
Filter_i::
|
||||||
GetElementsId( Predicate_i* thePredicate,
|
GetElementsId( Predicate_i* thePredicate,
|
||||||
SMESH_Mesh_ptr theMesh,
|
SMESH_Mesh_ptr theMesh,
|
||||||
Controls::Filter::TIdSequence& theSequence )
|
Controls::Filter::TIdSequence& theSequence )
|
||||||
{
|
{
|
||||||
if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
|
if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
|
||||||
Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
|
Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
|
||||||
@ -1881,8 +1879,8 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
|
|||||||
aFunctor = aFilterMgr->CreateMultiConnection();
|
aFunctor = aFilterMgr->CreateMultiConnection();
|
||||||
break;
|
break;
|
||||||
case SMESH::FT_MultiConnection2D:
|
case SMESH::FT_MultiConnection2D:
|
||||||
aFunctor = aFilterMgr->CreateMultiConnection2D();
|
aFunctor = aFilterMgr->CreateMultiConnection2D();
|
||||||
break;
|
break;
|
||||||
case SMESH::FT_Length:
|
case SMESH::FT_Length:
|
||||||
aFunctor = aFilterMgr->CreateLength();
|
aFunctor = aFilterMgr->CreateLength();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user