PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis")

enable 0D hypotheses
This commit is contained in:
eap 2007-02-19 16:39:06 +00:00
parent 8ac5bcad9a
commit 49a1404d87
6 changed files with 36 additions and 26 deletions

View File

@ -391,12 +391,14 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
// Create tab widget // Create tab widget
myTabWg = new QTabWidget( mainFrame() ); myTabWg = new QTabWidget( mainFrame() );
myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg );
myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg );
myTabs[ Dim2D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim2D ] = new SMESHGUI_MeshTab( myTabWg );
myTabs[ Dim3D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim3D ] = new SMESHGUI_MeshTab( myTabWg );
myTabWg->addTab( myTabs[ Dim3D ], tr( "DIM_3D" ) ); myTabWg->addTab( myTabs[ Dim3D ], tr( "DIM_3D" ) );
myTabWg->addTab( myTabs[ Dim2D ], tr( "DIM_2D" ) ); myTabWg->addTab( myTabs[ Dim2D ], tr( "DIM_2D" ) );
myTabWg->addTab( myTabs[ Dim1D ], tr( "DIM_1D" ) ); myTabWg->addTab( myTabs[ Dim1D ], tr( "DIM_1D" ) );
myTabWg->addTab( myTabs[ Dim0D ], tr( "DIM_0D" ) );
// Hypotheses Sets // Hypotheses Sets
myHypoSetPopup = new QPopupMenu(); myHypoSetPopup = new QPopupMenu();
@ -454,7 +456,7 @@ SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg()
//================================================================================ //================================================================================
SMESHGUI_MeshTab* SMESHGUI_MeshDlg::tab( const int theId ) const 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() void SMESHGUI_MeshDlg::reset()
{ {
clearSelection(); clearSelection();
myTabs[ Dim0D ]->reset();
myTabs[ Dim1D ]->reset(); myTabs[ Dim1D ]->reset();
myTabs[ Dim2D ]->reset(); myTabs[ Dim2D ]->reset();
myTabs[ Dim3D ]->reset(); myTabs[ Dim3D ]->reset();
@ -489,8 +492,8 @@ void SMESHGUI_MeshDlg::setCurrentTab( const int theId )
void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim )
{ {
const int DIM = maxDim - 1; const int DIM = maxDim;
for ( int dim = Dim1D; dim <= Dim3D; ++dim ) { for ( int dim = Dim0D; dim <= Dim3D; ++dim ) {
bool enable = ( dim <= DIM ); bool enable = ( dim <= DIM );
if ( !enable ) if ( !enable )
myTabs[ dim ]->reset(); myTabs[ dim ]->reset();

View File

@ -60,7 +60,7 @@ public:
enum Controls { Obj, Mesh, Geom }; enum Controls { Obj, Mesh, Geom };
/*! Describes dimensions */ /*! Describes dimensions */
enum Dimensions { Dim1D = 0, Dim2D, Dim3D }; enum Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D };
public: public:
SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh ); SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh );

View File

@ -76,6 +76,7 @@ enum { GLOBAL_ALGO_TAG =3,
GLOBAL_HYPO_TAG =2, GLOBAL_HYPO_TAG =2,
LOCAL_ALGO_TAG =2, LOCAL_ALGO_TAG =2,
LOCAL_HYPO_TAG =1, LOCAL_HYPO_TAG =1,
SUBMESH_ON_VERTEX_TAG =4,
SUBMESH_ON_EDGE_TAG =5, SUBMESH_ON_EDGE_TAG =5,
SUBMESH_ON_WIRE_TAG =6, SUBMESH_ON_WIRE_TAG =6,
SUBMESH_ON_FACE_TAG =7, SUBMESH_ON_FACE_TAG =7,
@ -201,7 +202,7 @@ void SMESHGUI_MeshOp::startOperation()
if( !myDlg ) if( !myDlg )
{ {
myDlg = new SMESHGUI_MeshDlg( myToCreate, myIsMesh ); 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 ) ), connect( myDlg->tab( i ), SIGNAL( createHyp( const int, const int ) ),
this, SLOT( onCreateHyp( const int, const int ) ) ); this, SLOT( onCreateHyp( const int, const int ) ) );
@ -220,10 +221,9 @@ void SMESHGUI_MeshOp::startOperation()
} }
SMESHGUI_SelectionOp::startOperation(); SMESHGUI_SelectionOp::startOperation();
// iterate through dimensions and get available algoritms, // iterate through dimensions and get available algoritms, set them to the dialog
// set them to the dialog
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" ); _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 ); SMESHGUI_MeshTab* aTab = myDlg->tab( i );
QStringList hypList; QStringList hypList;
@ -367,6 +367,7 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
if ( !geom->_is_nil() ) { if ( !geom->_is_nil() ) {
int tag = -1; int tag = -1;
switch ( geom->GetShapeType() ) { switch ( geom->GetShapeType() ) {
case GEOM::VERTEX: tag = SUBMESH_ON_VERTEX_TAG ; break;
case GEOM::EDGE: tag = SUBMESH_ON_EDGE_TAG ; break; case GEOM::EDGE: tag = SUBMESH_ON_EDGE_TAG ; break;
case GEOM::WIRE: tag = SUBMESH_ON_WIRE_TAG ; break; case GEOM::WIRE: tag = SUBMESH_ON_WIRE_TAG ; break;
case GEOM::FACE: tag = SUBMESH_ON_FACE_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 ) static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
{ {
int aDim = -1; 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)) if (tab == dlg->tab(i))
aDim = i; aDim = i;
return aDim; return aDim;
@ -978,7 +979,7 @@ HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
const int theHypType, const int theHypType,
const int theIndex) const int theIndex)
{ {
if ( theDim > -1 && theDim < 3 && if ( theDim > -1 && theDim <= SMESH::DIM_3D &&
theHypType > -1 && theHypType < NbHypTypes && theHypType > -1 && theHypType < NbHypTypes &&
theIndex > -1 && theIndex < myAvailableHypData[ theDim ][ theHypType ].count() ) theIndex > -1 && theIndex < myAvailableHypData[ theDim ][ theHypType ].count() )
return myAvailableHypData[ theDim ][ theHypType ][ theIndex ]; 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 // find highest available dimension, all algos of this dimension are available for choice
int aTopDim = -1; 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 )) if (isAccessibleDim( i ))
aTopDim = i; aTopDim = i;
if (aTopDim == -1) if (aTopDim == -1)
@ -1013,7 +1014,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh )); const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh ));
HypothesisData* algoData = hypData( aDim, Algo, theIndex ); HypothesisData* algoData = hypData( aDim, Algo, theIndex );
HypothesisData* algoByDim[3]; HypothesisData* algoByDim[4];
algoByDim[ aDim ] = algoData; algoByDim[ aDim ] = algoData;
QStringList anAvailable; QStringList anAvailable;
@ -1030,7 +1031,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
{ {
int dim = aDim + 1, lastDim = SMESH::DIM_3D, dir = 1; int dim = aDim + 1, lastDim = SMESH::DIM_3D, dir = 1;
if ( !forward ) { if ( !forward ) {
dim = aDim - 1; lastDim = SMESH::DIM_1D; dir = -1; dim = aDim - 1; lastDim = SMESH::DIM_0D; dir = -1;
} }
HypothesisData* prevAlgo = algoData; HypothesisData* prevAlgo = algoData;
bool noCompatible = false; bool noCompatible = false;
@ -1064,7 +1065,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
// restore previously selected algo // restore previously selected algo
algoIndex = myAvailableHypData[dim][Algo].findIndex( curAlgo ); 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 // select the sole compatible algo
algoIndex = myAvailableHypData[dim][Algo].findIndex( soleCompatible ); algoIndex = myAvailableHypData[dim][Algo].findIndex( soleCompatible );
setCurrentHyp( dim, Algo, algoIndex ); setCurrentHyp( dim, Algo, algoIndex );
@ -1078,7 +1079,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
_PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH"); _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 )) if ( !isAccessibleDim( dim ))
continue; continue;
@ -1159,7 +1160,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
if (!aHypoSet) return; if (!aHypoSet) return;
// clear all hyps // 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, Algo, -1);
setCurrentHyp(dim, AddHyp, -1); setCurrentHyp(dim, AddHyp, -1);
setCurrentHyp(dim, MainHyp, -1); setCurrentHyp(dim, MainHyp, -1);
@ -1243,7 +1244,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess )
if ( aMeshSO ) if ( aMeshSO )
SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() ); 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; if ( !isAccessibleDim( aDim )) continue;
// assign hypotheses // assign hypotheses
@ -1363,7 +1364,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
// create sub-mesh // create sub-mesh
SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.latin1() ); 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; if ( !isAccessibleDim( aDim )) continue;
@ -1581,7 +1582,7 @@ void SMESHGUI_MeshOp::readMesh()
// Get hypotheses and algorithms assigned to the mesh/sub-mesh // Get hypotheses and algorithms assigned to the mesh/sub-mesh
QStringList anExisting; 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 // get algorithm
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] ); existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
@ -1606,7 +1607,7 @@ void SMESHGUI_MeshOp::readMesh()
// get hypotheses // get hypotheses
bool hypWithoutAlgo = false; 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++ ) 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() ); SMESH::SetName( pObj, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() );
// Assign new hypotheses and algorithms // 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; if ( !isAccessibleDim( dim )) continue;

