Skip to content
GitLab
Menu
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
547aa8fb
Commit
547aa8fb
authored
Aug 31, 2005
by
Will Schroeder
Browse files
BUG: vtkLabeledDataMapper was never converted to new pipeline
parent
cfb44079
Changes
3
Hide whitespace changes
Inline
Side-by-side
Rendering/Testing/Tcl/labeledContours.tcl
View file @
547aa8fb
...
...
@@ -20,12 +20,12 @@ vtkVolume16Reader v16
v16 SetImageRange 45 45
v16 SetDataSpacing 3.2 3.2 1.5
vtkContourFilter iso
iso SetInput
[
v16 GetOutput
]
iso SetInput
Connection
[
v16 GetOutput
Port
]
iso GenerateValues 6 500 1150
iso Update
set numPts
[[
iso GetOutput
]
GetNumberOfPoints
]
vtkPolyDataMapper isoMapper
isoMapper SetInput
[
iso GetOutput
]
isoMapper SetInput
Connection
[
iso GetOutput
Port
]
isoMapper ScalarVisibilityOn
eval isoMapper SetScalarRange
[[
iso GetOutput
]
GetScalarRange
]
vtkActor isoActor
...
...
@@ -33,17 +33,17 @@ vtkActor isoActor
# Subsample the points and label them
vtkMaskPoints mask
mask SetInput
[
iso GetOutput
]
mask SetInput
Connection
[
iso GetOutput
Port
]
mask SetOnRatio
[
expr $numPts / 50
]
mask SetMaximumNumberOfPoints 50
mask RandomModeOn
# Create labels for points - only show visible points
vtkSelectVisiblePoints visPts
visPts SetInput
[
mask GetOutput
]
visPts SetInput
Connection
[
mask GetOutput
Port
]
visPts SetRenderer ren1
vtkLabeledDataMapper ldm
ldm SetInput
[
mask GetOutput
]
ldm SetInput
Connection
[
mask GetOutput
Port
]
ldm SetLabelFormat
"%g"
ldm SetLabelModeToLabelScalars
set tprop
[
ldm GetLabelTextProperty
]
...
...
Rendering/vtkLabeledDataMapper.cxx
View file @
547aa8fb
...
...
@@ -14,6 +14,8 @@
=========================================================================*/
#include
"vtkLabeledDataMapper.h"
#include
"vtkExecutive.h"
#include
"vtkInformation.h"
#include
"vtkActor2D.h"
#include
"vtkDataArray.h"
#include
"vtkDataSet.h"
...
...
@@ -22,10 +24,9 @@
#include
"vtkTextMapper.h"
#include
"vtkTextProperty.h"
vtkCxxRevisionMacro
(
vtkLabeledDataMapper
,
"1.
39
"
);
vtkCxxRevisionMacro
(
vtkLabeledDataMapper
,
"1.
40
"
);
vtkStandardNewMacro
(
vtkLabeledDataMapper
);
vtkCxxSetObjectMacro
(
vtkLabeledDataMapper
,
Input
,
vtkDataSet
);
vtkCxxSetObjectMacro
(
vtkLabeledDataMapper
,
LabelTextProperty
,
vtkTextProperty
);
//----------------------------------------------------------------------------
...
...
@@ -76,15 +77,33 @@ vtkLabeledDataMapper::~vtkLabeledDataMapper()
delete
[]
this
->
TextMappers
;
}
this
->
SetInput
(
NULL
);
this
->
SetLabelTextProperty
(
NULL
);
}
//----------------------------------------------------------------------------
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
void
vtkLabeledDataMapper
::
SetInput
(
vtkDataSet
*
input
)
{
if
(
input
)
{
this
->
SetInputConnection
(
0
,
input
->
GetProducerPort
());
}
else
{
// Setting a NULL input removes the connection.
this
->
SetInputConnection
(
0
,
0
);
}
}
//----------------------------------------------------------------------------
// Specify the input data or filter.
vtkDataSet
*
vtkLabeledDataMapper
::
GetInput
()
{
return
vtkDataSet
::
SafeDownCast
(
this
->
GetExecutive
()
->
GetInputData
(
0
,
0
));
}
//----------------------------------------------------------------------------
// Release any graphics resources that are being consumed by this mapper.
void
vtkLabeledDataMapper
::
ReleaseGraphicsResources
(
vtkWindow
*
win
)
{
if
(
this
->
TextMappers
!=
NULL
)
...
...
@@ -111,7 +130,7 @@ void vtkLabeledDataMapper::RenderOverlay(vtkViewport *viewport,
}
for
(
i
=
0
;
i
<
this
->
NumberOfLabels
;
i
++
)
{
this
->
I
nput
->
GetPoint
(
i
,
x
);
i
nput
->
GetPoint
(
i
,
x
);
actor
->
GetPositionCoordinate
()
->
SetCoordinateSystemToWorld
();
actor
->
GetPositionCoordinate
()
->
SetValue
(
x
);
this
->
TextMappers
[
i
]
->
RenderOverlay
(
viewport
,
actor
);
...
...
@@ -218,7 +237,7 @@ void vtkLabeledDataMapper::RenderOpaqueGeometry(vtkViewport *viewport,
return
;
}
this
->
NumberOfLabels
=
this
->
I
nput
->
GetNumberOfPoints
();
this
->
NumberOfLabels
=
i
nput
->
GetNumberOfPoints
();
if
(
this
->
NumberOfLabels
>
this
->
NumberOfLabelsAllocated
)
{
// delete old stuff
...
...
@@ -247,18 +266,21 @@ void vtkLabeledDataMapper::RenderOpaqueGeometry(vtkViewport *viewport,
{
if
(
numComp
==
1
)
{
if
(
data
->
GetDataType
()
==
VTK_CHAR
)
if
(
data
->
GetDataType
()
==
VTK_CHAR
)
{
if
(
strcmp
(
this
->
LabelFormat
,
"%c"
)
!=
0
)
{
if
(
strcmp
(
this
->
LabelFormat
,
"%c"
)
!=
0
)
{
vtkErrorMacro
(
<<
"Label format must be %c to use with char"
);
return
;
}
sprintf
(
string
,
this
->
LabelFormat
,
(
char
)
data
->
GetComponent
(
i
,
activeComp
));
}
else
{
sprintf
(
string
,
this
->
LabelFormat
,
data
->
GetComponent
(
i
,
activeComp
));
vtkErrorMacro
(
<<
"Label format must be %c to use with char"
);
return
;
}
sprintf
(
string
,
this
->
LabelFormat
,
(
char
)
data
->
GetComponent
(
i
,
activeComp
));
}
else
{
sprintf
(
string
,
this
->
LabelFormat
,
data
->
GetComponent
(
i
,
activeComp
));
}
}
else
{
...
...
@@ -282,13 +304,21 @@ void vtkLabeledDataMapper::RenderOpaqueGeometry(vtkViewport *viewport,
for
(
i
=
0
;
i
<
this
->
NumberOfLabels
;
i
++
)
{
this
->
I
nput
->
GetPoint
(
i
,
x
);
i
nput
->
GetPoint
(
i
,
x
);
actor
->
GetPositionCoordinate
()
->
SetCoordinateSystemToWorld
();
actor
->
GetPositionCoordinate
()
->
SetValue
(
x
);
this
->
TextMappers
[
i
]
->
RenderOpaqueGeometry
(
viewport
,
actor
);
}
}
//----------------------------------------------------------------------------
int
vtkLabeledDataMapper
::
FillInputPortInformation
(
int
vtkNotUsed
(
port
),
vtkInformation
*
info
)
{
info
->
Set
(
vtkAlgorithm
::
INPUT_REQUIRED_DATA_TYPE
(),
"vtkDataSet"
);
return
1
;
}
//----------------------------------------------------------------------------
void
vtkLabeledDataMapper
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
...
...
Rendering/vtkLabeledDataMapper.h
View file @
547aa8fb
...
...
@@ -94,9 +94,9 @@ public:
vtkGetMacro
(
FieldDataArray
,
int
);
// Description:
// Set the input dataset to the mapper.
// Set the input dataset to the mapper.
This mapper handles any type of data.
virtual
void
SetInput
(
vtkDataSet
*
);
vtk
GetObjectMacro
(
Input
,
vtkDataSet
);
vtk
DataSet
*
GetInput
(
);
// Description:
// Specify which data to plot: scalars, vectors, normals, texture coords,
...
...
@@ -125,8 +125,6 @@ public:
// Description:
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
virtual
void
ReleaseGraphicsResources
(
vtkWindow
*
);
protected:
...
...
@@ -148,6 +146,8 @@ private:
int
NumberOfLabelsAllocated
;
vtkTextMapper
**
TextMappers
;
virtual
int
FillInputPortInformation
(
int
,
vtkInformation
*
);
private:
vtkLabeledDataMapper
(
const
vtkLabeledDataMapper
&
);
// Not implemented.
void
operator
=
(
const
vtkLabeledDataMapper
&
);
// Not implemented.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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