X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshOp.cxx;h=ff98510088ead389874ccd87465f2a6b73ff0816;hb=bf4083bfeee4e1ae00e16e8643d501cb8ff9142c;hp=bed7c25fda6dc159638fb18e57d4e00ba54d7c87;hpb=2742029b9094540c12b9e30bbdb958087e0cb850;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index bed7c25fd..ff9851008 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -26,15 +26,15 @@ #include "SMESHGUI_MeshOp.h" #include "SMESHGUI.h" +#include "SMESHGUI_GEOMGenUtils.h" +#include "SMESHGUI_Hypotheses.h" +#include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_MeshDlg.h" +#include "SMESHGUI_Operations.h" #include "SMESHGUI_ShapeByMeshDlg.h" -#include "SMESHGUI_HypothesesUtils.h" -#include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_Utils.h" -#include "SMESHGUI_GEOMGenUtils.h" - -#include -#include +#include "SMESH_NumberFilter.hxx" +#include "SMESH_TypeFilter.hxx" // SALOME GEOM includes #include @@ -247,8 +247,9 @@ void SMESHGUI_MeshOp::startOperation() myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh ); } else + { myDlg->activateObject( SMESHGUI_MeshDlg::Obj ); - + } myDlg->setCurrentTab( SMESH::DIM_3D ); QStringList TypeMeshList; @@ -387,8 +388,11 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const compSub, compSub->GetShapeType() ); geomGen->RemoveObject( compSub ); - if ( shared->length() > 0 ) + compSub->UnRegister(); + if ( shared->length() > 0 ) { geomGen->RemoveObject( shared[0] ); + shared[0]->UnRegister(); + } return ( shared->length() > 0 ); } } @@ -401,8 +405,8 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const //================================================================================ /*! - * \brief Return name of the algorithm that does not support submeshes and makes - * submesh creation useless + * \brief Return name of the algorithm that does not support sub-meshes and makes + * sub-mesh creation useless * \retval char* - string is to be deleted!!! */ //================================================================================ @@ -547,9 +551,17 @@ void SMESHGUI_MeshOp::selectionDone() for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) { QString aSubGeomEntry = (*aSubShapesIter); _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data()); - GEOM::GEOM_Object_var aSubGeomVar = - GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); - aSeq[iSubSh] = aSubGeomVar; + + if( pSubGeom ) { + SALOMEDS_SObject* sobj = _CAST(SObject,pSubGeom); + if( sobj ) { + GEOM::GEOM_Object_var aSubGeomVar = + GEOM::GEOM_Object::_narrow(sobj->GetObject()); + if( !aSubGeomVar->_is_nil() ){ + aSeq[iSubSh] = aSubGeomVar; + } + } + } } } else { // get geometry by selected sub-mesh @@ -654,7 +666,7 @@ void SMESHGUI_MeshOp::selectionDone() { selectionMgr()->clearFilters(); selectObject( pSubmesh ); - SMESHGUI::GetSMESHGUI()->switchToOperation(704); + SMESHGUI::GetSMESHGUI()->switchToOperation( SMESHOp::OpEditMeshOrSubMesh ); return; } else @@ -1484,14 +1496,24 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, if ( anAvailable.count() == 1 ) soleCompatible = myAvailableHypData[dim][Algo][0]; if ( dim == aTopDim && prevAlgo ) {// all available algoritms should be selectable any way - if (myDlg->currentMeshType() == MT_ANY) + if (aTopDim == SMESH::DIM_2D) { + anAvailable.clear(); + for (int i = 0; i < myFilteredAlgoData[dim].count(); ++i) { + HypothesisData* aCurAlgo = myFilteredAlgoData[dim][ i ]; + anAvailable.append( aCurAlgo->Label ); + } + } + if (aTopDim == SMESH::DIM_3D) availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], 0 ); } myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable ); noCompatible = anAvailable.isEmpty(); // restore previously selected algo - algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo ); + if (dim == aTopDim && prevAlgo && aTopDim == SMESH::DIM_2D) + algoIndex = myFilteredAlgoData[dim].indexOf( curAlgo ); + else + algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo ); if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) // select the sole compatible algo algoIndex = myAvailableHypData[dim][Algo].indexOf( soleCompatible ); @@ -2404,7 +2426,7 @@ bool SMESHGUI_MeshOp::checkSubMeshConcurrency(SMESH::SMESH_Mesh_ptr mesh, myDlg->setEnabled( false ); // disactivate selection selectionMgr()->clearFilters(); selectObject( meshSO ); - SMESHGUI::GetSMESHGUI()->OnGUIEvent( 713 ); // MESH_ORDER + SMESHGUI::GetSMESHGUI()->OnGUIEvent( SMESHOp::OpMeshOrder ); // MESH_ORDER qApp->processEvents(); myDlg->setEnabled( true ); @@ -2611,11 +2633,11 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI bool toCheckIsApplicableToAll = !myIsMesh; 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() )) { - CORBA::Object_var obj = _CAST( SObject,so )->GetObject(); - aGeomVar = GEOM::GEOM_Object::_narrow( obj ); + aGeomVar = SMESH::GetGeom( so ); if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll ) toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP ); } @@ -2634,6 +2656,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) ); } myAvailableHypData[dim][Algo].clear(); + myFilteredAlgoData[dim].clear(); anAvailableAlgs.clear(); if ( dim != SMESH::DIM_2D || currentHyp( SMESH::DIM_3D, Algo ) < 0 || myAvailableHypData[SMESH::DIM_3D][Algo].empty() || @@ -2647,6 +2670,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI { anAvailableAlgs.append( curAlgo->Label ); myAvailableHypData[dim][Algo].append( curAlgo ); + myFilteredAlgoData[dim].append( curAlgo ); } } if ( !isNone && algoCur ) {