[vtkusers] How to rotate the entire output of vtkDynamic2DLabelMapper ?

rakesh patil prakeshofficial at gmail.com
Tue Mar 13 07:39:50 EDT 2012


Hello,

I am displaying multiple lines. Each line has its own depth value.
Displaying line is working fine. I also have to display depth values on
these lines. In order to do this, I am using

vtkDynamic2DLabelMapper

Object. I am able to produce the output with the following code

bathyValueMapper = vtkDynamic2DMapper::New();
bathyValueMapper ->SetLabelFormat("%-#6.3g");
bathyValueMapper ->SetInputConnection(
this->translateFilter->GetOutputPort());
bathyValueMapper ->SetLabelModeToLabelScalars();

labelActor = vtkActor2D::New();
labelActor->SetMapper(bathyValueMapper);


Now there is a case where a terrain is translated and rotated, in which
case the lines indicating depths also should be translated and rotated. (
that's the reason why translateFilter's output is set as input in above
piece of code)

The code to display polylines is

vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(this->translateFilter->GetOutputPort());

bathyActor = vtkActor::New();
bathyActor->SetMapper(mapper);

Since the translation part is done above using translateFilter, the
rotation is done as

bathyActor->SetOrigin(rot_point[0], rot_point[1], 0);
bathyActor->RotateZ(rotAngle);

When I do this, the lines are translated and rotated correcly. But the
depth values are only translated(as input is coming from translate filter),
but not rotated.

I tried using the following code too

vtkTransform *rotateTransform = vtkTransform::New();
rotateTransform->RotateZ(rot_angle);

bathyValueMapper ->SetTransform(m_rotateTransform);

Even with this code, the output is same, i.e. lines are translated and
rotated, but labels are only translated but not rotated. What can I do to
display depth values rotated?

I want the output as shown in the attached file. The orientation of the
labels must be same as that of the lines. Right now they are mismatching.

Thanks in advance

Regards
Rakesh Patil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120313/4b6afa6c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screensht1.PNG
Type: image/png
Size: 55622 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120313/4b6afa6c/attachment.png>


More information about the vtkusers mailing list