Merge branch 'master' into rbe/fix-boost-smart-pointers

This commit is contained in:
Renaud Nédélec 2014-04-02 10:26:24 +02:00
commit 209c9bd9c3
39 changed files with 568 additions and 326 deletions

View File

@ -67,6 +67,7 @@ SET(SMESH_RESOURCES_FILES
mesh_line_n.png
mesh_line.png
mesh_move_node.png
mesh_move_without_node.png
mesh_octahedron.png
mesh_orientation.png
mesh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

View File

@ -23,6 +23,7 @@
// Declarations needed for usage of DriverMED
#include "SMDSAbs_ElementType.hxx"
#include "SMESH_DriverMED.hxx"
#include <boost/shared_ptr.hpp>
@ -36,10 +37,10 @@ namespace DriverMED
/*
* Returns MED element geom type (MED::EGeometrieElement) by SMDS type
*/
int GetMedGeoType( SMDSAbs_EntityType smdsType );
MESHDRIVERMED_EXPORT int GetMedGeoType( SMDSAbs_EntityType smdsType );
/*
* Returns SMDS element geom type by MED type (MED::EGeometrieElement)
*/
SMDSAbs_EntityType GetSMDSType( int medType );
MESHDRIVERMED_EXPORT SMDSAbs_EntityType GetSMDSType( int medType );
}

View File

@ -45,6 +45,7 @@ SET(_link_LIBRARIES
${KERNEL_SALOMEBasics}
MeshDriver
SMDS
SMESHUtils
)
SET(_link_LIBRARIES_bin

View File

@ -22,17 +22,17 @@
#include "DriverSTL_R_SMDS_Mesh.h"
#include <Basics_Utils.hxx>
#include <gp_Pnt.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_NoMoreObject.hxx>
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESH_File.hxx"
#include <gp_Pnt.hxx>
#include <Basics_Utils.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_NoMoreObject.hxx>
namespace
{
struct Hasher

View File

@ -22,6 +22,12 @@
#include "DriverSTL_W_SMDS_Mesh.h"
#ifdef WIN32
#define NOMINMAX
#endif
#include <Basics_Utils.hxx>
#include "SMDS_FaceOfNodes.hxx"
#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_Mesh.hxx"
@ -32,8 +38,6 @@
#include "SMESH_File.hxx"
#include "SMESH_TypeDefs.hxx"
#include <Basics_Utils.hxx>
//#include "utilities.h"
#include <limits>

View File

@ -145,7 +145,7 @@ SMESH_ActorDef::SMESH_ActorDef()
double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1);
double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0);
double aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
@ -2108,12 +2108,12 @@ double SMESH_ActorDef::GetBallSize(){
return myBallProp->GetPointSize();
}
int SMESH_ActorDef::GetBallScale()
double SMESH_ActorDef::GetBallScale()
{
return myBallActor->GetBallScale();
}
void SMESH_ActorDef::SetBallScale( int theVal )
void SMESH_ActorDef::SetBallScale( double theVal )
{
myBallActor->SetBallScale( theVal );
}

View File

@ -101,8 +101,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetBallSize(double size) = 0;
virtual double GetBallSize() = 0;
virtual void SetBallScale(int size) = 0;
virtual int GetBallScale() = 0;
virtual void SetBallScale(double size) = 0;
virtual double GetBallScale() = 0;
enum EReperesent { ePoint, eEdge, eSurface};

View File

@ -144,8 +144,8 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void SetBallSize(double size);
virtual double GetBallSize();
virtual void SetBallScale(int size);
virtual int GetBallScale();
virtual void SetBallScale(double size);
virtual double GetBallScale();
virtual int GetNodeObjId(int theVtkID);
virtual double* GetNodeCoord(int theObjID);

View File

@ -961,9 +961,9 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
/*!
* Set point marker scale factor
* \param theBallScale integer value which specifies a scale factor of ball element
* \param theBallScale double value which specifies a scale factor of ball element
*/
void SMESH_DeviceActor::SetBallScale( int theBallScale )
void SMESH_DeviceActor::SetBallScale( double theBallScale )
{
myMapper->SetBallScale( theBallScale );
myMapper->Modified();
@ -1019,7 +1019,7 @@ int SMESH_DeviceActor::GetMarkerTexture()
* Get scale factor of ball element
* \return scale factor of ball element
*/
int SMESH_DeviceActor::GetBallScale()
double SMESH_DeviceActor::GetBallScale()
{
return myMapper->GetBallScale();
}

View File

@ -148,13 +148,13 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
void SetMarkerEnabled( bool );
void SetBallEnabled( bool );
void SetBallScale( int );
void SetBallScale( double );
void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
void SetMarkerTexture( int, VTK::MarkerTexture );
VTK::MarkerType GetMarkerType();
VTK::MarkerScale GetMarkerScale();
int GetMarkerTexture();
int GetBallScale();
double GetBallScale();
protected:
void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);

View File

@ -74,6 +74,7 @@ SET(_link_LIBRARIES
${GEOM_GEOMObject}
SMESHFiltersSelection
SMDS
SMESHEngine
SMESHControls
SMESHObject
)

View File

@ -1316,7 +1316,7 @@ namespace
int deltaF = 0, deltaV = 0;
int elem0dSize = 1;
int ballSize = 1;
int ballScale = 1;
double ballScale = 1.0;
int edgeWidth = 1;
int outlineWidth = 1;
double shrinkCoef = 0.0;
@ -1361,7 +1361,7 @@ namespace
anActor->GetBallColor( color[0], color[1], color[2] );
ballColor.setRgbF( color[0], color[1], color[2] );
ballSize = qMax( (int)anActor->GetBallSize(), 1 ); // minimum allowed size is 1
ballScale = qMax( (int)anActor->GetBallScale(), 1 ); // minimum allowed size is 1
ballScale = qMax( (double)anActor->GetBallScale(), 1e-2 ); // minimum allowed scale is 1e-2
// outlines: color
anActor->GetOutlineColor( color[0], color[1], color[2] );
outlineColor.setRgbF( color[0], color[1], color[2] );
@ -5058,8 +5058,8 @@ void SMESHGUI::createPreferences()
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
int ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_scale");
double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale");
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width");
int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
@ -5073,8 +5073,9 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( ballSize, "min", 1 );
setPreferenceProperty( ballSize, "max", 10 );
setPreferenceProperty( ballScale, "min", 1 );
setPreferenceProperty( ballScale, "max", 10 );
setPreferenceProperty( ballScale, "min", 1e-2 );
setPreferenceProperty( ballScale, "max", 1e7 );
setPreferenceProperty( ballScale, "step", 0.5 );
setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 );
@ -5748,7 +5749,7 @@ void SMESHGUI::storeVisualParameters (int savePoint)
sizeStr << QString::number((int)aSmeshActor->Get0DSize());
sizeStr << "ball";
sizeStr << QString::number((int)aSmeshActor->GetBallSize());
sizeStr << QString::number((int)aSmeshActor->GetBallScale());
sizeStr << QString::number((double)aSmeshActor->GetBallScale());
sizeStr << "shrink";
sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
sizeStr << "orientation";
@ -6333,7 +6334,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
int outlineWidth = -1;
int elem0dSize = -1;
int ballSize = -1;
int ballScale = -1;
double ballScale = -1.0;
double shrinkSize = -1;
double orientationSize = -1;
bool orientation3d = false;
@ -6363,11 +6364,11 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
else if ( type == "ball" ) {
// balls are specified by two values: size:scale, where
// - size - is a integer value specifying size
// - scale - is a integer value specifying scale factor
// - scale - is a double value specifying scale factor
if ( i+1 >= sizes.count() ) break; // format error
int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= sizes.count() ) break; // format error
int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break; // format error
double v2 = sizes[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
ballSize = v1;
ballScale = v2;
i += 2;
@ -6407,7 +6408,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
if ( ballSize > 0 )
aSmeshActor->SetBallSize( ballSize );
// ball scale
if ( ballScale > 0 )
if ( ballScale > 0.0 )
aSmeshActor->SetBallScale( ballScale );
// shrink factor
if ( shrinkSize > 0 )

View File

@ -384,7 +384,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
break;
}
}
myGroupArguments->hide();
myGroupArguments->show();
this->resize(this->sizeHint().width(), this->minimumSizeHint().height());
// Process selection
onSelectionChanged();
}

View File

@ -487,6 +487,9 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
if (CheckBoxMesh->isChecked())
onSelectMesh(true);
myEditCurrentArgument->hide();
myEditCurrentArgument->show();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
}

View File

