Mesh edit dlg bug: algos are not filtered by shape at mesh edition

More bug: "Belong to geom" filter does not find nodes bound to SOLID
This commit is contained in:
eap 2014-11-07 18:07:13 +03:00
parent 131ded7390
commit d6b7cb735f
5 changed files with 44 additions and 28 deletions

View File

@ -4251,11 +4251,11 @@ void BelongToGeom::init()
myIsSubshape = IsSubShape(aMap, myShape); myIsSubshape = IsSubShape(aMap, myShape);
} }
if (!myIsSubshape) //if (!myIsSubshape) // to be always ready to check an element not bound to geometry
{ {
myElementsOnShapePtr.reset(new ElementsOnShape()); myElementsOnShapePtr.reset(new ElementsOnShape());
myElementsOnShapePtr->SetTolerance(myTolerance); myElementsOnShapePtr->SetTolerance(myTolerance);
myElementsOnShapePtr->SetAllNodes(true); // belong, while false means "lays on" myElementsOnShapePtr->SetAllNodes(true); // "belong", while false means "lays on"
myElementsOnShapePtr->SetMesh(myMeshDS); myElementsOnShapePtr->SetMesh(myMeshDS);
myElementsOnShapePtr->SetShape(myShape, myType); myElementsOnShapePtr->SetShape(myShape, myType);
} }
@ -4296,36 +4296,43 @@ bool BelongToGeom::IsSatisfy (long theId)
{ {
if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) ) if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
{ {
if ( aNode->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId);
const SMDS_PositionPtr& aPosition = aNode->GetPosition(); const SMDS_PositionPtr& aPosition = aNode->GetPosition();
SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition(); SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
switch( aTypeOfPosition ) switch( aTypeOfPosition )
{ {
case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX ); case SMDS_TOP_VERTEX : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX ));
case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE ); case SMDS_TOP_EDGE : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE ));
case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE ); case SMDS_TOP_FACE : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_FACE ));
case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL ); case SMDS_TOP_3DSPACE: return ( IsContains( myMeshDS,myShape,aNode,TopAbs_SOLID ) ||
IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL ));
} }
} }
} }
else else
{ {
if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) ) if ( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ))
{ {
if ( anElem->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId);
if( myType == SMDSAbs_All ) if( myType == SMDSAbs_All )
{ {
return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ) || return ( IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ) || IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )|| IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID ); IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL ));
} }
else if( myType == anElem->GetType() ) else if( myType == anElem->GetType() )
{ {
switch( myType ) switch( myType )
{ {
case SMDSAbs_Edge : return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ); case SMDSAbs_Edge : return ( IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ));
case SMDSAbs_Face : return IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ); case SMDSAbs_Face : return ( IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ));
case SMDSAbs_Volume: return IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )|| case SMDSAbs_Volume: return ( IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID ); IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL ));
} }
} }
} }

View File

@ -82,20 +82,25 @@ namespace SMESH
return GEOM::GEOM_Object::_nil(); return GEOM::GEOM_Object::_nil();
} }
GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO) GEOM::GEOM_Object_var GetGeom (_PTR(SObject) theSO)
{ {
GEOM::GEOM_Object_var aMeshShape;
if (!theSO) if (!theSO)
return GEOM::GEOM_Object::_nil(); return aMeshShape;
CORBA::Object_var obj = _CAST( SObject,theSO )->GetObject();
aMeshShape = GEOM::GEOM_Object::_narrow( obj );
if ( !aMeshShape->_is_nil() )
return aMeshShape;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (!aStudy) if (!aStudy)
return GEOM::GEOM_Object::_nil(); return aMeshShape;
_PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO)); _PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO));
for ( ; anIter->More(); anIter->Next()) { for ( ; anIter->More(); anIter->Next()) {
_PTR(SObject) aSObject = anIter->Value(); _PTR(SObject) aSObject = anIter->Value();
_PTR(SObject) aRefSOClient; _PTR(SObject) aRefSOClient;
GEOM::GEOM_Object_var aMeshShape;
if (aSObject->ReferencedObject(aRefSOClient)) { if (aSObject->ReferencedObject(aRefSOClient)) {
SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient); SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient);
@ -104,11 +109,10 @@ namespace SMESH
SALOMEDS_SObject* aSO = _CAST(SObject,aSObject); SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject()); aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject());
} }
if ( !aMeshShape->_is_nil() )
if (!aMeshShape->_is_nil()) return aMeshShape;
return aMeshShape._retn();
} }
return GEOM::GEOM_Object::_nil(); return aMeshShape;
} }
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO ) SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO )

View File

@ -47,7 +47,7 @@ namespace SMESH
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 ); SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 );
SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetGeom( _PTR(SObject) ); SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( _PTR(SObject) );
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO ); SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );

View File

@ -511,10 +511,14 @@ namespace SMESH
return SMESH::SMESH_Hypothesis::_nil(); return SMESH::SMESH_Hypothesis::_nil();
} }
bool IsApplicable(const QString& aHypType, bool IsApplicable(const QString& aHypType,
GEOM::GEOM_Object_ptr theGeomObject, GEOM::GEOM_Object_ptr theGeomObject,
const bool toCheckAll) const bool toCheckAll)
{ {
if ( getenv("NO_LIMIT_ALGO_BY_SHAPE")) // allow a workaround for a case if
return true; // IsApplicable() returns false due to a bug
HypothesisData* aHypData = GetHypothesisData(aHypType); HypothesisData* aHypData = GetHypothesisData(aHypType);
QString aServLib = aHypData->ServerLibName; QString aServLib = aHypData->ServerLibName;
return SMESHGUI::GetSMESHGen()->IsApplicable( aHypType.toLatin1().data(), return SMESHGUI::GetSMESHGen()->IsApplicable( aHypType.toLatin1().data(),

View File

@ -247,8 +247,9 @@ void SMESHGUI_MeshOp::startOperation()
myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh ); myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh );
} }
else else
{
myDlg->activateObject( SMESHGUI_MeshDlg::Obj ); myDlg->activateObject( SMESHGUI_MeshDlg::Obj );
}
myDlg->setCurrentTab( SMESH::DIM_3D ); myDlg->setCurrentTab( SMESH::DIM_3D );
QStringList TypeMeshList; QStringList TypeMeshList;
@ -2614,11 +2615,11 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI
bool toCheckIsApplicableToAll = !myIsMesh; bool toCheckIsApplicableToAll = !myIsMesh;
GEOM::GEOM_Object_var aGeomVar; GEOM::GEOM_Object_var aGeomVar;
QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); QString anEntry =
myDlg->selectedObject( myToCreate ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Obj );
if ( _PTR(SObject) so = studyDS()->FindObjectID( anEntry.toLatin1().data() )) if ( _PTR(SObject) so = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
{ {
CORBA::Object_var obj = _CAST( SObject,so )->GetObject(); aGeomVar = SMESH::GetGeom( so );
aGeomVar = GEOM::GEOM_Object::_narrow( obj );
if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll ) if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll )
toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP ); toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP );
} }