mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
Remove not used files
This commit is contained in:
parent
5ad374f205
commit
3e906035e4
@ -59,8 +59,6 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_MeshPatternDlg.cxx \
|
||||
SMESHGUI_SpinBox.cxx \
|
||||
SMESHGUI_NodesDlg.cxx \
|
||||
SMESHGUI_InitMeshDlg.cxx \
|
||||
SMESHGUI_AddSubMeshDlg.cxx \
|
||||
SMESHGUI_TransparencyDlg.cxx \
|
||||
SMESHGUI_ClippingDlg.cxx \
|
||||
SMESHGUI_GroupDlg.cxx \
|
||||
@ -121,8 +119,6 @@ LIB_MOC = \
|
||||
SMESHGUI_CreatePatternDlg.h \
|
||||
SMESHGUI_NodesDlg.h \
|
||||
SMESHGUI_SpinBox.h \
|
||||
SMESHGUI_InitMeshDlg.h \
|
||||
SMESHGUI_AddSubMeshDlg.h \
|
||||
SMESHGUI_TransparencyDlg.h \
|
||||
SMESHGUI_ClippingDlg.h \
|
||||
SMESHGUI_GroupDlg.h \
|
||||
|
@ -1,22 +1,22 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
// 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
|
||||
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
// File : SMESHGUI.cxx
|
||||
@ -26,8 +26,6 @@
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
#include "SMESHGUI_InitMeshDlg.h"
|
||||
#include "SMESHGUI_AddSubMeshDlg.h"
|
||||
#include "SMESHGUI_NodesDlg.h"
|
||||
#include "SMESHGUI_TransparencyDlg.h"
|
||||
#include "SMESHGUI_ClippingDlg.h"
|
||||
@ -169,7 +167,7 @@ namespace{
|
||||
{
|
||||
QStringList filter;
|
||||
string myExtension;
|
||||
|
||||
|
||||
if(theCommandID == 113){
|
||||
filter.append(QObject::tr("MED files (*.med)"));
|
||||
filter.append(QObject::tr("All files (*)"));
|
||||
@ -298,7 +296,7 @@ namespace{
|
||||
QStringList filters;
|
||||
for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
|
||||
filters.push_back( it.key() );
|
||||
|
||||
|
||||
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
|
||||
fd->setCaption( aTitle );
|
||||
fd->setFilters( filters );
|
||||
@ -309,7 +307,7 @@ namespace{
|
||||
aFormat = aFilterMap[fd->selectedFilter()];
|
||||
is_ok = true;
|
||||
if( !aFilename.isEmpty()
|
||||
&& (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
|
||||
&& (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
|
||||
&& aFormat==SMESH::MED_V2_1){
|
||||
int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
@ -517,7 +515,7 @@ namespace{
|
||||
SMESH::RepaintCurrentView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Control( int theCommandID )
|
||||
{
|
||||
SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
@ -811,7 +809,7 @@ SalomeApp_Module( "SMESH" )
|
||||
|
||||
SMESH::GetFilterManager();
|
||||
SMESH::GetPattern();
|
||||
|
||||
|
||||
/* load resources for all available meshers */
|
||||
SMESH::InitAvailableHypotheses();
|
||||
}
|
||||
@ -1170,7 +1168,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (anAction == SMESH::eErase) {
|
||||
SALOME_ListIO l1;
|
||||
aSel->setSelectedObjects( l1 );
|
||||
@ -1191,7 +1189,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
else {
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_VIEWER_VTK"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
}
|
||||
@ -1263,7 +1261,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
SMESH::ModifiedMesh(aMeshSObj,true);
|
||||
// TO Do : change icon of all submeshes
|
||||
else
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_COMPUTE_FAILED"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
@ -1278,7 +1276,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
if(!refShapeObject->_is_nil()){
|
||||
bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
|
||||
if(!compute){
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_MISSING_PARAMETERS"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
@ -1316,7 +1314,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
}else{
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_VIEWER_VTK"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
}
|
||||
@ -1541,7 +1539,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
aGroup->Add(aVolumes.inout());
|
||||
}
|
||||
updateObjBrowser();
|
||||
|
||||
|
||||
}catch(const SALOME::SALOME_Exception & S_ex){
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
@ -1699,8 +1697,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
else
|
||||
new SMESHGUI_StandardMeshInfosDlg( this, "", false);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 1100: // EDIT HYPOTHESIS
|
||||
{
|
||||
if(checkLock(aStudy)) break;
|
||||
@ -1770,7 +1768,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
|
||||
if (!aGroup->_is_nil() )
|
||||
aGroup->SetName( newName.latin1() );
|
||||
|
||||
|
||||
updateObjBrowser();
|
||||
}
|
||||
}
|
||||
@ -1937,7 +1935,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4063: // SYMMETRY
|
||||
case 4063: // SYMMETRY
|
||||
{
|
||||
if(checkLock(aStudy)) break;
|
||||
if(vtkwnd) {
|
||||
@ -1995,7 +1993,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 5105: // Library of selection filters
|
||||
{
|
||||
static QValueList<int> aTypes;
|
||||
@ -2050,7 +2048,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
else {
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "NOT_A_VTK_VIEWER" ),
|
||||
tr( "NOT_A_VTK_VIEWER" ),
|
||||
tr( "SMESH_BUT_OK" ) );
|
||||
}
|
||||
break;
|
||||
@ -2294,7 +2292,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createSMESHAction( 1134, "CLIP" );
|
||||
createSMESHAction( 1135, "DISP_ENT" );
|
||||
createSMESHAction( 2000, "CTRL" );
|
||||
|
||||
|
||||
createSMESHAction( 300, "ERASE" );
|
||||
createSMESHAction( 301, "DISPLAY" );
|
||||
createSMESHAction( 302, "DISPLAY_ONLY" );
|
||||
@ -2550,12 +2548,12 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
|
||||
QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
|
||||
QString aMeshInVTK = aClient + "&&" + aType;
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Numbering
|
||||
//-------------------------------------------------
|
||||
anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
|
||||
|
||||
|
||||
popupMgr()->insert( action( 9010 ), anId, -1 );
|
||||
popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, true );
|
||||
popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false );
|
||||
@ -2729,7 +2727,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
|
||||
connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
|
||||
connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
|
||||
this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
|
||||
}
|
||||
|
||||
@ -2749,7 +2747,7 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study )
|
||||
setToolShown( false );
|
||||
|
||||
EmitSignalCloseAllDialogs();
|
||||
|
||||
|
||||
return SalomeApp_Module::deactivateModule( study );
|
||||
}
|
||||
|
||||
@ -2769,7 +2767,7 @@ SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
|
||||
{
|
||||
SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
|
||||
return aGUI.myComponentSMESH;
|
||||
}
|
||||
}
|
||||
return myComponentSMESH;
|
||||
}
|
||||
|
||||
@ -2814,7 +2812,7 @@ void SMESHGUI::createPreferences()
|
||||
int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
|
||||
addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, SalomeApp_Preferences::Bool, "SMESH", "display_entity" );
|
||||
addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, SalomeApp_Preferences::Bool, "SMESH", "use_precision" );
|
||||
|
||||
|
||||
int precGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), genTab );
|
||||
setPreferenceProperty( precGroup, "columns", 1 );
|
||||
|
||||
@ -2830,14 +2828,14 @@ void SMESHGUI::createPreferences()
|
||||
modes.append( "Shading" );
|
||||
modes.append( "Nodes" );
|
||||
modes.append( "Shrink" );
|
||||
QValueList<QVariant> indices;
|
||||
indices.append( 0 );
|
||||
QValueList<QVariant> indices;
|
||||
indices.append( 0 );
|
||||
indices.append( 1 );
|
||||
indices.append( 2 );
|
||||
indices.append( 3 );
|
||||
setPreferenceProperty( dispmode, "strings", modes );
|
||||
setPreferenceProperty( dispmode, "indexes", indices );
|
||||
|
||||
|
||||
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
|
||||
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
|
||||
|
||||
@ -2870,10 +2868,10 @@ void SMESHGUI::createPreferences()
|
||||
addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, SalomeApp_Preferences::Color, "SMESH", "selection_object_color" );
|
||||
addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, SalomeApp_Preferences::Color, "SMESH", "selection_element_color" );
|
||||
int selW = addPreference( tr( "PREF_WIDTH" ), selGroup, SalomeApp_Preferences::IntSpin, "SMESH", "selection_width" );
|
||||
|
||||
|
||||
setPreferenceProperty( selW, "min", 1 );
|
||||
setPreferenceProperty( selW, "max", 5 );
|
||||
|
||||
|
||||
int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab );
|
||||
|
||||
addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, SalomeApp_Preferences::Color, "SMESH", "highlight_color" );
|
||||
@ -2903,17 +2901,17 @@ void SMESHGUI::createPreferences()
|
||||
|
||||
setPreferenceProperty( tfont, "families", fam );
|
||||
setPreferenceProperty( tfont, "system", false );
|
||||
setPreferenceProperty( tfont, "widget_flags", wflag );
|
||||
setPreferenceProperty( tfont, "widget_flags", wflag );
|
||||
setPreferenceProperty( lfont, "families", fam );
|
||||
setPreferenceProperty( lfont, "system", false );
|
||||
setPreferenceProperty( lfont, "widget_flags", wflag );
|
||||
|
||||
|
||||
int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
|
||||
|
||||
int numcol = addPreference( tr( "SMESH_NUMBEROFCOLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_colors" );
|
||||
setPreferenceProperty( numcol, "min", 2 );
|
||||
setPreferenceProperty( numcol, "max", 256 );
|
||||
|
||||
setPreferenceProperty( numcol, "max", 256 );
|
||||
|
||||
int numlab = addPreference( tr( "SMESH_NUMBEROFLABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_labels" );
|
||||
setPreferenceProperty( numlab, "min", 2 );
|
||||
setPreferenceProperty( numlab, "max", 65 );
|
||||
@ -2926,10 +2924,10 @@ void SMESHGUI::createPreferences()
|
||||
indices.clear(); indices.append( 0 ); indices.append( 1 );
|
||||
setPreferenceProperty( orient, "strings", orients );
|
||||
setPreferenceProperty( orient, "indexes", indices );
|
||||
|
||||
|
||||
int posVSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_VERTICAL" ), sbarTab );
|
||||
int xv = addPreference( tr( "SMESH_X_SCALARBAR" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_x" );
|
||||
int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
|
||||
int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
|
||||
int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" );
|
||||
int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" );
|
||||
setPreferenceProperty( xv, "step", 0.1 );
|
||||
@ -2943,7 +2941,7 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( wv, "max", 1.0 );
|
||||
setPreferenceProperty( hv, "min", 0.0 );
|
||||
setPreferenceProperty( hv, "max", 1.0 );
|
||||
setPreferenceProperty( hv, "step", 0.1 );
|
||||
setPreferenceProperty( hv, "step", 0.1 );
|
||||
|
||||
int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab );
|
||||
int xh = addPreference( tr( "SMESH_X_SCALARBAR" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_x" );
|
||||
@ -2977,7 +2975,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
||||
* \param theFlags - update flags
|
||||
*
|
||||
* Update viewer or/and object browser etc. in accordance with update flags ( see
|
||||
* SalomeApp_UpdateFlags enumeration ).
|
||||
* SalomeApp_UpdateFlags enumeration ).
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI::update( const int flags )
|
||||
@ -3024,8 +3022,8 @@ void SMESHGUI::onOperationAborted( SUIT_Operation* )
|
||||
* \param id - identifier of operation to be started
|
||||
* \return Pointer on created operation or NULL if operation is not created
|
||||
*
|
||||
* Virtual method redefined from the base class creates operation with given id.
|
||||
* It is called called automatically from startOperation method of base class.
|
||||
* Virtual method redefined from the base class creates operation with given id.
|
||||
* It is called called automatically from startOperation method of base class.
|
||||
*/
|
||||
//================================================================================
|
||||
SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
||||
@ -3046,14 +3044,6 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,535 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_AddSubMeshDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_AddSubMeshDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_Operation.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOMEDS_SObject.hxx"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "SalomeApp_Tools.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace SMESH {
|
||||
SMESH::SMESH_subMesh_var AddSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
||||
GEOM::GEOM_Object_ptr theShapeObject,
|
||||
const char* theMeshName)
|
||||
{
|
||||
SMESH::SMESH_subMesh_var aSubMesh;
|
||||
try {
|
||||
if (!theMesh->_is_nil() && !theShapeObject->_is_nil())
|
||||
aSubMesh = theMesh->GetSubMesh(theShapeObject, theMeshName);
|
||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
return aSubMesh._retn();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_AddSubMeshDlg()
|
||||
// purpose : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( SMESHGUI* theModule, const char* name,
|
||||
bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
if (!name)
|
||||
setName("SMESHGUI_AddSubMeshDlg");
|
||||
setCaption(tr("SMESH_ADD_SUBMESH"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_AddSubMeshDlgLayout->setSpacing(6);
|
||||
SMESHGUI_AddSubMeshDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox (tr("SMESH_ARGUMENTS"), this, "GroupC1");
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
||||
GroupC1->layout()->setSpacing(0);
|
||||
GroupC1->layout()->setMargin(0);
|
||||
QGridLayout* GroupC1Layout = new QGridLayout (GroupC1->layout());
|
||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
||||
GroupC1Layout->setSpacing(6);
|
||||
GroupC1Layout->setMargin(11);
|
||||
|
||||
TextLabel_NameMesh = new QLabel (tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
|
||||
GroupC1Layout->addWidget(TextLabel_NameMesh, 0, 0);
|
||||
LineEdit_NameMesh = new QLineEdit (GroupC1, "LineEdit_NameMesh");
|
||||
GroupC1Layout->addWidget(LineEdit_NameMesh, 0, 2);
|
||||
|
||||
TextLabelC1A1 = new QLabel (tr("SMESH_OBJECT_MESH"), GroupC1, "TextLabelC1A1");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1, 1, 0);
|
||||
SelectButtonC1A1 = new QPushButton (GroupC1, "SelectButtonC1A1");
|
||||
SelectButtonC1A1->setPixmap(image0);
|
||||
SelectButtonC1A1->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1, 1, 1);
|
||||
LineEditC1A1 = new QLineEdit (GroupC1, "LineEditC1A1");
|
||||
LineEditC1A1->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 1, 2);
|
||||
|
||||
TextLabelC1A2 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A2");
|
||||
GroupC1Layout->addWidget(TextLabelC1A2, 2, 0);
|
||||
SelectButtonC1A2 = new QPushButton(GroupC1, "SelectButtonC1A2");
|
||||
SelectButtonC1A2->setPixmap(image0);
|
||||
SelectButtonC1A2->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A2, 2, 1);
|
||||
LineEditC1A2 = new QLineEdit(GroupC1, "LineEditC1A2");
|
||||
LineEditC1A2->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A2, 2, 2);
|
||||
|
||||
TextLabelC1A1Hyp = new QLabel(tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, "TextLabelC1A1Hyp");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Hyp, 3, 0);
|
||||
SelectButtonC1A1Hyp = new QPushButton(GroupC1, "SelectButtonC1A1Hyp");
|
||||
SelectButtonC1A1Hyp->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Hyp, 3, 1);
|
||||
LineEditC1A1Hyp = new QLineEdit(GroupC1, "LineEditC1A1Hyp");
|
||||
LineEditC1A1Hyp->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Hyp, 3, 2);
|
||||
|
||||
TextLabelC1A1Algo = new QLabel(tr("SMESH_OBJECT_ALGORITHM"), GroupC1, "TextLabelC1A1Algo");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Algo, 4, 0);
|
||||
SelectButtonC1A1Algo = new QPushButton(GroupC1, "SelectButtonC1A1Algo");
|
||||
SelectButtonC1A1Algo->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Algo, 4, 1);
|
||||
LineEditC1A1Algo = new QLineEdit(GroupC1, "LineEditC1A1Algo");
|
||||
LineEditC1A1Algo->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Algo, 4, 2);
|
||||
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupC1, 1, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
|
||||
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
|
||||
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
|
||||
buttonApply->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
||||
|
||||
GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
|
||||
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_AddSubMeshDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::Init ()
|
||||
{
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
//myGeomFilter = new SALOME_TypeFilter("GEOM");
|
||||
TColStd_MapOfInteger allTypesMap;
|
||||
for (int i = 0; i < 10; i++)
|
||||
allTypesMap.Add(i);
|
||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
||||
myMeshFilter = new SMESH_TypeFilter (MESH);
|
||||
myAlgorithmFilter = new SMESH_TypeFilter (ALGORITHM);
|
||||
myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect(SelectButtonC1A1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Hyp, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Algo, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
LineEdit_NameMesh->setText(tr("SMESH_SUBMESH"));
|
||||
LineEdit_NameMesh->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::ClickOnOk()
|
||||
{
|
||||
if (this->ClickOnApply())
|
||||
this->ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
|
||||
if (myNameSubMesh.isEmpty()) {
|
||||
SUIT_MessageBox::warn1(this, tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_EMPTY_NAME"), tr("SMESH_BUT_OK"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (myMesh->_is_nil() || myGeomShape->_is_nil() ||
|
||||
(!HypoList.count() && !AlgoList.count()))
|
||||
return false;
|
||||
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
if (myMainShape->_is_nil())
|
||||
return false;
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
SUIT_Operation* op =
|
||||
new SUIT_Operation (SUIT_Session::session()->activeApplication());
|
||||
|
||||
// start transaction
|
||||
op->start();
|
||||
|
||||
// create submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh(myMesh, myGeomShape, myNameSubMesh);
|
||||
int nbSuccess = 0;
|
||||
|
||||
if (!aSubMesh->_is_nil()) {
|
||||
// assign hypotheses
|
||||
int nbAlgo = AlgoList.count();
|
||||
int nbHyps = HypoList.count() + nbAlgo;
|
||||
for (int i = 0; i < nbHyps; i++) {
|
||||
_PTR(SObject) aHypSOClient =
|
||||
SMESH::GetActiveStudyDocument()->FindObjectID
|
||||
(i < nbAlgo ? AlgoList[i].latin1() : HypoList[i-nbAlgo].latin1());
|
||||
if (aHypSOClient) {
|
||||
CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
|
||||
if (!CORBA::is_nil(anObject)) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
|
||||
if (!aHyp->_is_nil())
|
||||
if (SMESH::AddHypothesisOnSubMesh(aSubMesh, aHyp))
|
||||
nbSuccess++;
|
||||
} else {
|
||||
SCRUTE(CORBA::is_nil(anObject));
|
||||
}
|
||||
} else {
|
||||
SCRUTE(!aHypSOClient);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SCRUTE(aSubMesh->_is_nil());
|
||||
}
|
||||
|
||||
// commit transaction
|
||||
op->commit();
|
||||
mySMESHGUI->updateObjBrowser();
|
||||
return (nbSuccess > 0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : IsFatherOf()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
static bool IsFatherOf (_PTR(SObject) SO, _PTR(SObject) fatherSO)
|
||||
{
|
||||
if (SO && fatherSO) {
|
||||
_PTR(SObject) aSO = SO->GetFather();
|
||||
//while (strlen(aSO->GetID()) >= strlen(fatherSO->GetID())) {
|
||||
while (aSO->GetID().length() >= fatherSO->GetID().length()) {
|
||||
//if (QString(aSO->GetID()) == QString(fatherSO->GetID()))
|
||||
if (aSO->GetID() == fatherSO->GetID())
|
||||
return true;
|
||||
aSO = aSO->GetFather();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
|
||||
{
|
||||
QString aString = "";
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (myEditCurrentArgument == LineEditC1A1) {
|
||||
// mesh
|
||||
if (nbSel != 1) {
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
aString = "";
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
if (myMesh->_is_nil()) {
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
LineEditC1A2->setText("");
|
||||
|
||||
} else if (myEditCurrentArgument == LineEditC1A2) {
|
||||
// geom shape
|
||||
if (nbSel != 1) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
|
||||
if (myGeomShape->_is_nil() || !GEOMBase::IsShape(myGeomShape)) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
if (!myMesh->_is_nil()) {
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
_PTR(SObject) aMainGeomShapeSO = SMESH::FindSObject(aMainGeomShape);
|
||||
if (!aMainGeomShapeSO ||
|
||||
!IsFatherOf(SMESH::GetActiveStudyDocument()->FindObjectID
|
||||
(IO->getEntry()), aMainGeomShapeSO)) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Hyp) {
|
||||
// hypotheses
|
||||
HypoList.clear();
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
HypoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Hypothesis").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Algo) {
|
||||
// algorithms
|
||||
AlgoList.clear();
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
AlgoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Algorithms").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myEditCurrentArgument->setCursorPosition( 0 );
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
} else if (send == SelectButtonC1A2) {
|
||||
LineEditC1A2->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
myEditCurrentArgument = LineEditC1A2;
|
||||
} else if(send == SelectButtonC1A1Hyp) {
|
||||
LineEditC1A1Hyp->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myHypothesisFilter);
|
||||
myEditCurrentArgument = LineEditC1A1Hyp;
|
||||
} else if(send == SelectButtonC1A1Algo) {
|
||||
LineEditC1A1Algo->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myAlgorithmFilter);
|
||||
myEditCurrentArgument = LineEditC1A1Algo;
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if (GroupC1->isEnabled()) {
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
|
||||
{
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if (!GroupC1->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::closeEvent (QCloseEvent* e)
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
mySelectionMgr->clearFilters();
|
||||
QDialog::closeEvent(e);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : UpdateControlState()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::UpdateControlState()
|
||||
{
|
||||
bool isEnabled = (!myMesh->_is_nil() &&
|
||||
!myGeomShape->_is_nil() &&
|
||||
(HypoList.count() || AlgoList.count()));
|
||||
bool isImportedMesh = false;
|
||||
if (!myMesh->_is_nil()) {
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
isImportedMesh = myGeomShape->_is_nil();
|
||||
}
|
||||
|
||||
buttonOk ->setEnabled(isEnabled && !isImportedMesh);
|
||||
buttonApply->setEnabled(isEnabled && !isImportedMesh);
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_AddSubMeshDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_ADD_SUBMESH_H
|
||||
#define DIALOGBOX_ADD_SUBMESH_H
|
||||
|
||||
//#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class SMESHGUI;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_AddSubMeshDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_AddSubMeshDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_AddSubMeshDlg( SMESHGUI*,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~SMESHGUI_AddSubMeshDlg();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent* e);
|
||||
void enterEvent (QEvent *) ;
|
||||
|
||||
private:
|
||||
void Init ();
|
||||
|
||||
void UpdateControlState();
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
GEOM::GEOM_Object_var myGeomShape;
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
|
||||
//Handle(SALOME_TypeFilter) myMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) myHypothesisFilter;
|
||||
//Handle(SMESH_TypeFilter) myAlgorithmFilter;
|
||||
SUIT_SelectionFilter* myGeomFilter;
|
||||
SUIT_SelectionFilter* myMeshFilter;
|
||||
SUIT_SelectionFilter* myHypothesisFilter;
|
||||
SUIT_SelectionFilter* myAlgorithmFilter;
|
||||
|
||||
QStringList HypoList;
|
||||
QStringList AlgoList;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonApply;
|
||||
QPushButton* buttonCancel;
|
||||
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabel_NameMesh;
|
||||
QLineEdit* LineEdit_NameMesh;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
QLabel* TextLabelC1A2;
|
||||
QPushButton* SelectButtonC1A2;
|
||||
QLineEdit* LineEditC1A2;
|
||||
|
||||
QLabel* TextLabelC1A1Hyp;
|
||||
QPushButton* SelectButtonC1A1Hyp;
|
||||
QLineEdit* LineEditC1A1Hyp;
|
||||
|
||||
QLabel* TextLabelC1A1Algo;
|
||||
QPushButton* SelectButtonC1A1Algo;
|
||||
QLineEdit* LineEditC1A1Algo;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_ADD_SUBMESH_H
|
@ -1,498 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_InitMeshDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_InitMeshDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_Operation.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOMEDS_SObject.hxx"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "SalomeApp_Tools.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace SMESH {
|
||||
SMESH::SMESH_Mesh_var InitMesh (GEOM::GEOM_Object_ptr theShapeObject,
|
||||
const char* theMeshName)
|
||||
{
|
||||
SMESH::SMESH_Mesh_var aMesh;
|
||||
try {
|
||||
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
|
||||
if (!aSMESHGen->_is_nil() && !theShapeObject->_is_nil()) {
|
||||
aMesh = aSMESHGen->CreateMesh(theShapeObject);
|
||||
if (!aMesh->_is_nil()) {
|
||||
_PTR(SObject) aMeshSObject = SMESH::FindSObject(aMesh.in());
|
||||
SMESH::SetName(aMeshSObject, theMeshName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
return aMesh._retn();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_InitMeshDlg()
|
||||
// purpose : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg (SMESHGUI* theModule, const char* name,
|
||||
bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
if (!name)
|
||||
setName("SMESHGUI_InitMeshDlg");
|
||||
|
||||
setCaption(tr("SMESH_INIT_MESH"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* SMESHGUI_InitMeshDlgLayout = new QGridLayout (this);
|
||||
SMESHGUI_InitMeshDlgLayout->setSpacing(6);
|
||||
SMESHGUI_InitMeshDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox(tr("SMESH_ARGUMENTS"), this, "GroupC1");
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
||||
GroupC1->layout()->setSpacing(0);
|
||||
GroupC1->layout()->setMargin(0);
|
||||
QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
|
||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
||||
GroupC1Layout->setSpacing(6);
|
||||
GroupC1Layout->setMargin(11);
|
||||
|
||||
TextLabel_NameMesh = new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
|
||||
GroupC1Layout->addWidget(TextLabel_NameMesh, 0, 0);
|
||||
LineEdit_NameMesh = new QLineEdit(GroupC1, "LineEdit_NameMesh");
|
||||
GroupC1Layout->addWidget(LineEdit_NameMesh, 0, 2);
|
||||
|
||||
TextLabelC1A1 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A1");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1, 1, 0);
|
||||
SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
|
||||
SelectButtonC1A1->setPixmap(image0);
|
||||
SelectButtonC1A1->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1, 1, 1);
|
||||
LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
|
||||
LineEditC1A1->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 1, 2);
|
||||
|
||||
TextLabelC1A1Hyp = new QLabel(tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, "TextLabelC1A1Hyp");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Hyp, 2, 0);
|
||||
SelectButtonC1A1Hyp = new QPushButton(GroupC1, "SelectButtonC1A1Hyp");
|
||||
SelectButtonC1A1Hyp->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Hyp, 2, 1);
|
||||
LineEditC1A1Hyp = new QLineEdit(GroupC1, "LineEditC1A1Hyp");
|
||||
LineEditC1A1Hyp->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Hyp, 2, 2);
|
||||
|
||||
TextLabelC1A1Algo = new QLabel(tr("SMESH_OBJECT_ALGORITHM"), GroupC1, "TextLabelC1A1Algo");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Algo, 3, 0);
|
||||
SelectButtonC1A1Algo = new QPushButton(GroupC1, "SelectButtonC1A1Algo");
|
||||
SelectButtonC1A1Algo->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Algo, 3, 1);
|
||||
LineEditC1A1Algo = new QLineEdit(GroupC1, "LineEditC1A1Algo");
|
||||
LineEditC1A1Algo->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Algo, 3, 2);
|
||||
|
||||
SMESHGUI_InitMeshDlgLayout->addWidget(GroupC1, 1, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
|
||||
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
|
||||
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
|
||||
buttonApply->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
||||
|
||||
GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
|
||||
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
|
||||
SMESHGUI_InitMeshDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_InitMeshDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_InitMeshDlg::~SMESHGUI_InitMeshDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::Init ()
|
||||
{
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
//myGeomFilter = new SALOME_TypeFilter("GEOM");
|
||||
TColStd_MapOfInteger allTypesMap;
|
||||
for (int i = 0; i < 10; i++)
|
||||
allTypesMap.Add(i);
|
||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
||||
myAlgorithmFilter = new SMESH_TypeFilter (ALGORITHM);
|
||||
myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect(SelectButtonC1A1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Hyp, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Algo, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
LineEdit_NameMesh->setText(GetDefaultMeshName());
|
||||
LineEdit_NameMesh->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
|
||||
SelectionIntoArgument();
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::ClickOnOk()
|
||||
{
|
||||
if (this->ClickOnApply())
|
||||
this->ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_InitMeshDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
QString myNameMesh = LineEdit_NameMesh->text().stripWhiteSpace();
|
||||
if (myNameMesh.isEmpty()) {
|
||||
SUIT_MessageBox::warn1(this, tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_EMPTY_NAME"), tr("SMESH_BUT_OK"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (myGeomShape->_is_nil() || !HypoList.count() || !AlgoList.count())
|
||||
return false;
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
SUIT_Operation* op =
|
||||
new SUIT_Operation (SUIT_Session::session()->activeApplication());
|
||||
|
||||
// start transaction
|
||||
op->start();
|
||||
|
||||
// create mesh
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::InitMesh(myGeomShape, myNameMesh);
|
||||
|
||||
if (!aMesh->_is_nil()) {
|
||||
// assign hypotheses
|
||||
for (int i = 0; i < HypoList.count(); i++) {
|
||||
_PTR(SObject) aHypSOClient =
|
||||
SMESH::GetActiveStudyDocument()->FindObjectID(HypoList[i].latin1());
|
||||
if (aHypSOClient) {
|
||||
CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
|
||||
if (!CORBA::is_nil(anObject)) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::AddHypothesisOnMesh(aMesh, aHyp)) {
|
||||
// abort transaction
|
||||
// op->abort();
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// assign algorithms
|
||||
for (int i = 0; i < AlgoList.count(); i++) {
|
||||
_PTR(SObject) aHypSOClient =
|
||||
SMESH::GetActiveStudyDocument()->FindObjectID(AlgoList[i].latin1());
|
||||
if (aHypSOClient) {
|
||||
CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
|
||||
if (!CORBA::is_nil(anObject)) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::AddHypothesisOnMesh(aMesh, aHyp)) {
|
||||
// abort transaction
|
||||
// op->abort();
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// commit transaction
|
||||
op->commit();
|
||||
mySMESHGUI->updateObjBrowser();
|
||||
LineEdit_NameMesh->setText(GetDefaultMeshName());
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::ClickOnCancel()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::SelectionIntoArgument()
|
||||
{
|
||||
QString aString = "";
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (myEditCurrentArgument == LineEditC1A1) {
|
||||
// geom shape
|
||||
if (nbSel != 1) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
|
||||
if (myGeomShape->_is_nil() || !GEOMBase::IsShape(myGeomShape)) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Hyp) {
|
||||
// hypotheses
|
||||
HypoList.clear();
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
HypoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Hypothesis").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Algo) {
|
||||
// algorithms
|
||||
AlgoList.clear();
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
AlgoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Algorithms").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aString);
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if (send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
} else if (send == SelectButtonC1A1Hyp) {
|
||||
LineEditC1A1Hyp->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1Hyp;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myHypothesisFilter);
|
||||
} else if (send == SelectButtonC1A1Algo) {
|
||||
LineEditC1A1Algo->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1Algo;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myAlgorithmFilter);
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if (GroupC1->isEnabled()) {
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::ActivateThisDialog()
|
||||
{
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::enterEvent (QEvent* e)
|
||||
{
|
||||
if (!GroupC1->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::closeEvent (QCloseEvent* e)
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
mySelectionMgr->clearFilters();
|
||||
QDialog::closeEvent(e);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : UpdateControlState()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_InitMeshDlg::UpdateControlState()
|
||||
{
|
||||
bool isEnabled = (!myGeomShape->_is_nil() && HypoList.count() && AlgoList.count());
|
||||
|
||||
buttonOk ->setEnabled(isEnabled);
|
||||
buttonApply->setEnabled(isEnabled);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetDefaultMeshName()
|
||||
// purpose : Generates default mesh name(Mesh_1, Mesh_2, etc.)
|
||||
//=================================================================================
|
||||
QString SMESHGUI_InitMeshDlg::GetDefaultMeshName()
|
||||
{
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
int aNumber = 0;
|
||||
QString aMeshName;
|
||||
_PTR(SObject) obj;
|
||||
|
||||
do {
|
||||
aMeshName = QString(tr("SMESH_OBJECT_MESH")) + "_" + QString::number(++aNumber);
|
||||
obj = aStudy->FindObject(aMeshName.latin1());
|
||||
} while (obj);
|
||||
|
||||
return aMeshName;
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_InitMeshDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_INIT_MESH_H
|
||||
#define DIALOGBOX_INIT_MESH_H
|
||||
|
||||
//#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Gen)
|
||||
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class SMESHGUI;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_InitMeshDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_InitMeshDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_InitMeshDlg ( SMESHGUI*,
|
||||
const char* = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0 );
|
||||
~SMESHGUI_InitMeshDlg();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent( QEvent * ) ;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
void UpdateControlState();
|
||||
QString SMESHGUI_InitMeshDlg::GetDefaultMeshName();
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
|
||||
GEOM::GEOM_Object_var myGeomShape;
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
|
||||
//Handle(SALOME_TypeFilter) myGeomFilter;
|
||||
SUIT_SelectionFilter* myGeomFilter;
|
||||
//SMESH_TypeFilter* myHypothesisFilter;
|
||||
//SMESH_TypeFilter* myAlgorithmFilter;
|
||||
SUIT_SelectionFilter* myHypothesisFilter;
|
||||
SUIT_SelectionFilter* myAlgorithmFilter;
|
||||
|
||||
QStringList HypoList;
|
||||
QStringList AlgoList;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabel_NameMesh;
|
||||
QLineEdit* LineEdit_NameMesh;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
|
||||
QLabel* TextLabelC1A1Hyp;
|
||||
QPushButton* SelectButtonC1A1Hyp;
|
||||
QLineEdit* LineEditC1A1Hyp;
|
||||
|
||||
QLabel* TextLabelC1A1Algo;
|
||||
QPushButton* SelectButtonC1A1Algo;
|
||||
QLineEdit* LineEditC1A1Algo;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_INIT_MESH_H
|
Loading…
Reference in New Issue
Block a user