Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
f798c58d
Commit
f798c58d
authored
Nov 18, 2011
by
Philippe Pébay
Browse files
Added distance-based LOD for titles and labels.
This is ON by default Change-Id: I1cdb875643c3e97f13ddb09a1e0cf7bb1f327a3f
parent
a89eb38f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Hybrid/vtkPolarAxesActor.cxx
View file @
f798c58d
...
...
@@ -169,17 +169,11 @@ vtkPolarAxesActor::vtkPolarAxesActor() : vtkActor()
// Base offset for followers
double
offset
=
this
->
LabelScreenOffset
+
this
->
ScreenSize
*
0.5
;
//
Using twice the base offset and a little for the title of the polar axis.
//
Set polar axis title follower (label followers not built yet)
vtkAxisFollower
*
follower
=
this
->
PolarAxis
->
GetTitleActor
();
follower
->
SetAxis
(
this
->
PolarAxis
);
follower
->
SetScreenOffset
(
2.0
*
offset
+
5
);
vtkAxisFollower
**
labelActors
=
this
->
PolarAxis
->
GetLabelActors
();
int
numberOfLabels
=
this
->
PolarAxis
->
GetNumberOfLabelsBuilt
();
for
(
int
i
=
0
;
i
<
numberOfLabels
;
++
i
)
{
labelActors
[
i
]
->
SetScreenOffset
(
offset
);
}
follower
->
SetEnableDistanceLOD
(
this
->
EnableDistanceLOD
);
// Properties of the radial axes, with default color black
this
->
RadialAxesProperty
=
vtkProperty
::
New
();
...
...
@@ -197,9 +191,10 @@ vtkPolarAxesActor::vtkPolarAxesActor() : vtkActor()
axis
->
SetCalculateTitleOffset
(
0
);
axis
->
SetCalculateLabelOffset
(
0
);
//
Using 2/3 of base offset if not for non-polar radial axes.
//
Set radial axis title follower
axis
->
GetTitleActor
()
->
SetAxis
(
axis
);
axis
->
GetTitleActor
()
->
SetScreenOffset
(
.67
*
offset
);
axis
->
GetTitleActor
()
->
SetEnableDistanceLOD
(
this
->
EnableDistanceLOD
);
}
// for ( int i = 0; i < VTK_MAXIMUM_NUMBER_OF_RADIAL_AXES; ++ i )
// Create and set polar arcs and ancillary objects, with default color white
...
...
@@ -426,7 +421,6 @@ double *vtkPolarAxesActor::GetBounds()
//-----------------------------------------------------------------------------
void
vtkPolarAxesActor
::
BuildAxes
(
vtkViewport
*
viewport
)
{
cerr
<<
"In BuildAxes
\n
"
;
double
bounds
[
6
];
if
(
(
this
->
GetMTime
()
<
this
->
BuildTime
.
GetMTime
()
))
...
...
@@ -538,6 +532,7 @@ void vtkPolarAxesActor::SetCommonAxisAttributes( vtkAxisActor* axis )
prop
->
SetDiffuse
(
0.0
);
axis
->
SetProperty
(
prop
);
// Common space and range attributes
axis
->
SetCamera
(
this
->
Camera
);
axis
->
SetBounds
(
this
->
Bounds
);
axis
->
SetRange
(
0.
,
this
->
MaximumRadius
);
...
...
@@ -546,12 +541,6 @@ void vtkPolarAxesActor::SetCommonAxisAttributes( vtkAxisActor* axis )
axis
->
SetMinorTicksVisible
(
0
);
}
//-----------------------------------------------------------------------------
double
vtkPolarAxesActor
::
MaxOf
(
double
a
,
double
b
)
{
return
(
a
>
b
?
a
:
b
);
}
//-----------------------------------------------------------------------------
inline
double
vtkPolarAxesActor
::
FFix
(
double
value
)
{
...
...
@@ -573,7 +562,6 @@ inline double vtkPolarAxesActor::FSign( double value, double sign )
//-----------------------------------------------------------------------------
void
vtkPolarAxesActor
::
BuildPolarAxisTicks
(
double
x0
)
{
cerr
<<
"In BuildPolarAxisTicks
\n
"
;
double
delta
;
if
(
this
->
AutoSubdividePolarAxis
...
...
@@ -643,7 +631,6 @@ void vtkPolarAxesActor::BuildPolarAxisTicks( double x0 )
//-----------------------------------------------------------------------------
void
vtkPolarAxesActor
::
BuildPolarAxisLabelsArcs
(
double
*
O
)
{
cerr
<<
"In BuildPolarAxisLabelsArcs
\n
"
;
// Prepare storage for polar axis labels
vtkStringArray
*
labels
=
vtkStringArray
::
New
();
labels
->
SetNumberOfValues
(
this
->
NumberOfPolarAxisTicks
);
...
...
@@ -660,12 +647,12 @@ void vtkPolarAxesActor::BuildPolarAxisLabelsArcs( double* O )
=
static_cast
<
vtkIdType
>
(
angularSector
*
VTK_POLAR_ARC_RESOLUTION_PER_DEG
);
// Arc points
vtkPoints
*
polarArcsPoints
=
vtkPoints
::
New
();
vtkPoints
*
polarArcsPoints
=
vtkPoints
::
New
();
this
->
PolarArcs
->
SetPoints
(
polarArcsPoints
);
polarArcsPoints
->
Delete
();
// Arc lines
vtkCellArray
*
polarArcsLines
=
vtkCellArray
::
New
();
vtkCellArray
*
polarArcsLines
=
vtkCellArray
::
New
();
this
->
PolarArcs
->
SetLines
(
polarArcsLines
);
polarArcsLines
->
Delete
();
...
...
@@ -734,6 +721,7 @@ void vtkPolarAxesActor::BuildPolarAxisLabelsArcs( double* O )
{
labelActors
[
i
]
->
SetAxis
(
axis
);
labelActors
[
i
]
->
SetScreenOffset
(
this
->
LabelScreenOffset
);
labelActors
[
i
]
->
SetEnableDistanceLOD
(
EnableDistanceLOD
);
}
}
...
...
Hybrid/vtkPolarAxesActor.h
View file @
f798c58d
...
...
@@ -146,23 +146,33 @@ public:
// resources to release.
void
ReleaseGraphicsResources
(
vtkWindow
*
);
// Description:
// Enable and disable the use of distance based LOD for titles and labels.
vtkSetMacro
(
EnableDistanceLOD
,
int
);
vtkGetMacro
(
EnableDistanceLOD
,
int
);
// Description:a
// Set distance LOD threshold [0.0 - 1.0] for titles and labels.
vtkSetClampMacro
(
DistanceLODThreshold
,
double
,
0.0
,
1.0
);
vtkGetMacro
(
DistanceLODThreshold
,
double
);
// Description:
// Turn on and off the visibility of the polar axis.
vtkSetMacro
(
PolarAxisVisibility
,
int
);
vtkGetMacro
(
PolarAxisVisibility
,
int
);
vtkBooleanMacro
(
PolarAxisVisibility
,
int
);
vtkSetMacro
(
PolarAxisVisibility
,
int
);
vtkGetMacro
(
PolarAxisVisibility
,
int
);
vtkBooleanMacro
(
PolarAxisVisibility
,
int
);
// Description:
// Turn on and off the visibility of titles for polar axis.
vtkSetMacro
(
PolarTitleVisibility
,
int
);
vtkGetMacro
(
PolarTitleVisibility
,
int
);
vtkBooleanMacro
(
PolarTitleVisibility
,
int
);
vtkSetMacro
(
PolarTitleVisibility
,
int
);
vtkGetMacro
(
PolarTitleVisibility
,
int
);
vtkBooleanMacro
(
PolarTitleVisibility
,
int
);
// Description:
// Turn on and off the visibility of labels for polar axis.
vtkSetMacro
(
PolarLabelVisibility
,
int
);
vtkGetMacro
(
PolarLabelVisibility
,
int
);
vtkBooleanMacro
(
PolarLabelVisibility
,
int
);
vtkSetMacro
(
PolarLabelVisibility
,
int
);
vtkGetMacro
(
PolarLabelVisibility
,
int
);
vtkBooleanMacro
(
PolarLabelVisibility
,
int
);
// Description:
// Turn on and off the visibility of ticks for polar axis.
...
...
@@ -172,15 +182,15 @@ public:
// Description:
// Turn on and off the visibility of non-polar radial axes.
vtkSetMacro
(
RadialAxesVisibility
,
int
);
vtkGetMacro
(
RadialAxesVisibility
,
int
);
vtkBooleanMacro
(
RadialAxesVisibility
,
int
);
vtkSetMacro
(
RadialAxesVisibility
,
int
);
vtkGetMacro
(
RadialAxesVisibility
,
int
);
vtkBooleanMacro
(
RadialAxesVisibility
,
int
);
// Description:
// Turn on and off the visibility of titles for non-polar radial axes.
vtkSetMacro
(
RadialTitleVisibility
,
int
);
vtkGetMacro
(
RadialTitleVisibility
,
int
);
vtkBooleanMacro
(
RadialTitleVisibility
,
int
);
vtkSetMacro
(
RadialTitleVisibility
,
int
);
vtkGetMacro
(
RadialTitleVisibility
,
int
);
vtkBooleanMacro
(
RadialTitleVisibility
,
int
);
// Description:
// Turn on and off the visibility of arcs for polar axis.
...
...
@@ -247,7 +257,6 @@ protected:
// Description:
// Convenience methods
double
MaxOf
(
double
,
double
);
double
FFix
(
double
);
double
FSign
(
double
,
double
);
...
...
@@ -318,19 +327,33 @@ protected:
char
*
PolarLabelFormat
;
// Description:
// Use angle units (degrees) to label radial axes
// Display angle units (degrees) to label radial axes
// Default is true
bool
RadialUnits
;
// Description:
// If enabled the actor will not be visible at a certain distance from the camera.
// Default is true
int
EnableDistanceLOD
;
// Description:
// Default is 0.80.
// This determines at what fraction of camera far clip range, actor is not visible.
double
DistanceLODThreshold
;
// Description:
// Visibility of polar axis and its title, labels, ticks (major only)
int
PolarAxisVisibility
;
int
PolarTitleVisibility
;
int
PolarLabelVisibility
;
int
PolarTickVisibility
;
// Description:
// Visibility of radial axes and their titles
int
RadialAxesVisibility
;
int
RadialTitleVisibility
;
// Description:
// Visibility of polar arcs
int
PolarArcsVisibility
;
...
...
@@ -338,23 +361,35 @@ protected:
int
RenderSomething
;
double
LabelScreenOffset
;
// Description:
// Text properties of polar axis title and labels
vtkTextProperty
*
PolarAxisTitleTextProperty
;
vtkTextProperty
*
PolarAxisLabelTextProperty
;
// Description:
// General properties of polar axis
vtkProperty
*
PolarAxisProperty
;
// Description:
// General properties of radial axes
vtkProperty
*
RadialAxesProperty
;
vtkTimeStamp
BuildTime
;
double
LabelScale
;
// Description:
// Title scale factor
double
TitleScale
;
// Description:
// Label scale factor
double
LabelScale
;
// Description:
// Label screen offset
double
LabelScreenOffset
;
// Description:
// Text screen size
double
ScreenSize
;
private:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment