mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-13 03:14:33 +05:00
*** empty log message ***
This commit is contained in:
parent
c2e6b533c6
commit
709c3dba30
@ -60,6 +60,8 @@ LIB_SRC = SMESHGUI.cxx \
|
|||||||
SMESHGUI_SpinBox.cxx \
|
SMESHGUI_SpinBox.cxx \
|
||||||
SMESHGUI_NodesDlg.cxx \
|
SMESHGUI_NodesDlg.cxx \
|
||||||
SMESHGUI_NodesOp.cxx \
|
SMESHGUI_NodesOp.cxx \
|
||||||
|
SMESHGUI_AddMeshElementDlg.cxx \
|
||||||
|
SMESHGUI_AddMeshElementOp.cxx \
|
||||||
SMESHGUI_InitMeshDlg.cxx \
|
SMESHGUI_InitMeshDlg.cxx \
|
||||||
SMESHGUI_InitMeshOp.cxx \
|
SMESHGUI_InitMeshOp.cxx \
|
||||||
SMESHGUI_AddSubMeshDlg.cxx \
|
SMESHGUI_AddSubMeshDlg.cxx \
|
||||||
@ -77,7 +79,6 @@ LIB_SRC = SMESHGUI.cxx \
|
|||||||
SMESHGUI_aParameterDlg.cxx \
|
SMESHGUI_aParameterDlg.cxx \
|
||||||
SMESHGUI_Swig.cxx \
|
SMESHGUI_Swig.cxx \
|
||||||
SMESHGUI_MoveNodesDlg.cxx \
|
SMESHGUI_MoveNodesDlg.cxx \
|
||||||
SMESHGUI_AddMeshElementDlg.cxx \
|
|
||||||
SMESHGUI_EditHypothesesDlg.cxx \
|
SMESHGUI_EditHypothesesDlg.cxx \
|
||||||
SMESHGUI_EditHypothesesOp.cxx \
|
SMESHGUI_EditHypothesesOp.cxx \
|
||||||
SMESHGUI_CreateHypothesesDlg.cxx \
|
SMESHGUI_CreateHypothesesDlg.cxx \
|
||||||
@ -123,6 +124,8 @@ LIB_MOC = \
|
|||||||
SMESHGUI_CreatePatternDlg.h \
|
SMESHGUI_CreatePatternDlg.h \
|
||||||
SMESHGUI_NodesDlg.h \
|
SMESHGUI_NodesDlg.h \
|
||||||
SMESHGUI_NodesOp.h \
|
SMESHGUI_NodesOp.h \
|
||||||
|
SMESHGUI_AddMeshElementDlg.h \
|
||||||
|
SMESHGUI_AddMeshElementOp.h \
|
||||||
SMESHGUI_SpinBox.h \
|
SMESHGUI_SpinBox.h \
|
||||||
SMESHGUI_InitMeshDlg.h \
|
SMESHGUI_InitMeshDlg.h \
|
||||||
SMESHGUI_InitMeshOp.h \
|
SMESHGUI_InitMeshOp.h \
|
||||||
@ -140,7 +143,6 @@ LIB_MOC = \
|
|||||||
SMESHGUI_Preferences_SelectionDlg.h \
|
SMESHGUI_Preferences_SelectionDlg.h \
|
||||||
SMESHGUI_aParameterDlg.h \
|
SMESHGUI_aParameterDlg.h \
|
||||||
SMESHGUI_MoveNodesDlg.h \
|
SMESHGUI_MoveNodesDlg.h \
|
||||||
SMESHGUI_AddMeshElementDlg.h \
|
|
||||||
SMESHGUI_EditHypothesesDlg.h \
|
SMESHGUI_EditHypothesesDlg.h \
|
||||||
SMESHGUI_EditHypothesesOp.h \
|
SMESHGUI_EditHypothesesOp.h \
|
||||||
SMESHGUI_CreateHypothesesDlg.h \
|
SMESHGUI_CreateHypothesesDlg.h \
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "SMESHGUI.h"
|
#include "SMESHGUI.h"
|
||||||
#include "SMESHGUI_InitMeshOp.h"
|
#include "SMESHGUI_InitMeshOp.h"
|
||||||
#include "SMESHGUI_AddSubMeshOp.h"
|
#include "SMESHGUI_AddSubMeshOp.h"
|
||||||
#include "SMESHGUI_NodesDlg.h"
|
#include "SMESHGUI_NodesOp.h"
|
||||||
#include "SMESHGUI_TransparencyDlg.h"
|
#include "SMESHGUI_TransparencyDlg.h"
|
||||||
#include "SMESHGUI_ClippingDlg.h"
|
#include "SMESHGUI_ClippingDlg.h"
|
||||||
#include "SMESHGUI_GroupDlg.h"
|
#include "SMESHGUI_GroupDlg.h"
|
||||||
@ -41,14 +41,14 @@
|
|||||||
#include "SMESHGUI_Hypotheses.h"
|
#include "SMESHGUI_Hypotheses.h"
|
||||||
#include "SMESHGUI_HypothesesUtils.h"
|
#include "SMESHGUI_HypothesesUtils.h"
|
||||||
#include "SMESHGUI_MoveNodesDlg.h"
|
#include "SMESHGUI_MoveNodesDlg.h"
|
||||||
#include "SMESHGUI_AddMeshElementDlg.h"
|
#include "SMESHGUI_AddMeshElementOp.h"
|
||||||
#include "SMESHGUI_EditHypothesesDlg.h"
|
#include "SMESHGUI_EditHypothesesOp.h"
|
||||||
#include "SMESHGUI_CreateHypothesesDlg.h"
|
#include "SMESHGUI_CreateHypothesesDlg.h"
|
||||||
#include "SMESHGUI_FilterDlg.h"
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
#include "SMESHGUI_FilterLibraryDlg.h"
|
#include "SMESHGUI_FilterLibraryDlg.h"
|
||||||
#include "SMESHGUI_SingleEditDlg.h"
|
#include "SMESHGUI_SingleEditDlg.h"
|
||||||
#include "SMESHGUI_MultiEditDlg.h"
|
#include "SMESHGUI_MultiEditDlg.h"
|
||||||
#include "SMESHGUI_GroupOpDlg.h"
|
#include "SMESHGUI_GroupOp.h"
|
||||||
#include "SMESHGUI_DeleteGroupDlg.h"
|
#include "SMESHGUI_DeleteGroupDlg.h"
|
||||||
#include "SMESHGUI_SmoothingDlg.h"
|
#include "SMESHGUI_SmoothingDlg.h"
|
||||||
#include "SMESHGUI_RenumberingDlg.h"
|
#include "SMESHGUI_RenumberingDlg.h"
|
||||||
@ -1227,7 +1227,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 400: // NODES
|
case 400: // NODES
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
|
startOperation( 400 );
|
||||||
|
/*
|
||||||
if ( vtkwnd ) {
|
if ( vtkwnd ) {
|
||||||
EmitSignalDeactivateDialog();
|
EmitSignalDeactivateDialog();
|
||||||
|
|
||||||
@ -1238,7 +1239,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
tr("SMESH_WRN_WARNING"),
|
tr("SMESH_WRN_WARNING"),
|
||||||
tr("SMESH_WRN_VIEWER_VTK"),
|
tr("SMESH_WRN_VIEWER_VTK"),
|
||||||
tr("SMESH_BUT_OK"));
|
tr("SMESH_BUT_OK"));
|
||||||
}
|
} */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1393,24 +1394,21 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 704: // EDIT Hypothesis
|
case 704: // EDIT Hypothesis
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
EmitSignalDeactivateDialog();
|
startOperation( 704 );
|
||||||
new SMESHGUI_EditHypothesesDlg( this );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 705: // EDIT Global Hypothesis
|
case 705: // EDIT Global Hypothesis
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
EmitSignalDeactivateDialog();
|
startOperation( 704 );
|
||||||
new SMESHGUI_EditHypothesesDlg( this );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 706: // EDIT Local Hypothesis
|
case 706: // EDIT Local Hypothesis
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
EmitSignalDeactivateDialog();
|
startOperation( 704 );
|
||||||
new SMESHGUI_EditHypothesesDlg( this );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,9 +1436,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
*/
|
*/
|
||||||
EmitSignalDeactivateDialog();
|
EmitSignalDeactivateDialog();
|
||||||
if ( theCommandID == 407 )
|
if ( theCommandID == 407 )
|
||||||
new SMESHGUI_TrianglesInversionDlg(this);
|
startOperation( 407 );
|
||||||
else
|
else
|
||||||
new SMESHGUI_UnionOfTwoTrianglesDlg(this);
|
startOperation( 408 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 409: // Change orientation
|
case 409: // Change orientation
|
||||||
@ -1694,24 +1692,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 811: // Intersect groups
|
case 811: // Intersect groups
|
||||||
case 812: // Cut groups
|
case 812: // Cut groups
|
||||||
{
|
{
|
||||||
if ( !vtkwnd )
|
if( !checkLock( aStudy ) )
|
||||||
{
|
startOperation( theCommandID );
|
||||||
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
|
|
||||||
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( checkLock( aStudy ) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
EmitSignalDeactivateDialog();
|
|
||||||
|
|
||||||
int aMode;
|
|
||||||
if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
|
|
||||||
else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
|
|
||||||
else aMode = SMESHGUI_GroupOpDlg::CUT;
|
|
||||||
|
|
||||||
( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2003,7 +1985,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 4032: // HEXA
|
case 4032: // HEXA
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
if ( vtkwnd ) {
|
startOperation( theCommandID );
|
||||||
|
/* if ( vtkwnd ) {
|
||||||
EmitSignalDeactivateDialog();
|
EmitSignalDeactivateDialog();
|
||||||
SMDSAbs_ElementType type = SMDSAbs_Edge;
|
SMDSAbs_ElementType type = SMDSAbs_Edge;
|
||||||
int nbNodes = 2;
|
int nbNodes = 2;
|
||||||
@ -2028,7 +2011,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
SUIT_MessageBox::warn1(desktop(),
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
||||||
tr("SMESH_BUT_OK"));
|
tr("SMESH_BUT_OK"));
|
||||||
}
|
}*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4033: // POLYHEDRON
|
case 4033: // POLYHEDRON
|
||||||
@ -3309,6 +3292,34 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
|||||||
SalomeApp_Operation* op = 0;
|
SalomeApp_Operation* op = 0;
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
case 400:
|
||||||
|
op = new SMESHGUI_NodesOp();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 401:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Edge, 2 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4021:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Face, 3 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4022:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Face, 4 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4023:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Face, 5 ); // 5 - identificator for POLYGON
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4031:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Volume, 4 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4032:
|
||||||
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Volume, 8 );
|
||||||
|
break;
|
||||||
|
|
||||||
case 702:
|
case 702:
|
||||||
op = new SMESHGUI_AddSubMeshOp();
|
op = new SMESHGUI_AddSubMeshOp();
|
||||||
break;
|
break;
|
||||||
@ -3317,6 +3328,22 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
|||||||
op = new SMESHGUI_InitMeshOp();
|
op = new SMESHGUI_InitMeshOp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 704:
|
||||||
|
op = new SMESHGUI_EditHypothesesOp();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 810:
|
||||||
|
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::UNION );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 811:
|
||||||
|
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::INTERSECT );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 812:
|
||||||
|
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::CUT );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
op = SalomeApp_Module::createOperation( id );
|
op = SalomeApp_Module::createOperation( id );
|
||||||
break;
|
break;
|
||||||
|
@ -27,269 +27,53 @@
|
|||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#include "SMESHGUI_AddMeshElementDlg.h"
|
#include "SMESHGUI_AddMeshElementDlg.h"
|
||||||
|
#include <SMESHGUI_Operation.h>
|
||||||
|
|
||||||
#include "SMESHGUI.h"
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include "SMESHGUI_Utils.h"
|
|
||||||
#include "SMESHGUI_VTKUtils.h"
|
|
||||||
#include "SMESHGUI_MeshUtils.h"
|
|
||||||
#include "SMESHGUI_IdValidator.h"
|
|
||||||
#include "SMESH_ActorUtils.h"
|
|
||||||
|
|
||||||
#include "SMDS_Mesh.hxx"
|
#include <SMDSAbs_ElementType.hxx>
|
||||||
#include "SMESH_Actor.h"
|
|
||||||
|
|
||||||
#include "SUIT_Session.h"
|
|
||||||
|
|
||||||
#include "SVTK_Selection.h"
|
|
||||||
#include "SVTK_Selector.h"
|
|
||||||
#include "SALOME_ListIO.hxx"
|
|
||||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
|
||||||
|
|
||||||
#include "SalomeApp_Study.h"
|
|
||||||
#include "SalomeApp_Application.h"
|
|
||||||
|
|
||||||
#include "SVTK_ViewModel.h"
|
|
||||||
#include "SVTK_ViewWindow.h"
|
|
||||||
|
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
// OCCT Includes
|
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
// VTK Includes
|
|
||||||
#include <vtkCell.h>
|
|
||||||
#include <vtkIdList.h>
|
|
||||||
#include <vtkIntArray.h>
|
|
||||||
#include <vtkCellArray.h>
|
|
||||||
#include <vtkUnsignedCharArray.h>
|
|
||||||
#include <vtkUnstructuredGrid.h>
|
|
||||||
#include <vtkDataSetMapper.h>
|
|
||||||
|
|
||||||
// QT Includes
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
#include <qvariant.h>
|
#include <qgroupbox.h>
|
||||||
#include <qtooltip.h>
|
#include <qbuttongroup.h>
|
||||||
#include <qwhatsthis.h>
|
#include <qradiobutton.h>
|
||||||
#include <qimage.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qregexp.h>
|
|
||||||
|
|
||||||
// STL includes
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace SMESH {
|
|
||||||
|
|
||||||
class TElementSimulation {
|
|
||||||
SalomeApp_Application* myApplication;
|
|
||||||
SUIT_ViewWindow* myViewWindow;
|
|
||||||
SVTK_ViewWindow* myVTKViewWindow;
|
|
||||||
|
|
||||||
SALOME_Actor* myPreviewActor;
|
|
||||||
vtkDataSetMapper* myMapper;
|
|
||||||
vtkUnstructuredGrid* myGrid;
|
|
||||||
|
|
||||||
public:
|
|
||||||
TElementSimulation (SalomeApp_Application* theApplication)
|
|
||||||
{
|
|
||||||
myApplication = theApplication;
|
|
||||||
SUIT_ViewManager* mgr = theApplication->activeViewManager();
|
|
||||||
if (!mgr) return;
|
|
||||||
myViewWindow = mgr->getActiveView();
|
|
||||||
myVTKViewWindow = GetVtkViewWindow(myViewWindow);
|
|
||||||
|
|
||||||
myGrid = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
// Create and display actor
|
|
||||||
myMapper = vtkDataSetMapper::New();
|
|
||||||
myMapper->SetInput(myGrid);
|
|
||||||
|
|
||||||
myPreviewActor = SALOME_Actor::New();
|
|
||||||
myPreviewActor->PickableOff();
|
|
||||||
myPreviewActor->VisibilityOff();
|
|
||||||
myPreviewActor->SetMapper(myMapper);
|
|
||||||
|
|
||||||
float anRGB[3];
|
|
||||||
vtkProperty* aProp = vtkProperty::New();
|
|
||||||
GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
|
|
||||||
aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
|
|
||||||
myPreviewActor->SetProperty( aProp );
|
|
||||||
aProp->Delete();
|
|
||||||
|
|
||||||
vtkProperty* aBackProp = vtkProperty::New();
|
|
||||||
GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
|
|
||||||
aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
|
|
||||||
myPreviewActor->SetBackfaceProperty( aBackProp );
|
|
||||||
aBackProp->Delete();
|
|
||||||
|
|
||||||
myVTKViewWindow->AddActor(myPreviewActor);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::vector<vtkIdType> TVTKIds;
|
|
||||||
void SetPosition (SMESH_Actor* theActor,
|
|
||||||
vtkIdType theType,
|
|
||||||
const TVTKIds& theIds)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
|
|
||||||
myGrid->SetPoints(aGrid->GetPoints());
|
|
||||||
|
|
||||||
const int* aConn = NULL;
|
|
||||||
switch (theType) {
|
|
||||||
case VTK_TETRA:
|
|
||||||
{
|
|
||||||
static int anIds[] = {0,2,1,3};
|
|
||||||
aConn = anIds;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VTK_PYRAMID:
|
|
||||||
{
|
|
||||||
static int anIds[] = {0,3,2,1,4};
|
|
||||||
aConn = anIds;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VTK_HEXAHEDRON:
|
|
||||||
{
|
|
||||||
static int anIds[] = {0,3,2,1,4,7,6,5};
|
|
||||||
aConn = anIds;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myGrid->Reset();
|
|
||||||
vtkIdList *anIds = vtkIdList::New();
|
|
||||||
|
|
||||||
if(aConn)
|
|
||||||
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
|
|
||||||
anIds->InsertId(i,theIds[aConn[i]]);
|
|
||||||
else
|
|
||||||
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
|
|
||||||
anIds->InsertId(i,theIds[i]);
|
|
||||||
|
|
||||||
myGrid->InsertNextCell(theType,anIds);
|
|
||||||
anIds->Delete();
|
|
||||||
|
|
||||||
myGrid->Modified();
|
|
||||||
|
|
||||||
SetVisibility(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SetVisibility (bool theVisibility)
|
|
||||||
{
|
|
||||||
myPreviewActor->SetVisibility(theVisibility);
|
|
||||||
RepaintCurrentView();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
~TElementSimulation()
|
|
||||||
{
|
|
||||||
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
|
||||||
myVTKViewWindow->RemoveActor(myPreviewActor);
|
|
||||||
}
|
|
||||||
myPreviewActor->Delete();
|
|
||||||
|
|
||||||
myMapper->RemoveAllInputs();
|
|
||||||
myMapper->Delete();
|
|
||||||
|
|
||||||
myGrid->Delete();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SMESHGUI_AddMeshElementDlg()
|
// function : SMESHGUI_AddMeshElementDlg()
|
||||||
// purpose : constructor
|
// purpose : constructor
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
|
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( const QString& elemName, const bool reverse )
|
||||||
const char* name,
|
: SMESHGUI_Dialog()
|
||||||
SMDSAbs_ElementType ElementType, int nbNodes,
|
|
||||||
bool modal, WFlags fl)
|
|
||||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
|
||||||
WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
|
||||||
mySMESHGUI( theModule ),
|
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
|
||||||
myViewWindow( SMESH::GetViewWindow( theModule ) ),
|
|
||||||
mySelector( myViewWindow->GetSelector() )
|
|
||||||
{
|
{
|
||||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
|
|
||||||
(SUIT_Session::session()->activeApplication());
|
|
||||||
myIsPoly = false;
|
|
||||||
mySimulation = new SMESH::TElementSimulation (anApp);
|
|
||||||
|
|
||||||
// verify nb nodes and type
|
|
||||||
myNbNodes = nbNodes;
|
|
||||||
myElementType = ElementType;
|
|
||||||
switch (ElementType) {
|
|
||||||
case SMDSAbs_Face:
|
|
||||||
// if (myNbNodes != 3 && myNbNodes != 4)
|
|
||||||
// myNbNodes = 3;
|
|
||||||
// break;
|
|
||||||
case SMDSAbs_Volume:
|
|
||||||
// if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
|
|
||||||
// myNbNodes = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
myElementType = SMDSAbs_Edge;
|
|
||||||
myNbNodes = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString elemName;
|
|
||||||
if (myNbNodes == 2)
|
|
||||||
elemName = "EDGE";
|
|
||||||
else if (myNbNodes == 3)
|
|
||||||
elemName = "TRIANGLE";
|
|
||||||
else if (myNbNodes == 4)
|
|
||||||
if (myElementType == SMDSAbs_Face)
|
|
||||||
elemName = "QUADRANGLE";
|
|
||||||
else
|
|
||||||
elemName = "TETRAS";
|
|
||||||
else if (myNbNodes == 8)
|
|
||||||
elemName = "HEXAS";
|
|
||||||
else if (myElementType == SMDSAbs_Face){
|
|
||||||
elemName = "POLYGON";
|
|
||||||
myIsPoly = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
|
QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
|
||||||
QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
|
QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
|
||||||
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
|
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
|
||||||
QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
|
QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
|
||||||
|
|
||||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
|
QPixmap image0 ( resMgr()->loadPixmap("SMESH", iconName));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
QPixmap image1 ( resMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||||
|
|
||||||
if (!name)
|
setName("SMESHGUI_AddMeshElementDlg");
|
||||||
setName("SMESHGUI_AddMeshElementDlg");
|
|
||||||
resize(303, 185);
|
resize(303, 185);
|
||||||
setCaption(caption);
|
setCaption(caption);
|
||||||
|
|
||||||
setSizeGripEnabled(TRUE);
|
setSizeGripEnabled(TRUE);
|
||||||
SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
|
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
||||||
SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
|
|
||||||
SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupConstructors = new QButtonGroup(this, "GroupConstructors");
|
QButtonGroup* GroupConstructors = new QButtonGroup(mainFrame(), "GroupConstructors");
|
||||||
GroupConstructors->setTitle(buttonGrTitle);
|
GroupConstructors->setTitle(buttonGrTitle);
|
||||||
|
|
||||||
GroupConstructors->setExclusive(TRUE);
|
GroupConstructors->setExclusive(TRUE);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||||
GroupConstructors->layout()->setSpacing(0);
|
GroupConstructors->layout()->setSpacing(0);
|
||||||
GroupConstructors->layout()->setMargin(0);
|
GroupConstructors->layout()->setMargin(0);
|
||||||
GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
|
QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
|
||||||
GroupConstructorsLayout->setAlignment(Qt::AlignTop);
|
GroupConstructorsLayout->setAlignment(Qt::AlignTop);
|
||||||
GroupConstructorsLayout->setSpacing(6);
|
GroupConstructorsLayout->setSpacing(6);
|
||||||
GroupConstructorsLayout->setMargin(11);
|
GroupConstructorsLayout->setMargin(11);
|
||||||
Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
|
QRadioButton* Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
|
||||||
Constructor1->setText(tr("" ));
|
Constructor1->setText(tr("" ));
|
||||||
Constructor1->setPixmap(image0);
|
Constructor1->setPixmap(image0);
|
||||||
Constructor1->setChecked(TRUE);
|
Constructor1->setChecked(TRUE);
|
||||||
@ -298,78 +82,32 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
|
|||||||
GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
|
GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
|
||||||
QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
GroupConstructorsLayout->addItem(spacer, 0, 1);
|
GroupConstructorsLayout->addItem(spacer, 0, 1);
|
||||||
SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0);
|
main->addWidget(GroupConstructors);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
QGroupBox* GroupC1 = new QGroupBox( mainFrame(), "GroupC1");
|
||||||
GroupButtons->setGeometry(QRect(10, 10, 281, 48));
|
|
||||||
GroupButtons->setTitle(tr("" ));
|
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
|
||||||
GroupButtons->layout()->setSpacing(0);
|
|
||||||
GroupButtons->layout()->setMargin(0);
|
|
||||||
GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
|
||||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
|
||||||
GroupButtonsLayout->setSpacing(6);
|
|
||||||
GroupButtonsLayout->setMargin(11);
|
|
||||||
buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
|
|
||||||
buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
|
|
||||||
buttonCancel->setAutoDefault(TRUE);
|
|
||||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
|
||||||
buttonApply = new QPushButton(GroupButtons, "buttonApply");
|
|
||||||
buttonApply->setText(tr("SMESH_BUT_APPLY" ));
|
|
||||||
buttonApply->setAutoDefault(TRUE);
|
|
||||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
||||||
GroupButtonsLayout->addItem(spacer_9, 0, 2);
|
|
||||||
buttonOk = new QPushButton(GroupButtons, "buttonOk");
|
|
||||||
buttonOk->setText(tr("SMESH_BUT_OK" ));
|
|
||||||
buttonOk->setAutoDefault(TRUE);
|
|
||||||
buttonOk->setDefault(TRUE);
|
|
||||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
|
||||||
SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
GroupC1 = new QGroupBox(this, "GroupC1");
|
|
||||||
GroupC1->setTitle(grBoxTitle);
|
GroupC1->setTitle(grBoxTitle);
|
||||||
|
|
||||||
GroupC1->setMinimumSize(QSize(0, 0));
|
GroupC1->setMinimumSize(QSize(0, 0));
|
||||||
GroupC1->setFrameShape(QGroupBox::Box);
|
GroupC1->setFrameShape(QGroupBox::Box);
|
||||||
GroupC1->setFrameShadow(QGroupBox::Sunken);
|
GroupC1->setFrameShadow(QGroupBox::Sunken);
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
GroupC1->setColumnLayout(3, Qt::Horizontal);
|
||||||
GroupC1->layout()->setSpacing(0);
|
|
||||||
GroupC1->layout()->setMargin(0);
|
|
||||||
GroupC1Layout = new QGridLayout(GroupC1->layout());
|
|
||||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
|
||||||
GroupC1Layout->setSpacing(6);
|
|
||||||
GroupC1Layout->setMargin(11);
|
|
||||||
TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
|
|
||||||
TextLabelC1A1->setText(tr("SMESH_ID_NODES" ));
|
|
||||||
TextLabelC1A1->setMinimumSize(QSize(50, 0));
|
|
||||||
TextLabelC1A1->setFrameShape(QLabel::NoFrame);
|
|
||||||
TextLabelC1A1->setFrameShadow(QLabel::Plain);
|
|
||||||
GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
|
|
||||||
SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
|
|
||||||
SelectButtonC1A1->setText(tr("" ));
|
|
||||||
SelectButtonC1A1->setPixmap(image1);
|
|
||||||
SelectButtonC1A1->setToggleButton(FALSE);
|
|
||||||
GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
|
|
||||||
LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
|
|
||||||
// LineEditC1A1->setReadOnly(TRUE);
|
|
||||||
if (!myIsPoly)
|
|
||||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
|
|
||||||
GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
|
|
||||||
|
|
||||||
if (myElementType == SMDSAbs_Face) {
|
createObject( tr( "SMESH_ID_NODES" ), GroupC1, 0 );
|
||||||
Reverse = new QCheckBox(GroupC1, "Reverse");
|
setNameIndication( 0, ListOfNames );
|
||||||
Reverse->setText(tr("SMESH_REVERSE" ));
|
setReadOnly( 0, false );
|
||||||
GroupC1Layout->addWidget(Reverse, 1, 0);
|
setObjectType( 0, SMESHGUI_Operation::prefix( "SMESH element" ) + SMDSAbs_Node, -1 );
|
||||||
|
|
||||||
|
myReverse = 0;
|
||||||
|
if ( reverse ) {
|
||||||
|
myReverse = new QCheckBox(GroupC1, "Reverse");
|
||||||
|
myReverse->setText(tr("SMESH_REVERSE" ));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Reverse = 0;
|
|
||||||
|
|
||||||
SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
|
if( myReverse )
|
||||||
|
connect( myReverse, SIGNAL(stateChanged(int)), this, SIGNAL(reverse(int)));
|
||||||
|
|
||||||
Init(); /* Initialisations */
|
main->addWidget(GroupC1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -378,369 +116,25 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
|
SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
|
||||||
{
|
{
|
||||||
// no need to delete child widgets, Qt does it all for us
|
|
||||||
delete mySimulation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : ~SMESHGUI_AddMeshElementDlg()
|
||||||
// purpose :
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddMeshElementDlg::Init()
|
bool SMESHGUI_AddMeshElementDlg::isReverse() const
|
||||||
{
|
{
|
||||||
GroupC1->show();
|
if( myReverse )
|
||||||
Constructor1->setChecked(TRUE);
|
return myReverse->isChecked();
|
||||||
myEditCurrentArgument = LineEditC1A1;
|
else
|
||||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
return false;
|
||||||
|
|
||||||
myNbOkNodes = 0;
|
|
||||||
myActor = 0;
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
|
||||||
connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
|
|
||||||
connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
|
|
||||||
connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
|
|
||||||
|
|
||||||
connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
|
|
||||||
connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
|
||||||
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
|
|
||||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
|
|
||||||
/* to close dialog if study frame change */
|
|
||||||
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
|
|
||||||
|
|
||||||
if (Reverse)
|
|
||||||
connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
|
|
||||||
|
|
||||||
// Move widget on the botton right corner of main widget
|
|
||||||
int x, y;
|
|
||||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
|
||||||
this->move(x, y);
|
|
||||||
this->show(); // displays Dialog
|
|
||||||
|
|
||||||
// set selection mode
|
|
||||||
SMESH::SetPointRepresentation(true);
|
|
||||||
|
|
||||||
myViewWindow->SetSelectionMode( NodeSelection );
|
|
||||||
|
|
||||||
myBusy = false;
|
|
||||||
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ~SMESHGUI_AddMeshElementDlg()
|
||||||
// purpose :
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddMeshElementDlg::ClickOnApply()
|
void SMESHGUI_AddMeshElementDlg::setBusy( const bool b )
|
||||||
{
|
{
|
||||||
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
|
myIsBusy = b;
|
||||||
myBusy = true;
|
|
||||||
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
|
|
||||||
anArrayOfIdeces->length(myNbNodes);
|
|
||||||
bool reverse = (Reverse && Reverse->isChecked());
|
|
||||||
QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
|
|
||||||
for (int i = 0; i < aListId.count(); i++)
|
|
||||||
if (reverse)
|
|
||||||
anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
|
|
||||||
else
|
|
||||||
anArrayOfIdeces[i] = aListId[ i ].toInt();
|
|
||||||
|
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
|
||||||
switch (myElementType) {
|
|
||||||
case SMDSAbs_Edge:
|
|
||||||
aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
|
|
||||||
case SMDSAbs_Face:
|
|
||||||
aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
|
|
||||||
case SMDSAbs_Volume:
|
|
||||||
aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
|
|
||||||
default:;
|
|
||||||
}
|
|
||||||
|
|
||||||
SALOME_ListIO aList; aList.Append( myActor->getIO() );
|
|
||||||
mySelectionMgr->setSelectedObjects( aList, false );
|
|
||||||
|
|
||||||
SMESH::UpdateView();
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
|
||||||
|
|
||||||
myBusy = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnOk()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::ClickOnOk()
|
|
||||||
{
|
|
||||||
this->ClickOnApply();
|
|
||||||
this->ClickOnCancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelectionMgr->clearSelected();
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
SMESH::SetPointRepresentation(false);
|
|
||||||
myViewWindow->SetSelectionMode( ActorSelection );
|
|
||||||
disconnect(mySelectionMgr, 0, this, 0);
|
|
||||||
mySMESHGUI->ResetState();
|
|
||||||
reject();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : onTextChange()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
|
|
||||||
{
|
|
||||||
if (myBusy) return;
|
|
||||||
myBusy = true;
|
|
||||||
|
|
||||||
myNbOkNodes = 0;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
|
|
||||||
// hilight entered nodes
|
|
||||||
SMDS_Mesh* aMesh = 0;
|
|
||||||
if (myActor)
|
|
||||||
aMesh = myActor->GetObject()->GetMesh();
|
|
||||||
|
|
||||||
if (aMesh) {
|
|
||||||
TColStd_MapOfInteger newIndices;
|
|
||||||
|
|
||||||
QStringList aListId = QStringList::split(" ", theNewText, false);
|
|
||||||
for (int i = 0; i < aListId.count(); i++) {
|
|
||||||
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
|
||||||
{
|
|
||||||
newIndices.Add( n->GetID() );
|
|
||||||
myNbOkNodes++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
|
|
||||||
myViewWindow->highlight( myActor->getIO(), true, true );
|
|
||||||
|
|
||||||
bool aNodesOK = false;
|
|
||||||
if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
|
|
||||||
myNbOkNodes = aListId.count();
|
|
||||||
aNodesOK = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myNbOkNodes) {
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
displaySimulation();
|
|
||||||
}
|
|
||||||
|
|
||||||
myBusy = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SelectionIntoArgument()
|
|
||||||
// purpose : Called when selection has changed
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
|
|
||||||
{
|
|
||||||
if (myBusy) return;
|
|
||||||
|
|
||||||
// clear
|
|
||||||
myNbOkNodes = 0;
|
|
||||||
myActor = 0;
|
|
||||||
|
|
||||||
myBusy = true;
|
|
||||||
myEditCurrentArgument->setText("");
|
|
||||||
myBusy = false;
|
|
||||||
|
|
||||||
if (!GroupButtons->isEnabled()) // inactive
|
|
||||||
return;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(false);
|
|
||||||
buttonApply->setEnabled(false);
|
|
||||||
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
// SMESH::SetPointRepresentation(true);
|
|
||||||
|
|
||||||
// get selected mesh
|
|
||||||
SALOME_ListIO aList;
|
|
||||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
|
||||||
|
|
||||||
if (aList.Extent() != 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
|
||||||
myMesh = SMESH::GetMeshByIO(anIO);
|
|
||||||
if (myMesh->_is_nil())
|
|
||||||
return;
|
|
||||||
|
|
||||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
|
||||||
if (!myActor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// get selected nodes
|
|
||||||
QString aString = "";
|
|
||||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
|
|
||||||
myBusy = true;
|
|
||||||
myEditCurrentArgument->setText(aString);
|
|
||||||
myBusy = false;
|
|
||||||
if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
|
|
||||||
myNbNodes = nbNodes;
|
|
||||||
} else if (myNbNodes != nbNodes) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK
|
|
||||||
myNbOkNodes = nbNodes;
|
|
||||||
|
|
||||||
buttonOk->setEnabled(true);
|
|
||||||
buttonApply->setEnabled(true);
|
|
||||||
|
|
||||||
displaySimulation();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : displaySimulation()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::displaySimulation()
|
|
||||||
{
|
|
||||||
if (myNbOkNodes && GroupButtons->isEnabled()) {
|
|
||||||
SMESH::TElementSimulation::TVTKIds anIds;
|
|
||||||
QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
|
|
||||||
for (int i = 0; i < aListId.count(); i++)
|
|
||||||
anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
|
|
||||||
|
|
||||||
if (Reverse && Reverse->isChecked())
|
|
||||||
reverse(anIds.begin(),anIds.end());
|
|
||||||
|
|
||||||
vtkIdType aType = 0;
|
|
||||||
if (myIsPoly)
|
|
||||||
switch ( myElementType ) {
|
|
||||||
case SMDSAbs_Face : aType = VTK_POLYGON; break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (myNbNodes) {
|
|
||||||
case 2: aType = VTK_LINE; break;
|
|
||||||
case 3: aType = VTK_TRIANGLE; break;
|
|
||||||
case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
|
|
||||||
case 8: aType = VTK_HEXAHEDRON; break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mySimulation->SetPosition(myActor,aType,anIds);
|
|
||||||
SMESH::UpdateView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
if (send == SelectButtonC1A1) {
|
|
||||||
LineEditC1A1->setFocus();
|
|
||||||
myEditCurrentArgument = LineEditC1A1;
|
|
||||||
}
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if (GroupConstructors->isEnabled()) {
|
|
||||||
GroupConstructors->setEnabled(false);
|
|
||||||
GroupC1->setEnabled(false);
|
|
||||||
GroupButtons->setEnabled(false);
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
mySMESHGUI->ResetState();
|
|
||||||
mySMESHGUI->SetActiveDialogBox(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ActivateThisDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
|
|
||||||
{
|
|
||||||
/* Emit a signal to deactivate the active dialog */
|
|
||||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
|
||||||
|
|
||||||
GroupConstructors->setEnabled(true);
|
|
||||||
GroupC1->setEnabled(true);
|
|
||||||
GroupButtons->setEnabled(true);
|
|
||||||
|
|
||||||
SMESH::SetPointRepresentation(true);
|
|
||||||
|
|
||||||
myViewWindow->SetSelectionMode( NodeSelection );
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : enterEvent()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
|
|
||||||
{
|
|
||||||
if (GroupConstructors->isEnabled())
|
|
||||||
return;
|
|
||||||
ActivateThisDialog();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : closeEvent()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
|
|
||||||
{
|
|
||||||
/* same than click on cancel button */
|
|
||||||
this->ClickOnCancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : hideEvent()
|
|
||||||
// purpose : caused by ESC key
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
|
|
||||||
{
|
|
||||||
if (!isMinimized())
|
|
||||||
ClickOnCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : CheckBox()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
|
|
||||||
{
|
|
||||||
if (!myNbOkNodes)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (state >= 0) {
|
|
||||||
mySimulation->SetVisibility(false);
|
|
||||||
displaySimulation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -29,108 +29,30 @@
|
|||||||
#ifndef DIALOGBOX_ADD_FACE_H
|
#ifndef DIALOGBOX_ADD_FACE_H
|
||||||
#define DIALOGBOX_ADD_FACE_H
|
#define DIALOGBOX_ADD_FACE_H
|
||||||
|
|
||||||
#include "SalomeApp_SelectionMgr.h"
|
#include <SMESHGUI_Dialog.h>
|
||||||
|
|
||||||
#include "SMDSAbs_ElementType.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
// QT Includes
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class SMESHGUI;
|
|
||||||
class SMESH_Actor;
|
|
||||||
class SMDS_Mesh;
|
|
||||||
class SVTK_ViewWindow;
|
|
||||||
class SVTK_Selector;
|
|
||||||
|
|
||||||
namespace SMESH{
|
|
||||||
struct TElementSimulation;
|
|
||||||
}
|
|
||||||
|
|
||||||
// IDL Headers
|
|
||||||
#include <SALOMEconfig.h>
|
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_AddMeshElementDlg
|
// class : SMESHGUI_AddMeshElementDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_AddMeshElementDlg : public QDialog
|
class SMESHGUI_AddMeshElementDlg : public SMESHGUI_Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_AddMeshElementDlg( SMESHGUI*,
|
SMESHGUI_AddMeshElementDlg( const QString&, const bool );
|
||||||
const char* = 0,
|
|
||||||
SMDSAbs_ElementType ElementType = SMDSAbs_Edge,
|
|
||||||
int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 );
|
|
||||||
~SMESHGUI_AddMeshElementDlg();
|
~SMESHGUI_AddMeshElementDlg();
|
||||||
|
|
||||||
|
bool isReverse() const;
|
||||||
|
void setBusy( const bool );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void reverse( int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init ();
|
QCheckBox* myReverse;
|
||||||
void closeEvent (QCloseEvent*);
|
|
||||||
void hideEvent (QHideEvent*); /* ESC key */
|
|
||||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
|
||||||
void displaySimulation();
|
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
|
||||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
|
||||||
int myNbOkNodes; /* to check when arguments is defined */
|
|
||||||
bool myBusy;
|
|
||||||
SVTK_ViewWindow* myViewWindow;
|
|
||||||
SVTK_Selector* mySelector;
|
|
||||||
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
|
|
||||||
int myElementType;
|
|
||||||
int myNbNodes;
|
|
||||||
bool myIsPoly;
|
|
||||||
|
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
|
||||||
SMESH_Actor* myActor;
|
|
||||||
SMESH::TElementSimulation* mySimulation;
|
|
||||||
|
|
||||||
QButtonGroup* GroupConstructors;
|
|
||||||
QRadioButton* Constructor1;
|
|
||||||
QGroupBox * GroupButtons;
|
|
||||||
QPushButton * buttonOk;
|
|
||||||
QPushButton * buttonCancel;
|
|
||||||
QPushButton * buttonApply;
|
|
||||||
QGroupBox * GroupC1;
|
|
||||||
QLabel * TextLabelC1A1;
|
|
||||||
QPushButton * SelectButtonC1A1;
|
|
||||||
QLineEdit * LineEditC1A1;
|
|
||||||
|
|
||||||
QCheckBox * Reverse;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void ClickOnOk();
|
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
|
||||||
void SetEditCurrentArgument() ;
|
|
||||||
void SelectionIntoArgument() ;
|
|
||||||
void DeactivateActiveDialog() ;
|
|
||||||
void ActivateThisDialog() ;
|
|
||||||
void CheckBox( int );
|
|
||||||
void onTextChange(const QString&);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* SMESHGUI_AddMeshElementDlgLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_ADD_FACE_H
|
#endif // DIALOGBOX_ADD_FACE_H
|
||||||
|
459
src/SMESHGUI/SMESHGUI_AddMeshElementOp.cxx
Normal file
459
src/SMESHGUI/SMESHGUI_AddMeshElementOp.cxx
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
// 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_AddMeshElementOp.cxx
|
||||||
|
// Author : Alexander SOLOVYOV
|
||||||
|
// Module : SMESH
|
||||||
|
// $Header$
|
||||||
|
|
||||||
|
#include "SMESHGUI_AddMeshElementOp.h"
|
||||||
|
#include <SMESHGUI_AddMeshElementDlg.h>
|
||||||
|
#include <SMESHGUI.h>
|
||||||
|
|
||||||
|
#include <SalomeApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
#include <SVTK_ViewWindow.h>
|
||||||
|
#include <SVTK_ViewModel.h>
|
||||||
|
#include <SVTK_Selector.h>
|
||||||
|
#include <SMESH_Actor.h>
|
||||||
|
#include <SMESH_ActorUtils.h>
|
||||||
|
#include <SMESHGUI_Utils.h>
|
||||||
|
#include <SMESHGUI_VTKUtils.h>
|
||||||
|
#include <SMESHGUI_MeshUtils.h>
|
||||||
|
|
||||||
|
#include <SALOME_ListIO.hxx>
|
||||||
|
|
||||||
|
#include <vtkCell.h>
|
||||||
|
#include <vtkDataSetMapper.h>
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
#include <vtkIdList.h>
|
||||||
|
|
||||||
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
|
#include <SMDS_Mesh.hxx>
|
||||||
|
#include <SMDS_MeshNode.hxx>
|
||||||
|
|
||||||
|
namespace SMESH {
|
||||||
|
|
||||||
|
class TElementSimulation {
|
||||||
|
SVTK_ViewWindow* myVTKViewWindow;
|
||||||
|
SALOME_Actor* myPreviewActor;
|
||||||
|
vtkDataSetMapper* myMapper;
|
||||||
|
vtkUnstructuredGrid* myGrid;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TElementSimulation( SVTK_ViewWindow* wnd )
|
||||||
|
{
|
||||||
|
myVTKViewWindow = wnd;
|
||||||
|
|
||||||
|
myGrid = vtkUnstructuredGrid::New();
|
||||||
|
|
||||||
|
// Create and display actor
|
||||||
|
myMapper = vtkDataSetMapper::New();
|
||||||
|
myMapper->SetInput(myGrid);
|
||||||
|
|
||||||
|
myPreviewActor = SALOME_Actor::New();
|
||||||
|
myPreviewActor->PickableOff();
|
||||||
|
myPreviewActor->VisibilityOff();
|
||||||
|
myPreviewActor->SetMapper(myMapper);
|
||||||
|
|
||||||
|
float anRGB[3];
|
||||||
|
vtkProperty* aProp = vtkProperty::New();
|
||||||
|
GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
|
||||||
|
aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
|
||||||
|
myPreviewActor->SetProperty( aProp );
|
||||||
|
aProp->Delete();
|
||||||
|
|
||||||
|
vtkProperty* aBackProp = vtkProperty::New();
|
||||||
|
GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
|
||||||
|
aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
|
||||||
|
myPreviewActor->SetBackfaceProperty( aBackProp );
|
||||||
|
aBackProp->Delete();
|
||||||
|
|
||||||
|
myVTKViewWindow->AddActor(myPreviewActor);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef std::vector<vtkIdType> TVTKIds;
|
||||||
|
void SetPosition (SMESH_Actor* theActor,
|
||||||
|
vtkIdType theType,
|
||||||
|
const TVTKIds& theIds)
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
|
||||||
|
myGrid->SetPoints(aGrid->GetPoints());
|
||||||
|
|
||||||
|
const int* aConn = NULL;
|
||||||
|
switch (theType) {
|
||||||
|
case VTK_TETRA:
|
||||||
|
{
|
||||||
|
static int anIds[] = {0,2,1,3};
|
||||||
|
aConn = anIds;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VTK_PYRAMID:
|
||||||
|
{
|
||||||
|
static int anIds[] = {0,3,2,1,4};
|
||||||
|
aConn = anIds;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VTK_HEXAHEDRON:
|
||||||
|
{
|
||||||
|
static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||||
|
aConn = anIds;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myGrid->Reset();
|
||||||
|
vtkIdList *anIds = vtkIdList::New();
|
||||||
|
|
||||||
|
if(aConn)
|
||||||
|
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
|
||||||
|
anIds->InsertId(i,theIds[aConn[i]]);
|
||||||
|
else
|
||||||
|
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
|
||||||
|
anIds->InsertId(i,theIds[i]);
|
||||||
|
|
||||||
|
myGrid->InsertNextCell(theType,anIds);
|
||||||
|
anIds->Delete();
|
||||||
|
|
||||||
|
myGrid->Modified();
|
||||||
|
|
||||||
|
SetVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SetVisibility (bool theVisibility)
|
||||||
|
{
|
||||||
|
myPreviewActor->SetVisibility(theVisibility);
|
||||||
|
RepaintCurrentView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~TElementSimulation()
|
||||||
|
{
|
||||||
|
SetVisibility( false );
|
||||||
|
if( myVTKViewWindow )
|
||||||
|
myVTKViewWindow->RemoveActor(myPreviewActor);
|
||||||
|
|
||||||
|
myPreviewActor->Delete();
|
||||||
|
|
||||||
|
myMapper->RemoveAllInputs();
|
||||||
|
myMapper->Delete();
|
||||||
|
|
||||||
|
myGrid->Delete();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SMESHGUI_AddMeshElementDlg()
|
||||||
|
// purpose : constructor
|
||||||
|
//=================================================================================
|
||||||
|
SMESHGUI_AddMeshElementOp::SMESHGUI_AddMeshElementOp( const SMDSAbs_ElementType t, const int nbNodes )
|
||||||
|
: SMESHGUI_SelectionOp( NodeSelection ),
|
||||||
|
myElementType( t ),
|
||||||
|
myNbNodes( nbNodes ),
|
||||||
|
myIsPoly( myElementType==SMDSAbs_Face && myNbNodes==5 ),
|
||||||
|
mySimulation( 0 ),
|
||||||
|
myDlg( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~SMESHGUI_AddMeshElementDlg()
|
||||||
|
// purpose : destructor
|
||||||
|
//=================================================================================
|
||||||
|
SMESHGUI_AddMeshElementOp::~SMESHGUI_AddMeshElementOp()
|
||||||
|
{
|
||||||
|
if( myDlg )
|
||||||
|
delete myDlg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : dlg()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
SalomeApp_Dialog* SMESHGUI_AddMeshElementOp::dlg() const
|
||||||
|
{
|
||||||
|
return myDlg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : startOperation()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::startOperation()
|
||||||
|
{
|
||||||
|
if( !myDlg )
|
||||||
|
{
|
||||||
|
QString elemName;
|
||||||
|
switch( myNbNodes )
|
||||||
|
{
|
||||||
|
case 2: elemName = "EDGE"; break;
|
||||||
|
case 3: elemName = "TRIANGLE"; break;
|
||||||
|
case 4: if (myElementType == SMDSAbs_Face)
|
||||||
|
elemName = "QUADRANGLE";
|
||||||
|
else
|
||||||
|
elemName = "TETRAS";
|
||||||
|
break;
|
||||||
|
case 5: elemName = "POLYGON"; break;
|
||||||
|
case 8: elemName = "HEXAS"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
myDlg = new SMESHGUI_AddMeshElementDlg( elemName, myElementType == SMDSAbs_Face );
|
||||||
|
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& ) ),
|
||||||
|
this, SLOT( onTextChanged( int, const QStringList& ) ) );
|
||||||
|
connect( myDlg, SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
|
||||||
|
connect( myDlg, SIGNAL( reverse( int ) ), this, SLOT( onReverse( int ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESHGUI_SelectionOp::startOperation();
|
||||||
|
|
||||||
|
mySimulation = new SMESH::TElementSimulation( viewWindow() );
|
||||||
|
updateDialog();
|
||||||
|
myDlg->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : selectionDone()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::selectionDone()
|
||||||
|
{
|
||||||
|
if( !mySimulation )
|
||||||
|
return;
|
||||||
|
|
||||||
|
mySimulation->SetVisibility(false);
|
||||||
|
|
||||||
|
// get selected mesh
|
||||||
|
SALOME_ListIO aList;
|
||||||
|
selectionMgr()->selectedObjects(aList,SVTK_Viewer::Type());
|
||||||
|
|
||||||
|
if( aList.Extent() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||||
|
myMesh = SMESH::GetMeshByIO(anIO);
|
||||||
|
|
||||||
|
QStringList names, ids; SalomeApp_Dialog::TypesList types;
|
||||||
|
selected( names, types, ids );
|
||||||
|
myDlg->selectObject( names, types, ids );
|
||||||
|
|
||||||
|
updateDialog();
|
||||||
|
displaySimulation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : commitOperation()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::commitOperation()
|
||||||
|
{
|
||||||
|
if( mySimulation )
|
||||||
|
delete mySimulation;
|
||||||
|
mySimulation = 0;
|
||||||
|
SMESHGUI_SelectionOp::commitOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : abortOperation()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::abortOperation()
|
||||||
|
{
|
||||||
|
if( mySimulation )
|
||||||
|
delete mySimulation;
|
||||||
|
mySimulation = 0;
|
||||||
|
SMESHGUI_SelectionOp::abortOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onApply()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
bool SMESHGUI_AddMeshElementOp::onApply()
|
||||||
|
{
|
||||||
|
if( !mySimulation )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QStringList ids; myDlg->selectedObject( 0, ids );
|
||||||
|
if( ids.count()>=myNbNodes && !getSMESHGUI()->isActiveStudyLocked() ) {
|
||||||
|
//myBusy = true;
|
||||||
|
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
|
||||||
|
anArrayOfIdeces->length(myNbNodes);
|
||||||
|
bool reverse = myDlg->isReverse();
|
||||||
|
|
||||||
|
for (int i = 0; i < myNbNodes; i++)
|
||||||
|
{
|
||||||
|
QString id_str = ids[ i ];
|
||||||
|
int pos = id_str.find( idChar() );
|
||||||
|
int id = -1;
|
||||||
|
if( pos>=0 )
|
||||||
|
id = id_str.mid( pos+1 ).toInt();
|
||||||
|
|
||||||
|
if( id==-1 )
|
||||||
|
{
|
||||||
|
printf( "SMESHGUI_AddMeshElementOp::onApply(): Error!!!\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
anArrayOfIdeces[ myNbNodes - i - 1 ] = id;
|
||||||
|
else
|
||||||
|
anArrayOfIdeces[i] = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
switch (myElementType) {
|
||||||
|
case SMDSAbs_Edge:
|
||||||
|
aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
|
||||||
|
case SMDSAbs_Face:
|
||||||
|
aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
|
||||||
|
case SMDSAbs_Volume:
|
||||||
|
aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
|
||||||
|
//SALOME_ListIO aList; aList.Append( myActor->getIO() );
|
||||||
|
//mySelectionMgr->setSelectedObjects( aList, false );
|
||||||
|
|
||||||
|
SMESH::UpdateView();
|
||||||
|
mySimulation->SetVisibility(false);
|
||||||
|
|
||||||
|
initDialog();
|
||||||
|
updateDialog();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onTextChanged()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::onTextChanged( int, const QStringList& aListId )
|
||||||
|
{
|
||||||
|
myDlg->setBusy( true );
|
||||||
|
TColStd_MapOfInteger newIndices;
|
||||||
|
SALOME_ListIO list; selectionMgr()->selectedObjects( list );
|
||||||
|
if( list.Extent()==0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() );
|
||||||
|
if( !anActor )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
|
||||||
|
|
||||||
|
for (int i = 0; i < aListId.count(); i++)
|
||||||
|
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
||||||
|
newIndices.Add( n->GetID() );
|
||||||
|
|
||||||
|
selector()->AddOrRemoveIndex( list.First(), newIndices, false );
|
||||||
|
highlight( list.First(), true, true );
|
||||||
|
|
||||||
|
selectionDone();
|
||||||
|
myDlg->setBusy( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : displaySimulation()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::displaySimulation()
|
||||||
|
{
|
||||||
|
QStringList ids; myDlg->selectedObject( 0, ids );
|
||||||
|
if( ids.count()>=myNbNodes ) {
|
||||||
|
SMESH::TElementSimulation::TVTKIds anIds;
|
||||||
|
|
||||||
|
SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() );
|
||||||
|
if( !anActor )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < myNbNodes; i++)
|
||||||
|
{
|
||||||
|
QString id_str = ids[ i ];
|
||||||
|
int pos = id_str.find( idChar() );
|
||||||
|
int id = -1;
|
||||||
|
if( pos>=0 )
|
||||||
|
id = id_str.mid( pos+1 ).toInt();
|
||||||
|
|
||||||
|
if( id==-1 )
|
||||||
|
{
|
||||||
|
printf( "SMESHGUI_AddMeshElementOp::displaySimulation(): Error!!!\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
anIds.push_back( anActor->GetObject()->GetNodeVTKId( id ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( myDlg->isReverse() )
|
||||||
|
reverse( anIds.begin(), anIds.end() );
|
||||||
|
|
||||||
|
vtkIdType aType = 0;
|
||||||
|
if (myIsPoly)
|
||||||
|
switch ( myElementType ) {
|
||||||
|
case SMDSAbs_Face : aType = VTK_POLYGON; break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (myNbNodes) {
|
||||||
|
case 2: aType = VTK_LINE; break;
|
||||||
|
case 3: aType = VTK_TRIANGLE; break;
|
||||||
|
case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
|
||||||
|
case 8: aType = VTK_HEXAHEDRON; break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mySimulation->SetPosition( anActor, aType, anIds );
|
||||||
|
SMESH::UpdateView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onReverse()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::onReverse( int )
|
||||||
|
{
|
||||||
|
if( mySimulation )
|
||||||
|
{
|
||||||
|
mySimulation->SetVisibility( false );
|
||||||
|
displaySimulation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddMeshElementOp::updateDialog()
|
||||||
|
{
|
||||||
|
if( myDlg )
|
||||||
|
{
|
||||||
|
QStringList ids; myDlg->selectedObject( 0, ids );
|
||||||
|
myDlg->setButtonEnabled( ids.count()>=myNbNodes, QtxDialog::OK | QtxDialog::Apply );
|
||||||
|
}
|
||||||
|
}
|
86
src/SMESHGUI/SMESHGUI_AddMeshElementOp.h
Normal file
86
src/SMESHGUI/SMESHGUI_AddMeshElementOp.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// 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_AddMeshElementOp.h
|
||||||
|
// Author : Nicolas REJNERI
|
||||||
|
// Module : SMESH
|
||||||
|
// $Header$
|
||||||
|
|
||||||
|
#ifndef OPERATION_ADD_FACE_H
|
||||||
|
#define OPERATION_ADD_FACE_H
|
||||||
|
|
||||||
|
namespace SMESH{
|
||||||
|
struct TElementSimulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDL Headers
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
|
#include <SMESHGUI_SelectionOp.h>
|
||||||
|
#include <SMDSAbs_ElementType.hxx>
|
||||||
|
|
||||||
|
class SMESHGUI_AddMeshElementDlg;
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : SMESHGUI_AddMeshElementOp
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
class SMESHGUI_AddMeshElementOp : public SMESHGUI_SelectionOp
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SMESHGUI_AddMeshElementOp( const SMDSAbs_ElementType, const int );
|
||||||
|
~SMESHGUI_AddMeshElementOp();
|
||||||
|
|
||||||
|
virtual SalomeApp_Dialog* dlg() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void startOperation();
|
||||||
|
virtual void selectionDone();
|
||||||
|
virtual void commitOperation();
|
||||||
|
virtual void abortOperation();
|
||||||
|
|
||||||
|
void updateDialog();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual bool onApply();
|
||||||
|
void onTextChanged( int, const QStringList& );
|
||||||
|
void onReverse( int );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void displaySimulation();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int myElementType;
|
||||||
|
int myNbNodes;
|
||||||
|
bool myIsPoly;
|
||||||
|
|
||||||
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
|
SMESH::TElementSimulation* mySimulation;
|
||||||
|
|
||||||
|
SMESHGUI_AddMeshElementDlg* myDlg;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGBOX_ADD_FACE_H
|
@ -43,8 +43,8 @@
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( SMESHGUI* theModule )
|
SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg()
|
||||||
: SMESHGUI_Dialog( theModule, false, true )
|
: SMESHGUI_Dialog( false, true )
|
||||||
{
|
{
|
||||||
setCaption(tr("SMESH_ADD_SUBMESH"));
|
setCaption(tr("SMESH_ADD_SUBMESH"));
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
enum { MeshObj, GeomObj, Hypo, Algo };
|
enum { MeshObj, GeomObj, Hypo, Algo };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_AddSubMeshDlg( SMESHGUI* );
|
SMESHGUI_AddSubMeshDlg();
|
||||||
~SMESHGUI_AddSubMeshDlg();
|
~SMESHGUI_AddSubMeshDlg();
|
||||||
|
|
||||||
void setSubMeshName( const QString& );
|
void setSubMeshName( const QString& );
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// File : SMESHGUI_AddSubMeshDlg.cxx
|
// File : SMESHGUI_AddSubMeshOp.cxx
|
||||||
// Author : Nicolas REJNERI
|
// Author : Nicolas REJNERI
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
// $Header$
|
||||||
@ -55,12 +55,8 @@
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_AddSubMeshOp::SMESHGUI_AddSubMeshOp()
|
SMESHGUI_AddSubMeshOp::SMESHGUI_AddSubMeshOp()
|
||||||
: SMESHGUI_Operation(),
|
: SMESHGUI_SelectionOp(),
|
||||||
myDlg( 0 ),
|
myDlg( 0 )
|
||||||
myMeshFilter( 0 ),
|
|
||||||
myGeomFilter( 0 ),
|
|
||||||
myHypothesisFilter( 0 ),
|
|
||||||
myAlgorithmFilter( 0 )
|
|
||||||
{
|
{
|
||||||
setAutoResumed( true );
|
setAutoResumed( true );
|
||||||
}
|
}
|
||||||
@ -73,18 +69,6 @@ SMESHGUI_AddSubMeshOp::~SMESHGUI_AddSubMeshOp()
|
|||||||
{
|
{
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
delete myDlg;
|
delete myDlg;
|
||||||
|
|
||||||
if( myMeshFilter )
|
|
||||||
delete myMeshFilter;
|
|
||||||
|
|
||||||
if( myGeomFilter )
|
|
||||||
delete myGeomFilter;
|
|
||||||
|
|
||||||
if( myAlgorithmFilter )
|
|
||||||
delete myAlgorithmFilter;
|
|
||||||
|
|
||||||
if( myHypothesisFilter )
|
|
||||||
delete myHypothesisFilter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -95,31 +79,12 @@ void SMESHGUI_AddSubMeshOp::startOperation()
|
|||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_AddSubMeshDlg( getSMESHGUI() );
|
myDlg = new SMESHGUI_AddSubMeshDlg();
|
||||||
connect( myDlg, SIGNAL( objectActivated( int ) ), this, SLOT( onActivateObject( int ) ) );
|
connect( myDlg, SIGNAL( nameChanged( const QString& ) ), this, SLOT( onNameChanged( const QString& ) ) );
|
||||||
connect( myDlg, SIGNAL( selectionChanged( int ) ), this, SLOT( onSelectionChanged( int ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESHGUI_Operation::startOperation();
|
SMESHGUI_SelectionOp::startOperation();
|
||||||
|
|
||||||
if( !myGeomFilter )
|
|
||||||
{
|
|
||||||
TColStd_MapOfInteger allTypesMap;
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
allTypesMap.Add(i);
|
|
||||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !myMeshFilter )
|
|
||||||
myMeshFilter = new SMESH_TypeFilter (MESH);
|
|
||||||
|
|
||||||
if( !myAlgorithmFilter )
|
|
||||||
myAlgorithmFilter = new SMESH_TypeFilter (ALGORITHM);
|
|
||||||
|
|
||||||
if( !myHypothesisFilter )
|
|
||||||
myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
|
|
||||||
|
|
||||||
init();
|
|
||||||
myDlg->show();
|
myDlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,40 +103,36 @@ SalomeApp_Dialog* SMESHGUI_AddSubMeshOp::dlg() const
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddSubMeshOp::selectionDone()
|
void SMESHGUI_AddSubMeshOp::selectionDone()
|
||||||
{
|
{
|
||||||
QStringList names, ids;
|
SMESHGUI_SelectionOp::selectionDone();
|
||||||
SMESHGUI_Dialog::TypesList types;
|
|
||||||
selected( names, types, ids );
|
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
{
|
updateDialog();
|
||||||
myDlg->selectObject( names, types, ids );
|
|
||||||
myDlg->updateControlState( isValid() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onActivateObject
|
// function : createFilter
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddSubMeshOp::onActivateObject( int obj )
|
SUIT_SelectionFilter* SMESHGUI_AddSubMeshOp::createFilter( const int id ) const
|
||||||
{
|
{
|
||||||
SalomeApp_SelectionMgr* mgr = selectionMgr();
|
if( id==SMESHGUI_AddSubMeshDlg::GeomObj )
|
||||||
|
{
|
||||||
|
TColStd_MapOfInteger allTypesMap;
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
allTypesMap.Add(i);
|
||||||
|
return new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
||||||
|
}
|
||||||
|
|
||||||
if( !mgr )
|
if( id==SMESHGUI_AddSubMeshDlg::MeshObj )
|
||||||
return;
|
return new SMESH_TypeFilter (MESH);
|
||||||
|
|
||||||
mgr->clearFilters();
|
else if( id==SMESHGUI_AddSubMeshDlg::Algo )
|
||||||
|
return new SMESH_TypeFilter (ALGORITHM);
|
||||||
|
|
||||||
if( obj==SMESHGUI_AddSubMeshDlg::MeshObj )
|
else if( id==SMESHGUI_AddSubMeshDlg::Hypo )
|
||||||
mgr->installFilter( myMeshFilter );
|
return new SMESH_TypeFilter (HYPOTHESIS);
|
||||||
|
|
||||||
else if( obj==SMESHGUI_AddSubMeshDlg::GeomObj )
|
else
|
||||||
mgr->installFilter( myGeomFilter );
|
return 0;
|
||||||
|
|
||||||
else if( obj==SMESHGUI_AddSubMeshDlg::Hypo )
|
|
||||||
mgr->installFilter( myHypothesisFilter );
|
|
||||||
|
|
||||||
else if( obj==SMESHGUI_AddSubMeshDlg::Algo )
|
|
||||||
mgr->installFilter( myAlgorithmFilter );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -250,47 +211,25 @@ bool SMESHGUI_AddSubMeshOp::onApply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
update( UF_Model | UF_ObjBrowser );
|
update( UF_Model | UF_ObjBrowser );
|
||||||
init();
|
initDialog();
|
||||||
|
|
||||||
return (nbSuccess > 0);
|
return (nbSuccess > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : init()
|
// function : initDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_AddSubMeshOp::init()
|
void SMESHGUI_AddSubMeshOp::initDialog()
|
||||||
{
|
{
|
||||||
|
SMESHGUI_SelectionOp::initDialog();
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
{
|
{
|
||||||
myDlg->init();
|
myDlg->setSubMeshName( tr( "SMESH_SUBMESH" ) );
|
||||||
myDlg->updateControlState( false );
|
updateDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : isValid()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
bool SMESHGUI_AddSubMeshOp::isValid() const
|
|
||||||
{
|
|
||||||
bool isEnabled = !myDlg->subMeshName().isEmpty() &&
|
|
||||||
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::MeshObj ) &&
|
|
||||||
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::GeomObj ) &&
|
|
||||||
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::Hypo ) &&
|
|
||||||
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::Algo );
|
|
||||||
|
|
||||||
bool isImportedMesh = false;
|
|
||||||
|
|
||||||
QStringList selMesh;
|
|
||||||
myDlg->selectedObject( SMESHGUI_AddSubMeshDlg::MeshObj, selMesh );
|
|
||||||
_PTR(SObject) SO = studyDS()->FindObjectID( selMesh.first() );
|
|
||||||
GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(SO);
|
|
||||||
isImportedMesh = myGeomShape->_is_nil();
|
|
||||||
|
|
||||||
return isEnabled && !isImportedMesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : IsFatherOf()
|
// function : IsFatherOf()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -338,7 +277,7 @@ void SMESHGUI_AddSubMeshOp::onSelectionChanged( int id )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onSelectionChanged()
|
// function : addSubMesh()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESH::SMESH_subMesh_var SMESHGUI_AddSubMeshOp::addSubMesh( SMESH::SMESH_Mesh_ptr theMesh,
|
SMESH::SMESH_subMesh_var SMESHGUI_AddSubMeshOp::addSubMesh( SMESH::SMESH_Mesh_ptr theMesh,
|
||||||
@ -359,15 +298,51 @@ SMESH::SMESH_subMesh_var SMESHGUI_AddSubMeshOp::addSubMesh( SMESH::SMESH_Mesh_pt
|
|||||||
return aSubMesh._retn();
|
return aSubMesh._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddSubMeshOp::updateDialog()
|
||||||
|
{
|
||||||
|
if( !myDlg )
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool isEnabled = !myDlg->subMeshName().isEmpty() &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::MeshObj ) &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::GeomObj ) &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::Hypo ) &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_AddSubMeshDlg::Algo );
|
||||||
|
|
||||||
|
bool isImportedMesh = false;
|
||||||
|
|
||||||
|
QStringList selMesh;
|
||||||
|
myDlg->selectedObject( SMESHGUI_AddSubMeshDlg::MeshObj, selMesh );
|
||||||
|
_PTR(SObject) SO = studyDS()->FindObjectID( selMesh.first() );
|
||||||
|
GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(SO);
|
||||||
|
isImportedMesh = myGeomShape->_is_nil();
|
||||||
|
|
||||||
|
isEnabled = isEnabled && !isImportedMesh;
|
||||||
|
|
||||||
|
myDlg->setButtonEnabled( isEnabled, QtxDialog::OK | QtxDialog::Apply );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onNameChanged()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_AddSubMeshOp::onNameChanged( const QString& )
|
||||||
|
{
|
||||||
|
updateDialog();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool SMESHGUI_AddSubMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
bool SMESHGUI_AddSubMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
||||||
{
|
{
|
||||||
if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_InitMeshOp" ) )
|
//if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_InitMeshOp" ) )
|
||||||
return true;
|
return true;
|
||||||
else
|
/*else
|
||||||
return false;
|
return false;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#ifndef OPERATION_ADD_SUB_MESH_H
|
#ifndef OPERATION_ADD_SUB_MESH_H
|
||||||
#define OPERATION_ADD_SUB_MESH_H
|
#define OPERATION_ADD_SUB_MESH_H
|
||||||
|
|
||||||
#include <SMESHGUI_Operation.h>
|
#include <SMESHGUI_SelectionOp.h>
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||||
@ -43,7 +43,7 @@ class SUIT_SelectionFilter;
|
|||||||
// class : SMESHGUI_AddSubMeshOp
|
// class : SMESHGUI_AddSubMeshOp
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_AddSubMeshOp : public SMESHGUI_Operation
|
class SMESHGUI_AddSubMeshOp : public SMESHGUI_SelectionOp
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -52,14 +52,15 @@ public:
|
|||||||
~SMESHGUI_AddSubMeshOp();
|
~SMESHGUI_AddSubMeshOp();
|
||||||
|
|
||||||
virtual SalomeApp_Dialog* dlg() const;
|
virtual SalomeApp_Dialog* dlg() const;
|
||||||
void init();
|
virtual void initDialog();
|
||||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
virtual void selectionDone();
|
virtual void selectionDone();
|
||||||
|
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||||
|
|
||||||
bool isValid() const;
|
void updateDialog();
|
||||||
|
|
||||||
SMESH::SMESH_subMesh_var addSubMesh( SMESH::SMESH_Mesh_ptr,
|
SMESH::SMESH_subMesh_var addSubMesh( SMESH::SMESH_Mesh_ptr,
|
||||||
GEOM::GEOM_Object_ptr,
|
GEOM::GEOM_Object_ptr,
|
||||||
@ -67,14 +68,13 @@ protected:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
virtual void onSelectionChanged( int );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onActivateObject( int );
|
void onNameChanged( const QString& );
|
||||||
void onSelectionChanged( int );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESHGUI_AddSubMeshDlg *myDlg;
|
SMESHGUI_AddSubMeshDlg *myDlg;
|
||||||
SUIT_SelectionFilter *myMeshFilter, *myGeomFilter, *myHypothesisFilter, *myAlgorithmFilter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OPERATION_INIT_MESH_H
|
#endif // OPERATION_INIT_MESH_H
|
||||||
|
@ -1,16 +1,43 @@
|
|||||||
|
// 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_Dialog.cxx
|
||||||
|
// Author : Alexander SOLOVYOV
|
||||||
|
// Module : SMESH
|
||||||
|
// $Header$
|
||||||
|
|
||||||
#include <SMESHGUI_Dialog.h>
|
#include <SMESHGUI_Dialog.h>
|
||||||
#include <SMESHGUI_Utils.h>
|
|
||||||
#include <SMESHGUI_Operation.h>
|
#include <SMESHGUI_Operation.h>
|
||||||
#include <SMESH_Type.h>
|
#include <SMESH_Type.h>
|
||||||
#include <SMESHGUI.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SalomeApp_Application.h>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
//=================================================================================
|
||||||
|
// function : SMESHGUI_Dialog
|
||||||
SMESHGUI_Dialog::SMESHGUI_Dialog( SMESHGUI* theModule, const bool modal, const bool allowResize,
|
// purpose : Constructor
|
||||||
const int flags )
|
//=================================================================================
|
||||||
: SalomeApp_Dialog( SMESH::GetDesktop( theModule ), "", modal, allowResize, flags ),
|
SMESHGUI_Dialog::SMESHGUI_Dialog( const bool modal, const bool allowResize, const int flags )
|
||||||
mySMESHGUI( theModule )
|
: SalomeApp_Dialog( desktop(), "", modal, allowResize, flags )
|
||||||
{
|
{
|
||||||
int prefix = SMESHGUI_Operation::prefix( "SMESH" );
|
int prefix = SMESHGUI_Operation::prefix( "SMESH" );
|
||||||
typeName( prefix + MESH ) = tr( "DLG_MESH" );
|
typeName( prefix + MESH ) = tr( "DLG_MESH" );
|
||||||
@ -18,19 +45,50 @@ SMESHGUI_Dialog::SMESHGUI_Dialog( SMESHGUI* theModule, const bool modal, const b
|
|||||||
typeName( prefix + ALGORITHM ) = tr( "DLG_ALGO" );
|
typeName( prefix + ALGORITHM ) = tr( "DLG_ALGO" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~SMESHGUI_Dialog
|
||||||
|
// purpose : Destructor
|
||||||
|
//=================================================================================
|
||||||
SMESHGUI_Dialog::~SMESHGUI_Dialog()
|
SMESHGUI_Dialog::~SMESHGUI_Dialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : show
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
void SMESHGUI_Dialog::show()
|
void SMESHGUI_Dialog::show()
|
||||||
{
|
{
|
||||||
int x, y;
|
adjustSize();
|
||||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
SUIT_Desktop *PP = desktop();
|
||||||
|
int x = abs( PP->x() + PP->size().width() - size().width() - 10 ),
|
||||||
|
y = abs( PP->y() + PP->size().height() - size().height() - 10 );
|
||||||
move(x, y);
|
move(x, y);
|
||||||
SalomeApp_Dialog::show();
|
SalomeApp_Dialog::show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setContentActive
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
void SMESHGUI_Dialog::setContentActive( const bool active ) const
|
void SMESHGUI_Dialog::setContentActive( const bool active ) const
|
||||||
{
|
{
|
||||||
mainFrame()->setEnabled( active );
|
mainFrame()->setEnabled( active );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : desktop
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
SUIT_Desktop* SMESHGUI_Dialog::desktop() const
|
||||||
|
{
|
||||||
|
SUIT_Desktop* d = 0;
|
||||||
|
SUIT_Session* s = SUIT_Session::session();
|
||||||
|
if( s )
|
||||||
|
{
|
||||||
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( s->activeApplication() );
|
||||||
|
if( app )
|
||||||
|
d = app->desktop();
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
@ -1,17 +1,49 @@
|
|||||||
|
// 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_Dialog.h
|
||||||
|
// Author : Alexander SOLOVYOV
|
||||||
|
// Module : SMESH
|
||||||
|
// $Header$
|
||||||
|
|
||||||
|
|
||||||
#ifndef SMESHGUI_DIALOG_H
|
#ifndef SMESHGUI_DIALOG_H
|
||||||
#define SMESHGUI_DIALOG_H
|
#define SMESHGUI_DIALOG_H
|
||||||
|
|
||||||
#include <SalomeApp_Dialog.h>
|
#include <SalomeApp_Dialog.h>
|
||||||
|
|
||||||
class SMESHGUI;
|
class SUIT_Desktop;
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : SMESHGUI_Dialog
|
||||||
|
// purpose : Base dialog for all SMESHGUI dialogs
|
||||||
|
//=================================================================================
|
||||||
class SMESHGUI_Dialog : public SalomeApp_Dialog
|
class SMESHGUI_Dialog : public SalomeApp_Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_Dialog( SMESHGUI*, const bool = false, const bool = false, const int = OK | Cancel | Apply );
|
SMESHGUI_Dialog( const bool = false, const bool = false, const int = OK | Cancel | Apply );
|
||||||
virtual ~SMESHGUI_Dialog();
|
virtual ~SMESHGUI_Dialog();
|
||||||
|
|
||||||
virtual void show();
|
virtual void show();
|
||||||
@ -19,8 +51,9 @@ public:
|
|||||||
//! set all content to enable (parameter is true) or disable state
|
//! set all content to enable (parameter is true) or disable state
|
||||||
void setContentActive( const bool ) const;
|
void setContentActive( const bool ) const;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
SMESHGUI* mySMESHGUI;
|
//! find desktop of active application
|
||||||
|
SUIT_Desktop* desktop() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg( SMESHGUI* theModule )
|
SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg()
|
||||||
: SMESHGUI_Dialog( theModule, false, true )
|
: SMESHGUI_Dialog( false, true )
|
||||||
{
|
{
|
||||||
setName("SMESHGUI_EditHypothesesDlg");
|
setName("SMESHGUI_EditHypothesesDlg");
|
||||||
setCaption(tr("SMESH_EDIT_HYPOTHESES"));
|
setCaption(tr("SMESH_EDIT_HYPOTHESES"));
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
typedef enum { HypoDef, HypoAssign, AlgoDef, AlgoAssign } ListType;
|
typedef enum { HypoDef, HypoAssign, AlgoDef, AlgoAssign } ListType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_EditHypothesesDlg( SMESHGUI* );
|
SMESHGUI_EditHypothesesDlg();
|
||||||
~SMESHGUI_EditHypothesesDlg();
|
~SMESHGUI_EditHypothesesDlg();
|
||||||
|
|
||||||
void setListsEnabled( const bool );
|
void setListsEnabled( const bool );
|
||||||
|
@ -83,7 +83,7 @@ void SMESHGUI_EditHypothesesOp::startOperation()
|
|||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_EditHypothesesDlg( getSMESHGUI() );
|
myDlg = new SMESHGUI_EditHypothesesDlg();
|
||||||
connect( myDlg, SIGNAL( needToUpdate() ), this, SLOT( onUpdate() ) );
|
connect( myDlg, SIGNAL( needToUpdate() ), this, SLOT( onUpdate() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
|
// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
|
||||||
// Purpose : Constructor
|
// Purpose : Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int aMode )
|
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( const int aMode )
|
||||||
: SMESHGUI_Dialog( theModule, false, true )
|
: SMESHGUI_Dialog( false, true )
|
||||||
{
|
{
|
||||||
QString caption;
|
QString caption;
|
||||||
if( aMode == 0 )
|
if( aMode == 0 )
|
||||||
|
@ -42,7 +42,7 @@ class SMESHGUI_GroupOpDlg : public SMESHGUI_Dialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_GroupOpDlg( SMESHGUI*, const int );
|
SMESHGUI_GroupOpDlg( const int );
|
||||||
virtual ~SMESHGUI_GroupOpDlg();
|
virtual ~SMESHGUI_GroupOpDlg();
|
||||||
|
|
||||||
void setName( const QString& );
|
void setName( const QString& );
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( SMESHGUI* theModule )
|
SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg()
|
||||||
: SMESHGUI_Dialog( theModule, false, true )
|
: SMESHGUI_Dialog( false, true )
|
||||||
{
|
{
|
||||||
setCaption(tr("SMESH_INIT_MESH"));
|
setCaption(tr("SMESH_INIT_MESH"));
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
enum { GeomObj, Hypo, Algo };
|
enum { GeomObj, Hypo, Algo };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_InitMeshDlg( SMESHGUI* );
|
SMESHGUI_InitMeshDlg();
|
||||||
~SMESHGUI_InitMeshDlg();
|
~SMESHGUI_InitMeshDlg();
|
||||||
|
|
||||||
void setMeshName( const QString& );
|
void setMeshName( const QString& );
|
||||||
|
@ -54,11 +54,8 @@
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_InitMeshOp::SMESHGUI_InitMeshOp()
|
SMESHGUI_InitMeshOp::SMESHGUI_InitMeshOp()
|
||||||
: SMESHGUI_Operation(),
|
: SMESHGUI_SelectionOp(),
|
||||||
myDlg( 0 ),
|
myDlg( 0 )
|
||||||
myGeomFilter( 0 ),
|
|
||||||
myHypothesisFilter( 0 ),
|
|
||||||
myAlgorithmFilter( 0 )
|
|
||||||
{
|
{
|
||||||
setAutoResumed( true );
|
setAutoResumed( true );
|
||||||
}
|
}
|
||||||
@ -71,15 +68,6 @@ SMESHGUI_InitMeshOp::~SMESHGUI_InitMeshOp()
|
|||||||
{
|
{
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
delete myDlg;
|
delete myDlg;
|
||||||
|
|
||||||
if( myGeomFilter )
|
|
||||||
delete myGeomFilter;
|
|
||||||
|
|
||||||
if( myAlgorithmFilter )
|
|
||||||
delete myAlgorithmFilter;
|
|
||||||
|
|
||||||
if( myHypothesisFilter )
|
|
||||||
delete myHypothesisFilter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -90,27 +78,12 @@ void SMESHGUI_InitMeshOp::startOperation()
|
|||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_InitMeshDlg( getSMESHGUI() );
|
myDlg = new SMESHGUI_InitMeshDlg();
|
||||||
connect( myDlg, SIGNAL( objectActivated( int ) ), this, SLOT( onActivateObject( int ) ) );
|
connect( myDlg, SIGNAL( nameChanged( const QString& ) ), this, SLOT( onNameChanged( const QString& ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESHGUI_Operation::startOperation();
|
SMESHGUI_SelectionOp::startOperation();
|
||||||
|
|
||||||
if( !myGeomFilter )
|
|
||||||
{
|
|
||||||
TColStd_MapOfInteger allTypesMap;
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
allTypesMap.Add(i);
|
|
||||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !myAlgorithmFilter )
|
|
||||||
myAlgorithmFilter = new SMESH_TypeFilter (ALGORITHM);
|
|
||||||
|
|
||||||
if( !myHypothesisFilter )
|
|
||||||
myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
|
|
||||||
|
|
||||||
init();
|
|
||||||
myDlg->show();
|
myDlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,36 +102,33 @@ SalomeApp_Dialog* SMESHGUI_InitMeshOp::dlg() const
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_InitMeshOp::selectionDone()
|
void SMESHGUI_InitMeshOp::selectionDone()
|
||||||
{
|
{
|
||||||
QStringList names, ids;
|
SMESHGUI_SelectionOp::selectionDone();
|
||||||
SMESHGUI_Dialog::TypesList types;
|
|
||||||
selected( names, types, ids );
|
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
{
|
updateDialog();
|
||||||
myDlg->selectObject( names, types, ids );
|
|
||||||
myDlg->updateControlState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onActivateObject
|
// function : createFilter
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_InitMeshOp::onActivateObject( int obj )
|
SUIT_SelectionFilter* SMESHGUI_InitMeshOp::createFilter( const int id ) const
|
||||||
{
|
{
|
||||||
SalomeApp_SelectionMgr* mgr = selectionMgr();
|
if( id==SMESHGUI_InitMeshDlg::GeomObj )
|
||||||
|
{
|
||||||
|
TColStd_MapOfInteger allTypesMap;
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
allTypesMap.Add(i);
|
||||||
|
return new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, 0, allTypesMap );
|
||||||
|
}
|
||||||
|
|
||||||
if( !mgr )
|
else if( id==SMESHGUI_InitMeshDlg::Hypo )
|
||||||
return;
|
return new SMESH_TypeFilter (HYPOTHESIS);
|
||||||
|
|
||||||
mgr->clearFilters();
|
else if( id==SMESHGUI_InitMeshDlg::Algo )
|
||||||
if( obj==SMESHGUI_InitMeshDlg::GeomObj )
|
return new SMESH_TypeFilter (ALGORITHM);
|
||||||
mgr->installFilter( myGeomFilter );
|
|
||||||
|
|
||||||
else if( obj==SMESHGUI_InitMeshDlg::Hypo )
|
else
|
||||||
mgr->installFilter( myHypothesisFilter );
|
return 0;
|
||||||
|
|
||||||
else if( obj==SMESHGUI_InitMeshDlg::Algo )
|
|
||||||
mgr->installFilter( myAlgorithmFilter );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -236,7 +206,7 @@ bool SMESHGUI_InitMeshOp::onApply()
|
|||||||
|
|
||||||
update( UF_Model | UF_ObjBrowser );
|
update( UF_Model | UF_ObjBrowser );
|
||||||
|
|
||||||
init();
|
initDialog();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,13 +233,13 @@ QString SMESHGUI_InitMeshOp::defaultMeshName() const
|
|||||||
// function : init()
|
// function : init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_InitMeshOp::init()
|
void SMESHGUI_InitMeshOp::initDialog()
|
||||||
{
|
{
|
||||||
|
SMESHGUI_SelectionOp::initDialog();
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
{
|
{
|
||||||
myDlg->setMeshName( defaultMeshName() );
|
myDlg->setMeshName( defaultMeshName() );
|
||||||
myDlg->clearSelection();
|
updateDialog();
|
||||||
myDlg->updateControlState();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,28 +293,40 @@ void SMESHGUI_InitMeshOp::onSelectionChanged( int id )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onNameChanged()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_InitMeshOp::onNameChanged( const QString& )
|
||||||
|
{
|
||||||
|
updateDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_InitMeshOp::updateDialog()
|
||||||
|
{
|
||||||
|
if( !myDlg )
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool isEnabled = !myDlg->meshName().isEmpty() &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_InitMeshDlg::GeomObj ) &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_InitMeshDlg::Hypo ) &&
|
||||||
|
myDlg->hasSelection( SMESHGUI_InitMeshDlg::Algo );
|
||||||
|
myDlg->setButtonEnabled( isEnabled, QtxDialog::OK | QtxDialog::Apply );
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool SMESHGUI_InitMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
bool SMESHGUI_InitMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
||||||
{
|
{
|
||||||
if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_AddSubMeshOp" ) )
|
//if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_AddSubMeshOp" ) )
|
||||||
return true;
|
return true;
|
||||||
else
|
/*else
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,20 +29,19 @@
|
|||||||
#ifndef OPERATION_INIT_MESH_H
|
#ifndef OPERATION_INIT_MESH_H
|
||||||
#define OPERATION_INIT_MESH_H
|
#define OPERATION_INIT_MESH_H
|
||||||
|
|
||||||
#include <SMESHGUI_Operation.h>
|
#include <SMESHGUI_SelectionOp.h>
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Gen)
|
#include CORBA_SERVER_HEADER(SMESH_Gen)
|
||||||
|
|
||||||
class SMESHGUI_InitMeshDlg;
|
class SMESHGUI_InitMeshDlg;
|
||||||
class SUIT_SelectionFilter;
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_InitMeshOp
|
// class : SMESHGUI_InitMeshOp
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_InitMeshOp : public SMESHGUI_Operation
|
class SMESHGUI_InitMeshOp : public SMESHGUI_SelectionOp
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -51,7 +50,8 @@ public:
|
|||||||
~SMESHGUI_InitMeshOp();
|
~SMESHGUI_InitMeshOp();
|
||||||
|
|
||||||
virtual SalomeApp_Dialog* dlg() const;
|
virtual SalomeApp_Dialog* dlg() const;
|
||||||
void init();
|
virtual void initDialog();
|
||||||
|
|
||||||
QString defaultMeshName() const;
|
QString defaultMeshName() const;
|
||||||
|
|
||||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
||||||
@ -59,19 +59,21 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
virtual void selectionDone();
|
virtual void selectionDone();
|
||||||
|
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||||
|
|
||||||
SMESH::SMESH_Mesh_var initMesh( GEOM::GEOM_Object_ptr, const QString& );
|
SMESH::SMESH_Mesh_var initMesh( GEOM::GEOM_Object_ptr, const QString& );
|
||||||
|
|
||||||
|
void updateDialog();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
virtual void onSelectionChanged( int );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onActivateObject( int );
|
void onNameChanged( const QString& );
|
||||||
void onSelectionChanged( int );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESHGUI_InitMeshDlg *myDlg;
|
SMESHGUI_InitMeshDlg *myDlg;
|
||||||
SUIT_SelectionFilter *myGeomFilter, *myHypothesisFilter, *myAlgorithmFilter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OPERATION_INIT_MESH_H
|
#endif // OPERATION_INIT_MESH_H
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
// class : SMESHGUI_NodesDlg()
|
// class : SMESHGUI_NodesDlg()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule )
|
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg()
|
||||||
: SMESHGUI_Dialog( theModule, false, false, OK | Apply | Close )
|
: SMESHGUI_Dialog( false, false, OK | Apply | Close )
|
||||||
{
|
{
|
||||||
QPixmap image0( resMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
|
QPixmap image0( resMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
|
||||||
setName("SMESHGUI_NodesDlg");
|
setName("SMESHGUI_NodesDlg");
|
||||||
@ -112,6 +112,8 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule )
|
|||||||
connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SIGNAL(valueChanged(double)));
|
connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SIGNAL(valueChanged(double)));
|
||||||
|
|
||||||
SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
|
SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
|
||||||
|
|
||||||
|
setFocusProxy( SpinBox_X );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -142,7 +144,4 @@ void SMESHGUI_NodesDlg::setCoords( const double x, const double y, const double
|
|||||||
SpinBox_X->setValue( x );
|
SpinBox_X->setValue( x );
|
||||||
SpinBox_Y->setValue( y );
|
SpinBox_Y->setValue( y );
|
||||||
SpinBox_Z->setValue( z );
|
SpinBox_Z->setValue( z );
|
||||||
SpinBox_X->clearFocus();
|
|
||||||
SpinBox_Y->clearFocus();
|
|
||||||
SpinBox_Z->clearFocus();
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class SMESHGUI_NodesDlg : public SMESHGUI_Dialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_NodesDlg( SMESHGUI* );
|
SMESHGUI_NodesDlg();
|
||||||
~SMESHGUI_NodesDlg();
|
~SMESHGUI_NodesDlg();
|
||||||
|
|
||||||
void coords( double&, double&, double& ) const;
|
void coords( double&, double&, double& ) const;
|
||||||
|
@ -228,7 +228,7 @@ void SMESHGUI_NodesOp::startOperation()
|
|||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_NodesDlg( getSMESHGUI() );
|
myDlg = new SMESHGUI_NodesDlg();
|
||||||
connect( myDlg, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) );
|
connect( myDlg, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) );
|
||||||
connect( myDlg, SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
|
connect( myDlg, SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
|
||||||
}
|
}
|
||||||
@ -245,7 +245,8 @@ void SMESHGUI_NodesOp::startOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_NodesOp::commitOperation()
|
void SMESHGUI_NodesOp::commitOperation()
|
||||||
{
|
{
|
||||||
delete mySimulation;
|
if( mySimulation )
|
||||||
|
delete mySimulation;
|
||||||
mySimulation = 0;
|
mySimulation = 0;
|
||||||
SMESHGUI_SelectionOp::commitOperation();
|
SMESHGUI_SelectionOp::commitOperation();
|
||||||
}
|
}
|
||||||
@ -256,7 +257,8 @@ void SMESHGUI_NodesOp::commitOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_NodesOp::abortOperation()
|
void SMESHGUI_NodesOp::abortOperation()
|
||||||
{
|
{
|
||||||
delete mySimulation;
|
if( mySimulation )
|
||||||
|
delete mySimulation;
|
||||||
mySimulation = 0;
|
mySimulation = 0;
|
||||||
SMESHGUI_SelectionOp::abortOperation();
|
SMESHGUI_SelectionOp::abortOperation();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ protected:
|
|||||||
virtual void commitOperation();
|
virtual void commitOperation();
|
||||||
virtual void abortOperation();
|
virtual void abortOperation();
|
||||||
|
|
||||||
void initDialog();
|
virtual void initDialog();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user