@ -61,6 +61,7 @@
#include <gp_Pnt.hxx>
// Qt includes
#include <QApplication>
#include <QGroupBox>
#include <QGridLayout>
#include <QHBoxLayout>
@ -95,12 +96,11 @@ SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg()
QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
aDlgLay->setMargin(0);
aDlgLay->setSpacing(SPACING);
myMainFrame = createMainFrame(mainFrame());
QWidget* aMainFrame = createMainFrame (mainFrame());
aDlgLay->addWidget(myMainFrame);
aDlgLay->addWidget(aMainFrame);
aDlgLay->setStretchFactor(aMainFrame, 1);
aDlgLay->setStretchFactor(myMainFrame, 1);
}
//=======================================================================
@ -113,61 +113,32 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
SUIT_ResourceMgr* rm = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
QPixmap iconMoveWithoutNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_WITHOUT_NODE")));
QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT")));
// constructor
QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), aFrame);
QButtonGroup* aBtnGrp = new QButtonGroup(this);
QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), this);
aPixGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myButtonGroup = new QButtonGroup(this);
QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
aPixGrpLayout->setMargin(MARGIN);
aPixGrpLayout->setSpacing(SPACING);
QRadioButton* aRBut = new QRadioButton(aPixGrp);
aRBut->setIcon(iconMoveNode);
aRBut->setChecked(true);
aPixGrpLayout->addWidget(aRBut);
aBtnGrp->addButton(aRBut, 0);
myRButNodeToMove = new QRadioButton(aPixGrp);
myRButMoveWithoutNode = new QRadioButton(aPixGrp);
myRButNodeToMove->setIcon(iconMoveNode);
myRButMoveWithoutNode->setIcon(iconMoveWithoutNode);
myRButNodeToMove->setChecked(true);
// coordinates
aPixGrpLayout->addWidget(myRButNodeToMove);
aPixGrpLayout->addWidget(myRButMoveWithoutNode);
myButtonGroup->addButton(myRButNodeToMove, 0);
myButtonGroup->addButton(myRButMoveWithoutNode, 1);
QGroupBox* aCoordGrp = new QGroupBox(tr("DESTINATION"), aFrame);
QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp);
aCoordGrpLayout->setMargin(MARGIN);
aCoordGrpLayout->setSpacing(SPACING);
myCoordBtn = new QPushButton(aCoordGrp);
myCoordBtn->setIcon(iconSelect);
myCoordBtn->setCheckable(true);
QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
myX = new SMESHGUI_SpinBox(aCoordGrp);
QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
myY = new SMESHGUI_SpinBox(aCoordGrp);
QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
myZ = new SMESHGUI_SpinBox(aCoordGrp);
myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
aCoordGrpLayout->addWidget(myCoordBtn);
aCoordGrpLayout->addWidget(aXLabel);
aCoordGrpLayout->addWidget(myX);
aCoordGrpLayout->addWidget(aYLabel);
aCoordGrpLayout->addWidget(myY);
aCoordGrpLayout->addWidget(aZLabel);
aCoordGrpLayout->addWidget(myZ);
aCoordGrpLayout->setStretchFactor(myX, 1);
aCoordGrpLayout->setStretchFactor(myY, 1);
aCoordGrpLayout->setStretchFactor(myZ, 1);
// node ID
// Node to move
myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame);
myNodeToMoveGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
QLabel* idLabel = new QLabel(tr("NODE_2MOVE_ID"), myNodeToMoveGrp);
myIdBtn = new QPushButton(myNodeToMoveGrp);
myIdBtn->setIcon(iconSelect);
@ -195,27 +166,9 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
myCurrentZ->setButtonSymbols(QAbstractSpinBox::NoButtons);
myCurrentZ->setReadOnly(true);
QLabel* aDXLabel = new QLabel(tr("SMESH_DX"), aCoordWidget);
myDX = new SMESHGUI_SpinBox(aCoordWidget);
myDX->setButtonSymbols(QAbstractSpinBox::NoButtons);
myDX->setReadOnly(true);
QLabel* aDYLabel = new QLabel(tr("SMESH_DY"), aCoordWidget);
myDY = new SMESHGUI_SpinBox(aCoordWidget);
myDY->setButtonSymbols(QAbstractSpinBox::NoButtons);
myDY->setReadOnly(true);
QLabel* aDZLabel = new QLabel(tr("SMESH_DZ"), aCoordWidget);
myDZ = new SMESHGUI_SpinBox(aCoordWidget);
myDZ->setButtonSymbols(QAbstractSpinBox::NoButtons);
myDZ->setReadOnly(true);
myCurrentX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myCurrentY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myCurrentZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
QGridLayout* aCoordLayout = new QGridLayout(aCoordWidget);
aCoordLayout->setMargin(0);
@ -226,19 +179,10 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
aCoordLayout->addWidget(myCurrentY, 0, 3);
aCoordLayout->addWidget(aCurrentZLabel, 0, 4);
aCoordLayout->addWidget(myCurrentZ, 0, 5);
aCoordLayout->addWidget(aDXLabel, 1, 0);
aCoordLayout->addWidget(myDX, 1, 1);
aCoordLayout->addWidget(aDYLabel, 1, 2);
aCoordLayout->addWidget(myDY, 1, 3);
aCoordLayout->addWidget(aDZLabel, 1, 4);
aCoordLayout->addWidget(myDZ, 1, 5);
aCoordLayout->setColumnStretch(1, 1);
aCoordLayout->setColumnStretch(3, 1);
aCoordLayout->setColumnStretch(5, 1);
myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp);
myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp);
QGridLayout* myNodeToMoveGrpLayout = new QGridLayout(myNodeToMoveGrp);
myNodeToMoveGrpLayout->setSpacing(SPACING);
myNodeToMoveGrpLayout->setMargin(MARGIN);
@ -248,20 +192,79 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
myNodeToMoveGrpLayout->addWidget( myId, 0, 2 );
myNodeToMoveGrpLayout->addWidget( myUpdateBtn, 0, 3 );
myNodeToMoveGrpLayout->addWidget( aCoordWidget, 1, 0, 1, 4 );
myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 2, 0, 1, 4 );
myNodeToMoveGrpLayout->addWidget( myPreviewChkBox, 3, 0, 1, 4 );
// Destination
myDestinationGrp = new QGroupBox(tr("DESTINATION"), aFrame);
myDestinationGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myDestBtn = new QPushButton(myDestinationGrp);
myDestBtn->setIcon(iconSelect);
myDestBtn->setCheckable(true);
QLabel* aDestinationXLabel = new QLabel(tr("SMESH_X"), myDestinationGrp);
myDestinationX = new SMESHGUI_SpinBox(myDestinationGrp);
QLabel* aDestinationYLabel = new QLabel(tr("SMESH_Y"), myDestinationGrp);
myDestinationY = new SMESHGUI_SpinBox(myDestinationGrp);
QLabel* aDestinationZLabel = new QLabel(tr("SMESH_Z"), myDestinationGrp);
myDestinationZ = new SMESHGUI_SpinBox(myDestinationGrp);
myDestDXLabel = new QLabel(tr("SMESH_DX"), myDestinationGrp);
myDestDX = new SMESHGUI_SpinBox(myDestinationGrp);
myDestDX->setReadOnly(true);
myDestDYLabel = new QLabel(tr("SMESH_DY"), myDestinationGrp);
myDestDY = new SMESHGUI_SpinBox(myDestinationGrp);
myDestDY->setReadOnly(true);
myDestDZLabel = new QLabel(tr("SMESH_DZ"), myDestinationGrp);
myDestDZ = new SMESHGUI_SpinBox(myDestinationGrp);
myDestDZ->setReadOnly(true);
myDestinationX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDestinationY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDestinationZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDestDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDestDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
myDestDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
QGridLayout* aDestLayout = new QGridLayout(myDestinationGrp);
aDestLayout->setMargin(MARGIN);
aDestLayout->setSpacing(SPACING);
aDestLayout->addWidget(myDestBtn, 0, 0);
aDestLayout->addWidget(aDestinationXLabel, 0, 1);
aDestLayout->addWidget(myDestinationX, 0, 2);
aDestLayout->addWidget(aDestinationYLabel, 0, 3);
aDestLayout->addWidget(myDestinationY, 0, 4);
aDestLayout->addWidget(aDestinationZLabel, 0, 5);
aDestLayout->addWidget(myDestinationZ, 0, 6);
aDestLayout->addWidget(myDestDXLabel, 1, 1);
aDestLayout->addWidget(myDestDX, 1, 2);
aDestLayout->addWidget(myDestDYLabel, 1, 3);
aDestLayout->addWidget(myDestDY, 1, 4);
aDestLayout->addWidget(myDestDZLabel, 1, 5);
aDestLayout->addWidget(myDestDZ, 1, 6);
aDestLayout->setColumnStretch(2, 1);
aDestLayout->setColumnStretch(4, 1);
aDestLayout->setColumnStretch(6, 1);
// Preview
myPreviewChkBox = new QCheckBox( tr("PREVIEW"), aFrame);
QVBoxLayout* aLay = new QVBoxLayout(aFrame);
aLay->addWidget(aPixGrp);
aLay->addWidget(aCoordGrp);
aLay->addWidget(myNodeToMoveGrp);
aLay->addWidget(myDestinationGrp);
aLay->addWidget(myPreviewChkBox);
connect(myCoordBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int)));
myIdBtn->setChecked(true);
myAutoSearchChkBox->setChecked(true);
return aFrame;
}
@ -277,38 +280,61 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on)
{
const QObject* aSender = sender();
if ( on ) {
if ( aSender == myCoordBtn ) // button to set coord by node selection
if ( aSender == myDestBtn ) // button to set coord by node selection
{
if ( myIdBtn->isEnabled() )
myIdBtn->setChecked( !on );
}
else if ( aSender == myIdBtn ) // button to select a node to move
{
myCoordBtn->setChecked( !on );
myDestBtn->setChecked( !on );
}
}
if ( aSender == myAutoSearchChkBox ) // automatic node search
}
//================================================================================
/*!
* \brief SLOT called when clicked radio button
* \param int - number of the button
*/
//================================================================================
void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId)
{
switch (constructorId) {
case 0:
{
if ( on ) {
myDestDXLabel->show();
myDestDYLabel->show();
myDestDZLabel->show();
myDestDX->show();
myDestDY->show();
myDestDZ->show();
myCurrentX->SetValue(0);
myCurrentY->SetValue(0);
myCurrentZ->SetValue(0);
myDX->SetValue(0);
myDY->SetValue(0);
myDZ->SetValue(0);
if (!myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->show();
break;
}
case 1:
{
myId->setText("");
myId->setReadOnly ( true );
myIdBtn->setChecked( false );
myIdBtn->setEnabled( false );
myCoordBtn->setChecked( true );
myUpdateBtn->setEnabled( false );
}
else {
myId->setReadOnly ( false );
myIdBtn->setEnabled( true );
myUpdateBtn->setEnabled( true );
myCurrentX->SetValue(0);
myCurrentY->SetValue(0);
myCurrentZ->SetValue(0);
myDestDXLabel->hide();
myDestDYLabel->hide();
myDestDZLabel->hide();
myDestDX->hide();
myDestDY->hide();
myDestDZ->hide();
if (myNodeToMoveGrp->isVisible()) {myNodeToMoveGrp->hide();}
break;
}
}
QApplication::instance()->processEvents();
myMainFrame->hide();
myMainFrame->show();
updateGeometry();
resize(minimumSizeHint());
}
//================================================================================
@ -326,14 +352,17 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
myNoPreview = false;
myUpdateDestination = false;
myDestCoordChanged = true;
// connect signals and slots
connect(myDlg->myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
connect(myDlg->myAutoSearchChkBox,SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
// IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted
// note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class
@ -348,6 +377,13 @@ void SMESHGUI_MakeNodeAtPointOp::onUpdateDestination()
myUpdateDestination = false;
}
void SMESHGUI_MakeNodeAtPointOp::onDestCoordChanged()
{
myDestCoordChanged = false;
redisplayPreview();
myDestCoordChanged = true;
}
//=======================================================================
// function : startOperation()
// purpose : Init dialog fields, connect signals and slots, show dialog
@ -380,17 +416,23 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
// IPAL19360
SMESHGUI_SelectionOp::startOperation(); // this method should be called only after filter creation
//activateSelection(); // set filters // called inside of previous statement
myDlg->myX->SetValue(0);
myDlg->myY->SetValue(0);
myDlg->myZ->SetValue(0);
myDlg->myId->setText("");
myDlg->myDestinationX->SetValue(0);
myDlg->myDestinationY->SetValue(0);
myDlg->myDestinationZ->SetValue(0);
myDlg->myDestDX->SetValue(0);
myDlg->myDestDY->SetValue(0);
myDlg->myDestDZ->SetValue(0);
myDlg->myCurrentX->SetValue(0);
myDlg->myCurrentY->SetValue(0);
myDlg->myCurrentZ->SetValue(0);
myDlg->myDX->SetValue(0);
myDlg->myDY->SetValue(0);
myDlg->myDZ->SetValue(0);
myDlg->myId->setText("");
myDlg->myDestDX->setReadOnly(true);
myDlg->myDestDY->setReadOnly(true);
myDlg->myDestDZ->setReadOnly(true);
myDlg->myRButNodeToMove->setChecked(true);
myDlg->ConstructorsClicked(GetConstructorId());
myDlg->show();
onSelectionDone(); // init myMeshActor
@ -403,6 +445,15 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
}
}
//=================================================================================
// function : GetConstructorId()
// purpose :
//=================================================================================
int SMESHGUI_MakeNodeAtPointOp::GetConstructorId()
{
return myDlg->myButtonGroup->checkedId();
}
//================================================================================
/*!
* \brief Stops operation
@ -450,9 +501,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
}
QStringList aParameters;
aParameters << myDlg->myX->text();
aParameters << myDlg->myY->text();
aParameters << myDlg->myZ->text();
aParameters << myDlg->myDestinationX->text();
aParameters << myDlg->myDestinationY->text();
aParameters << myDlg->myDestinationZ->text();
try {
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
@ -470,24 +521,23 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
bool ok;
int anId = myDlg->myId->text().toInt( &ok );
if( !ok || anId < 1 )
anId = aMeshEditor->FindNodeClosestTo(myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
myDlg->myZ->GetValue());
anId = aMeshEditor->FindNodeClosestTo(myDlg->myDestinationX->GetValue(),
myDlg->myDestinationY->GetValue(),
myDlg->myDestinationZ->GetValue());
int aResult = aMeshEditor->MoveNode(anId,
myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
myDlg->myZ->GetValue() );
myDlg->myDestinationX->GetValue(),
myDlg->myDestinationY->GetValue(),
myDlg->myDestinationZ->GetValue() );
if (aResult)
{
myDlg->myCurrentX->SetValue(0);
myDlg->myCurrentY->SetValue(0);
myDlg->myCurrentZ->SetValue(0);
myDlg->myDX->SetValue(0);
myDlg->myDY->SetValue(0);
myDlg->myDZ->SetValue(0);
myDlg->myId->setText("");
myDlg->myDestDX->SetValue(0);
myDlg->myDestDY->SetValue(0);
myDlg->myDestDZ->SetValue(0);
SALOME_ListIO aList;
selectionMgr()->setSelectedObjects(aList,false);
@ -515,8 +565,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
{
bool ok = true;
if ( myMeshActor &&
!myDlg->myAutoSearchChkBox->isChecked() )
if ( myMeshActor && myDlg->myRButNodeToMove->isChecked() )
{
ok = false;
int id = myDlg->myId->text().toInt();
@ -527,9 +576,9 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
msg += tr("INVALID_ID") + "\n";
}
ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myDestinationX->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myDestinationY->isValid( msg, !myNoPreview ) && ok;
ok = myDlg->myDestinationZ->isValid( msg, !myNoPreview ) && ok;
return ok;
}
@ -553,7 +602,7 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
if (!aMeshActor) { // coord by geom
if ( myDlg->myCoordBtn->isChecked() ) {
if ( myDlg->myDestBtn->isChecked() ) {
GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
if ( !geom->_is_nil() ) {
TopoDS_Vertex aShape;
@ -561,9 +610,9 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
aShape.ShapeType() == TopAbs_VERTEX ) {
gp_Pnt P = BRep_Tool::Pnt(aShape);
myNoPreview = true;
myDlg->myX->SetValue(P.X());
myDlg->myY->SetValue(P.Y());
myDlg->myZ->SetValue(P.Z());
myDlg->myDestinationX->SetValue(P.X());
myDlg->myDestinationY->SetValue(P.Y());
myDlg->myDestinationZ->SetValue(P.Z());
myNoPreview = false;
redisplayPreview();
}
@ -581,10 +630,10 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
myNoPreview = true;
if ( myDlg->myCoordBtn->isChecked() ) { // set coord
myDlg->myX->SetValue(aNode->X());
myDlg->myY->SetValue(aNode->Y());
myDlg->myZ->SetValue(aNode->Z());
if ( myDlg->myDestBtn->isChecked() ) { // set coord
myDlg->myDestinationX->SetValue(aNode->X());
myDlg->myDestinationY->SetValue(aNode->Y());
myDlg->myDestinationZ->SetValue(aNode->Z());
myNoPreview = false;
redisplayPreview();
}
@ -599,15 +648,18 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
double x = aCurrentNode->X();
double y = aCurrentNode->Y();
double z = aCurrentNode->Z();
double dx = myDlg->myX->GetValue() - x;
double dy = myDlg->myY->GetValue() - y;
double dz = myDlg->myZ->GetValue() - z;
double dx = myDlg->myDestinationX->GetValue() - x;
double dy = myDlg->myDestinationY->GetValue() - y;
double dz = myDlg->myDestinationZ->GetValue() - z;
myDlg->myCurrentX->SetValue(x);
myDlg->myCurrentY->SetValue(y);
myDlg->myCurrentZ->SetValue(z);
myDlg->myDX->SetValue(dx);
myDlg->myDY->SetValue(dy);
myDlg->myDZ->SetValue(dz);
myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz);
myDlg->myDestDX->setReadOnly(false);
myDlg->myDestDY->setReadOnly(false);
myDlg->myDestDZ->setReadOnly(false);
}
}
}
@ -633,20 +685,10 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
bool moveShown = false;
if ( myMeshActor)
{
const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked();
const bool preview = myDlg->myPreviewChkBox->isChecked();
if ( autoSearch )
{
myDlg->myCurrentX->SetValue(0);
myDlg->myCurrentY->SetValue(0);
myDlg->myCurrentZ->SetValue(0);
myDlg->myDX->SetValue(0);
myDlg->myDY->SetValue(0);
myDlg->myDZ->SetValue(0);
myDlg->myId->setText("");
}
const bool isPreview = myDlg->myPreviewChkBox->isChecked();
const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked();
QString msg;
if ( autoSearch || isValid( msg ) )
if ( isValid( msg ) )
{
try {
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
@ -656,53 +698,68 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
{
SUIT_OverrideCursor aWaitCursor;
int anId = 0;
if ( autoSearch )
anId = aPreviewer->FindNodeClosestTo(myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
myDlg->myZ->GetValue());
else
anId = myDlg->myId->text().toInt();
int anId = myDlg->myId->text().toInt();
// find id and/or just compute preview
aPreviewer->MoveNode(anId,
myDlg->myX->GetValue(),
myDlg->myY->GetValue(),
myDlg->myZ->GetValue());
if ( autoSearch ) { // set found id
QString idTxt("%1");
if ( anId > 0 )
idTxt = idTxt.arg( anId );
else
idTxt = "";
myDlg->myId->setText( idTxt );
}
SMESH::double_array* aXYZ = aMesh->GetNodeXYZ( anId );
if( aXYZ && aXYZ->length() >= 3 )
SMESH::double_array_var aXYZ = aMesh->GetNodeXYZ( anId );
if( &aXYZ.in() && aXYZ->length() >= 3 )
{
double x = aXYZ->operator[](0);
double y = aXYZ->operator[](1);
double z = aXYZ->operator[](2);
double x = aXYZ[0];
double y = aXYZ[1];
double z = aXYZ[2];
double dx = 0;
double dy = 0;
double dz = 0;
if ( myUpdateDestination ) {
myDlg->myX->SetValue(x);
myDlg->myY->SetValue(y);
myDlg->myZ->SetValue(z);
myDlg->myDestinationX->SetValue(x);
myDlg->myDestinationY->SetValue(y);
myDlg->myDestinationZ->SetValue(z);
}
if ( myDestCoordChanged ) {
dx = myDlg->myDestinationX->GetValue() - myDlg->myCurrentX->GetValue();
dy = myDlg->myDestinationY->GetValue() - myDlg->myCurrentY->GetValue();
dz = myDlg->myDestinationZ->GetValue() - myDlg->myCurrentZ->GetValue();
myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz);
}
else {
dx = myDlg->myDestDX->GetValue() + myDlg->myCurrentX->GetValue();;
dy = myDlg->myDestDY->GetValue() + myDlg->myCurrentY->GetValue();;
dz = myDlg->myDestDZ->GetValue() + myDlg->myCurrentZ->GetValue();;
myDlg->myDestinationX->SetValue(dx);
myDlg->myDestinationY->SetValue(dy);
myDlg->myDestinationZ->SetValue(dz);
}
double dx = myDlg->myX->GetValue() - x;
double dy = myDlg->myY->GetValue() - y;
double dz = myDlg->myZ->GetValue() - z;
myDlg->myCurrentX->SetValue(x);
myDlg->myCurrentY->SetValue(y);
myDlg->myCurrentZ->SetValue(z);
myDlg->myDX->SetValue(dx);
myDlg->myDY->SetValue(dy);
myDlg->myDZ->SetValue(dz);
myDlg->myDestDX->setReadOnly(false);
myDlg->myDestDY->setReadOnly(false);
myDlg->myDestDZ->setReadOnly(false);
}
else {
myDlg->myCurrentX->SetValue(0);
myDlg->myCurrentY->SetValue(0);
myDlg->myCurrentZ->SetValue(0);
myDlg->myDestDX->SetValue(0);
myDlg->myDestDY->SetValue(0);
myDlg->myDestDZ->SetValue(0);
myDlg->myDestDX->setReadOnly(true);
myDlg->myDestDY->setReadOnly(true);
myDlg->myDestDZ->setReadOnly(true);
}
if ( isPreview && isMoveNode && anId == 0 )
anId = aPreviewer->FindNodeClosestTo(myDlg->myDestinationX->GetValue(),
myDlg->myDestinationY->GetValue(),
myDlg->myDestinationZ->GetValue());
// find id and/or just compute preview
aPreviewer->MoveNode(anId,
myDlg->myDestinationX->GetValue(),
myDlg->myDestinationY->GetValue(),
myDlg->myDestinationZ->GetValue());
if ( preview ) { // fill preview data
if ( isPreview ) { // fill preview data
aMeshPreviewStruct = aPreviewer->GetPreviewData();
moveShown = ( anId > 0 );
}
@ -718,9 +775,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
aMeshPreviewStruct = new SMESH::MeshPreviewStruct();
aMeshPreviewStruct->nodesXYZ.length(1);
aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myX->GetValue();
aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myY->GetValue();
aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myZ->GetValue();
aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myDestinationX->GetValue();
aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myDestinationY->GetValue();
aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myDestinationZ->GetValue();
aMeshPreviewStruct->elementTypes.length(1);
aMeshPreviewStruct->elementTypes[0].SMDS_ElementType = SMESH::NODE;
@ -737,7 +794,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
mySimulation->SetData(aMeshPreviewStruct._retn());
}
else
{
{
mySimulation->SetVisibility(false);
}

View File

@ -32,10 +32,12 @@
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_SelectionOp.h"
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLineEdit;
class QPushButton;
class QCheckBox;
class QRadioButton;
class SMESHGUI_SpinBox;
class SMESHGUI_MeshEditPreview;
class SMESHGUI_MakeNodeAtPointDlg;
@ -70,8 +72,11 @@ private slots:
void redisplayPreview();
void onTextChange( const QString& );
void onUpdateDestination();
void onDestCoordChanged();
private:
int GetConstructorId();
SMESHGUI_MakeNodeAtPointDlg* myDlg;
SUIT_SelectionFilter* myFilter;
@ -80,6 +85,7 @@ private:
SMESH_Actor* myMeshActor;
bool myNoPreview;
bool myUpdateDestination;
bool myDestCoordChanged;
};
/*!
@ -96,21 +102,29 @@ public:
private:
QWidget* createMainFrame( QWidget* );
QPushButton* myCoordBtn;
QWidget* myMainFrame;
QButtonGroup* myButtonGroup;
QRadioButton* myRButNodeToMove;
QRadioButton* myRButMoveWithoutNode;
QPushButton* myDestBtn;
QPushButton* myUpdateBtn;
SMESHGUI_SpinBox* myX;
SMESHGUI_SpinBox* myY;
SMESHGUI_SpinBox* myZ;
QGroupBox* myDestinationGrp;
QGroupBox* myNodeToMoveGrp;
QPushButton* myIdBtn;
QLineEdit* myId;
SMESHGUI_SpinBox* myCurrentX;
SMESHGUI_SpinBox* myCurrentY;
SMESHGUI_SpinBox* myCurrentZ;
SMESHGUI_SpinBox* myDX;
SMESHGUI_SpinBox* myDY;
SMESHGUI_SpinBox* myDZ;
QCheckBox* myAutoSearchChkBox;
SMESHGUI_SpinBox* myDestinationX;
SMESHGUI_SpinBox* myDestinationY;
SMESHGUI_SpinBox* myDestinationZ;
QLabel* myDestDXLabel;
QLabel* myDestDYLabel;
QLabel* myDestDZLabel;
SMESHGUI_SpinBox* myDestDX;
SMESHGUI_SpinBox* myDestDY;
SMESHGUI_SpinBox* myDestDZ;
QCheckBox* myPreviewChkBox;
QString myHelpFileName;
@ -119,6 +133,7 @@ private:
private slots:
void ButtonToggled( bool );
void ConstructorsClicked( int );
};
#endif // SMESHGUI_MAKENODEATPOINTDLG_H

View File

@ -29,6 +29,7 @@
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_Mesh.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHGUI.h"
#include "SMESHGUI_FilterUtils.h"
@ -1838,66 +1839,34 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
// connectivity
QTreeWidgetItem* conItem = createItem( elemItem, Bold );
conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
if( e->GetGeomType() != SMDSGeom_POLYHEDRA ) {
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
for ( int idx = 1; nodeIt->more(); idx++ ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
// node number and ID
QTreeWidgetItem* nodeItem = createItem( conItem, Bold );
nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
nodeItem->setData( 1, TypeRole, ElemConnectivity );
nodeItem->setData( 1, IdRole, node->GetID() );
nodeItem->setExpanded( false );
// node coordinates
QTreeWidgetItem* coordItem = createItem( nodeItem );
coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) );
QTreeWidgetItem* xItem = createItem( coordItem );
xItem->setText( 0, "X" );
xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
QTreeWidgetItem* yItem = createItem( coordItem );
yItem->setText( 0, "Y" );
yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
QTreeWidgetItem* zItem = createItem( coordItem );
zItem->setText( 0, "Z" );
zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
// node connectivity
QTreeWidgetItem* nconItem = createItem( nodeItem );
nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
Connectivity connectivity = nodeConnectivity( node );
if ( !connectivity.isEmpty() ) {
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) );
i->setText( 1, con );
nodeInfo( node, idx, e->NbNodes(), conItem );
}
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Ball );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Volume );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
else {
const SMDS_VtkVolume* aVtkVolume = dynamic_cast<const SMDS_VtkVolume*>(e);
SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator();
QList<const SMDS_MeshElement*> uniqueNodes;
while ( nodeIt->more() )
uniqueNodes.append( nodeIt->next() );
SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( aMesh );
const int nbFaces = mesh_i->ElemNbFaces( e->GetID() );
for( int i = 0; i < nbFaces; i++ ) {
QTreeWidgetItem* faceItem = createItem( conItem, Bold );
faceItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "FACE" ) ).arg( i + 1 ).arg( nbFaces ) );
faceItem->setExpanded( true );
SMESH::long_array_var anNodeIds = mesh_i->GetElemFaceNodes( e->GetID(), i );
for( CORBA::Long node_id = 0, n = anNodeIds->length(); node_id < n; node_id++ ) {
const SMDS_MeshNode* node = actor()->GetObject()->GetMesh()->FindNode( anNodeIds[node_id] );
nodeInfo( node, uniqueNodes.indexOf(node) + 1, aVtkVolume->NbUniqueNodes(), faceItem );
}
}
}
@ -2077,6 +2046,77 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
}
}
/*!
\brief Show node information
\param node mesh node for showing
\param index index of current node
\param nbNodes number of unique nodes in element
\param parentItem parent item of tree
*/
void SMESHGUI_TreeElemInfo::nodeInfo( const SMDS_MeshNode* node, int index,
int nbNodes, QTreeWidgetItem* parentItem )
{
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
// node number and ID
QTreeWidgetItem* nodeItem = createItem( parentItem, Bold );
nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( index ).arg( nbNodes ) );
nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
nodeItem->setData( 1, TypeRole, ElemConnectivity );
nodeItem->setData( 1, IdRole, node->GetID() );
nodeItem->setExpanded( false );
// node coordinates
QTreeWidgetItem* coordItem = createItem( nodeItem );
coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) );
QTreeWidgetItem* xItem = createItem( coordItem );
xItem->setText( 0, "X" );
xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
QTreeWidgetItem* yItem = createItem( coordItem );
yItem->setText( 0, "Y" );
yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
QTreeWidgetItem* zItem = createItem( coordItem );
zItem->setText( 0, "Z" );
zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
// node connectivity
QTreeWidgetItem* nconItem = createItem( nodeItem );
nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
Connectivity connectivity = nodeConnectivity( node );
if ( !connectivity.isEmpty() ) {
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) );
i->setText( 1, con );
}
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Ball );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
con = formatConnectivity( connectivity, SMDSAbs_Volume );
if ( !con.isEmpty() ) {
QTreeWidgetItem* i = createItem( nconItem );
i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) );
i->setText( 1, con );
i->setData( 1, TypeRole, NodeConnectivity );
}
}
}
/*!
\brief Internal clean-up (reset widget)
*/

View File

@ -226,6 +226,7 @@ public:
protected:
void contextMenuEvent( QContextMenuEvent* e );
void information( const QList<long>& );
void nodeInfo( const SMDS_MeshNode*, int, int, QTreeWidgetItem* );
void clearInternal();
private slots:

View File

@ -490,7 +490,7 @@ void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo)
myNbQuadTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] ));
// hexas
myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] +
theInfo[SMDSEntity_TriQuad_Hexa],
theInfo[SMDSEntity_TriQuad_Hexa] +
theInfo[SMDSEntity_Quad_Hexa] ));
myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] ));
myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] ));

View File

@ -119,13 +119,13 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule )
aDlgLay->setMargin( MARGIN );
aDlgLay->setSpacing( SPACING );
QWidget* aMainFrame = createMainFrame ( this );
myMainFrame = createMainFrame ( this );
QWidget* aBtnFrame = createButtonFrame( this );
aDlgLay->addWidget( aMainFrame );
aDlgLay->addWidget( myMainFrame );
aDlgLay->addWidget( aBtnFrame );
aDlgLay->setStretchFactor( aMainFrame, 1 );
aDlgLay->setStretchFactor( myMainFrame, 1 );
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
@ -1201,11 +1201,16 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged (int theType)
myNode2Lbl->show();
myNode2 ->show();
}
mySelInput = Mesh;
activateSelection();
updateWgState();
displayPreview();
myPicture2d->hide();
myPicture2d->show();
myPicture2d->resize(minimumSizeHint());
myMainFrame->hide();
myMainFrame->show();
resize(minimumSizeHint());
}
//=======================================================================
@ -1331,8 +1336,10 @@ void SMESHGUI_MeshPatternDlg::onModeToggled (bool on)
{
on ? myRefineGrp->show() : myRefineGrp->hide();
on ? myGeomGrp->hide() : myGeomGrp->show();
myMainFrame->hide();
myMainFrame->show();
displayPreview();
resize(minimumSizeHint());
}
//=======================================================================

