INT PAL 0052679: Set default "Diameter" value when adding new ball element

This commit is contained in:
imn 2015-04-21 11:08:15 +03:00
parent 25190cc8a5
commit c43b3fb0e3
9 changed files with 35 additions and 21 deletions

View File

@ -44,6 +44,7 @@
<parameter name="type_of_marker" value="1" /> <parameter name="type_of_marker" value="1" />
<parameter name="marker_scale" value="9" /> <parameter name="marker_scale" value="9" />
<parameter name="elem0d_size" value="5" /> <parameter name="elem0d_size" value="5" />
<parameter name="ball_elem_diameter" value="1" />
<parameter name="ball_elem_size" value="10" /> <parameter name="ball_elem_size" value="10" />
<parameter name="ball_elem_scale" value="1" /> <parameter name="ball_elem_scale" value="1" />
<parameter name="element_width" value="1" /> <parameter name="element_width" value="1" />

View File

@ -5146,8 +5146,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 ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup, double ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_diameter"); LightApp_Preferences::DblSpin, "SMESH", "ball_elem_diameter");
double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup, double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
LightApp_Preferences::DblSpin, "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,

View File

@ -169,7 +169,8 @@ namespace SMESH
// Preview for the balls // Preview for the balls
vtkProperty* aBallProp = vtkProperty::New(); vtkProperty* aBallProp = vtkProperty::New();
aBallProp->SetColor(ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255.); aBallProp->SetColor(ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255.);
double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); //double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_diameter",1);
aBallProp->SetPointSize(aBallElemSize); aBallProp->SetPointSize(aBallElemSize);
myBallPolyData = vtkPolyData::New(); myBallPolyData = vtkPolyData::New();
@ -427,7 +428,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
GroupC1Layout->addWidget(DiameterSpinBox, 1, 1, 1, 2); GroupC1Layout->addWidget(DiameterSpinBox, 1, 1, 1, 2);
DiameterSpinBox->RangeStepAndValidator( 1e-7, 1e+9, 0.1 ); DiameterSpinBox->RangeStepAndValidator( 1e-7, 1e+9, 0.1 );
DiameterSpinBox->SetValue( 1. ); DiameterSpinBox->SetValue( SMESH::GetFloat("SMESH:ball_elem_diameter", 1) );
connect( DiameterSpinBox, SIGNAL( valueChanged ( double ) ), this, SLOT( onDiameterChanged( ) ) ); connect( DiameterSpinBox, SIGNAL( valueChanged ( double ) ), this, SLOT( onDiameterChanged( ) ) );
} }
/* Add to group ************************************************/ /* Add to group ************************************************/

View File

