+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
/**
* SMESH SMESHGUI
*
#include "SALOMEDS_SObject.hxx"
-#include "SalomeApp_SelectionMgr.h"
-#include "SalomeApp_UpdateFlags.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_UpdateFlags.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Desktop.h"
#include "SUIT_OverrideCursor.h"
//================================================================================
/*!
* \brief Gets dialog of this operation
- * \retval SalomeApp_Dialog* - pointer to dialog of this operation
+ * \retval LightApp_Dialog* - pointer to dialog of this operation
*/
//================================================================================
-SalomeApp_Dialog* SMESHGUI_MeshOp::dlg() const
+LightApp_Dialog* SMESHGUI_MeshOp::dlg() const
{
return myDlg;
}
// Enable tabs according to shape dimension
int shapeDim = 3;
- if ( myToCreate )
+ try
{
- try
- {
- QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
- _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() );
- if ( pGeom ) {
- GEOM::GEOM_Object_var aGeomVar =
- GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
- if ( !aGeomVar->_is_nil() ) {
- shapeDim = 0;
- switch ( aGeomVar->GetShapeType() ) {
- case GEOM::SOLID:
- case GEOM::SHELL: shapeDim = 3; break;
- case GEOM::FACE: shapeDim = 2; break;
- case GEOM::WIRE:
- case GEOM::EDGE: shapeDim = 1; break;
- case GEOM::VERTEX: shapeDim = 0; break;
- default:
- TopoDS_Shape aShape;
- if ( GEOMBase::GetShape(aGeomVar, aShape)) {
- TopExp_Explorer exp( aShape, TopAbs_SHELL );
- if ( exp.More() )
- shapeDim = 3;
- else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
- shapeDim = 2;
- else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
- shapeDim = 1;
- else
- shapeDim = 0;
- }
- }
- }
- }
+ GEOM::GEOM_Object_var aGeomVar;
+ QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+ _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() );
+ if ( pGeom ) {
+ aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
}
- catch ( const SALOME::SALOME_Exception& S_ex )
- {
- SalomeApp_Tools::QtCatchCorbaException( S_ex );
+ else {
+ QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+ _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
+ aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
}
- catch ( ... )
- {
+ if ( !aGeomVar->_is_nil() ) {
+ shapeDim = 0;
+ switch ( aGeomVar->GetShapeType() ) {
+ case GEOM::SOLID:
+ case GEOM::SHELL: shapeDim = 3; break;
+ case GEOM::FACE: shapeDim = 2; break;
+ case GEOM::WIRE:
+ case GEOM::EDGE: shapeDim = 1; break;
+ case GEOM::VERTEX: shapeDim = 0; break;
+ default:
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape(aGeomVar, aShape)) {
+ TopExp_Explorer exp( aShape, TopAbs_SHELL );
+ if ( exp.More() )
+ shapeDim = 3;
+ else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
+ shapeDim = 2;
+ else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
+ shapeDim = 1;
+ else
+ shapeDim = 0;
+ }
+ }
}
}
+ catch ( const SALOME::SALOME_Exception& S_ex )
+ {
+ SalomeApp_Tools::QtCatchCorbaException( S_ex );
+ }
+ catch ( ... )
+ {
+ }
myDlg->setMaxHypoDim( shapeDim );
}
{
const QString& aHypoTypeName = (*aHypoList)[ i ];
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
+ if ( !aHypData ) continue;
int aDim = aHypData->Dim[0];
// create or/and set
int index = -1;
}
if ( index >= 0 ) // found
{
+ // select an algorithm
setCurrentHyp ( aDim, aHypType, index );
}
else
{
- // silently create a hypothesis
- SMESH::CreateHypothesis( aHypoTypeName, aHypData->Label, isAlgo );
+ // create a hypothesis
+ QString aClientLibName = aHypData->ClientLibName;
+ if ( aClientLibName == "" ) {
+ // Call hypothesis creation server method (without GUI)
+ SMESH::CreateHypothesis( aHypoTypeName, aHypData->Label, isAlgo );
+ }
+ else {
+ // Get hypotheses creator client (GUI)
+ SMESHGUI_GenericHypothesisCreator* aCreator =
+ SMESH::GetHypothesisCreator( aHypoTypeName );
+ aCreator->CreateHypothesis( false, myDlg );
+ }
QStringList aNewHyps;
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
existingHyps( aDim, aHypType, aFather, aNewHyps, aList );