View File

@ -141,6 +141,8 @@ private:
QMap<int, QLineEdit*> mySelEdit;
QMap<int, QLabel*> mySelLbl;
QWidget* myMainFrame;
QLineEdit* myName;
QPushButton* myOpenBtn;
QPushButton* myNewBtn;

View File

@ -1700,6 +1700,9 @@ void SMESHGUI_SplitVolumesDlg::on3d2dChanged(int isPrism)
}
SMESHGUI_MultiEditDlg::on3d2dChanged( !myEntityType );
myEntityType = 1; // == VOLUME
myChoiceWidget->hide();
myChoiceWidget->show();
resize(minimumSizeHint());
onSelectionDone();
}

View File

@ -42,7 +42,7 @@ SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent )
: QFrame( parent )
{
myMinU = myMinV = myMaxU = myMaxV = 0;
setMinimumHeight( 150 );
//setMinimumHeight( 150 );
}
//=================================================================================

View File

@ -34,6 +34,7 @@
#include <QtxBiColorTool.h>
#include <QtxColorButton.h>
#include <QtxIntSpinBox.h>
#include <QtxDoubleSpinBox.h>
#include <VTKViewer_MarkerWidget.h>
#include <SUIT_Session.h>
#include <LightApp_Application.h>
@ -158,7 +159,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp );
myBallSize = new QtxIntSpinBox( myBallGrp );
QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp );
myBallScale = new QtxIntSpinBox( myBallGrp );
myBallScale = new QtxDoubleSpinBox( 1e-2, 1e7, 0.5, myBallGrp );
hl = new QHBoxLayout( myBallGrp );
hl->setMargin( MARGIN );
hl->setSpacing( SPACING );
@ -248,7 +249,6 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
myNodeMarker->setCustomMarkers( customMarkers );
myElem0dSize->setRange( 1, 10 );
myBallSize->setRange( 1, 10 );
myBallScale->setRange( 1, 10 );
myEdgeWidth->setRange( 1, 5 );
myOutlineWidth->setRange( 1, 5 );
myShrinkSize->setRange( 20, 100 );
@ -540,7 +540,7 @@ int SMESHGUI_PropertiesDlg::ballSize() const
\brief Set discrete elements (balls) scale factor
\param size discrete elements (balls) scale factor
*/
void SMESHGUI_PropertiesDlg::setBallScale( int size )
void SMESHGUI_PropertiesDlg::setBallScale( double size )
{
myBallScale->setValue( size );
}
@ -549,7 +549,7 @@ void SMESHGUI_PropertiesDlg::setBallScale( int size )
\brief Get discrete elements (balls) scale factor
\return current discrete elements (balls) scale factor
*/
int SMESHGUI_PropertiesDlg::ballScale() const
double SMESHGUI_PropertiesDlg::ballScale() const
{
return myBallScale->value();
}

