From: eap Date: Mon, 19 Feb 2007 16:39:06 +0000 (+0000) Subject: PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis") X-Git-Tag: V3_2_6a1~74 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=49a1404d87d5e2fcc0382df68d6d3e77a912caef;p=modules%2Fsmesh.git PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis") enable 0D hypotheses --- diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 3d19a1278..33d2e6485 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -391,12 +391,14 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh // Create tab widget myTabWg = new QTabWidget( mainFrame() ); + myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim2D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim3D ] = new SMESHGUI_MeshTab( myTabWg ); myTabWg->addTab( myTabs[ Dim3D ], tr( "DIM_3D" ) ); myTabWg->addTab( myTabs[ Dim2D ], tr( "DIM_2D" ) ); myTabWg->addTab( myTabs[ Dim1D ], tr( "DIM_1D" ) ); + myTabWg->addTab( myTabs[ Dim0D ], tr( "DIM_0D" ) ); // Hypotheses Sets myHypoSetPopup = new QPopupMenu(); @@ -454,7 +456,7 @@ SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg() //================================================================================ SMESHGUI_MeshTab* SMESHGUI_MeshDlg::tab( const int theId ) const { - return ( theId >= Dim1D && theId <= Dim3D ? myTabs[ theId ] : 0 ); + return ( theId >= Dim0D && theId <= Dim3D ? myTabs[ theId ] : 0 ); } //================================================================================ @@ -465,6 +467,7 @@ SMESHGUI_MeshTab* SMESHGUI_MeshDlg::tab( const int theId ) const void SMESHGUI_MeshDlg::reset() { clearSelection(); + myTabs[ Dim0D ]->reset(); myTabs[ Dim1D ]->reset(); myTabs[ Dim2D ]->reset(); myTabs[ Dim3D ]->reset(); @@ -489,8 +492,8 @@ void SMESHGUI_MeshDlg::setCurrentTab( const int theId ) void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) { - const int DIM = maxDim - 1; - for ( int dim = Dim1D; dim <= Dim3D; ++dim ) { + const int DIM = maxDim; + for ( int dim = Dim0D; dim <= Dim3D; ++dim ) { bool enable = ( dim <= DIM ); if ( !enable ) myTabs[ dim ]->reset(); diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index 84ca7a229..78dafd726 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -60,7 +60,7 @@ public: enum Controls { Obj, Mesh, Geom }; /*! Describes dimensions */ - enum Dimensions { Dim1D = 0, Dim2D, Dim3D }; + enum Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D }; public: SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh ); diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 6a9c8553d..5a692f0e0 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -76,6 +76,7 @@ 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, @@ -201,7 +202,7 @@ void SMESHGUI_MeshOp::startOperation() if( !myDlg ) { myDlg = new SMESHGUI_MeshDlg( myToCreate, myIsMesh ); - for ( int i = SMESH::DIM_1D; i <= SMESH::DIM_3D; i++ ) + for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) { connect( myDlg->tab( i ), SIGNAL( createHyp( const int, const int ) ), this, SLOT( onCreateHyp( const int, const int ) ) ); @@ -220,10 +221,9 @@ void SMESHGUI_MeshOp::startOperation() } SMESHGUI_SelectionOp::startOperation(); - // iterate through dimensions and get available algoritms, - // set them to the dialog + // iterate through dimensions and get available algoritms, set them to the dialog _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" ); - for ( int i = SMESH::DIM_1D; i <= SMESH::DIM_3D; i++ ) + for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) { SMESHGUI_MeshTab* aTab = myDlg->tab( i ); QStringList hypList; @@ -367,6 +367,7 @@ _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; @@ -842,7 +843,7 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg ) { int aDim = -1; - for (int i = SMESH::DIM_1D; i <= SMESH::DIM_3D; i++) + for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++) if (tab == dlg->tab(i)) aDim = i; return aDim; @@ -978,7 +979,7 @@ HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim, const int theHypType, const int theIndex) { - if ( theDim > -1 && theDim < 3 && + if ( theDim > -1 && theDim <= SMESH::DIM_3D && theHypType > -1 && theHypType < NbHypTypes && theIndex > -1 && theIndex < myAvailableHypData[ theDim ][ theHypType ].count() ) return myAvailableHypData[ theDim ][ theHypType ][ theIndex ]; @@ -1004,7 +1005,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, // find highest available dimension, all algos of this dimension are available for choice int aTopDim = -1; - for (int i = SMESH::DIM_1D; i <= SMESH::DIM_3D; i++) + for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++) if (isAccessibleDim( i )) aTopDim = i; if (aTopDim == -1) @@ -1013,7 +1014,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh )); HypothesisData* algoData = hypData( aDim, Algo, theIndex ); - HypothesisData* algoByDim[3]; + HypothesisData* algoByDim[4]; algoByDim[ aDim ] = algoData; QStringList anAvailable; @@ -1030,7 +1031,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, { int dim = aDim + 1, lastDim = SMESH::DIM_3D, dir = 1; if ( !forward ) { - dim = aDim - 1; lastDim = SMESH::DIM_1D; dir = -1; + dim = aDim - 1; lastDim = SMESH::DIM_0D; dir = -1; } HypothesisData* prevAlgo = algoData; bool noCompatible = false; @@ -1064,7 +1065,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, // restore previously selected algo algoIndex = myAvailableHypData[dim][Algo].findIndex( curAlgo ); - if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward ) + if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) // select the sole compatible algo algoIndex = myAvailableHypData[dim][Algo].findIndex( soleCompatible ); setCurrentHyp( dim, Algo, algoIndex ); @@ -1078,7 +1079,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, _PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH"); - for ( int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++ ) + for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ ) { if ( !isAccessibleDim( dim )) continue; @@ -1159,7 +1160,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) if (!aHypoSet) return; // clear all hyps - for (int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++) { + for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) { setCurrentHyp(dim, Algo, -1); setCurrentHyp(dim, AddHyp, -1); setCurrentHyp(dim, MainHyp, -1); @@ -1243,7 +1244,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess ) if ( aMeshSO ) SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() ); - for ( int aDim = SMESH::DIM_1D; aDim <= SMESH::DIM_3D; aDim++ ) { + for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) { if ( !isAccessibleDim( aDim )) continue; // assign hypotheses @@ -1363,7 +1364,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) // create sub-mesh SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.latin1() ); - for ( int aDim = SMESH::DIM_1D; aDim <= SMESH::DIM_3D; aDim++ ) + for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) { if ( !isAccessibleDim( aDim )) continue; @@ -1581,7 +1582,7 @@ void SMESHGUI_MeshOp::readMesh() // Get hypotheses and algorithms assigned to the mesh/sub-mesh QStringList anExisting; - for ( int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++ ) + for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ ) { // get algorithm existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] ); @@ -1606,7 +1607,7 @@ void SMESHGUI_MeshOp::readMesh() // get hypotheses bool hypWithoutAlgo = false; - for ( int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++ ) + for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ ) { for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ ) { @@ -1720,7 +1721,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) SMESH::SetName( pObj, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() ); // Assign new hypotheses and algorithms - for ( int dim = SMESH::DIM_1D; dim <= SMESH::DIM_3D; dim++ ) + for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ ) { if ( !isAccessibleDim( dim )) continue; diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.h b/src/SMESHGUI/SMESHGUI_MeshOp.h index cc7bae75c..f74f5049d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -134,7 +134,7 @@ private: // edited mesh/sub-mesh // hypdata corresponding to hypotheses present in myDlg - THypDataList myAvailableHypData[3][NbHypTypes]; + THypDataList myAvailableHypData[4][NbHypTypes]; bool myIgnoreAlgoSelection; }; diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx index e1e4d0dc7..eca927eb6 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx @@ -126,7 +126,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, { int aVal = (*anIter).toInt( &isOk ); if ( isOk ) - aDim.append( aVal - 1 ); + aDim.append( aVal ); } // for algo @@ -141,18 +141,18 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, } } - HypothesisData* aHypLibNames = + HypothesisData* aHypData = new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib, aLabel, anIcon, aDim, isAux, attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ]); if (qName == "algorithm") { - myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypLibNames; + myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypData; } else { - myHypothesesMap[(char*)aHypAlType.latin1()] = aHypLibNames; + myHypothesesMap[(char*)aHypAlType.latin1()] = aHypData; } } } diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index 6c7532c38..d09b33255 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -1724,6 +1724,9 @@ msgstr "Start node" msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_USE_ANGLES" msgstr "Use Angles" +msgid "SMESHGUI_ExtrusionAlongPathDlg::LINEAR_ANGLES" +msgstr "Linear variation of the angles" + msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_ANGLES" msgstr "Rotation Angles" @@ -3136,6 +3139,9 @@ msgstr "Automatic renumbering" #----------------------------------------------------------- +msgid "SMESHGUI_MeshDlg::DIM_0D" +msgstr "0D" + msgid "SMESHGUI_MeshDlg::DIM_1D" msgstr "1D"