View File

@ -134,7 +134,7 @@ private:
// edited mesh/sub-mesh // edited mesh/sub-mesh
// hypdata corresponding to hypotheses present in myDlg // hypdata corresponding to hypotheses present in myDlg
THypDataList myAvailableHypData[3][NbHypTypes]; THypDataList myAvailableHypData[4][NbHypTypes];
bool myIgnoreAlgoSelection; bool myIgnoreAlgoSelection;
}; };

View File

@ -126,7 +126,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
{ {
int aVal = (*anIter).toInt( &isOk ); int aVal = (*anIter).toInt( &isOk );
if ( isOk ) if ( isOk )
aDim.append( aVal - 1 ); aDim.append( aVal );
} }
// for algo // for algo
@ -141,18 +141,18 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
} }
} }
HypothesisData* aHypLibNames = HypothesisData* aHypData =
new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib, new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib,
aLabel, anIcon, aDim, isAux, aLabel, anIcon, aDim, isAux,
attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ]); attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ]);
if (qName == "algorithm") if (qName == "algorithm")
{ {
myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypLibNames; myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypData;
} }
else else
{ {
myHypothesesMap[(char*)aHypAlType.latin1()] = aHypLibNames; myHypothesesMap[(char*)aHypAlType.latin1()] = aHypData;
} }
} }
} }

View File

@ -1724,6 +1724,9 @@ msgstr "Start node"
msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_USE_ANGLES" msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_USE_ANGLES"
msgstr "Use Angles" msgstr "Use Angles"
msgid "SMESHGUI_ExtrusionAlongPathDlg::LINEAR_ANGLES"
msgstr "Linear variation of the angles"
msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_ANGLES" msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_ANGLES"
msgstr "Rotation Angles" msgstr "Rotation Angles"
@ -3136,6 +3139,9 @@ msgstr "Automatic renumbering"
#----------------------------------------------------------- #-----------------------------------------------------------
msgid "SMESHGUI_MeshDlg::DIM_0D"
msgstr "0D"
msgid "SMESHGUI_MeshDlg::DIM_1D" msgid "SMESHGUI_MeshDlg::DIM_1D"
msgstr "1D" msgstr "1D"