From: mpa Date: Mon, 24 Mar 2014 07:29:24 +0000 (+0400) Subject: 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls X-Git-Tag: V7_4_0a1~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8608b2b5ca86779ae0b3c42239cb83f8eebf68e2;p=modules%2Fsmesh.git 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls --- diff --git a/doc/salome/gui/SMESH/images/colors_size.png b/doc/salome/gui/SMESH/images/colors_size.png index 213652e79..0b1d3e566 100755 Binary files a/doc/salome/gui/SMESH/images/colors_size.png and b/doc/salome/gui/SMESH/images/colors_size.png differ diff --git a/doc/salome/gui/SMESH/images/pref22.png b/doc/salome/gui/SMESH/images/pref22.png index f6a7b5978..d557d2515 100755 Binary files a/doc/salome/gui/SMESH/images/pref22.png and b/doc/salome/gui/SMESH/images/pref22.png differ diff --git a/doc/salome/gui/SMESH/input/colors_size.doc b/doc/salome/gui/SMESH/input/colors_size.doc index e777e84a1..c8be2278e 100644 --- a/doc/salome/gui/SMESH/input/colors_size.doc +++ b/doc/salome/gui/SMESH/input/colors_size.doc @@ -41,6 +41,7 @@ shown. - \b Balls: - \b Color - color of discrete ball elements. - \b Size - size of discrete ball elements. + - \b Scale - scale factor of discrete ball elements. - Orientation vectors: - \b Color - color of orientation vectors. - \b Scale - size of orientation vectors. diff --git a/doc/salome/gui/SMESH/input/mesh_preferences.doc b/doc/salome/gui/SMESH/input/mesh_preferences.doc index 02574d07d..e0374fd4c 100644 --- a/doc/salome/gui/SMESH/input/mesh_preferences.doc +++ b/doc/salome/gui/SMESH/input/mesh_preferences.doc @@ -159,6 +159,8 @@ later sessions with this module. - Size of 0D elements - specifies default size of 0D elements. - Size of ball elements - specifies default size of discrete elements (balls). + - Scale factor of ball elements - specifies default scale factor of discrete + elements (balls). - Line width - allows to define the width of 1D elements (edges). - Outline width - allows to define the width of borders of 2D and 3D elements (shown in the Shading mode). diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index aae569166..8658334a9 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -45,6 +45,7 @@ + diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index ed1ca8594..8cc3716b1 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -143,10 +143,11 @@ SMESH_ActorDef::SMESH_ActorDef() if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) ) myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1); - double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); - double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); - double aLineWidth = SMESH::GetFloat("SMESH:element_width",1); - double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); + 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 aLineWidth = SMESH::GetFloat("SMESH:element_width",1); + double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); SMESH::LabelFont aFamilyNd = SMESH::FntTimes; bool aBoldNd = true; @@ -566,6 +567,7 @@ SMESH_ActorDef::SMESH_ActorDef() #endif SetBallSize(aBallElemSize); + SetBallScale(aBallElemScale); Set0DSize(aElem0DSize); } @@ -2106,6 +2108,16 @@ double SMESH_ActorDef::GetBallSize(){ return myBallProp->GetPointSize(); } +int SMESH_ActorDef::GetBallScale() +{ + return myBallActor->GetBallScale(); +} + +void SMESH_ActorDef::SetBallScale( int theVal ) +{ + myBallActor->SetBallScale( theVal ); +} + int SMESH_ActorDef::GetObjDimension( const int theObjId ) { return myVisualObj->GetElemDimension( theObjId ); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index d07f79c26..f882abc71 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -101,6 +101,9 @@ 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; + enum EReperesent { ePoint, eEdge, eSurface}; enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eBallElem = 0x10, eAllEntity = 0x1f}; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 4b5cba5c7..cb9695c44 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -144,6 +144,9 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetBallSize(double size); virtual double GetBallSize(); + virtual void SetBallScale(int size); + virtual int 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 4785155d8..a1d8edf75 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -959,6 +959,16 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) { myMapper->SetBallEnabled( theBallEnabled ); } +/*! + * Set point marker scale factor + * \param theBallScale integer value which specifies a scale factor of ball element + */ +void SMESH_DeviceActor::SetBallScale( int theBallScale ) +{ + myMapper->SetBallScale( theBallScale ); + myMapper->Modified(); +} + /*! * Set standard point marker * \param theMarkerType type of the marker @@ -1005,6 +1015,15 @@ int SMESH_DeviceActor::GetMarkerTexture() return myMapper->GetMarkerTexture(); } +/*! + * Get scale factor of ball element + * \return scale factor of ball element + */ +int SMESH_DeviceActor::GetBallScale() +{ + return myMapper->GetBallScale(); +} + void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) { myGeomFilter->SetAppendCoincident3D(theFlag); } diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h index a85c25559..d4129d6fa 100644 --- a/src/OBJECT/SMESH_DeviceActor.h +++ b/src/OBJECT/SMESH_DeviceActor.h @@ -148,11 +148,13 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{ void SetMarkerEnabled( bool ); void SetBallEnabled( bool ); + void SetBallScale( int ); void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale ); void SetMarkerTexture( int, VTK::MarkerTexture ); VTK::MarkerType GetMarkerType(); VTK::MarkerScale GetMarkerScale(); int GetMarkerTexture(); + int GetBallScale(); protected: void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index aa09da82a..9bf90fde2 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1316,6 +1316,7 @@ namespace int deltaF = 0, deltaV = 0; int elem0dSize = 1; int ballSize = 1; + int ballScale = 1; int edgeWidth = 1; int outlineWidth = 1; double shrinkCoef = 0.0; @@ -1360,6 +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 // outlines: color anActor->GetOutlineColor( color[0], color[1], color[2] ); outlineColor.setRgbF( color[0], color[1], color[2] ); @@ -1416,6 +1418,7 @@ namespace // balls: color, size dlg.setBallColor( ballColor ); dlg.setBallSize( ballSize ); + dlg.setBallScale( ballScale ); // orientation: color, scale, 3d flag dlg.setOrientationColor( orientationColor ); dlg.setOrientationSize( int( orientationScale * 100. ) ); @@ -1442,6 +1445,7 @@ namespace elem0dSize = dlg.elem0dSize(); ballColor = dlg.ballColor(); ballSize = dlg.ballSize(); + ballScale = dlg.ballScale(); orientationColor = dlg.orientationColor(); orientationScale = dlg.orientationSize() / 100.; orientation3d = dlg.orientation3d(); @@ -1485,6 +1489,7 @@ namespace // balls: color, size anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() ); anActor->SetBallSize( ballSize ); + anActor->SetBallScale( ballScale ); // orientation: color, scale, 3d flag anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() ); anActor->SetFacesOrientationScale( orientationScale ); @@ -5053,6 +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"); int elemW = addPreference(tr("PREF_WIDTH"), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "element_width"); int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup, @@ -5066,6 +5073,9 @@ void SMESHGUI::createPreferences() setPreferenceProperty( ballSize, "min", 1 ); setPreferenceProperty( ballSize, "max", 10 ); + setPreferenceProperty( ballScale, "min", 1 ); + setPreferenceProperty( ballScale, "max", 10 ); + setPreferenceProperty( elemW, "min", 1 ); setPreferenceProperty( elemW, "max", 5 ); @@ -5738,6 +5748,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 << "shrink"; sizeStr << QString::number(aSmeshActor->GetShrinkFactor()); sizeStr << "orientation"; @@ -6322,6 +6333,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint) int outlineWidth = -1; int elem0dSize = -1; int ballSize = -1; + int ballScale = -1; double shrinkSize = -1; double orientationSize = -1; bool orientation3d = false; @@ -6349,11 +6361,16 @@ void SMESHGUI::restoreVisualParameters (int savePoint) i++; } else if ( type == "ball" ) { - // ball size is given as single integer value + // 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 v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error - ballSize = v; - i++; + 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 + ballSize = v1; + ballScale = v2; + i += 2; } else if ( type == "shrink" ) { // shrink factor is given as single floating point value @@ -6389,6 +6406,9 @@ void SMESHGUI::restoreVisualParameters (int savePoint) // ball size if ( ballSize > 0 ) aSmeshActor->SetBallSize( ballSize ); + // ball scale + if ( ballScale > 0 ) + aSmeshActor->SetBallScale( ballScale ); // shrink factor if ( shrinkSize > 0 ) aSmeshActor->SetShrinkFactor( shrinkSize ); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 7c430493d..79588047c 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -230,7 +230,7 @@ namespace SMESH for (int i = 0, iEnd = theIds.size(); i < iEnd; i++){ anIds->InsertId(0,theIds[i]); vtkIdType anId = myBallPolyData->InsertNextCell(VTK_POLY_VERTEX,anIds); - double d = theDiameter; + double d = theDiameter * theActor->GetBallScale(); aScalars->SetTuple(anId,&d); anIds->Reset(); } diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx index 475c84b2c..ecda71b99 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.cxx @@ -157,6 +157,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myBallColor = new QtxColorButton( myBallGrp ); QLabel* ballSizeLab = new QLabel( tr( "SIZE" ), myBallGrp ); myBallSize = new QtxIntSpinBox( myBallGrp ); + QLabel* ballScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myBallGrp ); + myBallScale = new QtxIntSpinBox( myBallGrp ); hl = new QHBoxLayout( myBallGrp ); hl->setMargin( MARGIN ); hl->setSpacing( SPACING ); @@ -164,6 +166,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark hl->addWidget( myBallColor ); hl->addWidget( ballSizeLab ); hl->addWidget( myBallSize ); + hl->addWidget( ballScaleLab ); + hl->addWidget( myBallScale ); widthLab1 = qMax( widthLab1, ballColorLab->minimumSizeHint().width() ); widthLab2 = qMax( widthLab2, ballSizeLab->minimumSizeHint().width() ); @@ -171,7 +175,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myOrientationGrp = new QGroupBox( tr( "ORIENTATIONS" ), mainFrame() ); QLabel* orientationColorLab = new QLabel( tr( "COLOR" ), myOrientationGrp ); myOrientationColor = new QtxColorButton( myOrientationGrp ); - QLabel* orientationScaleLab = new QLabel( tr( "ORIENTATION_SCALE" ), myOrientationGrp ); + QLabel* orientationScaleLab = new QLabel( tr( "SCALE_FACTOR" ), myOrientationGrp ); myOrientationSize = new QtxIntSpinBox( myOrientationGrp ); myOrientationSize->setSuffix( "% "); myOrientation3d = new QCheckBox( tr("ORIENTATION_3D"), myOrientationGrp ); @@ -236,6 +240,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark myOutlineWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myElem0dSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myBallSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myBallScale->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myOrientationSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myShrinkSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); @@ -243,6 +248,7 @@ 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 ); @@ -530,6 +536,24 @@ int SMESHGUI_PropertiesDlg::ballSize() const return myBallSize->value(); } +/*! + \brief Set discrete elements (balls) scale factor + \param size discrete elements (balls) scale factor +*/ +void SMESHGUI_PropertiesDlg::setBallScale( int size ) +{ + myBallScale->setValue( size ); +} + +/*! + \brief Get discrete elements (balls) scale factor + \return current discrete elements (balls) scale factor +*/ +int SMESHGUI_PropertiesDlg::ballScale() const +{ + return myBallScale->value(); +} + /*! \brief Set orientation vectors color \param color orientation vectors color diff --git a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h index c9d76b14e..eb3e551fc 100644 --- a/src/SMESHGUI/SMESHGUI_PropertiesDlg.h +++ b/src/SMESHGUI/SMESHGUI_PropertiesDlg.h @@ -83,6 +83,8 @@ public: QColor ballColor() const; void setBallSize( int ); int ballSize() const; + void setBallScale( int ); + int ballScale() const; void setOrientationColor( const QColor& ); QColor orientationColor() const; @@ -132,6 +134,7 @@ private: // - balls QtxColorButton* myBallColor; QtxIntSpinBox* myBallSize; + QtxIntSpinBox* myBallScale; // - orientation vectors QtxColorButton* myOrientationColor; QtxIntSpinBox* myOrientationSize; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index cf5fa1bf6..9b320f8e4 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -4577,6 +4577,10 @@ Please, create VTK viewer and try again PREF_BALL_SIZE Size of ball elements + + PREF_BALL_SCALE + Scale factor of ball elements + PREF_WIDTH Line width @@ -7776,7 +7780,7 @@ as they are of improper type: Size: - ORIENTATION_SCALE + SCALE_FACTOR Scale: diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 5bb4ca192..3181afe3f 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -4567,6 +4567,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_BALL_SIZE Taille des éléments particulaires + + PREF_BALL_SCALE + Facteur d'échelle des éléments particulaires + PREF_WIDTH Epaisseur de ligne @@ -7701,7 +7705,7 @@ en raison de leurs types incompatibles: Taille: - ORIENTATION_SCALE + SCALE_FACTOR Echelle: diff --git a/src/SMESHGUI/SMESH_msg_ja.ts b/src/SMESHGUI/SMESH_msg_ja.ts index b9689e56b..8350a23d7 100644 --- a/src/SMESHGUI/SMESH_msg_ja.ts +++ b/src/SMESHGUI/SMESH_msg_ja.ts @@ -7579,7 +7579,7 @@ サイズ - ORIENTATION_SCALE + SCALE_FACTOR スケール: