//================================================================================
bool SMESHGUI_MeshOp::onApply()
{
- if( isStudyLocked() )
+ if (isStudyLocked())
return false;
QString aMess;
//================================================================================
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++ )
//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;
//================================================================================
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;
}
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() );
}
else
myDlg->reset();
-
}
else if ( !myIsMesh ) // submesh creation
{
selectionDone();
}
}
-
+
// enable/disable popup for choice of geom selection way
bool enable = false;
QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
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)
( 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() ) );
}
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 ) )
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);
}
HypothesisData* prevAlgo = algoData;
bool noCompatible = false;
- for ( ; dim * dir <= lastDim * dir ; dim += dir )
+ for (; dim * dir <= lastDim * dir; dim += dir)
{
if ( !isAccessibleDim( dim ))
continue;
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;
{
// 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();
const QString& aHypoTypeName = (*aHypoList)[ i ];
HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
if (!aHypData)
- continue;
+ continue;
int aDim = aHypData->Dim[0];
// create or/and set
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 =
// 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();
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() )
myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName );
}
}
-
+
// Get name of geometry object
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
if ( !aGeomVar->_is_nil() )
{
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 ) )
{