@ -156,8 +156,8 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
myBallGrp = new QGroupBox( tr( "BALLS" ), mainFrame() ); myBallGrp = new QGroupBox( tr( "BALLS" ), mainFrame() );
QLabel* ballColorLab = new QLabel( tr( "COLOR" ), myBallGrp ); QLabel* ballColorLab = new QLabel( tr( "COLOR" ), myBallGrp );
myBallColor = new QtxColorButton( myBallGrp ); myBallColor = new QtxColorButton( myBallGrp );
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 QtxDoubleSpinBox( 1e-2, 1e7, 0.5, myBallGrp ); myBallScale = new QtxDoubleSpinBox( 1e-2, 1e7, 0.5, myBallGrp );
hl = new QHBoxLayout( myBallGrp ); hl = new QHBoxLayout( myBallGrp );
@ -165,12 +165,12 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
hl->setSpacing( SPACING ); hl->setSpacing( SPACING );
hl->addWidget( ballColorLab ); hl->addWidget( ballColorLab );
hl->addWidget( myBallColor ); hl->addWidget( myBallColor );
hl->addWidget( ballSizeLab ); // hl->addWidget( ballSizeLab );
hl->addWidget( myBallSize ); // hl->addWidget( myBallSize );
hl->addWidget( ballScaleLab ); hl->addWidget( ballScaleLab );
hl->addWidget( myBallScale ); hl->addWidget( myBallScale );
widthLab1 = qMax( widthLab1, ballColorLab->minimumSizeHint().width() ); widthLab1 = qMax( widthLab1, ballColorLab->minimumSizeHint().width() );
widthLab2 = qMax( widthLab2, ballSizeLab->minimumSizeHint().width() ); // widthLab2 = qMax( widthLab2, ballSizeLab->minimumSizeHint().width() );
// -- orientation vector controls // -- orientation vector controls
myOrientationGrp = new QGroupBox( tr( "ORIENTATIONS" ), mainFrame() ); myOrientationGrp = new QGroupBox( tr( "ORIENTATIONS" ), mainFrame() );
@ -234,13 +234,13 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
myVolumeColor->label()->setMinimumWidth( widthLab2 ); myVolumeColor->label()->setMinimumWidth( widthLab2 );
outlineWidthLab->setMinimumWidth( widthLab2 ); outlineWidthLab->setMinimumWidth( widthLab2 );
elem0dSizeLab->setMinimumWidth( widthLab2 ); elem0dSizeLab->setMinimumWidth( widthLab2 );
ballSizeLab->setMinimumWidth( widthLab2 ); // ballSizeLab->setMinimumWidth( widthLab2 );
orientationScaleLab->setMinimumWidth( widthLab2 ); orientationScaleLab->setMinimumWidth( widthLab2 );
myEdgeWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myEdgeWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myOutlineWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myOutlineWidth->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myElem0dSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myElem0dSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myBallSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); // myBallSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myBallScale->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myBallScale->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myOrientationSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myOrientationSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
myShrinkSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myShrinkSize->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
@ -248,7 +248,7 @@ SMESHGUI_PropertiesDlg::SMESHGUI_PropertiesDlg( const VTK::MarkerMap& customMark
// initialize widgets // initialize widgets
myNodeMarker->setCustomMarkers( customMarkers ); myNodeMarker->setCustomMarkers( customMarkers );
myElem0dSize->setRange( 1, 10 ); myElem0dSize->setRange( 1, 10 );
myBallSize->setRange( 1, 10 ); // myBallSize->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 );
@ -522,19 +522,19 @@ QColor SMESHGUI_PropertiesDlg::ballColor() const
\brief Set discrete elements (balls) size \brief Set discrete elements (balls) size
\param size discrete elements (balls) size \param size discrete elements (balls) size
*/ */
void SMESHGUI_PropertiesDlg::setBallSize( int size ) /*void SMESHGUI_PropertiesDlg::setBallSize( int size )
{ {
myBallSize->setValue( size ); myBallSize->setValue( size );
} }*/
/*! /*!
\brief Get discrete elements (balls) size \brief Get discrete elements (balls) size
\return current discrete elements (balls) size \return current discrete elements (balls) size
*/ */
int SMESHGUI_PropertiesDlg::ballSize() const /*int SMESHGUI_PropertiesDlg::ballSize() const
{ {
return myBallSize->value(); return myBallSize->value();
} }*/
/*! /*!
\brief Set discrete elements (balls) scale factor \brief Set discrete elements (balls) scale factor

View File

@ -82,8 +82,8 @@ public:
void setBallColor( const QColor& ); void setBallColor( const QColor& );
QColor ballColor() const; QColor ballColor() const;
void setBallSize( int ); // void setBallSize( int );
int ballSize() const; // int ballSize() const;
void setBallScale( double ); void setBallScale( double );
double ballScale() const; double ballScale() const;
@ -134,7 +134,7 @@ private:
QtxIntSpinBox* myElem0dSize; QtxIntSpinBox* myElem0dSize;
// - balls // - balls
QtxColorButton* myBallColor; QtxColorButton* myBallColor;
QtxIntSpinBox* myBallSize; // QtxIntSpinBox* myBallSize;
QtxDoubleSpinBox* myBallScale; QtxDoubleSpinBox* myBallScale;
// - orientation vectors // - orientation vectors
QtxColorButton* myOrientationColor; QtxColorButton* myOrientationColor;

View File

@ -904,12 +904,12 @@ namespace SMESH
aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan ); aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5); int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5);
int aBallSize = mgr->integerValue("SMESH", "ball_elem_size", 5); // int aBallSize = mgr->integerValue("SMESH", "ball_elem_size", 5);
int aLineWidth = mgr->integerValue("SMESH", "element_width", 1); int aLineWidth = mgr->integerValue("SMESH", "element_width", 1);
int maxSize = aElem0DSize; int maxSize = aElem0DSize;
if (aElem0DSize > maxSize) maxSize = aElem0DSize; if (aElem0DSize > maxSize) maxSize = aElem0DSize;
if (aLineWidth > maxSize) maxSize = aLineWidth; if (aLineWidth > maxSize) maxSize = aLineWidth;
if (aBallSize > maxSize) maxSize = aBallSize; // if (aBallSize > maxSize) maxSize = aBallSize;
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ), double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ), SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ),

View File

@ -4605,6 +4605,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_BALL_COLOR</source> <source>PREF_BALL_COLOR</source>
<translation>Ball color</translation> <translation>Ball color</translation>
</message> </message>
<message>
<source>PREF_BALL_DIAMETER</source>
<translation>Default diameter of ball elements</translation>
</message>
<message> <message>
<source>PREF_BALL_SIZE</source> <source>PREF_BALL_SIZE</source>
<translation>Size of ball elements</translation> <translation>Size of ball elements</translation>

View File

@ -4602,6 +4602,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
<source>PREF_BALL_COLOR</source> <source>PREF_BALL_COLOR</source>
<translation>Couleur des particulaires</translation> <translation>Couleur des particulaires</translation>
</message> </message>
<message>
<source>PREF_BALL_DIAMETER</source>
<translation type="unfinished">Default diameter of ball elements</translation>
</message>
<message> <message>
<source>PREF_BALL_SIZE</source> <source>PREF_BALL_SIZE</source>
<translation>Taille des éléments particulaires</translation> <translation>Taille des éléments particulaires</translation>

View File

@ -4552,6 +4552,10 @@
<source>PREF_BALL_COLOR</source> <source>PREF_BALL_COLOR</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>PREF_BALL_DIAMETER</source>
<translation type="unfinished">Default diameter of ball elements</translation>
</message>
<message> <message>
<source>PREF_BALL_SIZE</source> <source>PREF_BALL_SIZE</source>
<translation></translation> <translation></translation>