diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index aeb0faf2e..f55e54a70 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -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 diff --git a/resources/mesh_move_without_node.png b/resources/mesh_move_without_node.png new file mode 100644 index 000000000..4f4b0d044 Binary files /dev/null and b/resources/mesh_move_without_node.png differ diff --git a/src/DriverMED/DriverMED.hxx b/src/DriverMED/DriverMED.hxx index 857023efe..299b61083 100644 --- a/src/DriverMED/DriverMED.hxx +++ b/src/DriverMED/DriverMED.hxx @@ -23,6 +23,7 @@ // Declarations needed for usage of DriverMED #include "SMDSAbs_ElementType.hxx" +#include "SMESH_DriverMED.hxx" #include @@ -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 ); } diff --git a/src/DriverSTL/CMakeLists.txt b/src/DriverSTL/CMakeLists.txt index 58c7147fe..fa0a8139d 100644 --- a/src/DriverSTL/CMakeLists.txt +++ b/src/DriverSTL/CMakeLists.txt @@ -45,6 +45,7 @@ SET(_link_LIBRARIES ${KERNEL_SALOMEBasics} MeshDriver SMDS + SMESHUtils ) SET(_link_LIBRARIES_bin diff --git a/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cxx b/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cxx index ee4da4a6f..a250b428a 100644 --- a/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cxx +++ b/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cxx @@ -22,17 +22,17 @@ #include "DriverSTL_R_SMDS_Mesh.h" +#include + +#include +#include +#include + #include "SMDS_Mesh.hxx" #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" #include "SMESH_File.hxx" -#include -#include - -#include -#include - namespace { struct Hasher diff --git a/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cxx b/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cxx index 5499183cb..2ac7ca5da 100644 --- a/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cxx +++ b/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cxx @@ -22,6 +22,12 @@ #include "DriverSTL_W_SMDS_Mesh.h" +#ifdef WIN32 +#define NOMINMAX +#endif + +#include + #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 - //#include "utilities.h" #include diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 8cc3716b1..20582c7b1 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -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 ); } diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index f882abc71..2688e99a6 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -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}; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index cb9695c44..add4fb6be 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -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); diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index a1d8edf75..dd7c3480b 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -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(); } diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h index d4129d6fa..ce8f74362 100644 --- a/src/OBJECT/SMESH_DeviceActor.h +++ b/src/OBJECT/SMESH_DeviceActor.h @@ -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); diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index 39f744757..7852ef6de 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -74,6 +74,7 @@ SET(_link_LIBRARIES ${GEOM_GEOMObject} SMESHFiltersSelection SMDS + SMESHEngine SMESHControls SMESHObject ) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 9bf90fde2..c90cb0fa9 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -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 - 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 + // - 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 + 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 ) diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx index 924ad3589..368aa77ca 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx @@ -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(); } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 672c67975..5dba32360 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -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())); } diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index 68d20cf4a..970500e69 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -61,6 +61,7 @@ #include // Qt includes +#include #include #include #include @@ -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); } //======================================================================= @@ -112,62 +112,33 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) QWidget* aFrame = new QWidget(theParent); SUIT_ResourceMgr* rm = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); - QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); - QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT"))); + 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 - { - if ( on ) { +} +//================================================================================ +/*! + * \brief SLOT called when clicked radio button + * \param int - number of the button + */ +//================================================================================ +void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId) +{ + switch (constructorId) { + case 0: + { + 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); - myId->setText(""); - myId->setReadOnly ( true ); - myIdBtn->setChecked( false ); - myIdBtn->setEnabled( false ); - myCoordBtn->setChecked( true ); - myUpdateBtn->setEnabled( false ); + if (!myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->show(); + break; } - else { - myId->setReadOnly ( false ); - myIdBtn->setEnabled( true ); - myUpdateBtn->setEnabled( true ); + case 1: + { + myId->setText(""); + 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(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); } diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 140af0bb9..24be56a42 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -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 diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index c67112d47..4fdf52051 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -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& ids ) // connectivity QTreeWidgetItem* conItem = createItem( elemItem, Bold ); conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ); - SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); - for ( int idx = 1; nodeIt->more(); idx++ ) { - const SMDS_MeshNode* node = static_cast( 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 ); - } - 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 ); + + + if( e->GetGeomType() != SMDSGeom_POLYHEDRA ) { + SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); + for ( int idx = 1; nodeIt->more(); idx++ ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + nodeInfo( node, idx, e->NbNodes(), conItem ); + } + } + else { + const SMDS_VtkVolume* aVtkVolume = dynamic_cast(e); + SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator(); + QList 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& 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) */ diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.h b/src/SMESHGUI/SMESHGUI_MeshInfo.h index 69faa42cc..54ee1aca5 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.h @@ -226,6 +226,7 @@ public: protected: void contextMenuEvent( QContextMenuEvent* e ); void information( const QList& ); + void nodeInfo( const SMDS_MeshNode*, int, int, QTreeWidgetItem* ); void clearInternal(); private slots: diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx index fddda25c2..59900714e 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx @@ -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] )); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index 73d384cae..46bf3ef55 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -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()); } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index 4f140731c..43317618f 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -141,6 +141,8 @@ private: QMap mySelEdit; QMap mySelLbl; + QWidget* myMainFrame; + QLineEdit* myName; QPushButton* myOpenBtn; QPushButton* myNewBtn; diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 60c48dd91..503de82d7 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1700,6 +1700,9 @@ void SMESHGUI_SplitVolumesDlg::on3d2dChanged(int isPrism) } SMESHGUI_MultiEditDlg::on3d2dChanged( !myEntityType ); myEntityType = 1; // == VOLUME + myChoiceWidget->hide(); + myChoiceWidget->show(); + resize(minimumSizeHint()); onSelectionDone(); } diff --git a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx index ce3440813..747cd59a8 100644 --- a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx +++ b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx @@ -42,7 +42,7 @@ SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent ) : QFrame( parent ) { myMinU = myMinV = myMaxU = myMaxV = 0; - setMinimumHeight( 150 ); + //setMinimumHeight( 150 ); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx index ecda71b99..400a02532 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -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(); } diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h index eb3e551fc..5ec3ce620 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h @@ -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; diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index 99b86a89d..9da433c69 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -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); } diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index a9744f462..c887edf84 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -453,6 +453,8 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId) onDisplaySimulation(true); QApplication::instance()->processEvents(); + myEditCurrentArgument->hide(); + myEditCurrentArgument->show(); updateGeometry(); resize(100,100); } diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 0c2d37697..e4bf823f8 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -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); diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index f9082a77b..b27b101ca 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -151,6 +151,10 @@ ICON_DLG_MOVE_NODE mesh_move_node.png + + ICON_DLG_MOVE_WITHOUT_NODE + mesh_move_without_node.png + ICON_DLG_NODE mesh_vertex.png diff --git a/src/SMESHUtils/SMESH_File.cxx b/src/SMESHUtils/SMESH_File.cxx index c31c2e8bc..d75cd108a 100644 --- a/src/SMESHUtils/SMESH_File.cxx +++ b/src/SMESHUtils/SMESH_File.cxx @@ -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; diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx index 23a285f61..957828474 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.cxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx @@ -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() ) { diff --git a/src/SMESH_I/CMakeLists.txt b/src/SMESH_I/CMakeLists.txt index e9b14c919..3643f0928 100644 --- a/src/SMESH_I/CMakeLists.txt +++ b/src/SMESH_I/CMakeLists.txt @@ -80,6 +80,7 @@ SET(_link_LIBRARIES SMDS SMESHDS SMESHControls + MeshDriverMED ) # --- headers --- diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 223cf9130..ce0a35594 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -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 diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 0a7e33017..016a5098d 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -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; } //================================================================================ diff --git a/src/Tools/CMakeLists.txt b/src/Tools/CMakeLists.txt index 9495dd8c3..bf0346e8f 100644 --- a/src/Tools/CMakeLists.txt +++ b/src/Tools/CMakeLists.txt @@ -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 diff --git a/src/Tools/ZCracksPlug/CMakeLists.txt b/src/Tools/ZCracksPlug/CMakeLists.txt new file mode 100644 index 000000000..07cbf93b1 --- /dev/null +++ b/src/Tools/ZCracksPlug/CMakeLists.txt @@ -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}) + diff --git a/src/Tools/ZCracksPlug/zcracks_plugin.py b/src/Tools/ZCracksPlug/zcracks_plugin.py new file mode 100644 index 000000000..85ced69cf --- /dev/null +++ b/src/Tools/ZCracksPlug/zcracks_plugin.py @@ -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() diff --git a/src/Tools/smesh_plugins.py b/src/Tools/smesh_plugins.py index 29d25e447..b043ec692 100644 --- a/src/Tools/smesh_plugins.py +++ b/src/Tools/smesh_plugins.py @@ -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)