Correction of mistakes: 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls

This commit is contained in:
mpa 2014-04-02 10:09:25 +04:00
parent 32db05b07f
commit dcc24a9c43
8 changed files with 35 additions and 33 deletions

View File

@ -145,7 +145,7 @@ SMESH_ActorDef::SMESH_ActorDef()
double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); 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 aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
@ -2108,12 +2108,12 @@ double SMESH_ActorDef::GetBallSize(){
return myBallProp->GetPointSize(); return myBallProp->GetPointSize();
} }
int SMESH_ActorDef::GetBallScale() double SMESH_ActorDef::GetBallScale()
{ {
return myBallActor->GetBallScale(); return myBallActor->GetBallScale();
} }
void SMESH_ActorDef::SetBallScale( int theVal ) void SMESH_ActorDef::SetBallScale( double theVal )
{ {
myBallActor->SetBallScale( 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 void SetBallSize(double size) = 0;
virtual double GetBallSize() = 0; virtual double GetBallSize() = 0;
virtual void SetBallScale(int size) = 0; virtual void SetBallScale(double size) = 0;
virtual int GetBallScale() = 0; virtual double GetBallScale() = 0;
enum EReperesent { ePoint, eEdge, eSurface}; enum EReperesent { ePoint, eEdge, eSurface};

View File

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

View File

@ -961,9 +961,9 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
/*! /*!
* Set point marker scale factor * 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->SetBallScale( theBallScale );
myMapper->Modified(); myMapper->Modified();
@ -1019,7 +1019,7 @@ int SMESH_DeviceActor::GetMarkerTexture()
* Get scale factor of ball element * Get scale factor of ball element
* \return scale factor of ball element * \return scale factor of ball element
*/ */
int SMESH_DeviceActor::GetBallScale() double SMESH_DeviceActor::GetBallScale()
{ {
return myMapper->GetBallScale(); return myMapper->GetBallScale();
} }

View File

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

View File

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

View File

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

View File

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