From: ouv Date: Mon, 11 Jan 2010 13:30:06 +0000 (+0000) Subject: Issue 0020638: EDF 1225 SMESH: Missing options in Color/Size menu X-Git-Tag: PARAVIS_29012010~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3334ebae06a359554b9489701e8753679cf76bc2;p=modules%2Fsmesh.git Issue 0020638: EDF 1225 SMESH: Missing options in Color/Size menu --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 039557163..b768fd2f5 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -661,6 +661,39 @@ bool SMESH_ActorDef::GetFacesOriented() return myIsFacesOriented; } +void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType theColor[3]) +{ + my2DActor->SetFacesOrientationColor( theColor ); + my3DActor->SetFacesOrientationColor( theColor ); +} + +void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType theColor[3]) +{ + my3DActor->GetFacesOrientationColor( theColor ); +} + +void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale) +{ + my2DActor->SetFacesOrientationScale( theScale ); + my3DActor->SetFacesOrientationScale( theScale ); +} + +vtkFloatingPointType SMESH_ActorDef::GetFacesOrientationScale() +{ + return my3DActor->GetFacesOrientationScale(); +} + +void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState) +{ + my2DActor->SetFacesOrientation3DVectors( theState ); + my3DActor->SetFacesOrientation3DVectors( theState ); +} + +bool SMESH_ActorDef::GetFacesOrientation3DVectors() +{ + return my3DActor->GetFacesOrientation3DVectors(); +} + void SMESH_ActorDef:: @@ -1640,6 +1673,15 @@ void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& ::GetColor(myNodeProp,r,g,b); } +void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ + my0DProp->SetColor(r,g,b); + Modified(); +} + +void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ + ::GetColor(my0DProp,r,g,b); +} + void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ myHighlightProp->SetColor(r,g,b); Modified(); @@ -1694,6 +1736,22 @@ vtkFloatingPointType SMESH_ActorDef::GetNodeSize(){ return myNodeProp->GetPointSize(); } +void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){ + my0DProp->SetPointSize(theVal); + + vtkFloatingPointType aPointSize = myNodeProp->GetPointSize() > theVal ? myNodeProp->GetPointSize() : theVal; + //myHighlightProp->SetPointSize(theVal); + myHighlightProp->SetPointSize(aPointSize); // ?? + //myPreselectProp->SetPointSize(theVal); + myPreselectProp->SetPointSize(aPointSize); // ?? + + Modified(); +} + +vtkFloatingPointType SMESH_ActorDef::Get0DSize(){ + return my0DProp->GetPointSize(); +} + int SMESH_ActorDef::GetObjDimension( const int theObjId ) { return myVisualObj->GetElemDimension( theObjId ); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 89f4fc51a..fee096c57 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -60,6 +60,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; + virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; + virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; + virtual void SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; @@ -72,6 +75,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void SetNodeSize(vtkFloatingPointType size) = 0; virtual vtkFloatingPointType GetNodeSize() = 0; + virtual void Set0DSize(vtkFloatingPointType size) = 0; + virtual vtkFloatingPointType Get0DSize() = 0; + enum EReperesent { ePoint, eEdge, eSurface}; enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eAllEntity = 0x0f}; @@ -100,6 +106,15 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void SetFacesOriented(bool theIsFacesOriented) = 0; virtual bool GetFacesOriented() = 0; + virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]) = 0; + virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]) = 0; + + virtual void SetFacesOrientationScale(vtkFloatingPointType theScale) = 0; + virtual vtkFloatingPointType GetFacesOrientationScale() = 0; + + virtual void SetFacesOrientation3DVectors(bool theState) = 0; + virtual bool GetFacesOrientation3DVectors() = 0; + enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes, eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D}; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 98f87fd04..559ffd630 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -115,6 +115,9 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); + virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); + virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); + virtual void SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); virtual void GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); @@ -127,6 +130,9 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetNodeSize(vtkFloatingPointType size) ; virtual vtkFloatingPointType GetNodeSize() ; + virtual void Set0DSize(vtkFloatingPointType size); + virtual vtkFloatingPointType Get0DSize(); + virtual int GetNodeObjId(int theVtkID); virtual vtkFloatingPointType* GetNodeCoord(int theObjID); @@ -170,6 +176,15 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetFacesOriented(bool theIsFacesOriented); virtual bool GetFacesOriented(); + virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]); + virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]); + + virtual void SetFacesOrientationScale(vtkFloatingPointType theScale); + virtual vtkFloatingPointType GetFacesOrientationScale(); + + virtual void SetFacesOrientation3DVectors(bool theState); + virtual bool GetFacesOrientation3DVectors(); + virtual void SetControlMode(eControl theMode); virtual eControl GetControlMode(){ return myControlMode;} diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 4d0626902..f7d455ddb 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -625,6 +625,48 @@ SMESH_DeviceActor } } +void +SMESH_DeviceActor +::SetFacesOrientationColor(vtkFloatingPointType theColor[3]) +{ + myFaceOrientation->GetProperty()->SetColor( theColor ); +} + +void +SMESH_DeviceActor +::GetFacesOrientationColor(vtkFloatingPointType theColor[3]) +{ + myFaceOrientation->GetProperty()->GetColor( theColor ); +} + +void +SMESH_DeviceActor +::SetFacesOrientationScale(vtkFloatingPointType theScale) +{ + myFaceOrientationFilter->SetOrientationScale( theScale ); +} + +vtkFloatingPointType +SMESH_DeviceActor +::GetFacesOrientationScale() +{ + return myFaceOrientationFilter->GetOrientationScale(); +} + +void +SMESH_DeviceActor +::SetFacesOrientation3DVectors(bool theState) +{ + myFaceOrientationFilter->Set3dVectors( theState ); +} + +bool +SMESH_DeviceActor +::GetFacesOrientation3DVectors() +{ + return myFaceOrientationFilter->Get3dVectors(); +} + void SMESH_DeviceActor ::UpdateFaceOrientation() diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h index 0b9acb48f..8b2fd6bf7 100644 --- a/src/OBJECT/SMESH_DeviceActor.h +++ b/src/OBJECT/SMESH_DeviceActor.h @@ -77,6 +77,15 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{ virtual void SetFacesOriented(bool theIsFacesOriented); virtual bool GetFacesOriented() { return myIsFacesOriented; } + virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]); + virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]); + + virtual void SetFacesOrientationScale(vtkFloatingPointType theScale); + virtual vtkFloatingPointType GetFacesOrientationScale(); + + virtual void SetFacesOrientation3DVectors(bool theState); + virtual bool GetFacesOrientation3DVectors(); + //---------------------------------------------------------------------------- //! Setting for displaying quadratic elements virtual void SetQuadraticArcMode(bool theFlag); diff --git a/src/OBJECT/SMESH_FaceOrientationFilter.cxx b/src/OBJECT/SMESH_FaceOrientationFilter.cxx index cf09779d0..63b66d5a4 100644 --- a/src/OBJECT/SMESH_FaceOrientationFilter.cxx +++ b/src/OBJECT/SMESH_FaceOrientationFilter.cxx @@ -91,6 +91,19 @@ SMESH_FaceOrientationFilter::~SMESH_FaceOrientationFilter() myBaseGlyph->Delete(); } +void SMESH_FaceOrientationFilter::SetOrientationScale( vtkFloatingPointType theScale ) +{ + myOrientationScale = theScale; + Modified(); +} + +void SMESH_FaceOrientationFilter::Set3dVectors( bool theState ) +{ + my3dVectors = theState; + myBaseGlyph->SetSource(my3dVectors ? myArrowPolyData : myGlyphSource->GetOutput()); + Modified(); +} + vtkPolyData* SMESH_FaceOrientationFilter::CreateArrowPolyData() { vtkPoints* points = vtkPoints::New(); diff --git a/src/OBJECT/SMESH_FaceOrientationFilter.h b/src/OBJECT/SMESH_FaceOrientationFilter.h index d51b06b56..d769ecb75 100644 --- a/src/OBJECT/SMESH_FaceOrientationFilter.h +++ b/src/OBJECT/SMESH_FaceOrientationFilter.h @@ -39,6 +39,12 @@ public: /*!Create a new SMESH_FaceOrientationFilter.*/ static SMESH_FaceOrientationFilter *New(); + void SetOrientationScale( vtkFloatingPointType ); + vtkFloatingPointType GetOrientationScale() const { return myOrientationScale; } + + void Set3dVectors( bool ); + bool Get3dVectors() const { return my3dVectors; } + protected: SMESH_FaceOrientationFilter(); virtual ~SMESH_FaceOrientationFilter(); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 74b9d1673..20ad43e03 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -797,26 +797,53 @@ c2 = int (nodecolor[2] * 255); QColor n(c0, c1, c2); + vtkFloatingPointType color0D[3]; + anActor->Get0DColor(color0D[0], color0D[1], color0D[2]); + c0 = int (color0D[0] * 255); + c1 = int (color0D[1] * 255); + c2 = int (color0D[2] * 255); + QColor c0D(c0, c1, c2); + + int size0D = (int)anActor->Get0DSize(); + if(size0D == 0) + size0D = 1; int Edgewidth = (int)anActor->GetLineWidth(); if(Edgewidth == 0) Edgewidth = 1; int intValue = int(anActor->GetNodeSize()); vtkFloatingPointType Shrink = anActor->GetShrinkFactor(); + vtkFloatingPointType faces_orientation_color[3]; + anActor->GetFacesOrientationColor(faces_orientation_color); + c0 = int (faces_orientation_color[0] * 255); + c1 = int (faces_orientation_color[1] * 255); + c2 = int (faces_orientation_color[2] * 255); + QColor o(c0, c1, c2); + + vtkFloatingPointType faces_orientation_scale = anActor->GetFacesOrientationScale(); + bool faces_orientation_3dvectors = anActor->GetFacesOrientation3DVectors(); + SMESHGUI_Preferences_ColorDlg *aDlg = new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() ); aDlg->SetColor(1, c); aDlg->SetColor(2, e); aDlg->SetColor(3, n); aDlg->SetColor(4, b); + aDlg->SetColor(5, c0D); + aDlg->SetColor(6, o); aDlg->SetIntValue(1, Edgewidth); aDlg->SetIntValue(2, intValue); aDlg->SetIntValue(3, int(Shrink*100.)); + aDlg->SetIntValue(4, size0D); + aDlg->SetDoubleValue(1, faces_orientation_scale); + aDlg->SetBooleanValue(1, faces_orientation_3dvectors); if(aDlg->exec()){ QColor color = aDlg->GetColor(1); QColor edgecolor = aDlg->GetColor(2); QColor nodecolor = aDlg->GetColor(3); QColor backfacecolor = aDlg->GetColor(4); + QColor color0D = aDlg->GetColor(5); + QColor faces_orientation_color = aDlg->GetColor(6); /* actor color and backface color */ anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255., vtkFloatingPointType (color.green()) / 255., @@ -840,6 +867,20 @@ vtkFloatingPointType (nodecolor.blue()) / 255.); anActor->SetNodeSize(aDlg->GetIntValue(2)); + /* 0D elements */ + anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255., + vtkFloatingPointType (color0D.green()) / 255., + vtkFloatingPointType (color0D.blue()) / 255.); + anActor->Set0DSize(aDlg->GetIntValue(4)); + + /* Faces orientation */ + vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()), + vtkFloatingPointType(faces_orientation_color.greenF()), + vtkFloatingPointType(faces_orientation_color.blueF())}; + anActor->SetFacesOrientationColor(c); + anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1)); + anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1)); + SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface(IObject); if( !aGroupObject->_is_nil() ) { diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx index f8ed909ae..7e0981d63 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx @@ -32,6 +32,7 @@ // SALOME GUI includes #include #include +#include #include // Qt includes @@ -42,6 +43,7 @@ #include #include #include +#include #define SPACING 6 #define MARGIN 11 @@ -81,6 +83,16 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul QLabel* TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1 ); btnOutlineColor = new QtxColorButton( ButtonGroup1 ); + QLabel* TextLabel_0DElements_Color = new QLabel( tr( "0D elements" ), ButtonGroup1 ); + btn0DElementsColor = new QtxColorButton( ButtonGroup1 ); + + QLabel* TextLabel_0DElements_Size = new QLabel( tr( "Size of 0D elements" ), ButtonGroup1 ); + SpinBox_0DElements_Size = new QSpinBox( ButtonGroup1 ); + SpinBox_0DElements_Size->setRange( 1, 10 ); + SpinBox_0DElements_Size->setSingleStep( 1 ); + SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus ); + QLabel* TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1 ); SpinBox_Width = new QSpinBox( ButtonGroup1 ); SpinBox_Width->setRange( 0, 5 ); @@ -95,16 +107,20 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus ); - ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 ); - ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 ); - ButtonGroup1Layout->addWidget( TextLabel_BackFace, 0, 2 ); - ButtonGroup1Layout->addWidget( btnBackFaceColor, 0, 3 ); - ButtonGroup1Layout->addWidget( TextLabel_Outine, 1, 0 ); - ButtonGroup1Layout->addWidget( btnOutlineColor, 1, 1 ); - ButtonGroup1Layout->addWidget( TextLabel_Width, 1, 2 ); - ButtonGroup1Layout->addWidget( SpinBox_Width, 1, 3 ); - ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 2, 0 ); - ButtonGroup1Layout->addWidget( SpinBox_Shrink, 2, 1, 1, 3 ); + ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 ); + ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_BackFace, 0, 2 ); + ButtonGroup1Layout->addWidget( btnBackFaceColor, 0, 3 ); + ButtonGroup1Layout->addWidget( TextLabel_Outine, 1, 0 ); + ButtonGroup1Layout->addWidget( btnOutlineColor, 1, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 1, 2 ); + ButtonGroup1Layout->addWidget( btn0DElementsColor, 1, 3 ); + ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size, 2, 0 ); + ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size, 2, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_Width, 3, 0 ); + ButtonGroup1Layout->addWidget( SpinBox_Width, 3, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 3, 2 ); + ButtonGroup1Layout->addWidget( SpinBox_Shrink, 3, 3 ); // ------------------------------- QGroupBox* ButtonGroup2 = new QGroupBox( tr( "Nodes" ), this ); @@ -127,6 +143,30 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul ButtonGroup2Layout->addWidget( TextLabel_Nodes_Size ); ButtonGroup2Layout->addWidget( SpinBox_Nodes_Size ); + // ------------------------------- + QGroupBox* ButtonGroup3 = new QGroupBox( tr( "Orientation of faces" ), this ); + QGridLayout* ButtonGroup3Layout = new QGridLayout( ButtonGroup3 ); + ButtonGroup3Layout->setSpacing( SPACING ); + ButtonGroup3Layout->setMargin( MARGIN ); + + QLabel* TextLabel_Orientation_Color = new QLabel( tr( "Color" ), ButtonGroup3 ); + btnOrientationColor = new QtxColorButton( ButtonGroup3 ); + + QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "Scale" ), ButtonGroup3 ); + SpinBox_Orientation_Scale = new QtxDoubleSpinBox( ButtonGroup3 ); + SpinBox_Orientation_Scale->setRange( 0.05, 0.5 ); + SpinBox_Orientation_Scale->setSingleStep( 0.05 ); + SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus ); + + CheckBox_Orientation_3DVectors = new QCheckBox( tr( "3D vectors" ), ButtonGroup3 ); + + ButtonGroup3Layout->addWidget( TextLabel_Orientation_Color, 0, 0 ); + ButtonGroup3Layout->addWidget( btnOrientationColor, 0, 1 ); + ButtonGroup3Layout->addWidget( TextLabel_Orientation_Scale, 0, 2 ); + ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale, 0, 3 ); + ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, 1, 0, 1, 4 ); + // ------------------------------- QGroupBox* GroupButtons = new QGroupBox( this ); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); @@ -148,6 +188,7 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul // ------------------------------- topLayout->addWidget( ButtonGroup1 ); topLayout->addWidget( ButtonGroup2 ); + topLayout->addWidget( ButtonGroup3 ); topLayout->addWidget( GroupButtons ); // ------------------------------- @@ -226,10 +267,12 @@ void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog() void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color ) { switch ( type ) { - case 1 : btnFillColor->setColor( color ); break; // fill - case 2 : btnOutlineColor->setColor( color ); break; // outline - case 3 : btnNodeColor->setColor( color ); break; // node - case 4 : btnBackFaceColor->setColor( color ); break; // back face + case 1 : btnFillColor->setColor( color ); break; // fill + case 2 : btnOutlineColor->setColor( color ); break; // outline + case 3 : btnNodeColor->setColor( color ); break; // node + case 4 : btnBackFaceColor->setColor( color ); break; // back face + case 5 : btn0DElementsColor->setColor( color ); break; // 0d elements + case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces default: break; } } @@ -242,10 +285,12 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type ) { QColor color; switch ( type ) { - case 1 : color = btnFillColor->color(); break; // fill - case 2 : color = btnOutlineColor->color(); break; // outline - case 3 : color = btnNodeColor->color(); break; // node - case 4 : color = btnBackFaceColor->color(); break; // back face + case 1 : color = btnFillColor->color(); break; // fill + case 2 : color = btnOutlineColor->color(); break; // outline + case 3 : color = btnNodeColor->color(); break; // node + case 4 : color = btnBackFaceColor->color(); break; // back face + case 5 : color = btn0DElementsColor->color(); break; // 0d elements + case 6 : color = btnOrientationColor->color(); break; // orientation of faces default: break; } return color; @@ -258,9 +303,10 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type ) void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value ) { switch ( type ) { - case 1 : SpinBox_Width->setValue( value ); break; // width - case 2 : SpinBox_Nodes_Size->setValue( value ); break; // nodes size = value; break; - case 3 : SpinBox_Shrink->setValue( value ); break; // shrink coeff + case 1 : SpinBox_Width->setValue( value ); break; // width + case 2 : SpinBox_Nodes_Size->setValue( value ); break; // nodes size = value; break; + case 3 : SpinBox_Shrink->setValue( value ); break; // shrink coeff + case 4 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements default: break; } } @@ -273,9 +319,62 @@ int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type ) { int res = 0; switch ( type ) { - case 1 : res = SpinBox_Width->value(); break; // width - case 2 : res = SpinBox_Nodes_Size->value(); break; // nodes size - case 3 : res = SpinBox_Shrink->value(); break; // shrink coeff + case 1 : res = SpinBox_Width->value(); break; // width + case 2 : res = SpinBox_Nodes_Size->value(); break; // nodes size + case 3 : res = SpinBox_Shrink->value(); break; // shrink coeff + case 4 : res = SpinBox_0DElements_Size->value(); break; // 0d elements + default: break; + } + return res; +} + +//================================================================================= +// function : SetDoubleValue() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SetDoubleValue( int type, double value ) +{ + switch ( type ) { + case 1 : SpinBox_Orientation_Scale->setValue( value ); break; // orientation scale + default: break; + } +} + +//================================================================================= +// function : GetDoubleValue() +// purpose : +//================================================================================= +double SMESHGUI_Preferences_ColorDlg::GetDoubleValue( int type ) +{ + double res = 0; + switch ( type ) { + case 1 : res = SpinBox_Orientation_Scale->value(); break; // orientation scale + default: break; + } + return res; +} + +//================================================================================= +// function : SetBooleanValue() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SetBooleanValue( int type, bool value ) +{ + switch ( type ) { + case 1 : CheckBox_Orientation_3DVectors->setChecked( value ); break; // 3D vectors + default: break; + } +} + +//================================================================================= +// function : GetBooleanValue() +// purpose : +//================================================================================= +bool SMESHGUI_Preferences_ColorDlg::GetBooleanValue( int type ) +{ + bool res = false; + switch ( type ) { + case 1 : res = CheckBox_Orientation_3DVectors->isChecked(); break; // 3D vectors default: break; } return res; diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h index f3f43f94d..5b23b4e6b 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h @@ -32,8 +32,10 @@ // Qt includes #include +class QCheckBox; class QSpinBox; class SMESHGUI; +class QtxDoubleSpinBox; class QtxIntSpinBox; class QtxColorButton; @@ -49,6 +51,10 @@ public: QColor GetColor( int ); void SetIntValue( int, int ); int GetIntValue( int ); + void SetDoubleValue( int, double ); + double GetDoubleValue( int ); + void SetBooleanValue( int, bool ); + bool GetBooleanValue( int ); protected: void closeEvent( QCloseEvent* ); @@ -65,10 +71,15 @@ private: QtxColorButton* btnFillColor; QtxColorButton* btnBackFaceColor; QtxColorButton* btnOutlineColor; + QtxColorButton* btn0DElementsColor; + QSpinBox* SpinBox_0DElements_Size; QSpinBox* SpinBox_Width; QtxIntSpinBox* SpinBox_Shrink; QtxColorButton* btnNodeColor; QSpinBox* SpinBox_Nodes_Size; + QtxColorButton* btnOrientationColor; + QtxDoubleSpinBox* SpinBox_Orientation_Scale; + QCheckBox* CheckBox_Orientation_3DVectors; }; #endif // SMESHGUI_PREFERENCES_COLORDLG_H