X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshOp.cxx;h=8b50b3c2f351ceaaab3f155486d8ce3f205aa8bb;hp=c8d85ecb012040b32703ab0401269be93ac88e26;hb=415771a7d506997008edf6e99d0143ce5bb3a9a2;hpb=e28cd63140ca9482eb73918a1d37aebf2c55996e diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index c8d85ecb0..8b50b3c2f 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -44,6 +44,8 @@ #include "SMESH_TypeFilter.hxx" #include "SMESH_NumberFilter.hxx" +#include CORBA_CLIENT_HEADER(SMESH_Gen) + #include "GEOM_SelectionFilter.h" #include "GEOMBase.h" #include "GeometryGUI.h" @@ -72,18 +74,6 @@ #include #include -enum { GLOBAL_ALGO_TAG =3, - GLOBAL_HYPO_TAG =2, - LOCAL_ALGO_TAG =2, - LOCAL_HYPO_TAG =1, - SUBMESH_ON_VERTEX_TAG =4, - SUBMESH_ON_EDGE_TAG =5, - SUBMESH_ON_WIRE_TAG =6, - SUBMESH_ON_FACE_TAG =7, - SUBMESH_ON_SHELL_TAG =8, - SUBMESH_ON_SOLID_TAG =9, - SUBMESH_ON_COMPOUND_TAG=10 }; - //================================================================================ /*! * \brief Constructor @@ -138,7 +128,7 @@ LightApp_Dialog* SMESHGUI_MeshOp::dlg() const //================================================================================ bool SMESHGUI_MeshOp::onApply() { - if( isStudyLocked() ) + if (isStudyLocked()) return false; QString aMess; @@ -200,7 +190,7 @@ bool SMESHGUI_MeshOp::onApply() //================================================================================ void SMESHGUI_MeshOp::startOperation() { - if( !myDlg ) + if (!myDlg) { myDlg = new SMESHGUI_MeshDlg( myToCreate, myIsMesh ); for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) @@ -216,9 +206,9 @@ void SMESHGUI_MeshOp::startOperation() connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool ))); if ( myToCreate ) - if ( myIsMesh ) myHelpFileName = "/files/constructing_meshes.htm"; - else myHelpFileName = "/files/constructing_submeshes.htm"; - else myHelpFileName = "files/reassigning_hypotheses_and_algorithms.htm"; + if ( myIsMesh ) myHelpFileName = "constructing_meshes_page.html"; + else myHelpFileName = "constructing_submeshes_page.html"; + else myHelpFileName = "editing_meshes_page.html"; } SMESHGUI_SelectionOp::startOperation(); @@ -337,11 +327,11 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const //if (mainObj->_is_nil() || // string(mainObj->GetEntry()) != string(mainGeom->GetEntry())) return false; while(1) { - if(mainObj->_is_nil()) - return false; - if( string(mainObj->GetEntry()) == string(mainGeom->GetEntry()) ) - return true; - mainObj = op->GetMainShape(mainObj); + if (mainObj->_is_nil()) + return false; + if (string(mainObj->GetEntry()) == string(mainGeom->GetEntry())) + return true; + mainObj = op->GetMainShape(mainObj); } } //return true; @@ -368,13 +358,13 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const if ( !geom->_is_nil() ) { int tag = -1; switch ( geom->GetShapeType() ) { - case GEOM::VERTEX: tag = SUBMESH_ON_VERTEX_TAG ; break; - case GEOM::EDGE: tag = SUBMESH_ON_EDGE_TAG ; break; - case GEOM::WIRE: tag = SUBMESH_ON_WIRE_TAG ; break; - case GEOM::FACE: tag = SUBMESH_ON_FACE_TAG ; break; - case GEOM::SHELL: tag = SUBMESH_ON_SHELL_TAG ; break; - case GEOM::SOLID: tag = SUBMESH_ON_SOLID_TAG ; break; - case GEOM::COMPOUND: tag = SUBMESH_ON_COMPOUND_TAG; break; + case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex ; break; + case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge ; break; + case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire ; break; + case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace ; break; + case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell ; break; + case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid ; break; + case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break; default:; } _PTR(GenericAttribute) anAttr; @@ -411,36 +401,34 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const //================================================================================ void SMESHGUI_MeshOp::selectionDone() { - if ( !dlg()->isShown() || !myDlg->isEnabled() ) + if (!dlg()->isShown() || !myDlg->isEnabled()) return; - + SMESHGUI_SelectionOp::selectionDone(); - + try { + myIsOnGeometry = true; + //Check geometry for mesh - QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); - _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() ); - if ( !pObj ) - return; - - SMESH::SMESH_subMesh_var aSubMeshVar = - SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() ); - if ( !aSubMeshVar->_is_nil() ) - myIsOnGeometry = true; - else { + QString anObjEntry = myDlg->selectedObject(SMESHGUI_MeshDlg::Obj); + _PTR(SObject) pObj = studyDS()->FindObjectID(anObjEntry.latin1()); + if (pObj) + { SMESH::SMESH_Mesh_var aMeshVar = - SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pObj )->GetObject() ); - if ( !myToCreate && !aMeshVar->HasShapeToMesh() ) - myIsOnGeometry = false; - else - myIsOnGeometry = true; + SMESH::SMESH_Mesh::_narrow(_CAST(SObject,pObj)->GetObject()); + if (!aMeshVar->_is_nil()) { + if (!myToCreate && !aMeshVar->HasShapeToMesh()) + myIsOnGeometry = false; + } } - - if ( myIsOnGeometry ) { + + if (myIsOnGeometry) + { // Enable tabs according to shape dimension - + int shapeDim = 3; + QStringList aGEOMs; myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; @@ -497,14 +485,11 @@ void SMESHGUI_MeshOp::selectionDone() } myDlg->setMaxHypoDim( shapeDim ); - - if ( !myToCreate ) // edition: read hypotheses + + if (!myToCreate) // edition: read hypotheses { - QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); - _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() ); - if ( pObj != 0 ) + if (pObj != 0) { - SMESH::SMESH_subMesh_var aVar = SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() ); myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() ); @@ -517,7 +502,6 @@ void SMESHGUI_MeshOp::selectionDone() } else myDlg->reset(); - } else if ( !myIsMesh ) // submesh creation { @@ -544,7 +528,7 @@ void SMESHGUI_MeshOp::selectionDone() selectionDone(); } } - + // enable/disable popup for choice of geom selection way bool enable = false; QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); @@ -561,10 +545,10 @@ void SMESHGUI_MeshOp::selectionDone() QStringList hypList; availableHyps( SMESH::DIM_3D, Algo, hypList, myAvailableHypData[SMESH::DIM_3D][Algo]); - + SMESHGUI_MeshTab* aTab = myDlg->tab( SMESH::DIM_3D ); aTab->setAvailableHyps( Algo, hypList ); - for( int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i ) { + for (int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i) { myDlg->disableTab(i); } //Hide labels and fields (Mesh ang Geometry) @@ -766,9 +750,9 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim, bool isMesh = !_CAST( SComponent, theFather ); int aPart = -1; if ( isMesh ) - aPart = theHypType == Algo ? GLOBAL_ALGO_TAG : GLOBAL_HYPO_TAG; + aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis; else - aPart = theHypType == Algo ? LOCAL_ALGO_TAG : LOCAL_HYPO_TAG; + aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot; if ( theFather->FindSubObject( aPart, aHypRoot ) ) { @@ -800,7 +784,7 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim, ( isCompatible ( theAlgoData, aData, theHypType )) && ( isAux == aData->IsAux )) { - std::string aHypName = aName->Value(); + std::string aHypName = aName->Value(); theHyps.append( aHypName.c_str() ); theHypList.append( THypItem( aHypVar, aHypName.c_str() ) ); } @@ -927,8 +911,8 @@ void SMESHGUI_MeshOp::onCreateHyp( const int theHypType, const int theIndex ) namespace { QString GetUniqueName (const QStringList& theHypNames, - const QString& theName, - size_t theIteration = 1) + const QString& theName, + size_t theIteration = 1) { QString aName = theName + "_" + QString::number( theIteration ); if ( theHypNames.contains( aName ) ) @@ -951,18 +935,18 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim, QStringList aHypNames; TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin(); - for( ; aDimIter != myExistingHyps.end(); aDimIter++ ) { + for (; aDimIter != myExistingHyps.end(); aDimIter++) { const TType2HypList& aType2HypList = aDimIter.data(); TType2HypList::const_iterator aTypeIter = aType2HypList.begin(); - for( ; aTypeIter != aType2HypList.end(); aTypeIter++ ) { + for (; aTypeIter != aType2HypList.end(); aTypeIter++) { const THypList& aHypList = aTypeIter.data(); THypList::const_iterator anIter = aHypList.begin(); - for( ; anIter != aHypList.end(); anIter++ ) { - const THypItem& aHypItem = *anIter; - const QString& aHypName = aHypItem.second; - aHypNames.append(aHypName); - } - } + for (; anIter != aHypList.end(); anIter++) { + const THypItem& aHypItem = *anIter; + const QString& aHypName = aHypItem.second; + aHypNames.append(aHypName); + } + } } QString aHypName = GetUniqueName( aHypNames, aData->Label); @@ -1106,7 +1090,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, } HypothesisData* prevAlgo = algoData; bool noCompatible = false; - for ( ; dim * dir <= lastDim * dir ; dim += dir ) + for (; dim * dir <= lastDim * dir; dim += dir) { if ( !isAccessibleDim( dim )) continue; @@ -1174,11 +1158,11 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, myObjHyps[ dim ][ type ].count() > 0 && curHypType == myObjHyps[ dim ][ type ].first().first->GetName()) { - CORBA::String_var aName = curHyp->GetName(); + CORBA::String_var aName = curHyp->GetName(); HypothesisData* hypData = SMESH::GetHypothesisData( aName ); - for ( int i = 0 ; i < myAvailableHypData[ dim ][ Algo ].count(); ++i ) { + for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) { curAlgo = myAvailableHypData[ dim ][ Algo ][ i ]; - if ( curAlgo && hypData && isCompatible( curAlgo, hypData, type )) + if (curAlgo && hypData && isCompatible(curAlgo, hypData, type)) break; else curAlgo = 0; @@ -1190,7 +1174,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, { // check if a selected hyp is compatible with the curAlgo if ( !curHyp->_is_nil() ) { - CORBA::String_var aName = curHyp->GetName(); + CORBA::String_var aName = curHyp->GetName(); HypothesisData* hypData = SMESH::GetHypothesisData( aName ); if ( !isCompatible( curAlgo, hypData, type )) curHyp = SMESH::SMESH_Hypothesis::_nil(); @@ -1248,7 +1232,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) const QString& aHypoTypeName = (*aHypoList)[ i ]; HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName); if (!aHypData) - continue; + continue; int aDim = aHypData->Dim[0]; // create or/and set @@ -1299,8 +1283,8 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess ) QStringList aList; myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList ); QStringList::Iterator it = aList.begin(); - for(; it!=aList.end(); it++) { - + for (; it!=aList.end(); it++) + { QString aGeomEntry = *it; _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); GEOM::GEOM_Object_var aGeomVar = @@ -1571,7 +1555,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim ) // look for anexisting algo of such a type THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ]; THypList::iterator anIter = aHypVarList.begin(); - for ( ; anIter != aHypVarList.end(); anIter++ ) + for (; anIter != aHypVarList.end(); anIter++) { SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first; CORBA::String_var aName = aHypVar->GetName(); @@ -1635,11 +1619,11 @@ void SMESHGUI_MeshOp::readMesh() if ( !pObj ) return; - if( myIsOnGeometry ) { + if (myIsOnGeometry) { // Get name of mesh if current object is sub-mesh SMESH::SMESH_subMesh_var aSubMeshVar = SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() ); - if ( !aSubMeshVar->_is_nil() ) + if ( !aSubMeshVar->_is_nil() ) { SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather(); if ( !aMeshVar->_is_nil() ) @@ -1649,7 +1633,7 @@ void SMESHGUI_MeshOp::readMesh() myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName ); } } - + // Get name of geometry object GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); if ( !aGeomVar->_is_nil() ) @@ -1761,7 +1745,7 @@ int SMESHGUI_MeshOp::find( const SMESH::SMESH_Hypothesis_var& theHyp, { int i = 0; THypList::const_iterator anIter = theHypList.begin(); - for ( ; anIter != theHypList.end(); ++ anIter ) + for (; anIter != theHypList.end(); ++ anIter) { if ( theHyp->_is_equivalent( (*anIter).first ) ) {