X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshOp.cxx;h=10366f210c28e569e26ad3d491c402323a552968;hb=85b2ed944eec74a8d3ae2ea7c35b961ae9eabc88;hp=e232e408f20d6a09593c8c86e26d556523eb942a;hpb=5dcb2f2b467e63a0e5d37e234b2ba8f8e624f987;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index e232e408f..10366f210 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-2020 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 @@ -294,8 +294,8 @@ void SMESHGUI_MeshOp::commitOperation() //================================================================================ /*! * \brief Creates selection filter - * \param theId - identifier of current selection widget - * \retval SUIT_SelectionFilter* - pointer to the created filter or null + * \param theId - identifier of current selection widget + * \retval SUIT_SelectionFilter* - pointer to the created filter or null * * Creates selection filter in accordance with identifier of current selection widget */ @@ -346,7 +346,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); if (aGEOMs.count() > 0) { - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); if (geomGen->_is_nil()) return false; GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); @@ -780,7 +780,7 @@ bool SMESHGUI_MeshOp::isCompatibleToGeometry(HypothesisData* theAlgoData, bool isApplicable = false; if ( myGeomEntry == myLastGeomEntry && !myGeomEntry.isEmpty() ) { - THypLabelIsAppMap::const_iterator lab2isApp = myHypMapIsApplicable.find( theAlgoData->Label ); + THypLabelIsAppMap::const_iterator lab2isApp = myHypMapIsApplicable.find( theAlgoData->TypeName ); if ( lab2isApp != myHypMapIsApplicable.end() ) { isApplicable = lab2isApp.value(); return isApplicable; @@ -791,7 +791,7 @@ bool SMESHGUI_MeshOp::isCompatibleToGeometry(HypothesisData* theAlgoData, toCheckIsApplicableToAll = ( myGeom->GetType() == GEOM_GROUP ); isApplicable = SMESH::IsApplicable( theAlgoData->TypeName, myGeom, toCheckIsApplicableToAll ); - myHypMapIsApplicable.insert( theAlgoData->Label, isApplicable ); + myHypMapIsApplicable.insert( theAlgoData->TypeName, isApplicable ); return isApplicable; } @@ -882,7 +882,7 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim, THypDataList& theDataList, HypothesisData* thePrevAlgoData, HypothesisData* theNextAlgoData, - const QString& theMeshType) + const QString& /*theMeshType*/) { theDataList.clear(); theHyps.clear(); @@ -1103,12 +1103,18 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, initParams.way = isSubMesh ? BY_MESH : BY_GEOM; } - SMESH::SMESH_Hypothesis_var hyp = - SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(), - aServerLib.toUtf8().data(), - aMesh, - aGeomVar, - initParams ); + SMESH::SMESH_Hypothesis_var hyp; + if ( initParams.way == BY_AVERAGE_LENGTH ) + hyp = SMESHGUI::GetSMESHGen()->CreateHypothesisByAverageLength( aHypType.toUtf8().data(), + aServerLib.toUtf8().data(), + initParams.averageLength, + initParams.quadDominated ); + else + hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(), + aServerLib.toUtf8().data(), + aMesh, + aGeomVar, + initParams ); if ( hyp->_is_nil() && initParams.way == BY_MESH ) { initParams.way = BY_GEOM; @@ -1428,7 +1434,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 @@ -1750,7 +1756,7 @@ void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMes for ( size_t i = 0; i < internalEdges.size(); ++i ) intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ])); - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + GEOM::GEOM_Gen_var geomGen = theMainShape->GetGen(); if (geomGen->_is_nil()) return; GEOM::GEOM_Object_var edgeGroup; @@ -1898,7 +1904,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) HypothesesSet::SetType setType = aHypoSet->getPreferredHypType(); if ( !aHypoSet->getAlgoAvailable( setType )) { - setType = setType == HypothesesSet::ALT ? HypothesesSet::MAIN : HypothesesSet::ALT; + setType = ( setType == HypothesesSet::ALT ) ? HypothesesSet::MAIN : HypothesesSet::ALT; if ( !aHypoSet->getAlgoAvailable( setType )) return; } @@ -1907,6 +1913,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() ) { @@ -1924,6 +1931,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) { setCurrentHyp( myDim, Algo, index ); onAlgoSelected( index, myDim ); + maxDim = Max( maxDim, myDim ); } } else @@ -1957,6 +1965,9 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) } } + if ( maxDim > 0 ) + myDlg->setCurrentTab( maxDim ); + return; } @@ -2056,21 +2067,23 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList ) { // Create groups on all geom groups - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + GEOM::GEOM_Gen_var geomGen = aGeomVar->GetGen(); GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations(); GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar, - /*groupsOnly=*/true ); + /*groupsOnly=*/false ); SMESH::SMESH_GroupOnGeom_var meshGroup; for ( CORBA::ULong iG = 0; iG < geomGroups->length(); ++iG ) { SMESH::ElementType elemType = SMESHGUI_GroupOnShapeOp::ElementType( geomGroups[ iG ] ); if ( elemType == SMESH::ALL ) continue; + if ( elemType == SMESH::ELEM0D ) + elemType = SMESH::NODE; CORBA::String_var name = geomGroups[ iG ]->GetName(); meshGroup = aMesh->CreateGroupFromGEOM( elemType, name, geomGroups[ iG ]); - if ( elemType != SMESH::NODE ) - meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]); + // if ( elemType != SMESH::NODE ) + // meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]); } } @@ -2130,11 +2143,11 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList else if (aGEOMs.count() > 1) { // create a GEOM group - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - if (!geomGen->_is_nil()) { - GEOM::GEOM_IGroupOperations_wrap op = - geomGen->GetIGroupOperations(); - if (!op->_is_nil()) { + GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); + if ( !geomGen->_is_nil() ) { + GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); + if ( !op->_is_nil() ) + { // check and add all selected GEOM objects: they must be // a sub-shapes of the main GEOM and must be of one type int iSubSh = 0; @@ -2938,9 +2951,19 @@ void SMESHGUI_MeshOp::updateHypoSets() } currentHypoSet->setAlgoAvailable( sType, isAvailable ); } + if ( currentHypoSet->hasAlgo( HypothesesSet::MAIN ) && + currentHypoSet->hasAlgo( HypothesesSet::ALT )) + { + HypothesesSet::SetType setType = HypothesesSet::getPreferredHypType(); + if ( !currentHypoSet->getAlgoAvailable( setType )) + continue; // not add if a preferred type not available currently + } + if ( currentHypoSet->getAlgoAvailable( HypothesesSet::MAIN ) || currentHypoSet->getAlgoAvailable( HypothesesSet::ALT )) + { aFilteredHypothesesSetsList.append( *inHypoSetName ); + } } myDlg->setHypoSets( aFilteredHypothesesSetsList ); } @@ -2952,7 +2975,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(); }