Commit bbf78267 authored by Philippe Pebay's avatar Philippe Pebay Committed by Kitware Robot
Browse files

Merge topic 'FixBugsInAxes'

b64837b0 Testing all gridlines together with axis lines of various colors
c7652d88 Fixed subtle buggy combination of axis and outer grid lines visibility
90f91f66 A new set of tests to independently test gridline options
parents 25123124 b64837b0
......@@ -10,6 +10,9 @@ IF (VTK_DATA_ROOT)
# TestAxisActor3D.cxx
TestCubeAxes3.cxx
TestCubeAxesWithGridLines.cxx
TestCubeAxesWithXLines.cxx
TestCubeAxesWithYLines.cxx
TestCubeAxesWithZLines.cxx
TestCubeAxesWithXInnerGrids.cxx
TestCubeAxesWithYInnerGrids.cxx
TestCubeAxesWithZInnerGrids.cxx
......
......@@ -82,7 +82,7 @@ int TestCubeAxes3( int argc, char * argv [] )
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
renWin->AddRenderer(ren2.GetPointer());
renWin->SetWindowName("VTK - Cube Axes custom range");
renWin->SetWindowName("Cube Axes");
renWin->SetSize(600, 600);
vtkNew<vtkRenderWindowInteractor> iren;
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestCubeAxes3.cxx
Module: TestCubeAxesWithGridlines.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
......@@ -109,21 +109,26 @@ int TestCubeAxesWithGridLines( int argc, char * argv [] )
axes2->SetDrawYGridlines(1);
axes2->SetDrawZGridlines(1);
// Use red color for X gridlines, title, and labels
axes2->GetXAxesGridlinesProperty()->SetColor(1., 0., 0.);
// Use red color for X axis
axes2->GetXAxesLinesProperty()->SetColor(1., 0., 0.);
axes2->GetTitleTextProperty(0)->SetColor(1., 0., 0.);
axes2->GetLabelTextProperty(0)->SetColor(1., 0., 0.);
// Use green color for Y gridlines, title, and labels
axes2->GetYAxesGridlinesProperty()->SetColor(0., 1., 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., 1., 0.);
// Use blue color for Z gridlines, title, and labels
axes2->GetZAxesGridlinesProperty()->SetColor(0., 0., 1.);
// Use blue color for Z axis
axes2->GetZAxesLinesProperty()->SetColor(0., 0., 1.);
axes2->GetTitleTextProperty(2)->SetColor(0., 0., 1.);
axes2->GetLabelTextProperty(2)->SetColor(0., 0., 1.);
// Use olive color for gridlines
axes2->GetXAxesGridlinesProperty()->SetColor(.23, .37, .17);
axes2->GetYAxesGridlinesProperty()->SetColor(.23, .37, .17);
axes2->GetZAxesGridlinesProperty()->SetColor(.23, .37, .17);
ren2->AddViewProp(axes2.GetPointer());
renWin->Render();
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestCubeWithXLines.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.
=========================================================================*/
// .SECTION Thanks
// This test was written by Philippe Pebay, Kitware SAS 2011
#include "vtkBYUReader.h"
#include "vtkCamera.h"
#include "vtkCubeAxesActor.h"
#include "vtkLight.h"
#include "vtkLODActor.h"
#include "vtkNew.h"
#include "vtkOutlineFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkPolyDataNormals.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkTestUtilities.h"
#include "vtkTextProperty.h"
//----------------------------------------------------------------------------
int TestCubeAxesWithXLines( int argc, char * argv [] )
{
vtkNew<vtkBYUReader> fohe;
char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/teapot.g");
fohe->SetGeometryFileName(fname);
delete [] fname;
vtkNew<vtkPolyDataNormals> normals;
normals->SetInputConnection(fohe->GetOutputPort());
vtkNew<vtkPolyDataMapper> foheMapper;
foheMapper->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkLODActor> foheActor;
foheActor->SetMapper(foheMapper.GetPointer());
foheActor->GetProperty()->SetDiffuseColor(0.7, 0.3, 0.0);
vtkNew<vtkOutlineFilter> outline;
outline->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkPolyDataMapper> mapOutline;
mapOutline->SetInputConnection(outline->GetOutputPort());
vtkNew<vtkActor> outlineActor;
outlineActor->SetMapper(mapOutline.GetPointer());
outlineActor->GetProperty()->SetColor(0.0 ,0.0 ,0.0);
vtkNew<vtkCamera> camera;
camera->SetClippingRange(1.0, 100.0);
camera->SetFocalPoint(0.9, 1.0, 0.0);
camera->SetPosition(11.63, 6.0, 10.77);
vtkNew<vtkLight> light;
light->SetFocalPoint(0.21406, 1.5, 0.0);
light->SetPosition(8.3761, 4.94858, 4.12505);
vtkNew<vtkRenderer> ren2;
ren2->SetActiveCamera(camera.GetPointer());
ren2->AddLight(light.GetPointer());
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
renWin->AddRenderer(ren2.GetPointer());
renWin->SetWindowName("Cube Axes with Outer X Grid Lines");
renWin->SetSize(600, 600);
renWin->SetMultiSamples(0);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
ren2->AddViewProp(foheActor.GetPointer());
ren2->AddViewProp(outlineActor.GetPointer());
ren2->SetGradientBackground( true );
ren2->SetBackground(.1,.1,.1);
ren2->SetBackground2(.8,.8,.8);
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);
// Draw X (outer) grid lines
axes2->SetDrawXGridlines(1);
// Use red color for X axis lines, gridlines, title, and labels
axes2->GetTitleTextProperty(0)->SetColor(1., 0., 0.);
axes2->GetLabelTextProperty(0)->SetColor(1., 0., 0.);
axes2->GetXAxesLinesProperty()->SetColor(1., 0., 0.);
axes2->GetXAxesGridlinesProperty()->SetColor(1., 0., 0.);
ren2->AddViewProp(axes2.GetPointer());
renWin->Render();
int retVal = vtkRegressionTestImage( renWin.GetPointer() );
if ( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
return !retVal;
}
/*=========================================================================
Program: Visualization Toolkit
Module: TestCubeWithYLines.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.
=========================================================================*/
// .SECTION Thanks
// This test was written by Philippe Pebay, Kitware SAS 2011
#include "vtkBYUReader.h"
#include "vtkCamera.h"
#include "vtkCubeAxesActor.h"
#include "vtkLight.h"
#include "vtkLODActor.h"
#include "vtkNew.h"
#include "vtkOutlineFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkPolyDataNormals.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkTestUtilities.h"
#include "vtkTextProperty.h"
//----------------------------------------------------------------------------
int TestCubeAxesWithYLines( int argc, char * argv [] )
{
vtkNew<vtkBYUReader> fohe;
char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/teapot.g");
fohe->SetGeometryFileName(fname);
delete [] fname;
vtkNew<vtkPolyDataNormals> normals;
normals->SetInputConnection(fohe->GetOutputPort());
vtkNew<vtkPolyDataMapper> foheMapper;
foheMapper->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkLODActor> foheActor;
foheActor->SetMapper(foheMapper.GetPointer());
foheActor->GetProperty()->SetDiffuseColor(0.7, 0.3, 0.0);
vtkNew<vtkOutlineFilter> outline;
outline->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkPolyDataMapper> mapOutline;
mapOutline->SetInputConnection(outline->GetOutputPort());
vtkNew<vtkActor> outlineActor;
outlineActor->SetMapper(mapOutline.GetPointer());
outlineActor->GetProperty()->SetColor(0.0 ,0.0 ,0.0);
vtkNew<vtkCamera> camera;
camera->SetClippingRange(1.0, 100.0);
camera->SetFocalPoint(0.9, 1.0, 0.0);
camera->SetPosition(11.63, 6.0, 10.77);
vtkNew<vtkLight> light;
light->SetFocalPoint(0.21406, 1.5, 0.0);
light->SetPosition(8.3761, 4.94858, 4.12505);
vtkNew<vtkRenderer> ren2;
ren2->SetActiveCamera(camera.GetPointer());
ren2->AddLight(light.GetPointer());
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
renWin->AddRenderer(ren2.GetPointer());
renWin->SetWindowName("Cube Axes with Outer Y Grid Lines");
renWin->SetSize(600, 600);
renWin->SetMultiSamples(0);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
ren2->AddViewProp(foheActor.GetPointer());
ren2->AddViewProp(outlineActor.GetPointer());
ren2->SetGradientBackground( true );
ren2->SetBackground(.1,.1,.1);
ren2->SetBackground2(.8,.8,.8);
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);
// Draw YY(outer) grid lines
axes2->SetDrawYGridlines(1);
// Use green color for Y axis lines, gridlines, title, and labels
axes2->GetTitleTextProperty(1)->SetColor(0., 1., 0.);
axes2->GetLabelTextProperty(1)->SetColor(0., 1., 0.);
axes2->GetYAxesLinesProperty()->SetColor(0., 1., 0.);
axes2->GetYAxesGridlinesProperty()->SetColor(0., 1., 0.);
ren2->AddViewProp(axes2.GetPointer());
renWin->Render();
int retVal = vtkRegressionTestImage( renWin.GetPointer() );
if ( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
return !retVal;
}
/*=========================================================================
Program: Visualization Toolkit
Module: TestCubeWithZLines.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.
=========================================================================*/
// .SECTION Thanks
// This test was written by Philippe Pebay, Kitware SAS 2011
#include "vtkBYUReader.h"
#include "vtkCamera.h"
#include "vtkCubeAxesActor.h"
#include "vtkLight.h"
#include "vtkLODActor.h"
#include "vtkNew.h"
#include "vtkOutlineFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkPolyDataNormals.h"
#include "vtkProperty.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkTestUtilities.h"
#include "vtkTextProperty.h"
//----------------------------------------------------------------------------
int TestCubeAxesWithZLines( int argc, char * argv [] )
{
vtkNew<vtkBYUReader> fohe;
char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/teapot.g");
fohe->SetGeometryFileName(fname);
delete [] fname;
vtkNew<vtkPolyDataNormals> normals;
normals->SetInputConnection(fohe->GetOutputPort());
vtkNew<vtkPolyDataMapper> foheMapper;
foheMapper->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkLODActor> foheActor;
foheActor->SetMapper(foheMapper.GetPointer());
foheActor->GetProperty()->SetDiffuseColor(0.7, 0.3, 0.0);
vtkNew<vtkOutlineFilter> outline;
outline->SetInputConnection(normals->GetOutputPort());
vtkNew<vtkPolyDataMapper> mapOutline;
mapOutline->SetInputConnection(outline->GetOutputPort());
vtkNew<vtkActor> outlineActor;
outlineActor->SetMapper(mapOutline.GetPointer());
outlineActor->GetProperty()->SetColor(0.0 ,0.0 ,0.0);
vtkNew<vtkCamera> camera;
camera->SetClippingRange(1.0, 100.0);
camera->SetFocalPoint(0.9, 1.0, 0.0);
camera->SetPosition(11.63, 6.0, 10.77);
vtkNew<vtkLight> light;
light->SetFocalPoint(0.21406, 1.5, 0.0);
light->SetPosition(8.3761, 4.94858, 4.12505);
vtkNew<vtkRenderer> ren2;
ren2->SetActiveCamera(camera.GetPointer());
ren2->AddLight(light.GetPointer());
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
renWin->AddRenderer(ren2.GetPointer());
renWin->SetWindowName("Cube Axes with Z Outer Grid Lines");
renWin->SetSize(600, 600);
renWin->SetMultiSamples(0);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
ren2->AddViewProp(foheActor.GetPointer());
ren2->AddViewProp(outlineActor.GetPointer());
ren2->SetGradientBackground( true );
ren2->SetBackground(.1,.1,.1);
ren2->SetBackground2(.8,.8,.8);
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);
// Draw Z (outer) grid lines
axes2->SetDrawZGridlines(1);
// Use bluee color for Z axis lines, gridlines, title, and labels
axes2->GetTitleTextProperty(2)->SetColor(0., 0., 1.);
axes2->GetLabelTextProperty(2)->SetColor(0., 0., 1.);
axes2->GetZAxesLinesProperty()->SetColor(0., 0., 1.);
axes2->GetZAxesGridlinesProperty()->SetColor(0., 0., 1.);
ren2->AddViewProp(axes2.GetPointer());
renWin->Render();
int retVal = vtkRegressionTestImage( renWin.GetPointer() );
if ( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
return !retVal;
}
......@@ -1791,6 +1791,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesX[1] = 2;
this->NumberOfAxesX = 2;
this->XAxes[RenderAxesX[1]]->SetAxisVisibility(0);
this->XAxes[RenderAxesX[1]]->SetTickVisibility(0);
this->XAxes[RenderAxesX[1]]->SetLabelVisibility(0);
this->XAxes[RenderAxesX[1]]->SetTitleVisibility(0);
......@@ -1804,6 +1805,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesY[1] = 2;
this->NumberOfAxesY = 2;
this->YAxes[RenderAxesY[1]]->SetAxisVisibility(0);
this->YAxes[RenderAxesY[1]]->SetTickVisibility(0);
this->YAxes[RenderAxesY[1]]->SetLabelVisibility(0);
this->YAxes[RenderAxesY[1]]->SetTitleVisibility(0);
......@@ -1817,6 +1819,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesZ[1] = 2;
this->NumberOfAxesZ = 2;
this->ZAxes[RenderAxesZ[1]]->SetAxisVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetTickVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetLabelVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetTitleVisibility(0);
......@@ -2004,6 +2007,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesX[1] = (xloc + 2) % NUMBER_OF_ALIGNED_AXIS;
this->NumberOfAxesX = 2;
this->XAxes[RenderAxesX[1]]->SetAxisVisibility(0);
this->XAxes[RenderAxesX[1]]->SetTickVisibility(0);
this->XAxes[RenderAxesX[1]]->SetLabelVisibility(0);
this->XAxes[RenderAxesX[1]]->SetTitleVisibility(0);
......@@ -2019,6 +2023,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesY[1] = (yloc + 2) % NUMBER_OF_ALIGNED_AXIS;
this->NumberOfAxesY = 2;
this->YAxes[RenderAxesY[1]]->SetAxisVisibility(0);
this->YAxes[RenderAxesY[1]]->SetTickVisibility(0);
this->YAxes[RenderAxesY[1]]->SetLabelVisibility(0);
this->YAxes[RenderAxesY[1]]->SetTitleVisibility(0);
......@@ -2034,6 +2039,7 @@ void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport *viewport)
{
this->RenderAxesZ[1] = (zloc + 2) % NUMBER_OF_ALIGNED_AXIS;
this->NumberOfAxesZ = 2;
this->ZAxes[RenderAxesX[1]]->SetAxisVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetTickVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetLabelVisibility(0);
this->ZAxes[RenderAxesZ[1]]->SetTitleVisibility(0);
......
......@@ -45,7 +45,7 @@ All rights reserve
// This class was written by:
// Hank Childs, Kathleen Bonnell, Amy Squillacote, Brad Whitlock,
// Eric Brugger, Claire Guilbaud, Nicolas Dolegieviez, Will Schroeder,
// Aashish Chaudhary, Philippe Pébay, David Gobbi, David Partyka, Utkarsh Ayachit
// Aashish Chaudhary, Philippe Pebay, David Gobbi, David Partyka, Utkarsh Ayachit
// David Cole, François Bertel, and Mark Olesen
//
//
......
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