View File

@ -38,6 +38,7 @@ class QGroupBox;
class QtxColorButton;
class QtxBiColorTool;
class QtxIntSpinBox;
class QtxDoubleSpinBox;
class VTKViewer_MarkerWidget;
class SMESHGUI_EXPORT SMESHGUI_PropertiesDlg : public SMESHGUI_Dialog
@ -83,8 +84,8 @@ public:
QColor ballColor() const;
void setBallSize( int );
int ballSize() const;
void setBallScale( int );
int ballScale() const;
void setBallScale( double );
double ballScale() const;
void setOrientationColor( const QColor& );
QColor orientationColor() const;
@ -134,7 +135,7 @@ private:
// - balls
QtxColorButton* myBallColor;
QtxIntSpinBox* myBallSize;
QtxIntSpinBox* myBallScale;
QtxDoubleSpinBox* myBallScale;
// - orientation vectors
QtxColorButton* myOrientationColor;
QtxIntSpinBox* myOrientationSize;

View File

@ -425,6 +425,8 @@ void SMESHGUI_ScaleDlg::ConstructorsClicked (int constructorId)
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
QApplication::instance()->processEvents();
myEditCurrentArgument->hide();
myEditCurrentArgument->show();
updateGeometry();
resize(100,100);
}

View File

