Commit fd04b442 authored by Andrew Bauer's avatar Andrew Bauer

Improvements for vtkNew for stl containers and comparison operations

Adding in functionality to allow inserting vtkNew objects into
stl containers of vtkSmartPointer objects as well as comparisons
between vtkNew objects and raw pointers. Also removing Get() and
GetPointer() calls from vtkNew objects since in most instances we
can just pass in the vtkNew<> object instead of having to use the
Get() or GetPointer() methods to get the raw pointer.
parent 459017a8
......@@ -43,21 +43,21 @@ int TestVTKMCleanGrid(int argc, char *argv[])
mapper->SetScalarRange(37, 277);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
actor->SetMapper(mapper);
vtkNew<vtkRenderer> renderer;
renderer->AddActor(actor.GetPointer());
renderer->AddActor(actor);
renderer->ResetCamera();
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer(renderer.GetPointer());
renWin->AddRenderer(renderer);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
iren->SetRenderWindow(renWin);
iren->Initialize();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -51,7 +51,7 @@ void GenerateScalars(DataSetT *dataset, bool negate)
scalars->SetTypedComponent(i, 0, (negate ?-point[0] - point[1]
: point[0] + point[1]));
}
dataset->GetPointData()->SetScalars(scalars.Get());
dataset->GetPointData()->SetScalars(scalars);
}
} // end anon namespace
......@@ -86,10 +86,10 @@ int TestVTKMClip(int, char*[])
sphereMapper->SetScalarRange(0, 1);
vtkNew<vtkActor> sphereActor;
sphereActor->SetMapper(sphereMapper.Get());
sphereActor->SetMapper(sphereMapper);
sphereActor->SetPosition(0.5, 0.5, 0.);
sphereActor->RotateWXYZ(90., 0., 0., 1.);
renderer->AddActor(sphereActor.Get());
renderer->AddActor(sphereActor);
// Second input is an unstructured grid with 3D cells. This should produce an
// unstructured grid output from vtkmClip.
......@@ -124,9 +124,9 @@ int TestVTKMClip(int, char*[])
tetMapper->SetScalarRange(0, 10);
vtkNew<vtkActor> tetActor;
tetActor->SetMapper(tetMapper.Get());
tetActor->SetMapper(tetMapper);
tetActor->SetScale(1. / 5.);
renderer->AddActor(tetActor.Get());
renderer->AddActor(tetActor);
// Third dataset tests imagedata. This should produce an unstructured grid:
vtkImageData *image = imageSource->GetOutput();
......@@ -148,16 +148,16 @@ int TestVTKMClip(int, char*[])
imageMapper->SetScalarRange(0, 10);
vtkNew<vtkActor> imageActor;
imageActor->SetMapper(imageMapper.Get());
imageActor->SetMapper(imageMapper);
imageActor->SetScale(1. / 5.);
imageActor->SetPosition(1.0, 1.0, 0.);
renderer->AddActor(imageActor.Get());
renderer->AddActor(imageActor);
vtkNew<vtkRenderWindowInteractor> iren;
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
iren->SetRenderWindow(renWin.Get());
renWin->AddRenderer(renderer.Get());
iren->SetRenderWindow(renWin);
renWin->AddRenderer(renderer);
renWin->SetSize(500,500);
renderer->GetActiveCamera()->SetPosition(0,0,1);
......
......@@ -40,7 +40,7 @@ int TestVTKMClipWithImplicitFunction(int argc, char* argv[])
sphere->SetRadius(10);
vtkNew<vtkmClip> clip;
clip->SetInputConnection(wavelet->GetOutputPort());
clip->SetClipFunction(sphere.GetPointer());
clip->SetClipFunction(sphere);
vtkNew<vtkDataSetSurfaceFilter> surface;
surface->SetInputConnection(clip->GetOutputPort());
......@@ -50,21 +50,21 @@ int TestVTKMClipWithImplicitFunction(int argc, char* argv[])
mapper->SetScalarRange(37, 150);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
actor->SetMapper(mapper);
vtkNew<vtkRenderer> renderer;
renderer->AddActor(actor.GetPointer());
renderer->AddActor(actor);
renderer->ResetCamera();
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer(renderer.GetPointer());
renWin->AddRenderer(renderer);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
iren->SetRenderWindow(renWin);
iren->Initialize();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -78,7 +78,7 @@ int TestVTKMExternalFaces(int argc, char* argv[])
cylinder->SetAxis(0, 1, 0);
vtkNew<vtkTableBasedClipDataSet> clipCyl;
clipCyl->SetInputConnection(wavelet->GetOutputPort());
clipCyl->SetClipFunction(cylinder.GetPointer());
clipCyl->SetClipFunction(cylinder);
clipCyl->InsideOutOn();
vtkNew<vtkSphere> sphere;
......@@ -86,13 +86,13 @@ int TestVTKMExternalFaces(int argc, char* argv[])
sphere->SetRadius(12);
vtkNew<vtkTableBasedClipDataSet> clipSphr;
clipSphr->SetInputConnection(clipCyl->GetOutputPort());
clipSphr->SetClipFunction(sphere.GetPointer());
clipSphr->SetClipFunction(sphere);
vtkNew<vtkTransform> transform;
transform->RotateZ(45);
vtkNew<vtkTransformFilter> transFilter;
transFilter->SetInputConnection(clipSphr->GetOutputPort());
transFilter->SetTransform(transform.GetPointer());
transFilter->SetTransform(transform);
vtkNew<vtkRandomAttributeGenerator> cellDataAdder;
cellDataAdder->SetInputConnection(transFilter->GetOutputPort());
......@@ -130,7 +130,7 @@ int TestVTKMExternalFaces(int argc, char* argv[])
}
vtkNew<vtkPolyData> polydata;
if (!Convert2DUnstructuredGridToPolyData(result, polydata.GetPointer()))
if (!Convert2DUnstructuredGridToPolyData(result, polydata))
{
std::cout << "Error converting result to polydata\n";
return 1;
......@@ -142,25 +142,25 @@ int TestVTKMExternalFaces(int argc, char* argv[])
polydata->GetPointData()->GetArray("RTData")->GetRange(scalarRange);
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputData(polydata.GetPointer());
mapper->SetInputData(polydata);
mapper->SetScalarRange(scalarRange);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
actor->SetMapper(mapper);
vtkNew<vtkRenderer> renderer;
renderer->AddActor(actor.GetPointer());
renderer->AddActor(actor);
renderer->ResetCamera();
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer(renderer.GetPointer());
renWin->AddRenderer(renderer);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
iren->SetRenderWindow(renWin);
iren->Initialize();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -38,7 +38,7 @@ int TestVTKMExtractVOI(int argc, char* argv[])
sphereMapper->ImmediateModeRenderingOn();
vtkNew<vtkActor> sphereActor;
sphereActor->SetMapper(sphereMapper.GetPointer());
sphereActor->SetMapper(sphereMapper);
vtkNew<vtkRTAnalyticSource> rt;
rt->SetWholeExtent(-50, 50, -50, 50, 0, 0);
......@@ -61,22 +61,22 @@ int TestVTKMExtractVOI(int argc, char* argv[])
mapper->SetScalarRange(130, 280);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
actor->SetMapper(mapper);
vtkNew<vtkRenderer> renderer;
renderer->AddActor(actor.GetPointer());
renderer->AddActor(sphereActor.GetPointer());
renderer->AddActor(actor);
renderer->AddActor(sphereActor);
renderer->ResetCamera();
vtkNew<vtkRenderWindow> renWin;
renWin->AddRenderer(renderer.GetPointer());
renWin->AddRenderer(renderer);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
iren->SetRenderWindow(renWin);
iren->Initialize();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -41,8 +41,8 @@ int TestVTKMLevelOfDetail(int argc, char *argv[])
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderWindowInteractor> iren;
renWin->AddRenderer(ren.GetPointer());
iren->SetRenderWindow(renWin.GetPointer());
renWin->AddRenderer(ren);
iren->SetRenderWindow(renWin);
//---------------------------------------------------
// Load file and make only triangles
......@@ -80,10 +80,10 @@ int TestVTKMLevelOfDetail(int argc, char *argv[])
mappers[i]->SetInputConnection(surfaces[i]->GetOutputPort());
actors[i]->SetMapper(mappers[i].GetPointer());
actors[i]->SetMapper(mappers[i]);
actors[i]->SetPosition( i * 10, 0, 0);
ren->AddActor(actors[i].GetPointer());
ren->AddActor(actors[i]);
}
ren->SetBackground(0.1, 0.2, 0.4);
......@@ -93,7 +93,7 @@ int TestVTKMLevelOfDetail(int argc, char *argv[])
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -37,8 +37,8 @@ int RunVTKPipeline(T *t, int argc, char* argv[])
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderWindowInteractor> iren;
renWin->AddRenderer(ren.GetPointer());
iren->SetRenderWindow(renWin.GetPointer());
renWin->AddRenderer(ren);
iren->SetRenderWindow(renWin);
vtkNew<vtkmContour> cubes;
......@@ -58,13 +58,13 @@ int RunVTKPipeline(T *t, int argc, char* argv[])
mapper->SetScalarRange(0.0, 1.0);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
actor->SetMapper(mapper);
ren->AddActor(actor.GetPointer());
ren->AddActor(actor);
ren->ResetCamera();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
int retVal = vtkRegressionTestImage(renWin);
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
......
......@@ -35,8 +35,8 @@ int TestVTKMMarchingCubes2(int argc, char* argv[])