Fix bug 17722: menu for 'Geometry' button of 'Create Sub-mesh' dlg was lost.

This commit is contained in:
jfa 2007-11-21 11:20:17 +00:00
parent d2bb955929
commit a3511231dc

View File

@ -138,7 +138,7 @@ LightApp_Dialog* SMESHGUI_MeshOp::dlg() const
//================================================================================
bool SMESHGUI_MeshOp::onApply()
{
if( isStudyLocked() )
if (isStudyLocked())
return false;
QString aMess;
@ -200,7 +200,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++ )
@ -337,9 +337,9 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
//if (mainObj->_is_nil() ||
// string(mainObj->GetEntry()) != string(mainGeom->GetEntry())) return false;
while(1) {
if(mainObj->_is_nil())
if (mainObj->_is_nil())
return false;
if( string(mainObj->GetEntry()) == string(mainGeom->GetEntry()) )
if (string(mainObj->GetEntry()) == string(mainGeom->GetEntry()))
return true;
mainObj = op->GetMainShape(mainObj);
}
@ -411,36 +411,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
{
//Check geometry for mesh
QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
if ( !pObj )
return;
myIsOnGeometry = true;
SMESH::SMESH_subMesh_var aSubMeshVar =
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
if ( !aSubMeshVar->_is_nil() )
myIsOnGeometry = true;
else {
//Check geometry for mesh
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() )
SMESH::SMESH_Mesh::_narrow(_CAST(SObject,pObj)->GetObject());
if (!aMeshVar->_is_nil()) {
if (!myToCreate && !aMeshVar->HasShapeToMesh())
myIsOnGeometry = false;
else
myIsOnGeometry = true;
}
}
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;
@ -498,13 +496,10 @@ 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 +512,6 @@ void SMESHGUI_MeshOp::selectionDone()
}
else
myDlg->reset();
}
else if ( !myIsMesh ) // submesh creation
{
@ -564,7 +558,7 @@ void SMESHGUI_MeshOp::selectionDone()
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)
@ -951,13 +945,13 @@ 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++ ) {
for (; anIter != aHypList.end(); anIter++) {
const THypItem& aHypItem = *anIter;
const QString& aHypName = aHypItem.second;
aHypNames.append(aHypName);
@ -1106,7 +1100,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;
@ -1176,9 +1170,9 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
{
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;
@ -1299,8 +1293,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 +1565,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,7 +1629,7 @@ 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() );
@ -1761,7 +1755,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 ) )
{