@ -453,6 +453,8 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
onDisplaySimulation(true);
QApplication::instance()->processEvents();
myEditCurrentArgument->hide();
myEditCurrentArgument->show();
updateGeometry();
resize(100,100);
}

View File

@ -451,7 +451,8 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
onDisplaySimulation(true);
myEditCurrentArgument->hide();
myEditCurrentArgument->show();
QApplication::instance()->processEvents();
updateGeometry();
resize(100,100);

View File

@ -151,6 +151,10 @@
<source>ICON_DLG_MOVE_NODE</source>
<translation>mesh_move_node.png</translation>
</message>
<message>
<source>ICON_DLG_MOVE_WITHOUT_NODE</source>
<translation>mesh_move_without_node.png</translation>
</message>
<message>
<source>ICON_DLG_NODE</source>
<translation>mesh_vertex.png</translation>

View File

@ -171,7 +171,7 @@ long SMESH_File::size()
if ( _size >= 0 ) return _size; // size of an open file
boost::system::error_code err;
uintmax_t size = boofs::file_size( _name, err );
boost::uintmax_t size = boofs::file_size( _name, err );
_error = err.message();
return err ? -1 : (long) size;

View File

@ -759,10 +759,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt& point,
{
gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox()->CornerMin() +
_ebbTree->getBox()->CornerMax() );
double radius;
double radius = -1;
if ( _ebbTree->getBox()->IsOut( point.XYZ() ))
radius = point.Distance( boxCenter ) - 0.5 * _ebbTree->maxSize();
else
if ( radius < 0 )
radius = _ebbTree->maxSize() / pow( 2., _ebbTree->getHeight()) / 2;
while ( suspectElems.empty() )
{

View File

@ -80,6 +80,7 @@ SET(_link_LIBRARIES
SMDS
SMESHDS
SMESHControls
MeshDriverMED
)
# --- headers ---

View File

@ -384,9 +384,12 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
#print "init_smesh"
self.SetCurrentStudy(theStudy,geompyD)
## Creates an empty Mesh. This mesh can have an underlying geometry.
# @param obj the Geometrical object on which the mesh is built. If not defined,
# the mesh will have no underlying geometry.
## Creates a mesh. This can be either an empty mesh, possibly having an underlying geometry,
# or a mesh wrapping a CORBA mesh given as a parameter.
# @param obj either (1) a CORBA mesh (SMESH._objref_SMESH_Mesh) got e.g. by calling
# salome.myStudy.FindObjectID("0:1:2:3").GetObject() or
# (2) a Geometrical object for meshing or
# (3) none.
# @param name the name for the new mesh.
# @return an instance of Mesh class.
# @ingroup l2_construct

View File

@ -5244,6 +5244,7 @@ FaceQuadStruct::Side& FaceQuadStruct::Side::operator=(const Side& otherSide)
oSide->contacts[iOC].other_side = this;
}
}
return *this;
}
//================================================================================
@ -5290,6 +5291,7 @@ bool FaceQuadStruct::Side::Reverse(bool keepGrid)
grid->Reverse();
}
}
return (bool)grid;
}
//================================================================================

