diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 20be22917..d72d42480 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -90,6 +90,18 @@ + + + + + + + + + + + + diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 94d90d1b2..4a64b0de0 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -152,6 +152,22 @@ SMESH_ActorDef::SMESH_ActorDef() vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); + int aSizeNd = mgr->integerValue( "SMESH", "numbering_node_size", 10 ); + SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) ); + bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true ); + bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false ); + bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false ); + vtkFloatingPointType anRGBNd[3] = {1,1,1}; + SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) ); + + int aSizeEl = mgr->integerValue( "SMESH", "numbering_elem_size", 12 ); + SMESH::LabelFont aFamilyEl = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) ); + bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true ); + bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false ); + bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false ); + vtkFloatingPointType anRGBEl[3] = {0,1,0}; + SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) ); + vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New(); VTKViewer_ExtractUnstructuredGrid* aFilter = NULL; @@ -182,6 +198,7 @@ SMESH_ActorDef::SMESH_ActorDef() my2DActor->SetStoreGemetryMapping(true); my2DActor->SetUserMatrix(aMatrix); my2DActor->PickableOff(); + my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); my2DActor->SetProperty(mySurfaceProp); my2DActor->SetBackfaceProperty(myBackSurfaceProp); my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface); @@ -220,6 +237,7 @@ SMESH_ActorDef::SMESH_ActorDef() my3DActor->SetStoreGemetryMapping(true); my3DActor->SetUserMatrix(aMatrix); my3DActor->PickableOff(); + my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); my3DActor->SetProperty(myNormalVProp); my3DActor->SetBackfaceProperty(myReversedVProp); my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface); @@ -289,6 +307,7 @@ SMESH_ActorDef::SMESH_ActorDef() my1DActor->SetUserMatrix(aMatrix); my1DActor->PickableOff(); my1DActor->SetHighlited(true); + my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); my1DActor->SetProperty(myEdgeProp); my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface); aFilter = my1DActor->GetExtractUnstructuredGrid(); @@ -334,6 +353,7 @@ SMESH_ActorDef::SMESH_ActorDef() my0DActor->SetUserMatrix(aMatrix); my0DActor->SetStoreGemetryMapping(true); my0DActor->PickableOff(); + my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); my0DActor->SetVisibility(false); my0DActor->SetProperty(my0DProp); my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface); @@ -353,6 +373,7 @@ SMESH_ActorDef::SMESH_ActorDef() myBallActor->SetUserMatrix(aMatrix); myBallActor->SetStoreGemetryMapping(true); myBallActor->PickableOff(); + myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); myBallActor->SetVisibility(false); myBallActor->SetProperty(myBallProp); myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface); @@ -393,6 +414,7 @@ SMESH_ActorDef::SMESH_ActorDef() myNodeActor->SetStoreClippingMapping(true); myNodeActor->PickableOff(); myNodeActor->SetVisibility(false); + myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] ); myNodeActor->SetProperty(myNodeProp); myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint); aFilter = myNodeActor->GetExtractUnstructuredGrid(); @@ -622,6 +644,48 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled ) } } +void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize, + bool theBold, bool theItalic, bool theShadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) +{ + if(myNodeActor) { + myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } +} + +void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize, + bool theBold, bool theItalic, bool theShadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) +{ + if(my3DActor) { + my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } + if(my2DActor) { + my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } + if(my1DActor) { + my1DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } + if(my0DActor) { + my0DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } + if(myBallActor) { + myBallActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); + SetRepresentation( GetRepresentation() ); + myTimeStamp->Modified(); + } +} + bool SMESH_ActorDef::GetPointsLabeled() { return myNodeActor && myNodeActor->GetPointsLabeled(); } diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index fc954253d..2952818a7 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -31,6 +31,7 @@ #include // To fix some redefinition #include #include "SMESH_Object.h" +#include "SMESH_ActorUtils.h" #include @@ -162,6 +163,13 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void UpdateScalarBar() = 0; virtual void UpdateDistribution() = 0; + virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; + virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; + #ifndef DISABLE_PLOT2DVIEWER virtual SPlot2d_Histogram* GetPlot2Histogram() = 0; virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 11d7fe41a..2238faa5e 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -180,6 +180,13 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetPointsLabeled(bool theIsPointsLabeled); virtual bool GetPointsLabeled(); + virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + virtual void SetCellsLabeled(bool theIsCellsLabeled); virtual bool GetCellsLabeled(); diff --git a/src/OBJECT/SMESH_ActorUtils.h b/src/OBJECT/SMESH_ActorUtils.h index 3a15c40ad..5aafbbbf5 100644 --- a/src/OBJECT/SMESH_ActorUtils.h +++ b/src/OBJECT/SMESH_ActorUtils.h @@ -33,6 +33,13 @@ class SMESH_Actor; namespace SMESH { + //! Label font family + enum LabelFont { + FntArial, //!< arial font family + FntCourier, //!< courier font family + FntTimes, //!< times font family + }; + SMESHOBJECT_EXPORT vtkFloatingPointType GetFloat( const QString& theValue, diff --git a/src/OBJECT/SMESH_CellLabelActor.cxx b/src/OBJECT/SMESH_CellLabelActor.cxx index 81f2107f0..0726cd65f 100644 --- a/src/OBJECT/SMESH_CellLabelActor.cxx +++ b/src/OBJECT/SMESH_CellLabelActor.cxx @@ -69,21 +69,19 @@ SMESH_CellLabelActor::SMESH_CellLabelActor() { myClsLabeledDataMapper->SetLabelFormat("%d"); myClsLabeledDataMapper->SetLabelModeToLabelScalars(); - vtkTextProperty* aClsTextProp = vtkTextProperty::New(); - aClsTextProp->SetFontFamilyToTimes(); - static int aCellsFontSize = 12; - aClsTextProp->SetFontSize(aCellsFontSize); - aClsTextProp->SetBold(1); - aClsTextProp->SetItalic(0); - aClsTextProp->SetShadow(0); - myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp); - aClsTextProp->Delete(); + myClsTextProp = vtkTextProperty::New(); + myClsTextProp->SetFontFamilyToTimes(); + myClsTextProp->SetFontSize(12); + myClsTextProp->SetBold(1); + myClsTextProp->SetItalic(0); + myClsTextProp->SetShadow(0); + myClsTextProp->SetColor( 0, 1, 0 ); + myClsLabeledDataMapper->SetLabelTextProperty(myClsTextProp); myIsCellsLabeled = false; myCellsLabels = vtkActor2D::New(); myCellsLabels->SetMapper(myClsLabeledDataMapper); - myCellsLabels->GetProperty()->SetColor(0,1,0); myCellsLabels->SetVisibility(myIsCellsLabeled); vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New(); @@ -116,12 +114,30 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() { // commented: porting to vtk 5.0 // myClsSelectVisiblePoints->UnRegisterAllOutputs(); myClsSelectVisiblePoints->Delete(); - - - + myClsTextProp->Delete(); } +void SMESH_CellLabelActor::SetFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) +{ + switch ( family ) { + case SMESH::FntArial: + myClsTextProp->SetFontFamilyToArial(); break; + case SMESH::FntCourier: + myClsTextProp->SetFontFamilyToCourier(); break; + case SMESH::FntTimes: + default: + myClsTextProp->SetFontFamilyToTimes(); break; + } + myClsTextProp->SetFontSize( size ); + myClsTextProp->SetBold( bold ); + myClsTextProp->SetItalic( italic ); + myClsTextProp->SetShadow( shadow ); + myClsTextProp->SetColor( r, g, b ); +} + void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) { myTransformFilter->Update(); vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput()); diff --git a/src/OBJECT/SMESH_CellLabelActor.h b/src/OBJECT/SMESH_CellLabelActor.h index a754d0b08..eff545d7c 100644 --- a/src/OBJECT/SMESH_CellLabelActor.h +++ b/src/OBJECT/SMESH_CellLabelActor.h @@ -27,12 +27,14 @@ #define SMESH_CELL_LABEL_ACTOR_H #include "SMESH_DeviceActor.h" +#include "SMESH_ActorUtils.h" class vtkSelectVisiblePoints; class vtkLabeledDataMapper; class vtkActor2D; class vtkMaskPoints; class vtkUnstructuredGrid; +class vtkTextProperty; class VTKViewer_CellCenters; @@ -57,6 +59,10 @@ public: virtual void AddToRender(vtkRenderer* theRenderer); virtual void RemoveFromRender(vtkRenderer* theRenderer); + + virtual void SetFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); void UpdateLabels(); @@ -72,6 +78,7 @@ protected: vtkLabeledDataMapper* myClsLabeledDataMapper; vtkSelectVisiblePoints* myClsSelectVisiblePoints; SMESH_DeviceActor* myBaseActor; //Pointer to the base actor + vtkTextProperty* myClsTextProp; protected: // Not implemented. diff --git a/src/OBJECT/SMESH_NodeLabelActor.cxx b/src/OBJECT/SMESH_NodeLabelActor.cxx index aa2ba78a2..2e172d4ab 100644 --- a/src/OBJECT/SMESH_NodeLabelActor.cxx +++ b/src/OBJECT/SMESH_NodeLabelActor.cxx @@ -63,21 +63,19 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() { myPtsLabeledDataMapper->SetLabelFormat("%d"); myPtsLabeledDataMapper->SetLabelModeToLabelScalars(); - vtkTextProperty* aPtsTextProp = vtkTextProperty::New(); - aPtsTextProp->SetFontFamilyToTimes(); - static int aPointsFontSize = 10; - aPtsTextProp->SetFontSize(aPointsFontSize); - aPtsTextProp->SetBold(1); - aPtsTextProp->SetItalic(0); - aPtsTextProp->SetShadow(0); - myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp); - aPtsTextProp->Delete(); + myPtsTextProp = vtkTextProperty::New(); + myPtsTextProp->SetFontFamilyToTimes(); + myPtsTextProp->SetFontSize(10); + myPtsTextProp->SetBold(1); + myPtsTextProp->SetItalic(0); + myPtsTextProp->SetShadow(0); + myPtsTextProp->SetColor( 1, 1, 1 ); + myPtsLabeledDataMapper->SetLabelTextProperty(myPtsTextProp); myIsPointsLabeled = false; myPointLabels = vtkActor2D::New(); myPointLabels->SetMapper(myPtsLabeledDataMapper); - myPointLabels->GetProperty()->SetColor(1,1,1); myPointLabels->SetVisibility(myIsPointsLabeled); vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New(); @@ -109,7 +107,27 @@ SMESH_NodeLabelActor::~SMESH_NodeLabelActor() { // myPtsMaskPoints->UnRegisterAllOutputs(); myPtsMaskPoints->Delete(); myPointLabels->Delete(); + myPtsTextProp->Delete(); +} +void SMESH_NodeLabelActor::SetFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) +{ + switch ( family ) { + case SMESH::FntArial: + myPtsTextProp->SetFontFamilyToArial(); break; + case SMESH::FntCourier: + myPtsTextProp->SetFontFamilyToCourier(); break; + case SMESH::FntTimes: + default: + myPtsTextProp->SetFontFamilyToTimes(); break; + } + myPtsTextProp->SetFontSize( size ); + myPtsTextProp->SetBold( bold ); + myPtsTextProp->SetItalic( italic ); + myPtsTextProp->SetShadow( shadow ); + myPtsTextProp->SetColor( r, g, b ); } void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) { diff --git a/src/OBJECT/SMESH_NodeLabelActor.h b/src/OBJECT/SMESH_NodeLabelActor.h index a05b35467..df09248d3 100644 --- a/src/OBJECT/SMESH_NodeLabelActor.h +++ b/src/OBJECT/SMESH_NodeLabelActor.h @@ -27,13 +27,14 @@ #define SMESH_NODE_LABEL_ACTOR_H #include "SMESH_DeviceActor.h" +#include "SMESH_ActorUtils.h" class vtkSelectVisiblePoints; class vtkLabeledDataMapper; class vtkActor2D; class vtkMaskPoints; class vtkUnstructuredGrid; - +class vtkTextProperty; class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor { public: @@ -55,6 +56,10 @@ public: virtual void AddToRender(vtkRenderer* theRenderer); virtual void RemoveFromRender(vtkRenderer* theRenderer); + + virtual void SetFontProperties( SMESH::LabelFont family, int size, + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); void UpdateLabels(); @@ -68,6 +73,7 @@ protected: vtkMaskPoints* myPtsMaskPoints; vtkLabeledDataMapper* myPtsLabeledDataMapper; vtkSelectVisiblePoints* myPtsSelectVisiblePoints; + vtkTextProperty* myPtsTextProp; protected: // Not implemented. diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index d6831d7ad..60ab16961 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4880,6 +4880,34 @@ void SMESHGUI::createPreferences() setPreferenceProperty( shrink, "min", 0 ); setPreferenceProperty( shrink, "max", 100 ); + int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab ); + setPreferenceProperty( numGroup, "columns", 6 ); + QStringList fonts; + fonts << tr( "SMESH_ARIAL" ) << tr( "SMESH_COURIER" ) << tr( "SMESH_TIMES" ); + indices.clear(); indices << 0 << 1 << 2; + // ... + addPreference( tr( "PREF_NUMBERING_NODE" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_node_color" ); + int NumNodeSize = addPreference( tr( "PREF_NUMBERING_SIZE" ), numGroup, LightApp_Preferences::IntSpin, "SMESH", "numbering_node_size" ); + setPreferenceProperty( NumNodeSize, "min", 1 ); + setPreferenceProperty( NumNodeSize, "max", 100 ); + int NumFontNode = addPreference( tr( "PREF_NUMBERING_FONT" ), numGroup, LightApp_Preferences::Selector, "SMESH", "numbering_node_font" ); + setPreferenceProperty( NumFontNode, "strings", fonts ); + setPreferenceProperty( NumFontNode, "indexes", indices ); + addPreference( tr( "PREF_NUMBERING_BOLD" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_bold" ); + addPreference( tr( "PREF_NUMBERING_ITALIC" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_italic" ); + addPreference( tr( "PREF_NUMBERING_SHADOW" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_node_shadow" ); + // ... + addPreference( tr( "PREF_NUMBERING_ELEM" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_elem_color" ); + int NumElemSize = addPreference( tr( "PREF_NUMBERING_SIZE" ), numGroup, LightApp_Preferences::IntSpin, "SMESH", "numbering_elem_size" ); + setPreferenceProperty( NumElemSize, "min", 1 ); + setPreferenceProperty( NumElemSize, "max", 100 ); + int NumFontElem = addPreference( tr( "PREF_NUMBERING_FONT" ), numGroup, LightApp_Preferences::Selector, "SMESH", "numbering_elem_font" ); + setPreferenceProperty( NumFontElem, "strings", fonts ); + setPreferenceProperty( NumFontElem, "indexes", indices ); + addPreference( tr( "PREF_NUMBERING_BOLD" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_bold" ); + addPreference( tr( "PREF_NUMBERING_ITALIC" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_italic" ); + addPreference( tr( "PREF_NUMBERING_SHADOW" ), numGroup, LightApp_Preferences::Bool, "SMESH", "numbering_elem_shadow" ); + int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab ); setPreferenceProperty( orientGroup, "columns", 1 ); @@ -5066,6 +5094,16 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) QString val = aResourceMgr->stringValue( "SMESH", name ); myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() ); } + else if(name == QString("numbering_node_color") || name == QString("numbering_node_size") || + name == QString("numbering_node_font") || name == QString("numbering_node_bold") || + name == QString("numbering_node_italic") || name == QString("numbering_node_shadow") ) { + SMESH::UpdateFontProp( this ); + } + else if(name == QString("numbering_elem_color") || name == QString("numbering_elem_size") || + name == QString("numbering_elem_font") || name == QString("numbering_elem_bold") || + name == QString("numbering_elem_italic") || name == QString("numbering_elem_shadow") ) { + SMESH::UpdateFontProp( this ); + } if(aWarning.size() != 0){ aWarning += "The default values are applied instead."; diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 7831412db..48ce5afc7 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -34,6 +34,8 @@ #include #include +#include "SMESH_NodeLabelActor.h" +#include "SMESH_CellLabelActor.h" #include #include @@ -949,6 +951,58 @@ namespace SMESH } + void UpdateFontProp( SMESHGUI* theModule ) + { + if ( !theModule ) return; + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() ); + if ( !app ) return; + + SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule ); + if ( !mgr ) return; + // + vtkFloatingPointType anRGBNd[3] = {1,1,1}; + SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) ); + int aSizeNd = mgr->integerValue( "SMESH", "numbering_node_size", 10 ); + SMESH::LabelFont aFamilyNd = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_node_font", 2 ) ); + bool aBoldNd = mgr->booleanValue( "SMESH", "numbering_node_bold", true ); + bool anItalicNd = mgr->booleanValue( "SMESH", "numbering_node_italic", false ); + bool aShadowNd = mgr->booleanValue( "SMESH", "numbering_node_shadow", false ); + // + vtkFloatingPointType anRGBEl[3] = {0,1,0}; + SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) ); + int aSizeEl = mgr->integerValue( "SMESH", "numbering_elem_size", 12 ); + SMESH::LabelFont aFamilyEl = (SMESH::LabelFont)( mgr->integerValue( "SMESH", "numbering_elem_font", 2 ) ); + bool aBoldEl = mgr->booleanValue( "SMESH", "numbering_elem_bold", true ); + bool anItalicEl = mgr->booleanValue( "SMESH", "numbering_elem_italic", false ); + bool aShadowEl = mgr->booleanValue( "SMESH", "numbering_elem_shadow", false ); + // + ViewManagerList vmList; + app->viewManagers( SVTK_Viewer::Type(), vmList ); + foreach ( SUIT_ViewManager* vm, vmList ) { + QVector views = vm->getViews(); + foreach ( SUIT_ViewWindow* vw, views ) { + // update VTK viewer properties + if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) { + // update actors + vtkRenderer* aRenderer = aVtkView->getRenderer(); + VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() ); + vtkActorCollection* aCollection = aCopy.GetActors(); + aCollection->InitTraversal(); + while ( vtkActor* anAct = aCollection->GetNextActor() ) { + if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) { + anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] ); + } + else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) { + anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); + } + } + aVtkView->Repaint( false ); + } + } + } + } + //---------------------------------------------------------------------------- SVTK_Selector* GetSelector(SUIT_ViewWindow *theWindow) diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index 94d69a9cd..b226f7767 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -137,6 +137,9 @@ SMESHGUI_EXPORT SMESHGUI_EXPORT void UpdateSelectionProp( SMESHGUI* ); +SMESHGUI_EXPORT + void UpdateFontProp( SMESHGUI* ); + //---------------------------------------------------------------------------- SMESHGUI_EXPORT SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() ); diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 12109c0b9..2e7d4dd30 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -2232,6 +2232,50 @@ Check algorithm documentation for supported geometry SMESH_PRECISION Precision + + PREF_GROUP_NUMBERING + Numbering + + + PREF_NUMBERING_NODE + Nodes: Color + + + PREF_NUMBERING_ELEM + Edges: Color + + + PREF_NUMBERING_SIZE + Size + + + PREF_NUMBERING_FONT + Font + + + SMESH_ARIAL + Arial + + + SMESH_COURIER + Courier + + + SMESH_TIMES + Times + + + PREF_NUMBERING_BOLD + Bold + + + PREF_NUMBERING_ITALIC + Italic + + + PREF_NUMBERING_SHADOW + Shadow + SMESH_PREFERENCES_SCALARBAR Scalar Bar Preferences