Commit f51bde8f authored by Haocheng LIU's avatar Haocheng LIU Committed by Kitware Robot

Merge topic '0015270-vtkGlyph3DMapper_GetBounds-wrong'

82021e42 VTK Bug15270: Correct empty condition for vtkGlyph3DMapper
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Reviewed-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !1729
parents d202b6bb 82021e42
Pipeline #25778 failed with stage
in 0 seconds
......@@ -37,6 +37,7 @@ vtk_add_test_cxx(${vtk-module}CxxTests tests
TestEdgeFlags.cxx
TestFollowerPicking.cxx
TestGlyph3DMapper.cxx
TestGlyph3DMapper2.cxx,NO_VALID,NO_RT,NO_DATA
TestGlyph3DMapperArrow.cxx
TestGlyph3DMapperMasking.cxx
TestGlyph3DMapperOrientationArray.cxx
......
/*=========================================================================
Program: Visualization Toolkit
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.
=========================================================================*/
// Test case of empty input for vtkGlyph3DMapper. Refer to MR!1529.
#include "vtkTestUtilities.h"
#include "vtkRegressionTestImage.h"
#include <vtkMath.h>
#include <vtkSmartPointer.h>
#include <vtkCubeSource.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkGlyph3DMapper.h>
int TestGlyph3DMapper2(int vtkNotUsed(argc), char *vtkNotUsed(argv)[])
{
// create empty input data
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkCubeSource> cubeSource =
vtkSmartPointer<vtkCubeSource>::New();
vtkSmartPointer<vtkGlyph3DMapper> glyph3Dmapper =
vtkSmartPointer<vtkGlyph3DMapper>::New();
glyph3Dmapper->SetSourceConnection(cubeSource->GetOutputPort());
glyph3Dmapper->SetInputData(polydata);
glyph3Dmapper->Update();
double *boundsResult, boundsAnswer[6];
vtkMath::UninitializeBounds(boundsAnswer);
// since there is nothing inside the scene, the boundsResult should be an
// uninitializeBounds
boundsResult = glyph3Dmapper->GetBounds();
for (int i = 0; i < 6; ++i)
{
if (boundsResult[i] != boundsAnswer[i]) return -1;
}
return 0;
}
......@@ -442,7 +442,12 @@ bool vtkGlyph3DMapper::GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6])
}
ds->GetBounds(ds_bounds);
// if there is nothing inside the scene, just return uninitializedBounds
if ((ds_bounds[0] > ds_bounds[1]) && (ds_bounds[2] > ds_bounds[3]) && \
(ds_bounds[4] > ds_bounds[5]))
{
return false;
}
// if the input is not conform to what the mapper expects (use vector
// but no vector data), nothing will be mapped.
// It make sense to return uninitialized bounds.
......
Markdown is supported
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