mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls
This commit is contained in:
parent
1821a9c35f
commit
8608b2b5ca
Binary file not shown.
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 37 KiB |
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 75 KiB |
@ -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.
|
||||
- <b>Orientation vectors</b>:
|
||||
- \b Color - color of orientation vectors.
|
||||
- \b Scale - size of orientation vectors.
|
||||
|
@ -159,6 +159,8 @@ later sessions with this module.
|
||||
- <b>Size of 0D elements</b> - specifies default size of 0D elements.
|
||||
- <b>Size of ball elements</b> - specifies default size of discrete
|
||||
elements (balls).
|
||||
- <b>Scale factor of ball elements</b> - specifies default scale factor of discrete
|
||||
elements (balls).
|
||||
- <b>Line width</b> - allows to define the width of 1D elements (edges).
|
||||
- <b>Outline width</b> - allows to define the width of borders of
|
||||
2D and 3D elements (shown in the Shading mode).
|
||||
|
@ -45,6 +45,7 @@
|
||||
<parameter name="marker_scale" value="9" />
|
||||
<parameter name="elem0d_size" value="5" />
|
||||
<parameter name="ball_elem_size" value="10" />
|
||||
<parameter name="ball_elem_scale" value="1" />
|
||||
<parameter name="element_width" value="1" />
|
||||
<parameter name="outline_width" value="1" />
|
||||
<parameter name="shrink_coeff" value="75"/>
|
||||
|
@ -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 );
|
||||
|
@ -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};
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -4577,6 +4577,10 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_BALL_SIZE</source>
|
||||
<translation>Size of ball elements</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_BALL_SCALE</source>
|
||||
<translation>Scale factor of ball elements</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_WIDTH</source>
|
||||
<translation>Line width</translation>
|
||||
@ -7776,7 +7780,7 @@ as they are of improper type:
|
||||
<translation>Size:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ORIENTATION_SCALE</source>
|
||||
<source>SCALE_FACTOR</source>
|
||||
<translation>Scale:</translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -4567,6 +4567,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
|
||||
<source>PREF_BALL_SIZE</source>
|
||||
<translation>Taille des éléments particulaires</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_BALL_SCALE</source>
|
||||
<translation>Facteur d'échelle des éléments particulaires</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_WIDTH</source>
|
||||
<translation>Epaisseur de ligne</translation>
|
||||
@ -7701,7 +7705,7 @@ en raison de leurs types incompatibles:
|
||||
<translation>Taille:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ORIENTATION_SCALE</source>
|
||||
<source>SCALE_FACTOR</source>
|
||||
<translation>Echelle:</translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -7579,7 +7579,7 @@
|
||||
<translation>サイズ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ORIENTATION_SCALE</source>
|
||||
<source>SCALE_FACTOR</source>
|
||||
<translation>スケール:</translation>
|
||||
</message>
|
||||
<message>
|
||||
|
Loading…
Reference in New Issue
Block a user