Imp: allow customization of nodes / cells numbering text properties via preferences

This commit is contained in:
vsr 2012-12-17 15:48:01 +00:00
parent 7085686b04
commit beab223e19
13 changed files with 308 additions and 24 deletions

View File

@ -90,6 +90,18 @@
<parameter name="documentation" value="smesh_help"/>
<parameter name="preview_actor_chunk_size" value="100" />
<parameter name="historical_python_dump" value="true" />
<parameter name="numbering_node_color" value="255, 255, 255" />
<parameter name="numbering_node_size" value="10" />
<parameter name="numbering_node_font" value="Times" />
<parameter name="numbering_node_bold" value="true" />
<parameter name="numbering_node_italic" value="false" />
<parameter name="numbering_node_shadow" value="false" />
<parameter name="numbering_elem_color" value="0, 255, 0" />
<parameter name="numbering_elem_size" value="12" />
<parameter name="numbering_elem_font" value="Times" />
<parameter name="numbering_elem_bold" value="true" />
<parameter name="numbering_elem_italic" value="false" />
<parameter name="numbering_elem_shadow" value="false" />
<!-- Input field precisions -->
<parameter name="def_precision" value="3" />
<parameter name="length_precision" value="-6" />

View File

@ -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();
}

View File

@ -31,6 +31,7 @@
#include <SALOMEconfig.h> // To fix some redefinition
#include <SALOME_Actor.h>
#include "SMESH_Object.h"
#include "SMESH_ActorUtils.h"
#include <vtkCommand.h>
@ -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;

View File

@ -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();

View File

@ -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,

View File

@ -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());

View File

@ -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.

View File

@ -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) {

View File

@ -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.

View File

@ -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.";

View File

@ -34,6 +34,8 @@
#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
#include "SMESH_NodeLabelActor.h"
#include "SMESH_CellLabelActor.h"
#include <SMESH_ObjectDef.h>
#include <SMDS_Mesh.hxx>
@ -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<SUIT_ViewWindow*> 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)

View File

@ -137,6 +137,9 @@ SMESHGUI_EXPORT
SMESHGUI_EXPORT
void UpdateSelectionProp( SMESHGUI* );
SMESHGUI_EXPORT
void UpdateFontProp( SMESHGUI* );
//----------------------------------------------------------------------------
SMESHGUI_EXPORT
SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );

View File

@ -2232,6 +2232,50 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_PRECISION</source>
<translation>Precision</translation>
</message>
<message>
<source>PREF_GROUP_NUMBERING</source>
<translation>Numbering</translation>
</message>
<message>
<source>PREF_NUMBERING_NODE</source>
<translation>Nodes: Color</translation>
</message>
<message>
<source>PREF_NUMBERING_ELEM</source>
<translation>Edges: Color</translation>
</message>
<message>
<source>PREF_NUMBERING_SIZE</source>
<translation>Size</translation>
</message>
<message>
<source>PREF_NUMBERING_FONT</source>
<translation>Font</translation>
</message>
<message>
<source>SMESH_ARIAL</source>
<translation>Arial</translation>
</message>
<message>
<source>SMESH_COURIER</source>
<translation>Courier</translation>
</message>
<message>
<source>SMESH_TIMES</source>
<translation>Times</translation>
</message>
<message>
<source>PREF_NUMBERING_BOLD</source>
<translation>Bold</translation>
</message>
<message>
<source>PREF_NUMBERING_ITALIC</source>
<translation>Italic</translation>
</message>
<message>
<source>PREF_NUMBERING_SHADOW</source>
<translation>Shadow</translation>
</message>
<message>
<source>SMESH_PREFERENCES_SCALARBAR</source>
<translation>Scalar Bar Preferences</translation>