2012-08-09 16:03:55 +06:00
|
|
|
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
2006-05-06 14:51:48 +06:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2006-05-06 14:51:48 +06:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
// 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.
|
2006-05-06 14:51:48 +06:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
// 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.
|
2006-05-06 14:51:48 +06:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
// 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
|
2009-02-17 10:27:49 +05:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2009-02-17 10:27:49 +05:00
|
|
|
//
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// SMESH SMESHGUI : GUI for SMESH component
|
|
|
|
// File : SMESHGUI_AddMeshElementDlg.cxx
|
|
|
|
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
|
|
|
|
// SMESH includes
|
2006-05-06 14:51:48 +06:00
|
|
|
//
|
2006-03-13 20:29:49 +05:00
|
|
|
#include "SMESHGUI_AddQuadraticElementDlg.h"
|
|
|
|
|
|
|
|
#include "SMESHGUI.h"
|
|
|
|
#include "SMESHGUI_Utils.h"
|
|
|
|
#include "SMESHGUI_VTKUtils.h"
|
|
|
|
#include "SMESHGUI_MeshUtils.h"
|
2012-08-09 16:03:55 +06:00
|
|
|
#include "SMESHGUI_GroupUtils.h"
|
2006-03-13 20:29:49 +05:00
|
|
|
#include "SMESHGUI_IdValidator.h"
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <SMESH_Actor.h>
|
|
|
|
#include <SMESH_ActorUtils.h>
|
|
|
|
#include <SMESH_FaceOrientationFilter.h>
|
|
|
|
#include <SMDS_Mesh.hxx>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// SALOME GUI includes
|
|
|
|
#include <SUIT_Desktop.h>
|
|
|
|
#include <SUIT_Session.h>
|
|
|
|
#include <SUIT_MessageBox.h>
|
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SUIT_ViewManager.h>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <LightApp_SelectionMgr.h>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <SVTK_ViewModel.h>
|
|
|
|
#include <SVTK_ViewWindow.h>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <SALOME_ListIO.hxx>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <SalomeApp_Application.h>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// IDL includes
|
|
|
|
#include <SALOMEconfig.h>
|
2008-03-07 12:47:05 +05:00
|
|
|
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// OCCT includes
|
2006-03-13 20:29:49 +05:00
|
|
|
#include <TColStd_MapOfInteger.hxx>
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// VTK includes
|
2006-03-13 20:29:49 +05:00
|
|
|
#include <vtkIdList.h>
|
|
|
|
#include <vtkUnstructuredGrid.h>
|
|
|
|
#include <vtkDataSetMapper.h>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <vtkPolyDataMapper.h>
|
2006-03-13 20:29:49 +05:00
|
|
|
#include <vtkProperty.h>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <vtkCellType.h>
|
|
|
|
|
|
|
|
// Qt includes
|
2012-08-09 16:03:55 +06:00
|
|
|
#include <QComboBox>
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
#include <QButtonGroup>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
// STL includes
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <vector>
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#define SPACING 6
|
|
|
|
#define MARGIN 11
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
namespace
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
void ReverseConnectivity( std::vector<vtkIdType> & ids, SMDSAbs_EntityType type,
|
|
|
|
bool toReverse, // inverse element
|
|
|
|
bool toVtkOrder ) // smds connectivity to vtk one
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
if ( toReverse ) // first reverse smds order
|
|
|
|
{
|
|
|
|
const std::vector<int>& index = SMDS_MeshCell::reverseSmdsOrder(type);
|
|
|
|
SMDS_MeshCell::applyInterlace( index, ids );
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
if ( toVtkOrder ) // from smds to vtk connectivity
|
|
|
|
{
|
|
|
|
const std::vector<int>& index = SMDS_MeshCell::toVtkOrder(type);
|
|
|
|
SMDS_MeshCell::applyInterlace( index, ids );
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
}
|
|
|
|
namespace SMESH
|
|
|
|
{
|
2006-03-13 20:29:49 +05:00
|
|
|
class TElementSimulation {
|
|
|
|
SalomeApp_Application* myApplication;
|
|
|
|
SUIT_ViewWindow* myViewWindow;
|
|
|
|
SVTK_ViewWindow* myVTKViewWindow;
|
|
|
|
|
|
|
|
SALOME_Actor* myPreviewActor;
|
|
|
|
vtkDataSetMapper* myMapper;
|
|
|
|
vtkUnstructuredGrid* myGrid;
|
|
|
|
//vtkProperty* myBackProp, *myProp;
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
//vtkFloatingPointType myRGB[3], myBackRGB[3];
|
|
|
|
|
|
|
|
SALOME_Actor* myFaceOrientation;
|
|
|
|
vtkPolyDataMapper* myFaceOrientationDataMapper;
|
|
|
|
SMESH_FaceOrientationFilter* myFaceOrientationFilter;
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
vtkProperty* myProp = vtkProperty::New();
|
2009-02-17 10:27:49 +05:00
|
|
|
vtkFloatingPointType aRGB[3], aBackRGB[3];
|
|
|
|
GetColor( "SMESH", "fill_color", aRGB[0], aRGB[1], aRGB[2], QColor( 0, 170, 255 ) );
|
|
|
|
myProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
|
2006-03-13 20:29:49 +05:00
|
|
|
myPreviewActor->SetProperty( myProp );
|
|
|
|
myProp->Delete();
|
|
|
|
|
|
|
|
vtkProperty* myBackProp = vtkProperty::New();
|
2009-02-17 10:27:49 +05:00
|
|
|
GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) );
|
|
|
|
myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] );
|
2006-03-13 20:29:49 +05:00
|
|
|
myPreviewActor->SetBackfaceProperty( myBackProp );
|
|
|
|
myBackProp->Delete();
|
|
|
|
|
|
|
|
myVTKViewWindow->AddActor(myPreviewActor);
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
// Orientation of faces
|
|
|
|
myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
|
|
|
|
myFaceOrientationFilter->SetInput(myGrid);
|
|
|
|
|
|
|
|
myFaceOrientationDataMapper = vtkPolyDataMapper::New();
|
|
|
|
myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());
|
|
|
|
|
|
|
|
myFaceOrientation = SALOME_Actor::New();
|
|
|
|
myFaceOrientation->PickableOff();
|
|
|
|
myFaceOrientation->VisibilityOff();
|
|
|
|
myFaceOrientation->SetMapper(myFaceOrientationDataMapper);
|
|
|
|
|
|
|
|
vtkProperty* anOrientationProp = vtkProperty::New();
|
|
|
|
GetColor( "SMESH", "orientation_color", aRGB[0], aRGB[1], aRGB[2], QColor( 255, 255, 255 ) );
|
|
|
|
anOrientationProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
|
|
|
|
myFaceOrientation->SetProperty( anOrientationProp );
|
|
|
|
anOrientationProp->Delete();
|
|
|
|
|
|
|
|
myVTKViewWindow->AddActor(myFaceOrientation);
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef std::vector<vtkIdType> TVTKIds;
|
2012-08-09 16:03:55 +06:00
|
|
|
void SetPosition (SMESH_Actor* theActor,
|
|
|
|
SMDSAbs_EntityType theType,
|
|
|
|
TVTKIds& theIds,
|
|
|
|
const int theMode,
|
|
|
|
const bool theReverse)
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
|
|
|
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
|
|
|
|
myGrid->SetPoints(aGrid->GetPoints());
|
|
|
|
|
|
|
|
//add points
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
ReverseConnectivity( theIds, theType, theReverse, /*toVtkOrder=*/true);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
myGrid->Reset();
|
|
|
|
vtkIdList *anIds = vtkIdList::New();
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++) {
|
|
|
|
anIds->InsertId(i,theIds[i]);
|
|
|
|
//std::cout << i<< ": " << theIds[i] << std::endl;
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
vtkIdType aType = SMDS_MeshCell::toVtkType(theType);
|
2006-03-13 20:29:49 +05:00
|
|
|
myGrid->InsertNextCell(aType,anIds);
|
|
|
|
anIds->Delete();
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
myGrid->Modified();
|
|
|
|
|
|
|
|
myPreviewActor->GetMapper()->Update();
|
|
|
|
myPreviewActor->SetRepresentation( theMode );
|
2009-02-17 10:27:49 +05:00
|
|
|
SetVisibility(true, theActor->GetFacesOriented());
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
void SetVisibility (bool theVisibility, bool theShowOrientation = false)
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
|
|
|
myPreviewActor->SetVisibility(theVisibility);
|
2009-02-17 10:27:49 +05:00
|
|
|
myFaceOrientation->SetVisibility(theShowOrientation);
|
2006-03-13 20:29:49 +05:00
|
|
|
RepaintCurrentView();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~TElementSimulation()
|
|
|
|
{
|
|
|
|
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
2012-08-09 16:03:55 +06:00
|
|
|
myVTKViewWindow->RemoveActor(myPreviewActor);
|
|
|
|
myVTKViewWindow->RemoveActor(myFaceOrientation);
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
myPreviewActor->Delete();
|
2009-02-17 10:27:49 +05:00
|
|
|
myFaceOrientation->Delete();
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
myMapper->RemoveAllInputs();
|
|
|
|
myMapper->Delete();
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myFaceOrientationFilter->Delete();
|
|
|
|
|
|
|
|
myFaceOrientationDataMapper->RemoveAllInputs();
|
|
|
|
myFaceOrientationDataMapper->Delete();
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
myGrid->Delete();
|
|
|
|
|
|
|
|
// myProp->Delete();
|
|
|
|
// myBackProp->Delete();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Define the sequences of ids
|
|
|
|
static int FirstEdgeIds[] = {0};
|
|
|
|
static int LastEdgeIds[] = {1};
|
|
|
|
|
|
|
|
static int FirstTriangleIds[] = {0,1,2};
|
|
|
|
static int LastTriangleIds[] = {1,2,0};
|
|
|
|
|
|
|
|
static int FirstQuadrangleIds[] = {0,1,2,3};
|
|
|
|
static int LastQuadrangleIds[] = {1,2,3,0};
|
|
|
|
|
|
|
|
static int FirstTetrahedronIds[] = {0,1,2,3,3,3};
|
|
|
|
static int LastTetrahedronIds[] = {1,2,0,0,1,2};
|
|
|
|
|
|
|
|
static int FirstPyramidIds[] = {0,1,2,3,4,4,4,4};
|
|
|
|
static int LastPyramidIds[] = {1,2,3,0,0,1,2,3};
|
|
|
|
|
|
|
|
static int FirstPentahedronIds[] = {0,1,2,3,4,5,0,1,2};
|
|
|
|
static int LastPentahedronIds[] = {1,2,0,4,5,3,3,4,5};
|
|
|
|
|
|
|
|
static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3};
|
|
|
|
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
/*!
|
|
|
|
\class BusyLocker
|
|
|
|
\brief Simple 'busy state' flag locker.
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
class BusyLocker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//! Constructor. Sets passed boolean flag to \c true.
|
|
|
|
BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
|
|
|
|
//! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
|
|
|
|
~BusyLocker() { myBusy = false; }
|
|
|
|
private:
|
|
|
|
bool& myBusy; //! External 'busy state' boolean flag
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class IdEditItem
|
|
|
|
\brief Simple editable table item.
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
|
|
|
|
class IdEditItem: public QTableWidgetItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
IdEditItem(const QString& text );
|
|
|
|
~IdEditItem();
|
|
|
|
|
|
|
|
QWidget* createEditor() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
IdEditItem::IdEditItem(const QString& text )
|
|
|
|
: QTableWidgetItem(text, QTableWidgetItem::UserType+100)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
IdEditItem::~IdEditItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget* IdEditItem::createEditor() const
|
|
|
|
{
|
|
|
|
QLineEdit *aLineEdit = new QLineEdit(text(), tableWidget());
|
|
|
|
aLineEdit->setValidator( new SMESHGUI_IdValidator(tableWidget(), 1) );
|
|
|
|
return aLineEdit;
|
|
|
|
}
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
//=================================================================================
|
|
|
|
// function : SMESHGUI_AddQuadraticElementDlg()
|
|
|
|
// purpose : constructor
|
|
|
|
//=================================================================================
|
|
|
|
SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule,
|
2012-08-09 16:03:55 +06:00
|
|
|
const SMDSAbs_EntityType theType )
|
2009-02-17 10:27:49 +05:00
|
|
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
|
|
|
mySMESHGUI( theModule ),
|
|
|
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
2012-08-09 16:03:55 +06:00
|
|
|
myGeomType( theType ),
|
|
|
|
//myType( theType ),
|
2009-02-17 10:27:49 +05:00
|
|
|
myBusy( false )
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
setModal( false );
|
|
|
|
setAttribute( Qt::WA_DeleteOnClose, true );
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
|
|
|
|
(SUIT_Session::session()->activeApplication());
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
mySimulation = new SMESH::TElementSimulation (anApp);
|
|
|
|
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
|
|
|
|
|
|
|
|
QString anElementName;
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
switch ( myGeomType ) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_EDGE");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Triangle:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_TRIANGLE");
|
2012-08-09 16:03:55 +06:00
|
|
|
break;
|
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_QUADRANGLE");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
|
|
|
anElementName = QString("BIQUADRATIC_QUADRANGLE");
|
|
|
|
break;
|
|
|
|
case SMDSEntity_Quad_Tetra:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_TETRAHEDRON");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Pyramid:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_PYRAMID");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Penta:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_PENTAHEDRON");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Hexa:
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_HEXAHEDRON");
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
|
|
|
anElementName = QString("TRIQUADRATIC_HEXAHEDRON");
|
|
|
|
break;
|
2006-03-13 20:29:49 +05:00
|
|
|
default:
|
2012-08-09 16:03:55 +06:00
|
|
|
myGeomType = SMDSEntity_Quad_Edge;
|
2006-03-13 20:29:49 +05:00
|
|
|
anElementName = QString("QUADRATIC_EDGE");
|
|
|
|
}
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
QString iconName = tr(QString("ICON_DLG_%1").arg(anElementName).toLatin1().data());
|
|
|
|
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(anElementName).toLatin1().data());
|
|
|
|
QString argumentsGrTitle = tr(QString("SMESH_ADD_%1").arg(anElementName).toLatin1().data());
|
|
|
|
QString constructorGrTitle = tr(QString("SMESH_%1").arg(anElementName).toLatin1().data());
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
|
|
|
|
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
setWindowTitle(caption);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
setSizeGripEnabled(true);
|
|
|
|
|
|
|
|
QVBoxLayout* aDialogLayout = new QVBoxLayout(this);
|
|
|
|
aDialogLayout->setSpacing(SPACING);
|
|
|
|
aDialogLayout->setMargin(MARGIN);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
/***************************************************************/
|
2009-02-17 10:27:49 +05:00
|
|
|
GroupConstructors = new QGroupBox(constructorGrTitle, this);
|
|
|
|
QButtonGroup* ButtonGroup = new QButtonGroup(this);
|
|
|
|
QHBoxLayout* aGroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
|
|
|
|
aGroupConstructorsLayout->setSpacing(SPACING);
|
|
|
|
aGroupConstructorsLayout->setMargin(MARGIN);
|
|
|
|
|
|
|
|
myRadioButton1 = new QRadioButton(GroupConstructors);
|
|
|
|
myRadioButton1->setIcon(image0);
|
|
|
|
aGroupConstructorsLayout->addWidget(myRadioButton1);
|
|
|
|
ButtonGroup->addButton(myRadioButton1, 0);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
/***************************************************************/
|
2009-02-17 10:27:49 +05:00
|
|
|
GroupArguments = new QGroupBox(argumentsGrTitle, this);
|
|
|
|
QGridLayout* aGroupArgumentsLayout = new QGridLayout(GroupArguments);
|
|
|
|
aGroupArgumentsLayout->setSpacing(SPACING);
|
|
|
|
aGroupArgumentsLayout->setMargin(MARGIN);
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
// Corner nodes
|
2009-02-17 10:27:49 +05:00
|
|
|
QLabel* aCornerNodesLabel = new QLabel(tr("SMESH_CORNER_NODES"), GroupArguments);
|
2012-08-09 16:03:55 +06:00
|
|
|
myCornerSelectButton = new QPushButton(GroupArguments);
|
|
|
|
myCornerSelectButton->setIcon(image1);
|
2009-02-17 10:27:49 +05:00
|
|
|
myCornerNodes = new QLineEdit(GroupArguments);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
// Mid-edge nodes
|
2009-02-17 10:27:49 +05:00
|
|
|
myTable = new QTableWidget(GroupArguments);
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
// Mid-face nodes
|
|
|
|
myMidFaceLabel = new QLabel(tr("SMESH_MIDFACE_NODES"), GroupArguments);
|
|
|
|
myMidFaceSelectButton = new QPushButton(GroupArguments);
|
|
|
|
myMidFaceSelectButton->setIcon(image1);
|
|
|
|
myMidFaceNodes = new QLineEdit(GroupArguments);
|
|
|
|
myMidFaceNodes->setValidator(new SMESHGUI_IdValidator(this, 6));
|
|
|
|
|
|
|
|
// Central node
|
|
|
|
myCenterLabel = new QLabel(tr("SMESH_CENTER_NODE"), GroupArguments);
|
|
|
|
myCenterSelectButton = new QPushButton(GroupArguments);
|
|
|
|
myCenterSelectButton->setIcon(image1);
|
|
|
|
myCenterNode = new QLineEdit(GroupArguments);
|
|
|
|
myCenterNode->setValidator(new SMESHGUI_IdValidator(this, 1));
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myReverseCB = new QCheckBox(tr("SMESH_REVERSE"), GroupArguments);
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
aGroupArgumentsLayout->addWidget(aCornerNodesLabel, 0, 0);
|
|
|
|
aGroupArgumentsLayout->addWidget(myCornerSelectButton, 0, 1);
|
|
|
|
aGroupArgumentsLayout->addWidget(myCornerNodes, 0, 2);
|
|
|
|
aGroupArgumentsLayout->addWidget(myTable, 1, 0, 1, 3);
|
|
|
|
aGroupArgumentsLayout->addWidget(myMidFaceLabel, 2, 0);
|
|
|
|
aGroupArgumentsLayout->addWidget(myMidFaceSelectButton, 2, 1);
|
|
|
|
aGroupArgumentsLayout->addWidget(myMidFaceNodes, 2, 2);
|
|
|
|
aGroupArgumentsLayout->addWidget(myCenterLabel, 3, 0);
|
|
|
|
aGroupArgumentsLayout->addWidget(myCenterSelectButton, 3, 1);
|
|
|
|
aGroupArgumentsLayout->addWidget(myCenterNode, 3, 2);
|
|
|
|
aGroupArgumentsLayout->addWidget(myReverseCB, 4, 0, 1, 3);
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
|
|
|
|
GroupGroups->setCheckable( true );
|
|
|
|
QHBoxLayout* GroupGroupsLayout = new QHBoxLayout(GroupGroups);
|
|
|
|
GroupGroupsLayout->setSpacing(SPACING);
|
|
|
|
GroupGroupsLayout->setMargin(MARGIN);
|
|
|
|
|
|
|
|
TextLabel_GroupName = new QLabel( tr( "SMESH_GROUP" ), GroupGroups );
|
|
|
|
ComboBox_GroupName = new QComboBox( GroupGroups );
|
|
|
|
ComboBox_GroupName->setEditable( true );
|
|
|
|
ComboBox_GroupName->setInsertPolicy( QComboBox::NoInsert );
|
|
|
|
|
|
|
|
GroupGroupsLayout->addWidget( TextLabel_GroupName );
|
|
|
|
GroupGroupsLayout->addWidget( ComboBox_GroupName, 1 );
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
/***************************************************************/
|
2009-02-17 10:27:49 +05:00
|
|
|
GroupButtons = new QGroupBox(this);
|
|
|
|
QHBoxLayout* aGroupButtonsLayout = new QHBoxLayout(GroupButtons);
|
|
|
|
aGroupButtonsLayout->setSpacing(SPACING);
|
|
|
|
aGroupButtonsLayout->setMargin(MARGIN);
|
|
|
|
|
|
|
|
buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
|
|
|
|
buttonOk->setAutoDefault(true);
|
|
|
|
buttonOk->setDefault(true);
|
|
|
|
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
|
|
|
|
buttonApply->setAutoDefault(true);
|
|
|
|
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
|
|
|
|
buttonCancel->setAutoDefault(true);
|
|
|
|
buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
|
|
|
|
buttonHelp->setAutoDefault(true);
|
|
|
|
|
|
|
|
aGroupButtonsLayout->addWidget(buttonOk);
|
|
|
|
aGroupButtonsLayout->addSpacing(10);
|
|
|
|
aGroupButtonsLayout->addWidget(buttonApply);
|
|
|
|
aGroupButtonsLayout->addSpacing(10);
|
|
|
|
aGroupButtonsLayout->addStretch();
|
|
|
|
aGroupButtonsLayout->addWidget(buttonCancel);
|
|
|
|
aGroupButtonsLayout->addWidget(buttonHelp);
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
aDialogLayout->addWidget(GroupConstructors);
|
|
|
|
aDialogLayout->addWidget(GroupArguments);
|
2012-08-09 16:03:55 +06:00
|
|
|
aDialogLayout->addWidget(GroupGroups);
|
2009-02-17 10:27:49 +05:00
|
|
|
aDialogLayout->addWidget(GroupButtons);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
Init(); /* Initialisations */
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~SMESHGUI_AddQuadraticElementDlg()
|
|
|
|
// purpose : Destroys the object and frees any allocated resources
|
|
|
|
//=================================================================================
|
|
|
|
SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg()
|
|
|
|
{
|
|
|
|
delete mySimulation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : Init()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::Init()
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
myRadioButton1->setChecked(true);
|
2006-03-13 20:29:49 +05:00
|
|
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
/* reset "Add to group" control */
|
|
|
|
GroupGroups->setChecked( false );
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
myActor = 0;
|
2012-08-09 16:03:55 +06:00
|
|
|
myNbMidFaceNodes = 0;
|
|
|
|
myNbCenterNodes = 0;
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
int aNumRows;
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
switch (myGeomType) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 1;
|
|
|
|
myNbCorners = 2;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_edges
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Triangle:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 3;
|
|
|
|
myNbCorners = 3;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_triangles
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
|
|
|
aNumRows = 4;
|
|
|
|
myNbCorners = 4;
|
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_quadrangles
|
|
|
|
break;
|
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 4;
|
|
|
|
myNbCorners = 4;
|
2012-08-09 16:03:55 +06:00
|
|
|
myNbCenterNodes = 1;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_quadrangles
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Tetra:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 6;
|
|
|
|
myNbCorners = 4;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_tetrahedrons
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Pyramid:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 8;
|
|
|
|
myNbCorners = 5;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_pyramids
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Penta:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 9;
|
|
|
|
myNbCorners = 6;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_pentahedrons
|
2012-08-09 16:03:55 +06:00
|
|
|
break;
|
|
|
|
case SMDSEntity_Quad_Hexa:
|
|
|
|
aNumRows = 12;
|
|
|
|
myNbCorners = 8;
|
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
|
|
|
|
break;
|
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
2006-03-13 20:29:49 +05:00
|
|
|
aNumRows = 12;
|
|
|
|
myNbCorners = 8;
|
2012-08-09 16:03:55 +06:00
|
|
|
myNbMidFaceNodes = 6;
|
|
|
|
myNbCenterNodes = 1;
|
2008-03-07 12:47:05 +05:00
|
|
|
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
|
2006-03-13 20:29:49 +05:00
|
|
|
break;
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
myMidFaceLabel ->setVisible( myNbMidFaceNodes );
|
|
|
|
myMidFaceSelectButton->setVisible( myNbMidFaceNodes );
|
|
|
|
myMidFaceNodes ->setVisible( myNbMidFaceNodes );
|
|
|
|
myCenterLabel ->setVisible( myNbCenterNodes );
|
|
|
|
myCenterSelectButton ->setVisible( myNbCenterNodes );
|
|
|
|
myCenterNode ->setVisible( myNbCenterNodes );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myCornerNodes->setValidator(new SMESHGUI_IdValidator(this, myNbCorners));
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
/* initialize table */
|
2009-02-17 10:27:49 +05:00
|
|
|
myTable->setColumnCount(3);
|
|
|
|
myTable->setRowCount(aNumRows);
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
QStringList aColLabels;
|
|
|
|
aColLabels.append(tr("SMESH_FIRST"));
|
|
|
|
aColLabels.append(tr("SMESH_MIDDLE"));
|
|
|
|
aColLabels.append(tr("SMESH_LAST"));
|
2009-02-17 10:27:49 +05:00
|
|
|
myTable->setHorizontalHeaderLabels(aColLabels);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int col = 0; col < myTable->columnCount(); col++ )
|
2006-03-13 20:29:49 +05:00
|
|
|
myTable->setColumnWidth(col, 80);
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
//myTable->setColumnReadOnly(0, true); // VSR: TODO
|
|
|
|
//myTable->setColumnReadOnly(2, true); // VSR: TODO
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
myTable->setEnabled( false );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
|
|
|
{
|
|
|
|
myTable->setItem( row, 0, new QTableWidgetItem( "" ) );
|
|
|
|
myTable->item( row, 0 )->setFlags(0);
|
|
|
|
|
|
|
|
IdEditItem* anEditItem = new IdEditItem( "" );
|
|
|
|
anEditItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
|
|
|
|
myTable->setItem(row, 1, anEditItem);
|
|
|
|
|
|
|
|
myTable->setItem( row, 2, new QTableWidgetItem( "" ) );
|
|
|
|
myTable->item( row, 2 )->setFlags(0);
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
/* signals and slots connections */
|
2012-08-09 16:03:55 +06:00
|
|
|
connect(myCornerSelectButton, SIGNAL(clicked()), SLOT(SetCurrentSelection()));
|
|
|
|
connect(myMidFaceSelectButton, SIGNAL(clicked()), SLOT(SetCurrentSelection()));
|
|
|
|
connect(myCenterSelectButton, SIGNAL(clicked()), SLOT(SetCurrentSelection()));
|
2006-03-13 20:29:49 +05:00
|
|
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
|
2009-02-17 10:27:49 +05:00
|
|
|
connect(myTable, SIGNAL(cellDoubleClicked(int, int)), SLOT(onCellDoubleClicked(int, int)));
|
|
|
|
connect(myTable, SIGNAL(cellChanged (int, int)), SLOT(onCellTextChange(int, int)));
|
2006-03-13 20:29:49 +05:00
|
|
|
connect(myCornerNodes, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
2012-08-09 16:03:55 +06:00
|
|
|
connect(myMidFaceNodes, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
|
|
|
connect(myCenterNode, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
2006-03-13 20:29:49 +05:00
|
|
|
connect(myReverseCB, SIGNAL(stateChanged(int)), SLOT(onReverse(int)));
|
|
|
|
|
|
|
|
connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
|
2013-02-28 21:07:35 +06:00
|
|
|
connect(buttonCancel, SIGNAL(clicked()), SLOT(reject()));
|
2006-03-13 20:29:49 +05:00
|
|
|
connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
|
2006-05-06 14:51:48 +06:00
|
|
|
connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp()));
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
|
2013-02-28 21:07:35 +06:00
|
|
|
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(reject()));
|
|
|
|
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(reject()));
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
myCurrentLineEdit = myCornerNodes;
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
// set selection mode
|
|
|
|
SMESH::SetPointRepresentation(true);
|
|
|
|
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode( NodeSelection );
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
SelectionIntoArgument();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnApply()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
|
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
if( !isValid() )
|
|
|
|
return;
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() )
|
|
|
|
return;
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
BusyLocker lock( myBusy );
|
|
|
|
|
|
|
|
std::vector<vtkIdType> anIds;
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
switch (myGeomType) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
2009-02-17 10:27:49 +05:00
|
|
|
anIds.push_back(myTable->item(0, 0)->text().toInt());
|
|
|
|
anIds.push_back(myTable->item(0, 2)->text().toInt());
|
|
|
|
anIds.push_back(myTable->item(0, 1)->text().toInt());
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Triangle:
|
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
|
|
|
case SMDSEntity_Quad_Tetra:
|
|
|
|
case SMDSEntity_Quad_Pyramid:
|
|
|
|
case SMDSEntity_Quad_Penta:
|
|
|
|
case SMDSEntity_Quad_Hexa:
|
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int row = 0; row < myNbCorners; row++ )
|
|
|
|
anIds.push_back(myTable->item(row, 0)->text().toInt());
|
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
|
|
|
anIds.push_back(myTable->item(row, 1)->text().toInt());
|
2012-08-09 16:03:55 +06:00
|
|
|
if ( myNbMidFaceNodes )
|
|
|
|
{
|
|
|
|
QStringList aListId = myMidFaceNodes->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
for (int i = 0; i < aListId.count(); i++)
|
|
|
|
anIds.push_back( aListId[ i ].toInt() );
|
|
|
|
}
|
|
|
|
if ( myNbCenterNodes )
|
|
|
|
{
|
|
|
|
QStringList aListId = myCenterNode->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
anIds.push_back( aListId[ 0 ].toInt() );
|
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( myReverseCB->isChecked())
|
2012-08-09 16:03:55 +06:00
|
|
|
ReverseConnectivity( anIds, myGeomType, /*toReverse=*/true, /*toVtkOrder=*/false );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
int aNumberOfIds = anIds.size();
|
|
|
|
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
|
|
|
|
anArrayOfIdeces->length( aNumberOfIds );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
for (int i = 0; i < aNumberOfIds; i++)
|
|
|
|
anArrayOfIdeces[i] = anIds[ i ];
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
bool addToGroup = GroupGroups->isChecked();
|
|
|
|
QString aGroupName;
|
|
|
|
|
|
|
|
SMESH::SMESH_GroupBase_var aGroup;
|
|
|
|
int idx = 0;
|
|
|
|
if( addToGroup ) {
|
|
|
|
aGroupName = ComboBox_GroupName->currentText();
|
2012-10-08 17:56:59 +06:00
|
|
|
for ( int i = 1; i <= ComboBox_GroupName->count(); i++ ) {
|
2012-08-09 16:03:55 +06:00
|
|
|
QString aName = ComboBox_GroupName->itemText( i );
|
|
|
|
if ( aGroupName == aName && ( i == ComboBox_GroupName->currentIndex() || idx == 0 ) )
|
|
|
|
idx = i;
|
|
|
|
}
|
2012-10-08 17:56:59 +06:00
|
|
|
if ( idx > 0 && idx <= myGroups.count() ) {
|
2012-08-09 16:03:55 +06:00
|
|
|
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( myGroups[idx-1] );
|
|
|
|
if ( !aGeomGroup->_is_nil() ) {
|
|
|
|
int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ),
|
|
|
|
tr( "MESH_STANDALONE_GRP_CHOSEN" ).arg( aGroupName ),
|
|
|
|
tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 0, 1 );
|
|
|
|
if ( res == 1 ) return;
|
|
|
|
}
|
|
|
|
aGroup = myGroups[idx-1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SMESH::ElementType anElementType;
|
|
|
|
long anElemId = -1;
|
2009-02-17 10:27:49 +05:00
|
|
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
2012-08-09 16:03:55 +06:00
|
|
|
switch (myGeomType) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
|
|
|
anElementType = SMESH::EDGE;
|
|
|
|
anElemId = aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
|
|
|
|
case SMDSEntity_Quad_Triangle:
|
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
|
|
|
anElementType = SMESH::FACE;
|
|
|
|
anElemId = aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
|
|
|
|
case SMDSEntity_Quad_Tetra:
|
|
|
|
case SMDSEntity_Quad_Pyramid:
|
|
|
|
case SMDSEntity_Quad_Penta:
|
|
|
|
case SMDSEntity_Quad_Hexa:
|
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
|
|
|
anElementType = SMESH::VOLUME;
|
|
|
|
anElemId = aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( anElemId != -1 && addToGroup && !aGroupName.isEmpty() ) {
|
|
|
|
SMESH::SMESH_Group_var aGroupUsed;
|
|
|
|
if ( aGroup->_is_nil() ) {
|
|
|
|
// create new group
|
|
|
|
aGroupUsed = SMESH::AddGroup( myMesh, anElementType, aGroupName );
|
|
|
|
if ( !aGroupUsed->_is_nil() ) {
|
|
|
|
myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroupUsed));
|
|
|
|
ComboBox_GroupName->addItem( aGroupName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
|
|
|
|
if ( !aGeomGroup->_is_nil() ) {
|
|
|
|
aGroupUsed = myMesh->ConvertToStandalone( aGeomGroup );
|
|
|
|
if ( !aGroupUsed->_is_nil() && idx > 0 ) {
|
|
|
|
myGroups[idx-1] = SMESH::SMESH_GroupBase::_duplicate(aGroupUsed);
|
|
|
|
SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aGroupUsed = SMESH::SMESH_Group::_narrow( aGroup );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !aGroupUsed->_is_nil() ) {
|
|
|
|
SMESH::long_array_var anIdList = new SMESH::long_array;
|
|
|
|
anIdList->length( 1 );
|
|
|
|
anIdList[0] = anElemId;
|
|
|
|
aGroupUsed->Add( anIdList.inout() );
|
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
SALOME_ListIO aList; aList.Append( myActor->getIO() );
|
|
|
|
mySelector->ClearIndex();
|
|
|
|
mySelectionMgr->setSelectedObjects( aList, false );
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
SMESH::UpdateView();
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
UpdateTable();
|
2012-08-09 16:03:55 +06:00
|
|
|
SetCurrentSelection();
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
updateButtons();
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
SMESHGUI::Modified();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnOk()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::ClickOnOk()
|
|
|
|
{
|
|
|
|
ClickOnApply();
|
2013-02-28 21:07:35 +06:00
|
|
|
reject();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2013-02-28 21:07:35 +06:00
|
|
|
// function : reject()
|
2006-03-13 20:29:49 +05:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2013-02-28 21:07:35 +06:00
|
|
|
void SMESHGUI_AddQuadraticElementDlg::reject()
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
|
|
|
mySelectionMgr->clearSelected();
|
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
SMESH::SetPointRepresentation(false);
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode( ActorSelection );
|
|
|
|
disconnect(mySelectionMgr, 0, this, 0);
|
|
|
|
mySMESHGUI->ResetState();
|
2013-02-28 21:07:35 +06:00
|
|
|
QDialog::reject();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2006-05-06 14:51:48 +06:00
|
|
|
// function : ClickOnHelp()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp()
|
|
|
|
{
|
|
|
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
2012-08-09 16:03:55 +06:00
|
|
|
if (app)
|
2006-05-06 14:51:48 +06:00
|
|
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
|
|
|
else {
|
2009-02-17 10:27:49 +05:00
|
|
|
QString platform;
|
2008-03-07 12:47:05 +05:00
|
|
|
#ifdef WIN32
|
2009-02-17 10:27:49 +05:00
|
|
|
platform = "winapplication";
|
2008-03-07 12:47:05 +05:00
|
|
|
#else
|
2009-02-17 10:27:49 +05:00
|
|
|
platform = "application";
|
2008-03-07 12:47:05 +05:00
|
|
|
#endif
|
2009-02-17 10:27:49 +05:00
|
|
|
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
2012-08-09 16:03:55 +06:00
|
|
|
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
|
|
|
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
|
|
|
platform)).
|
|
|
|
arg(myHelpFileName));
|
2006-05-06 14:51:48 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2006-03-13 20:29:49 +05:00
|
|
|
// function : onTextChange()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
|
|
|
|
{
|
|
|
|
if (myBusy) return;
|
2009-02-17 10:27:49 +05:00
|
|
|
BusyLocker lock( myBusy );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
|
|
|
|
// hilight entered nodes
|
|
|
|
SMDS_Mesh* aMesh = 0;
|
|
|
|
if (myActor)
|
|
|
|
aMesh = myActor->GetObject()->GetMesh();
|
|
|
|
|
2012-08-09 16:03:55 +06:00
|
|
|
QLineEdit* send = (QLineEdit*)sender();
|
|
|
|
if (send == myCornerNodes ||
|
|
|
|
send == myMidFaceNodes ||
|
|
|
|
send == myCenterNode)
|
|
|
|
myCurrentLineEdit = send;
|
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
if (aMesh) {
|
|
|
|
TColStd_MapOfInteger newIndices;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
|
2006-03-13 20:29:49 +05:00
|
|
|
bool allOk = true;
|
|
|
|
for (int i = 0; i < aListId.count(); i++) {
|
2009-02-17 10:27:49 +05:00
|
|
|
if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
newIndices.Add( n->GetID() );
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
else
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
allOk = false;
|
|
|
|
break;
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->highlight( myActor->getIO(), true, true );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
if ( myCurrentLineEdit == myCornerNodes )
|
2006-03-13 20:29:49 +05:00
|
|
|
UpdateTable( allOk );
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
updateButtons();
|
|
|
|
displaySimulation();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection has changed
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
|
|
|
|
{
|
|
|
|
if (myBusy) return;
|
2009-02-17 10:27:49 +05:00
|
|
|
BusyLocker lock( myBusy );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
QString aCurrentEntry = myEntry;
|
|
|
|
|
|
|
|
if ( myCurrentLineEdit )
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
// clear
|
|
|
|
myActor = 0;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
myCurrentLineEdit->setText("");
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
if (!GroupButtons->isEnabled()) // inactive
|
|
|
|
return;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
mySimulation->SetVisibility(false);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// get selected mesh
|
|
|
|
SALOME_ListIO aList;
|
|
|
|
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
if (aList.Extent() != 1)
|
|
|
|
{
|
|
|
|
UpdateTable();
|
|
|
|
updateButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
2012-08-09 16:03:55 +06:00
|
|
|
myEntry = anIO->getEntry();
|
2009-02-17 10:27:49 +05:00
|
|
|
myMesh = SMESH::GetMeshByIO(anIO);
|
|
|
|
if (myMesh->_is_nil()) {
|
|
|
|
updateButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
// process groups
|
|
|
|
if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
|
|
|
|
SMESH::ElementType anElementType;
|
|
|
|
switch ( myGeomType ) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
|
|
|
anElementType = SMESH::EDGE; break;
|
|
|
|
case SMDSEntity_Quad_Triangle:
|
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
|
|
|
anElementType = SMESH::FACE; break;
|
|
|
|
case SMDSEntity_Quad_Tetra:
|
|
|
|
case SMDSEntity_Quad_Pyramid:
|
|
|
|
case SMDSEntity_Quad_Penta:
|
|
|
|
case SMDSEntity_Quad_Hexa:
|
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
|
|
|
anElementType = SMESH::VOLUME; break;
|
|
|
|
}
|
|
|
|
myGroups.clear();
|
|
|
|
ComboBox_GroupName->clear();
|
|
|
|
ComboBox_GroupName->addItem( QString() );
|
|
|
|
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
|
|
|
|
for ( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
|
|
|
|
SMESH::SMESH_GroupBase_var aGroup = aListOfGroups[i];
|
|
|
|
if ( !aGroup->_is_nil() && aGroup->GetType() == anElementType ) {
|
|
|
|
QString aGroupName( aGroup->GetName() );
|
|
|
|
if ( !aGroupName.isEmpty() ) {
|
|
|
|
myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroup));
|
|
|
|
ComboBox_GroupName->addItem( aGroupName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
if (!myActor) {
|
|
|
|
updateButtons();
|
2006-03-13 20:29:49 +05:00
|
|
|
return;
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
// get selected nodes
|
|
|
|
QString aString = "";
|
|
|
|
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
if ( myCurrentLineEdit )
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
if ( myCurrentLineEdit != myCenterNode || nbNodes == 1 )
|
|
|
|
myCurrentLineEdit->setText(aString);
|
|
|
|
|
|
|
|
if ( myCurrentLineEdit == myCornerNodes )
|
|
|
|
UpdateTable();
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
else if ( myTable->isEnabled() && nbNodes == 1 )
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
int theRow = myTable->currentRow(), theCol = myTable->currentColumn();
|
|
|
|
if ( theCol == 1 )
|
|
|
|
myTable->item(theRow, 1)->setText(aString);
|
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
updateButtons();
|
2006-03-13 20:29:49 +05:00
|
|
|
displaySimulation();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : displaySimulation()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::displaySimulation()
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
if ( IsValid() )
|
|
|
|
{
|
2006-03-13 20:29:49 +05:00
|
|
|
SMESH::TElementSimulation::TVTKIds anIds;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
// Collect ids from the dialog
|
|
|
|
int anID;
|
|
|
|
bool ok;
|
|
|
|
int aDisplayMode = VTK_SURFACE;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
if ( myGeomType == SMDSEntity_Quad_Edge )
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) );
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) );
|
|
|
|
anID = myTable->item(0, 1)->text().toInt(&ok);
|
|
|
|
if (!ok) anID = myTable->item(0, 0)->text().toInt();
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
|
|
|
|
aDisplayMode = VTK_WIREFRAME;
|
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
else
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
for ( int row = 0; row < myNbCorners; row++ )
|
2012-08-09 16:03:55 +06:00
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
anID = myTable->item(row, 1)->text().toInt(&ok);
|
|
|
|
if (!ok) {
|
|
|
|
anID = myTable->item(row, 0)->text().toInt();
|
|
|
|
aDisplayMode = VTK_WIREFRAME;
|
|
|
|
}
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
|
|
|
|
}
|
|
|
|
if ( myNbMidFaceNodes )
|
|
|
|
{
|
|
|
|
QStringList aListId = myMidFaceNodes->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
for (int i = 0; i < aListId.count(); i++)
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId( aListId[ i ].toInt() ));
|
|
|
|
}
|
|
|
|
if ( myNbCenterNodes )
|
|
|
|
{
|
|
|
|
QStringList aListId = myCenterNode->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
anIds.push_back( myActor->GetObject()->GetNodeVTKId( aListId[ 0 ].toInt() ));
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
mySimulation->SetPosition(myActor,myGeomType,anIds,aDisplayMode,myReverseCB->isChecked());
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
}
|
|
|
|
SMESH::UpdateView();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
2012-08-09 16:03:55 +06:00
|
|
|
// function : SetCurrentSelection()
|
2006-03-13 20:29:49 +05:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2012-08-09 16:03:55 +06:00
|
|
|
void SMESHGUI_AddQuadraticElementDlg::SetCurrentSelection()
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
QPushButton* send = (QPushButton*)sender();
|
|
|
|
myCurrentLineEdit = 0;
|
|
|
|
|
|
|
|
if (send == myCornerSelectButton)
|
|
|
|
myCurrentLineEdit = myCornerNodes;
|
|
|
|
else if ( send == myMidFaceSelectButton )
|
|
|
|
myCurrentLineEdit = myMidFaceNodes;
|
|
|
|
else if ( send == myCenterSelectButton )
|
|
|
|
myCurrentLineEdit = myCenterNode;
|
|
|
|
|
|
|
|
if ( myCurrentLineEdit )
|
|
|
|
{
|
|
|
|
myCurrentLineEdit->setFocus();
|
|
|
|
SelectionIntoArgument();
|
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : DeactivateActiveDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::DeactivateActiveDialog()
|
|
|
|
{
|
|
|
|
if (GroupConstructors->isEnabled()) {
|
|
|
|
GroupConstructors->setEnabled(false);
|
|
|
|
GroupArguments->setEnabled(false);
|
|
|
|
GroupButtons->setEnabled(false);
|
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
mySMESHGUI->ResetState();
|
|
|
|
mySMESHGUI->SetActiveDialogBox(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ActivateThisDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::ActivateThisDialog()
|
|
|
|
{
|
|
|
|
/* Emit a signal to deactivate the active dialog */
|
|
|
|
mySMESHGUI->EmitSignalDeactivateDialog();
|
|
|
|
|
|
|
|
GroupConstructors->setEnabled(true);
|
|
|
|
GroupArguments->setEnabled(true);
|
|
|
|
GroupButtons->setEnabled(true);
|
|
|
|
|
|
|
|
SMESH::SetPointRepresentation(true);
|
|
|
|
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode( NodeSelection );
|
|
|
|
SelectionIntoArgument();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : enterEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*)
|
|
|
|
{
|
|
|
|
if (GroupConstructors->isEnabled())
|
|
|
|
return;
|
|
|
|
ActivateThisDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : onReverse()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::onReverse (int state)
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
mySimulation->SetVisibility(false);
|
|
|
|
displaySimulation();
|
|
|
|
updateButtons();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : IsValid()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
bool SMESHGUI_AddQuadraticElementDlg::IsValid()
|
|
|
|
{
|
|
|
|
SMDS_Mesh* aMesh = 0;
|
|
|
|
if (myActor)
|
|
|
|
aMesh = myActor->GetObject()->GetMesh();
|
|
|
|
if (!aMesh)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool ok;
|
2012-08-09 16:03:55 +06:00
|
|
|
std::set< int > okIDs;
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
|
|
|
{
|
|
|
|
int anID = myTable->item(row, 1)->text().toInt(&ok);
|
|
|
|
if ( !ok )
|
|
|
|
return false;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
const SMDS_MeshNode * aNode = aMesh->FindNode(anID);
|
|
|
|
if ( !aNode )
|
|
|
|
return false;
|
2012-08-09 16:03:55 +06:00
|
|
|
okIDs.insert( anID );
|
2009-02-17 10:27:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
QStringList aListId;
|
|
|
|
if ( myNbMidFaceNodes )
|
|
|
|
aListId += myMidFaceNodes->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
if ( myNbCenterNodes )
|
|
|
|
aListId += myCenterNode->text().split(" ", QString::SkipEmptyParts);
|
|
|
|
|
|
|
|
for (int i = 0; i < aListId.count(); i++)
|
|
|
|
{
|
|
|
|
int anID = aListId[ i ].toInt(&ok);
|
|
|
|
if ( !ok )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( !aMesh->FindNode(anID) )
|
|
|
|
return false;
|
|
|
|
okIDs.insert( anID );
|
|
|
|
}
|
|
|
|
|
|
|
|
return okIDs.size() == myTable->rowCount() + myNbMidFaceNodes + myNbCenterNodes;
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : UpdateTable()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity )
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
QStringList aListCorners = myCornerNodes->text().split(" ", QString::SkipEmptyParts);
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2006-03-13 20:29:49 +05:00
|
|
|
if ( aListCorners.count() == myNbCorners && theConersValidity )
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
myTable->setEnabled( true );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
// clear the Middle column
|
2009-02-17 10:27:49 +05:00
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
|
|
|
myTable->item( row, 1 )->setText("");
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
int* aFirstColIds;
|
|
|
|
int* aLastColIds;
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
switch (myGeomType) {
|
|
|
|
case SMDSEntity_Quad_Edge:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstEdgeIds;
|
|
|
|
aLastColIds = LastEdgeIds;
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Triangle:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstTriangleIds;
|
|
|
|
aLastColIds = LastTriangleIds;
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Quadrangle:
|
|
|
|
case SMDSEntity_BiQuad_Quadrangle:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstQuadrangleIds;
|
|
|
|
aLastColIds = LastQuadrangleIds;
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Tetra:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstTetrahedronIds;
|
|
|
|
aLastColIds = LastTetrahedronIds;
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Pyramid:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstPyramidIds;
|
|
|
|
aLastColIds = LastPyramidIds;
|
|
|
|
break;
|
2012-08-09 16:03:55 +06:00
|
|
|
case SMDSEntity_Quad_Penta:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstPentahedronIds;
|
|
|
|
aLastColIds = LastPentahedronIds;
|
2012-08-09 16:03:55 +06:00
|
|
|
break;
|
|
|
|
case SMDSEntity_Quad_Hexa:
|
|
|
|
case SMDSEntity_TriQuad_Hexa:
|
2009-02-17 10:27:49 +05:00
|
|
|
aFirstColIds = FirstHexahedronIds;
|
|
|
|
aLastColIds = LastHexahedronIds;
|
|
|
|
break;
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// fill the First and the Last columns
|
|
|
|
for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
|
|
|
|
myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] );
|
2012-08-09 16:03:55 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
|
|
|
|
myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] );
|
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
else
|
2009-02-17 10:27:49 +05:00
|
|
|
{
|
|
|
|
// clear table
|
|
|
|
for ( int row = 0; row < myTable->rowCount(); row++ )
|
|
|
|
for ( int col = 0; col < myTable->columnCount(); col++ )
|
2012-08-09 16:03:55 +06:00
|
|
|
if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText("");
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myTable->setEnabled( false );
|
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : onTableActivate()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2009-02-17 10:27:49 +05:00
|
|
|
void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol )
|
2006-03-13 20:29:49 +05:00
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
myCurrentLineEdit = 0;
|
2006-03-13 20:29:49 +05:00
|
|
|
displaySimulation();
|
2009-02-17 10:27:49 +05:00
|
|
|
updateButtons();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : onCellTextChange()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol)
|
|
|
|
{
|
2012-08-09 16:03:55 +06:00
|
|
|
myCurrentLineEdit = 0;
|
2009-02-17 10:27:49 +05:00
|
|
|
displaySimulation();
|
|
|
|
updateButtons();
|
2006-03-13 20:29:49 +05:00
|
|
|
}
|
2008-03-07 12:47:05 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : keyPressEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e )
|
|
|
|
{
|
|
|
|
QDialog::keyPressEvent( e );
|
|
|
|
if ( e->isAccepted() )
|
|
|
|
return;
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
if ( e->key() == Qt::Key_F1 ) {
|
|
|
|
e->accept();
|
|
|
|
ClickOnHelp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SMESHGUI_AddQuadraticElementDlg::updateButtons()
|
|
|
|
{
|
|
|
|
bool valid = IsValid();
|
|
|
|
buttonOk->setEnabled( valid );
|
|
|
|
buttonApply->setEnabled( valid );
|
2008-03-07 12:47:05 +05:00
|
|
|
}
|
2012-08-09 16:03:55 +06:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : isValid
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
bool SMESHGUI_AddQuadraticElementDlg::isValid()
|
|
|
|
{
|
|
|
|
if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) {
|
|
|
|
SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|