[vtkusers] vtkCaptionActor2D text appears chopped
Roberto Garrido
rgarrido at emedica.es
Thu Feb 7 09:37:59 EST 2013
Hi,
We have added a vtkCaptionActor2D to our scene, but the text appears
chopped, and we don't know why.
A simple and compilable example that shows the output text chopped is sent
attached. Also, an screenshot at the bottom.
Could anyone try to reproduce the error?
Thanks in advance.
My best,
Robert.
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>
#include <vtkCaptionWidget.h>
#include <vtkCaptionRepresentation.h>
#include <vtkCaptionActor2D.h>
#include <vtkTextActor.h>
#include <vtkTextProperty.h>
#include <sstream>
int main(int, char *[])
{
// A renderer and render window
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
// An interactor
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
// Draw text with diameter measure
std::stringstream stream;
int id = 2;
stream << "(" << id << ") " << std::fixed << std::setprecision(2) <<
2.2666;
vtkSmartPointer<vtkCaptionActor2D> sectionTextActor =
vtkCaptionActor2D::New();
sectionTextActor->SetAttachmentPoint( 0, 0, 0 );
sectionTextActor->SetCaption( stream.str().c_str() );
sectionTextActor->BorderOff();
sectionTextActor->LeaderOff();
sectionTextActor->SetPadding(0);
sectionTextActor->GetCaptionTextProperty()->SetJustificationToLeft();
sectionTextActor->GetCaptionTextProperty()->ShadowOff();
sectionTextActor->GetCaptionTextProperty()->ItalicOff();
sectionTextActor->GetCaptionTextProperty()->SetFontFamilyToCourier();
sectionTextActor->GetCaptionTextProperty()->SetFontSize( 24 );
sectionTextActor->GetTextActor()->SetTextScaleModeToNone();
renderer->AddActor2D( sectionTextActor );
renderer->SetBackground(1,0,0);
renderWindow->Render();
// Begin mouse interaction
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130207/5d6af33d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 10822 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130207/5d6af33d/attachment.png>
More information about the vtkusers
mailing list