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);
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 );
}
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};
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);
/*!
* 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();
* Get scale factor of ball element
* \return scale factor of ball element
*/
-int SMESH_DeviceActor::GetBallScale()
+double SMESH_DeviceActor::GetBallScale()
{
return myMapper->GetBallScale();
}
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);
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;
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] );
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,
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 );
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";
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;
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;
if ( ballSize > 0 )
aSmeshActor->SetBallSize( ballSize );
// ball scale
- if ( ballScale > 0 )
+ if ( ballScale > 0.0 )
aSmeshActor->SetBallScale( ballScale );
// shrink factor
if ( shrinkSize > 0 )
#include <QtxBiColorTool.h>
#include <QtxColorButton.h>
#include <QtxIntSpinBox.h>
+#include <QtxDoubleSpinBox.h>
#include <VTKViewer_MarkerWidget.h>
#include <SUIT_Session.h>
#include <LightApp_Application.h>
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 );
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 );
\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 );
}
\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();
}
class QtxColorButton;
class QtxBiColorTool;
class QtxIntSpinBox;
+class QtxDoubleSpinBox;
class VTKViewer_MarkerWidget;
class SMESHGUI_EXPORT SMESHGUI_PropertiesDlg : public SMESHGUI_Dialog
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;
// - balls
QtxColorButton* myBallColor;
QtxIntSpinBox* myBallSize;
- QtxIntSpinBox* myBallScale;
+ QtxDoubleSpinBox* myBallScale;
// - orientation vectors
QtxColorButton* myOrientationColor;
QtxIntSpinBox* myOrientationSize;