mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 10:50:34 +05:00
Imp: allow customization of nodes / cells numbering text properties via preferences
This commit is contained in:
parent
7085686b04
commit
beab223e19
@ -90,6 +90,18 @@
|
|||||||
<parameter name="documentation" value="smesh_help"/>
|
<parameter name="documentation" value="smesh_help"/>
|
||||||
<parameter name="preview_actor_chunk_size" value="100" />
|
<parameter name="preview_actor_chunk_size" value="100" />
|
||||||
<parameter name="historical_python_dump" value="true" />
|
<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 -->
|
<!-- Input field precisions -->
|
||||||
<parameter name="def_precision" value="3" />
|
<parameter name="def_precision" value="3" />
|
||||||
<parameter name="length_precision" value="-6" />
|
<parameter name="length_precision" value="-6" />
|
||||||
|
@ -152,6 +152,22 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
|
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
|
||||||
vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_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();
|
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
|
||||||
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
|
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
|
||||||
|
|
||||||
@ -182,6 +198,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my2DActor->SetStoreGemetryMapping(true);
|
my2DActor->SetStoreGemetryMapping(true);
|
||||||
my2DActor->SetUserMatrix(aMatrix);
|
my2DActor->SetUserMatrix(aMatrix);
|
||||||
my2DActor->PickableOff();
|
my2DActor->PickableOff();
|
||||||
|
my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||||
my2DActor->SetProperty(mySurfaceProp);
|
my2DActor->SetProperty(mySurfaceProp);
|
||||||
my2DActor->SetBackfaceProperty(myBackSurfaceProp);
|
my2DActor->SetBackfaceProperty(myBackSurfaceProp);
|
||||||
my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
@ -220,6 +237,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my3DActor->SetStoreGemetryMapping(true);
|
my3DActor->SetStoreGemetryMapping(true);
|
||||||
my3DActor->SetUserMatrix(aMatrix);
|
my3DActor->SetUserMatrix(aMatrix);
|
||||||
my3DActor->PickableOff();
|
my3DActor->PickableOff();
|
||||||
|
my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||||
my3DActor->SetProperty(myNormalVProp);
|
my3DActor->SetProperty(myNormalVProp);
|
||||||
my3DActor->SetBackfaceProperty(myReversedVProp);
|
my3DActor->SetBackfaceProperty(myReversedVProp);
|
||||||
my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
@ -289,6 +307,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my1DActor->SetUserMatrix(aMatrix);
|
my1DActor->SetUserMatrix(aMatrix);
|
||||||
my1DActor->PickableOff();
|
my1DActor->PickableOff();
|
||||||
my1DActor->SetHighlited(true);
|
my1DActor->SetHighlited(true);
|
||||||
|
my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||||
my1DActor->SetProperty(myEdgeProp);
|
my1DActor->SetProperty(myEdgeProp);
|
||||||
my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
aFilter = my1DActor->GetExtractUnstructuredGrid();
|
aFilter = my1DActor->GetExtractUnstructuredGrid();
|
||||||
@ -334,6 +353,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my0DActor->SetUserMatrix(aMatrix);
|
my0DActor->SetUserMatrix(aMatrix);
|
||||||
my0DActor->SetStoreGemetryMapping(true);
|
my0DActor->SetStoreGemetryMapping(true);
|
||||||
my0DActor->PickableOff();
|
my0DActor->PickableOff();
|
||||||
|
my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||||
my0DActor->SetVisibility(false);
|
my0DActor->SetVisibility(false);
|
||||||
my0DActor->SetProperty(my0DProp);
|
my0DActor->SetProperty(my0DProp);
|
||||||
my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
@ -353,6 +373,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myBallActor->SetUserMatrix(aMatrix);
|
myBallActor->SetUserMatrix(aMatrix);
|
||||||
myBallActor->SetStoreGemetryMapping(true);
|
myBallActor->SetStoreGemetryMapping(true);
|
||||||
myBallActor->PickableOff();
|
myBallActor->PickableOff();
|
||||||
|
myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
|
||||||
myBallActor->SetVisibility(false);
|
myBallActor->SetVisibility(false);
|
||||||
myBallActor->SetProperty(myBallProp);
|
myBallActor->SetProperty(myBallProp);
|
||||||
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
@ -393,6 +414,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myNodeActor->SetStoreClippingMapping(true);
|
myNodeActor->SetStoreClippingMapping(true);
|
||||||
myNodeActor->PickableOff();
|
myNodeActor->PickableOff();
|
||||||
myNodeActor->SetVisibility(false);
|
myNodeActor->SetVisibility(false);
|
||||||
|
myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
|
||||||
myNodeActor->SetProperty(myNodeProp);
|
myNodeActor->SetProperty(myNodeProp);
|
||||||
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
||||||
aFilter = myNodeActor->GetExtractUnstructuredGrid();
|
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() {
|
bool SMESH_ActorDef::GetPointsLabeled() {
|
||||||
return myNodeActor && myNodeActor->GetPointsLabeled();
|
return myNodeActor && myNodeActor->GetPointsLabeled();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <SALOMEconfig.h> // To fix some redefinition
|
#include <SALOMEconfig.h> // To fix some redefinition
|
||||||
#include <SALOME_Actor.h>
|
#include <SALOME_Actor.h>
|
||||||
#include "SMESH_Object.h"
|
#include "SMESH_Object.h"
|
||||||
|
#include "SMESH_ActorUtils.h"
|
||||||
|
|
||||||
#include <vtkCommand.h>
|
#include <vtkCommand.h>
|
||||||
|
|
||||||
@ -162,6 +163,13 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
|
|||||||
virtual void UpdateScalarBar() = 0;
|
virtual void UpdateScalarBar() = 0;
|
||||||
virtual void UpdateDistribution() = 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
|
#ifndef DISABLE_PLOT2DVIEWER
|
||||||
virtual SPlot2d_Histogram* GetPlot2Histogram() = 0;
|
virtual SPlot2d_Histogram* GetPlot2Histogram() = 0;
|
||||||
virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0;
|
virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0;
|
||||||
|
@ -180,6 +180,13 @@ class SMESH_ActorDef : public SMESH_Actor
|
|||||||
virtual void SetPointsLabeled(bool theIsPointsLabeled);
|
virtual void SetPointsLabeled(bool theIsPointsLabeled);
|
||||||
virtual bool GetPointsLabeled();
|
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 void SetCellsLabeled(bool theIsCellsLabeled);
|
||||||
virtual bool GetCellsLabeled();
|
virtual bool GetCellsLabeled();
|
||||||
|
|
||||||
|
@ -33,6 +33,13 @@ class SMESH_Actor;
|
|||||||
|
|
||||||
namespace SMESH
|
namespace SMESH
|
||||||
{
|
{
|
||||||
|
//! Label font family
|
||||||
|
enum LabelFont {
|
||||||
|
FntArial, //!< arial font family
|
||||||
|
FntCourier, //!< courier font family
|
||||||
|
FntTimes, //!< times font family
|
||||||
|
};
|
||||||
|
|
||||||
SMESHOBJECT_EXPORT
|
SMESHOBJECT_EXPORT
|
||||||
vtkFloatingPointType
|
vtkFloatingPointType
|
||||||
GetFloat( const QString& theValue,
|
GetFloat( const QString& theValue,
|
||||||
|
@ -69,21 +69,19 @@ SMESH_CellLabelActor::SMESH_CellLabelActor() {
|
|||||||
myClsLabeledDataMapper->SetLabelFormat("%d");
|
myClsLabeledDataMapper->SetLabelFormat("%d");
|
||||||
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
|
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
|
||||||
|
|
||||||
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
|
myClsTextProp = vtkTextProperty::New();
|
||||||
aClsTextProp->SetFontFamilyToTimes();
|
myClsTextProp->SetFontFamilyToTimes();
|
||||||
static int aCellsFontSize = 12;
|
myClsTextProp->SetFontSize(12);
|
||||||
aClsTextProp->SetFontSize(aCellsFontSize);
|
myClsTextProp->SetBold(1);
|
||||||
aClsTextProp->SetBold(1);
|
myClsTextProp->SetItalic(0);
|
||||||
aClsTextProp->SetItalic(0);
|
myClsTextProp->SetShadow(0);
|
||||||
aClsTextProp->SetShadow(0);
|
myClsTextProp->SetColor( 0, 1, 0 );
|
||||||
myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
|
myClsLabeledDataMapper->SetLabelTextProperty(myClsTextProp);
|
||||||
aClsTextProp->Delete();
|
|
||||||
|
|
||||||
myIsCellsLabeled = false;
|
myIsCellsLabeled = false;
|
||||||
|
|
||||||
myCellsLabels = vtkActor2D::New();
|
myCellsLabels = vtkActor2D::New();
|
||||||
myCellsLabels->SetMapper(myClsLabeledDataMapper);
|
myCellsLabels->SetMapper(myClsLabeledDataMapper);
|
||||||
myCellsLabels->GetProperty()->SetColor(0,1,0);
|
|
||||||
myCellsLabels->SetVisibility(myIsCellsLabeled);
|
myCellsLabels->SetVisibility(myIsCellsLabeled);
|
||||||
|
|
||||||
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
|
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
|
||||||
@ -116,12 +114,30 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() {
|
|||||||
// commented: porting to vtk 5.0
|
// commented: porting to vtk 5.0
|
||||||
// myClsSelectVisiblePoints->UnRegisterAllOutputs();
|
// myClsSelectVisiblePoints->UnRegisterAllOutputs();
|
||||||
myClsSelectVisiblePoints->Delete();
|
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) {
|
void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
|
||||||
myTransformFilter->Update();
|
myTransformFilter->Update();
|
||||||
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
|
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
|
||||||
|
@ -27,12 +27,14 @@
|
|||||||
#define SMESH_CELL_LABEL_ACTOR_H
|
#define SMESH_CELL_LABEL_ACTOR_H
|
||||||
|
|
||||||
#include "SMESH_DeviceActor.h"
|
#include "SMESH_DeviceActor.h"
|
||||||
|
#include "SMESH_ActorUtils.h"
|
||||||
|
|
||||||
class vtkSelectVisiblePoints;
|
class vtkSelectVisiblePoints;
|
||||||
class vtkLabeledDataMapper;
|
class vtkLabeledDataMapper;
|
||||||
class vtkActor2D;
|
class vtkActor2D;
|
||||||
class vtkMaskPoints;
|
class vtkMaskPoints;
|
||||||
class vtkUnstructuredGrid;
|
class vtkUnstructuredGrid;
|
||||||
|
class vtkTextProperty;
|
||||||
|
|
||||||
class VTKViewer_CellCenters;
|
class VTKViewer_CellCenters;
|
||||||
|
|
||||||
@ -58,6 +60,10 @@ public:
|
|||||||
virtual void AddToRender(vtkRenderer* theRenderer);
|
virtual void AddToRender(vtkRenderer* theRenderer);
|
||||||
virtual void RemoveFromRender(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();
|
void UpdateLabels();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -72,6 +78,7 @@ protected:
|
|||||||
vtkLabeledDataMapper* myClsLabeledDataMapper;
|
vtkLabeledDataMapper* myClsLabeledDataMapper;
|
||||||
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
|
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
|
||||||
SMESH_DeviceActor* myBaseActor; //Pointer to the base actor
|
SMESH_DeviceActor* myBaseActor; //Pointer to the base actor
|
||||||
|
vtkTextProperty* myClsTextProp;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Not implemented.
|
// Not implemented.
|
||||||
|
@ -63,21 +63,19 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
|
|||||||
myPtsLabeledDataMapper->SetLabelFormat("%d");
|
myPtsLabeledDataMapper->SetLabelFormat("%d");
|
||||||
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
|
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
|
||||||
|
|
||||||
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
|
myPtsTextProp = vtkTextProperty::New();
|
||||||
aPtsTextProp->SetFontFamilyToTimes();
|
myPtsTextProp->SetFontFamilyToTimes();
|
||||||
static int aPointsFontSize = 10;
|
myPtsTextProp->SetFontSize(10);
|
||||||
aPtsTextProp->SetFontSize(aPointsFontSize);
|
myPtsTextProp->SetBold(1);
|
||||||
aPtsTextProp->SetBold(1);
|
myPtsTextProp->SetItalic(0);
|
||||||
aPtsTextProp->SetItalic(0);
|
myPtsTextProp->SetShadow(0);
|
||||||
aPtsTextProp->SetShadow(0);
|
myPtsTextProp->SetColor( 1, 1, 1 );
|
||||||
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
|
myPtsLabeledDataMapper->SetLabelTextProperty(myPtsTextProp);
|
||||||
aPtsTextProp->Delete();
|
|
||||||
|
|
||||||
myIsPointsLabeled = false;
|
myIsPointsLabeled = false;
|
||||||
|
|
||||||
myPointLabels = vtkActor2D::New();
|
myPointLabels = vtkActor2D::New();
|
||||||
myPointLabels->SetMapper(myPtsLabeledDataMapper);
|
myPointLabels->SetMapper(myPtsLabeledDataMapper);
|
||||||
myPointLabels->GetProperty()->SetColor(1,1,1);
|
|
||||||
myPointLabels->SetVisibility(myIsPointsLabeled);
|
myPointLabels->SetVisibility(myIsPointsLabeled);
|
||||||
|
|
||||||
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
|
vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
|
||||||
@ -109,7 +107,27 @@ SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
|
|||||||
// myPtsMaskPoints->UnRegisterAllOutputs();
|
// myPtsMaskPoints->UnRegisterAllOutputs();
|
||||||
myPtsMaskPoints->Delete();
|
myPtsMaskPoints->Delete();
|
||||||
myPointLabels->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) {
|
void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
|
||||||
|
@ -27,13 +27,14 @@
|
|||||||
#define SMESH_NODE_LABEL_ACTOR_H
|
#define SMESH_NODE_LABEL_ACTOR_H
|
||||||
|
|
||||||
#include "SMESH_DeviceActor.h"
|
#include "SMESH_DeviceActor.h"
|
||||||
|
#include "SMESH_ActorUtils.h"
|
||||||
|
|
||||||
class vtkSelectVisiblePoints;
|
class vtkSelectVisiblePoints;
|
||||||
class vtkLabeledDataMapper;
|
class vtkLabeledDataMapper;
|
||||||
class vtkActor2D;
|
class vtkActor2D;
|
||||||
class vtkMaskPoints;
|
class vtkMaskPoints;
|
||||||
class vtkUnstructuredGrid;
|
class vtkUnstructuredGrid;
|
||||||
|
class vtkTextProperty;
|
||||||
|
|
||||||
class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor {
|
class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor {
|
||||||
public:
|
public:
|
||||||
@ -56,6 +57,10 @@ public:
|
|||||||
virtual void AddToRender(vtkRenderer* theRenderer);
|
virtual void AddToRender(vtkRenderer* theRenderer);
|
||||||
virtual void RemoveFromRender(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();
|
void UpdateLabels();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -68,6 +73,7 @@ protected:
|
|||||||
vtkMaskPoints* myPtsMaskPoints;
|
vtkMaskPoints* myPtsMaskPoints;
|
||||||
vtkLabeledDataMapper* myPtsLabeledDataMapper;
|
vtkLabeledDataMapper* myPtsLabeledDataMapper;
|
||||||
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
|
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
|
||||||
|
vtkTextProperty* myPtsTextProp;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Not implemented.
|
// Not implemented.
|
||||||
|
@ -4880,6 +4880,34 @@ void SMESHGUI::createPreferences()
|
|||||||
setPreferenceProperty( shrink, "min", 0 );
|
setPreferenceProperty( shrink, "min", 0 );
|
||||||
setPreferenceProperty( shrink, "max", 100 );
|
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 );
|
int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
|
||||||
setPreferenceProperty( orientGroup, "columns", 1 );
|
setPreferenceProperty( orientGroup, "columns", 1 );
|
||||||
|
|
||||||
@ -5066,6 +5094,16 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
|||||||
QString val = aResourceMgr->stringValue( "SMESH", name );
|
QString val = aResourceMgr->stringValue( "SMESH", name );
|
||||||
myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
|
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){
|
if(aWarning.size() != 0){
|
||||||
aWarning += "The default values are applied instead.";
|
aWarning += "The default values are applied instead.";
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_ActorUtils.h>
|
#include <SMESH_ActorUtils.h>
|
||||||
|
#include "SMESH_NodeLabelActor.h"
|
||||||
|
#include "SMESH_CellLabelActor.h"
|
||||||
#include <SMESH_ObjectDef.h>
|
#include <SMESH_ObjectDef.h>
|
||||||
#include <SMDS_Mesh.hxx>
|
#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*
|
SVTK_Selector*
|
||||||
GetSelector(SUIT_ViewWindow *theWindow)
|
GetSelector(SUIT_ViewWindow *theWindow)
|
||||||
|
@ -137,6 +137,9 @@ SMESHGUI_EXPORT
|
|||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
void UpdateSelectionProp( SMESHGUI* );
|
void UpdateSelectionProp( SMESHGUI* );
|
||||||
|
|
||||||
|
SMESHGUI_EXPORT
|
||||||
|
void UpdateFontProp( SMESHGUI* );
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SMESHGUI_EXPORT
|
SMESHGUI_EXPORT
|
||||||
SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
|
SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
|
||||||
|
@ -2232,6 +2232,50 @@ Check algorithm documentation for supported geometry</translation>
|
|||||||
<source>SMESH_PRECISION</source>
|
<source>SMESH_PRECISION</source>
|
||||||
<translation>Precision</translation>
|
<translation>Precision</translation>
|
||||||
</message>
|
</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>
|
<message>
|
||||||
<source>SMESH_PREFERENCES_SCALARBAR</source>
|
<source>SMESH_PREFERENCES_SCALARBAR</source>
|
||||||
<translation>Scalar Bar Preferences</translation>
|
<translation>Scalar Bar Preferences</translation>
|
||||||
|
Loading…
Reference in New Issue
Block a user