View File

@ -26,6 +26,7 @@ ADD_SUBDIRECTORY(MacMesh)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(MGCleanerPlug)
ADD_SUBDIRECTORY(YamsPlug)
ADD_SUBDIRECTORY(ZCracksPlug)
ENDIF(SALOME_BUILD_GUI)
# scripts / static

View File

@ -0,0 +1,33 @@
# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
zcracks_plugin.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS})

View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2013 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import SalomePyQt
sgPyQt = SalomePyQt.SalomePyQt()
import eficasSalome
class EficasForZcracks(eficasSalome.MyEficas):
"""
"""
def __init__(self, fichier = None, version = None):
eficasSalome.MyEficas.__init__(self, sgPyQt.getDesktop(),
"ZCRACKS",
fichier, version = version)
#sgPyQt.createView(custom_appli.widgetname, self)
def ZcracksLct(context):
window=EficasForZcracks()
window.show()

View File

@ -46,3 +46,18 @@ salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
salome_pluginsmanager.AddFunction('Meshed Pipe with a crack',
'Create a mesh with blocFissure tool',
fissureCoudeDlg)
# ZCracks plugin requires the module EFICAS to be installed
# thus it is first tested if this module is available before
# adding the plugin to salome_pluginsmanager
enable_zcracks = True
try:
import eficasSalome
except:
enable_zcracks = False
if enable_zcracks:
from zcracks_plugin import ZcracksLct
salome_pluginsmanager.AddFunction('Run Zcrack',
'Run Zcrack',
ZcracksLct)