X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshOp.cxx;h=a52234cd06dfed3885337a10c9b48b1038ace9de;hp=ed9e8d63c57f7e81e6ccad65349251c2d78494c5;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=6472eab132825fec572beda8276947593f85ffa1 diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index ed9e8d63c..a52234cd0 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -43,6 +43,7 @@ // SALOME GEOM includes #include #include +#include #include #include #include @@ -321,7 +322,7 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const //================================================================================ /*! * \brief check if selected shape is a sub-shape of the shape to mesh - * \retval bool - check result + * \retval bool - check result */ //================================================================================ bool SMESHGUI_MeshOp::isSubshapeOk() const @@ -345,61 +346,17 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const QStringList aGEOMs; myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); - if (aGEOMs.count() > 0) { - GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); - if (geomGen->_is_nil()) return false; - - GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations(); - if (op->_is_nil()) return false; - - // check all selected shapes - QStringList::const_iterator aSubShapesIter = aGEOMs.begin(); - for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) { - QString aSubGeomEntry = (*aSubShapesIter); - _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toUtf8().data()); - if (!pSubGeom) return false; - - GEOM::GEOM_Object_var aSubGeomVar = - GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); - if (aSubGeomVar->_is_nil()) return false; - - // skl for NPAL14695 - implementation of searching of mainObj - GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as - mainObj already exists! */ - while( !mainObj->_is_nil()) { - CORBA::String_var entry1 = mainObj->GetEntry(); - CORBA::String_var entry2 = mainGeom->GetEntry(); - if (std::string( entry1.in() ) == entry2.in() ) - return true; - mainObj = op->GetMainShape(mainObj); - } - if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND ) - { - // is aSubGeomVar a compound of sub-shapes? - GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations(); - if (sop->_is_nil()) return false; - GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar, - GEOM::SHAPE,/*sorted=*/false); - if ( ids->length() > 0 ) - { - ids->length( 1 ); - GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids ); - if ( !compSub->_is_nil() ) - { - GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom, - compSub, - compSub->GetShapeType() ); - geomGen->RemoveObject( compSub ); - compSub->UnRegister(); - if ( shared->length() > 0 ) { - geomGen->RemoveObject( shared[0] ); - shared[0]->UnRegister(); - } - return ( shared->length() > 0 ); - } - } - } - } + // check all selected shapes + for ( QString& aSubGeomEntry : aGEOMs ) + { + _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID( aSubGeomEntry.toUtf8().data() ); + if ( !pSubGeom ) return false; + + GEOM::GEOM_Object_var subGeom = + GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); + + if ( SMESH::ContainsSubShape( mainGeom, subGeom, false )) + return true; } return false; @@ -882,7 +839,7 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, THypDataList& theDataList, HypothesisData* thePrevAlgoData, HypothesisData* theNextAlgoData, - const QString& theMeshType) + const QString& /*theMeshType*/) { theDataList.clear(); theHyps.clear(); @@ -1434,7 +1391,7 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex ) * 1 = accepted */ //================================================================================ -void SMESHGUI_MeshOp::onHypoEdited( int result ) +void SMESHGUI_MeshOp::onHypoEdited( int /*result*/ ) { int obj = myDlg->getActiveObject(); onActivateObject( obj ); // Issue 0020170. Restore filters @@ -1913,6 +1870,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) if ( aHypoSet->toUseCommonSize() && !getAverageSize( myAverageSize )) return; + int maxDim = -1; for ( int isAlgo = 1; isAlgo >= 0; --isAlgo ) for ( aHypoSet->init( isAlgo, setType ); aHypoSet->more(); aHypoSet->next() ) { @@ -1930,6 +1888,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) { setCurrentHyp( myDim, Algo, index ); onAlgoSelected( index, myDim ); + maxDim = Max( maxDim, myDim ); } } else @@ -1963,6 +1922,9 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) } } + if ( maxDim > 0 ) + myDlg->setCurrentTab( maxDim ); + return; } @@ -2140,7 +2102,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList // create a GEOM group GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); if ( !geomGen->_is_nil() ) { - GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations(); + GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); if ( !op->_is_nil() ) { // check and add all selected GEOM objects: they must be @@ -2970,7 +2932,7 @@ void SMESHGUI_MeshOp::updateHypoSets() * \param theIndex - Index of current type of mesh */ //================================================================================ -void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex ) +void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int /*theTabIndex*/, const int /*theIndex*/ ) { setFilteredAlgoData(); }