/*========================================================================= Program: Visualization Toolkit Module: TestAxesTransformWidget.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // // This example tests the vtkCaptionWidget. // First include the required header files for the VTK classes we are using. #include "vtkActor.h" #include "vtkAxesTransformRepresentation.h" #include "vtkAxesTransformWidget.h" #include "vtkCommand.h" #include "vtkDebugLeaks.h" #include "vtkInteractorEventRecorder.h" #include "vtkPolyDataMapper.h" #include "vtkRegressionTestImage.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" #include "vtkSmartPointer.h" #include "vtkSphereSource.h" #include "vtkTextActor.h" #include "vtkTextProperty.h" const char eventLog[] = "o"; int TestAxesTransformWidget(int, char*[]) { // Create the RenderWindow, Renderer and both Actors // vtkSmartPointer ren1 = vtkSmartPointer::New(); vtkSmartPointer renWin = vtkSmartPointer::New(); renWin->AddRenderer(ren1); vtkSmartPointer iren = vtkSmartPointer::New(); iren->SetRenderWindow(renWin); // Create a test pipeline // vtkSmartPointer ss = vtkSmartPointer::New(); ss->SetCenter(100, 250, 500); ss->Update(); vtkSmartPointer mapper = vtkSmartPointer::New(); mapper->SetInputConnection(ss->GetOutputPort()); vtkSmartPointer actor = vtkSmartPointer::New(); actor->SetMapper(mapper); // Create the widget vtkSmartPointer rep = vtkSmartPointer::New(); vtkSmartPointer widget = vtkSmartPointer::New(); widget->SetInteractor(iren); widget->SetRepresentation(rep); // Print the widget and its representation rep->Print(cout); widget->Print(cout); // Add the actors to the renderer, set the background and size // ren1->AddActor(actor); ren1->SetBackground(0.1, 0.2, 0.4); renWin->SetSize(300, 300); // record events vtkSmartPointer recorder = vtkSmartPointer::New(); recorder->SetInteractor(iren); #ifdef RECORD recorder->SetFileName("record.log"); recorder->On(); recorder->Record(); #else recorder->ReadFromInputStringOn(); recorder->SetInputString(eventLog); #endif // render the image // iren->Initialize(); renWin->Render(); widget->On(); renWin->Render(); #ifndef RECORD recorder->Play(); recorder->Off(); #endif iren->Start(); return EXIT_SUCCESS; }