Commit 2d44b2c9 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Testing many more features now

Change-Id: I20ef8a35b6c49d55eb1c483d324f2c3b5b759a17
parent 903358a9
......@@ -30,6 +30,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkStructuredGrid.h"
#include "vtkTextProperty.h"
#include "vtkCubeAxesActor.h"
......@@ -38,6 +39,8 @@ int TestCubeAxes2DMode( int argc, char * argv [] )
// Create plane source
vtkSmartPointer<vtkPlaneSource> plane
= vtkSmartPointer<vtkPlaneSource>::New();
plane->SetXResolution( 10 );
plane->SetYResolution( 10 );
// Create plane mapper
vtkSmartPointer<vtkPolyDataMapper> planeMapper
......@@ -65,19 +68,33 @@ int TestCubeAxes2DMode( int argc, char * argv [] )
// Create renderer
vtkSmartPointer<vtkRenderer> renderer
= vtkSmartPointer<vtkRenderer>::New();
renderer->SetBackground( .3, .6, .3 );
renderer->SetBackground( 1., 1., 1. );
renderer->GetActiveCamera()->SetFocalPoint( .0, .0, .0 );
renderer->GetActiveCamera()->SetPosition( .0, .0, 2.5 );
// Create cube axes actor
vtkSmartPointer<vtkCubeAxesActor> axes = vtkSmartPointer<vtkCubeAxesActor>::New();
axes->SetCamera ( renderer->GetActiveCamera() );
axes->SetBounds( -.5, .5, -.5, .5, 0., 0. );
axes->SetCornerOffset( .0 );
axes->SetXAxisVisibility( 1 );
axes->SetYAxisVisibility( 1 );
axes->SetZAxisVisibility( 0 );
//axes->SetUse2DMode(1);
axes->SetBounds( -.5, .5, .5, .5, 0., 0. );
// Desactivate LOD for all axes
axes->SetEnableDistanceLOD( 0 );
axes->SetEnableViewAngleLOD( 0 );
// Use red color for X axis
axes->GetXAxesLinesProperty()->SetColor( 1., 0., 0.);
axes->GetTitleTextProperty( 0 )->SetColor( 1., 0., 0.);
axes->GetLabelTextProperty( 0 )->SetColor( 1., 0., 0.);
// Use green color for Y axis
axes->GetYAxesLinesProperty()->SetColor( 0., 1., 0. );
axes->GetTitleTextProperty( 1 )->SetColor( 0., 1., 0. );
axes->GetLabelTextProperty( 1 )->SetColor( 0., 1., 0. );
// Add all actors to renderer
renderer->AddActor( planeActor );
......
......@@ -13,13 +13,6 @@
=========================================================================*/
// This example illustrates how one may explicitly specify the range of each
// axes that's used to define the prop, while displaying data with a different
// set of bounds (unlike cubeAxes2.tcl). This example allows you to separate
// the notion of extent of the axes in physical space (bounds) and the extent
// of the values it represents. In other words, you can have the ticks and
// labels show a different range.
#include "vtkBYUReader.h"
#include "vtkCamera.h"
#include "vtkCubeAxesActor.h"
......@@ -94,29 +87,29 @@ int TestCubeAxes3( int argc, char * argv [] )
normals->Update();
vtkNew<vtkCubeAxesActor> axes2;
axes2->SetBounds(normals->GetOutput()->GetBounds());
axes2->SetXAxisRange(20, 300);
axes2->SetYAxisRange(-0.01, 0.01);
axes2->SetCamera(ren2->GetActiveCamera());
axes2->SetXLabelFormat("%6.1f");
axes2->SetYLabelFormat("%6.1f");
axes2->SetZLabelFormat("%6.1f");
axes2->SetScreenSize(15.0);
axes2->SetFlyModeToClosestTriad();
axes2->SetCornerOffset(0.0);
vtkNew<vtkCubeAxesActor> axes;
axes->SetBounds( normals->GetOutput()->GetBounds() );
axes->SetXAxisRange( 20, 300 );
axes->SetYAxisRange( -.01, .01 );
axes->SetCamera(ren2->GetActiveCamera());
axes->SetXLabelFormat( "%6.1f" );
axes->SetYLabelFormat( "%6.1f" );
axes->SetZLabelFormat( "%6.1f" );
axes->SetScreenSize( 15. );
axes->SetFlyModeToClosestTriad();
axes->SetCornerOffset( .0 );
// Use red color for X axis
axes2->GetXAxesLinesProperty()->SetColor(1., 0., 0.);
axes2->GetTitleTextProperty(0)->SetColor(1., 0., 0.);
axes2->GetLabelTextProperty(0)->SetColor(.8, 0., 0.);
axes->GetXAxesLinesProperty()->SetColor( 1., 0., 0. );
axes->GetTitleTextProperty(0)->SetColor( 1., 0., 0. );
axes->GetLabelTextProperty(0)->SetColor( .8, 0., 0. );
// Use green color for Y axis
axes2->GetYAxesLinesProperty()->SetColor(0., 1., 0.);
axes2->GetTitleTextProperty(1)->SetColor(0., 1., 0.);
axes2->GetLabelTextProperty(1)->SetColor(0., .8, 0.);
axes->GetYAxesLinesProperty()->SetColor( 0., 1., 0. );
axes->GetTitleTextProperty(1)->SetColor( 0., 1., 0. );
axes->GetLabelTextProperty(1)->SetColor( 0., .8, 0. );
ren2->AddViewProp(axes2.GetPointer());
ren2->AddViewProp( axes.GetPointer()) ;
renWin->Render();
int retVal = vtkRegressionTestImage( renWin.GetPointer() );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment