From: mpa Date: Wed, 2 Apr 2014 06:09:25 +0000 (+0400) Subject: Correction of mistakes: 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for... X-Git-Tag: V7_4_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dcc24a9c43065d83772d42db30e57a9a0e9ebf4e;p=modules%2Fsmesh.git Correction of mistakes: 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls --- 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/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_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;