Commit 367d1504 authored by Will Schroeder's avatar Will Schroeder
Browse files

BUG: Fixed warnings; activate new classes and tests by checking in...

BUG: Fixed warnings; activate new classes and tests by checking in CMakeLists.txt files; renamed vtkMeasureWidget (and kin) to vtkDistanceWidget
parent 89d18141
......@@ -37,6 +37,7 @@ vtkConnectivityFilter.cxx
vtkContourFilter.cxx
vtkContourGrid.cxx
vtkCubeSource.cxx
vtkCursor2D.cxx
vtkCursor3D.cxx
vtkCutter.cxx
vtkCurvatures.cxx
......
......@@ -215,6 +215,7 @@ IF (VTK_USE_RENDERING AND VTK_USE_DISPLAY)
constrainedDelaunay
contourCells
contoursToSurface
cursor2D
cutLoop
Delaunay2D
Delaunay2DAlpha
......
......@@ -69,6 +69,7 @@ vtkInteractorStyleUser.cxx
vtkLODActor.cxx
vtkLODProp3D.cxx
vtkLabeledDataMapper.cxx
vtkLeaderActor2D.cxx
vtkLight.cxx
vtkLightCollection.cxx
vtkLightKit.cxx
......
......@@ -19,6 +19,7 @@ IF (VTK_USE_RENDERING AND VTK_USE_DISPLAY)
rotations
ScalarBar
TestFlyTo
TestLeaderActor2D
TestOnePoint
TestParallelCoordinates
TestStyleTerrain
......
......@@ -25,7 +25,7 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkLeaderActor2D, "1.2");
vtkCxxRevisionMacro(vtkLeaderActor2D, "1.3");
vtkStandardNewMacro(vtkLeaderActor2D);
vtkCxxSetObjectMacro(vtkLeaderActor2D,LabelTextProperty,vtkTextProperty);
......@@ -694,11 +694,26 @@ void vtkLeaderActor2D::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Auto Label: " << (this->AutoLabel ? "On\n" : "Off\n");
os << indent << "Label Format: " << this->LabelFormat << "\n";
os << indent << "Arrow Style: ";
if ( this->ArrowStyle == VTK_ARROW_FILLED )
{
os << "Filled\n";
}
else if ( this->ArrowStyle == VTK_ARROW_OPEN )
{
os << "Open\n";
}
else // if ( this->ArrowStyle == VTK_ARROW_HOLLOW )
{
os << "Hollow\n";
}
os << indent << "Arrow Length: " << this->ArrowLength << "\n";
os << indent << "Arrow Width: " << this->ArrowWidth << "\n";
os << indent << "Minimum Arrow Size: " << this->MinimumArrowSize << "\n";
os << indent << "Maximum Arrow Size: " << this->MaximumArrowSize << "\n";
os << indent << "Arrow Style: ";
os << indent << "Arrow Placement: ";
if ( this->ArrowPlacement == VTK_ARROW_NONE )
{
os << "No Arrows\n";
......
......@@ -8,24 +8,80 @@ SET(KIT_LIBS vtkRendering vtkHybrid)
SET ( Kit_SRCS
vtk3DWidget.cxx
vtkAbstractWidget.cxx
vtkAffineRepresentation.cxx
vtkAffineRepresentation2D.cxx
vtkAffineWidget.cxx
vtkAngleRepresentation.cxx
vtkAngleRepresentation2D.cxx
vtkAngleWidget.cxx
vtkBezierContourLineInterpolator.cxx
vtkBorderRepresentation.cxx
vtkBorderWidget.cxx
vtkBoundedPlanePointPlacer.cxx
vtkBoxWidget.cxx
vtkCameraRepresentation.cxx
vtkCameraWidget.cxx
vtkCaptionRepresentation.cxx
vtkCaptionWidget.cxx
vtkContourLineInterpolator.cxx
vtkContourRepresentation.cxx
vtkContourWidget.cxx
vtkCheckerboardRepresentation.cxx
vtkCheckerboardWidget.cxx
vtkConstrainedPointHandleRepresentation.cxx
vtkDistanceWidget.cxx
vtkDistanceRepresentation.cxx
vtkDistanceRepresentation2D.cxx
vtkEvent.cxx
vtkFocalPlanePointPlacer.cxx
vtkHandleRepresentation.cxx
vtkHandleWidget.cxx
vtkImagePlaneWidget.cxx
vtkImageTracerWidget.cxx
vtkImplicitPlaneWidget.cxx
vtkLineWidget.cxx
vtkOrientationMarkerWidget.cxx
vtkOrientedGlyphContourRepresentation.cxx
vtkPlaneWidget.cxx
vtkPointHandleRepresentation2D.cxx
vtkPointHandleRepresentation3D.cxx
vtkPointPlacer.cxx
vtkPointWidget.cxx
vtkPolyDataSourceWidget.cxx
vtkRectilinearWipeRepresentation.cxx
vtkRectilinearWipeWidget.cxx
vtkScalarBarWidget.cxx
vtkSeedRepresentation.cxx
vtkSeedWidget.cxx
vtkSliderRepresentation.cxx
#vtkSliderRepresentation2D.cxx
vtkSliderRepresentation3D.cxx
vtkSliderWidget.cxx
vtkSphereWidget.cxx
vtkSplineWidget.cxx
vtkTextRepresentation.cxx
vtkTextWidget.cxx
vtkWidgetCallbackMapper.cxx
vtkWidgetEvent.cxx
vtkWidgetEventTranslator.cxx
vtkWidgetRepresentation.cxx
vtkXYPlotWidget.cxx
)
SET_SOURCE_FILES_PROPERTIES(
vtk3DWidget
vtkAbstractWidget
vtkAffineRepresentation
vtkAngleRepresentation
vtkContourLineInterpolator
vtkContourRepresentation
vtkDistanceRepresentation
vtkHandleRepresentation
vtkPolyDataSourceWidget
vtkPointPlacer
vtkSliderRepresentation
vtkWidgetRepresentation
ABSTRACT
)
......
......@@ -2,19 +2,36 @@ SET(KIT Widgets)
# add tests that do not require data
SET(MyTests
BoxWidget.cxx
TestAffineWidget.cxx
TestAngleWidget.cxx
TestBorderWidget.cxx
TestCameraWidget.cxx
TestCaptionWidget.cxx
TestCheckerboardWidget.cxx
TestDistanceWidget.cxx
TestHandleWidget.cxx
TestHandleWidget2D.cxx
TestImplicitPlaneWidget.cxx
TestOrientationMarkerWidget.cxx
TestRectilinearWipeWidget.cxx
TestSeedWidget.cxx
TestSliderWidget.cxx
TestTextWidget.cxx
)
IF (VTK_DATA_ROOT)
# add tests that require data
SET(MyTests ${MyTests}
ImagePlaneWidget.cxx
TestSplineWidget.cxx
TestScalarBarWidget.cxx
TestOrientedGlyphContour.cxx
TestFocalPlaneContour.cxx
TestConstrainedHandleWidget.cxx
TestImageTracerWidget.cxx
TestLineWidget.cxx
TestPlaneWidget.cxx
TestPointWidget.cxx
TestImageTracerWidget.cxx
TestScalarBarWidget.cxx
TestSeedWidget2.cxx
TestSplineWidget.cxx
)
ENDIF (VTK_DATA_ROOT)
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestMeasureWidget.cxx
Module: TestDistanceWidget.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
......@@ -16,8 +16,8 @@
// This example tests the vtkBorderWidget.
// First include the required header files for the VTK classes we are using.
#include "vtkMeasureWidget.h"
#include "vtkMeasureRepresentation2D.h"
#include "vtkDistanceWidget.h"
#include "vtkDistanceRepresentation2D.h"
#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
......@@ -39,36 +39,36 @@
// This callback is responsible for adjusting the point position.
// It looks in the region around the point and finds the maximum or
// minimum value.
class vtkMeasureCallback : public vtkCommand
class vtkDistanceCallback : public vtkCommand
{
public:
static vtkMeasureCallback *New()
{ return new vtkMeasureCallback; }
static vtkDistanceCallback *New()
{ return new vtkDistanceCallback; }
virtual void Execute(vtkObject *caller, unsigned long, void*);
vtkMeasureCallback():Renderer(0),RenderWindow(0),MeasureWidget(0),Measure(0) {}
vtkDistanceCallback():Renderer(0),RenderWindow(0),DistanceWidget(0),Distance(0) {}
vtkRenderer *Renderer;
vtkRenderWindow *RenderWindow;
vtkMeasureWidget *MeasureWidget;
vtkMeasureRepresentation2D *Measure;
vtkDistanceWidget *DistanceWidget;
vtkDistanceRepresentation2D *Distance;
};
// Method re-positions the points using random perturbation
void vtkMeasureCallback::Execute(vtkObject*, unsigned long eid, void* callData)
void vtkDistanceCallback::Execute(vtkObject*, unsigned long eid, void* callData)
{
if ( eid == vtkCommand::InteractionEvent ||
eid == vtkCommand::EndInteractionEvent )
{
double pos1[3], pos2[3];
// Modify the measure axis
this->Measure->GetPoint1WorldPosition(pos1);
this->Measure->GetPoint2WorldPosition(pos2);
this->Distance->GetPoint1WorldPosition(pos1);
this->Distance->GetPoint2WorldPosition(pos2);
double dist=sqrt(vtkMath::Distance2BetweenPoints(pos1,pos2));
char title[256];
this->Measure->GetAxis()->SetRange(0.0,dist);
this->Distance->GetAxis()->SetRange(0.0,dist);
sprintf(title,"%-#6.3g",dist);
this->Measure->GetAxis()->SetTitle(title);
this->Distance->GetAxis()->SetTitle(title);
}
else
{
......@@ -76,8 +76,8 @@ void vtkMeasureCallback::Execute(vtkObject*, unsigned long eid, void* callData)
//From the point id, get the display coordinates
double pos1[3], pos2[3], *pos;
this->Measure->GetPoint1DisplayPosition(pos1);
this->Measure->GetPoint2DisplayPosition(pos2);
this->Distance->GetPoint1DisplayPosition(pos1);
this->Distance->GetPoint2DisplayPosition(pos2);
if ( pid == 0 )
{
pos = pos1;
......@@ -88,10 +88,10 @@ void vtkMeasureCallback::Execute(vtkObject*, unsigned long eid, void* callData)
}
// Okay, render without the widget, and get the color buffer
int enabled = this->MeasureWidget->GetEnabled();
int enabled = this->DistanceWidget->GetEnabled();
if ( enabled )
{
this->MeasureWidget->SetEnabled(0); //does a Render() as a side effect
this->DistanceWidget->SetEnabled(0); //does a Render() as a side effect
}
// Pretend we are doing something serious....just randomly bump the
......@@ -104,23 +104,23 @@ void vtkMeasureCallback::Execute(vtkObject*, unsigned long eid, void* callData)
// Set the new position
if ( pid == 0 )
{
this->Measure->SetPoint1DisplayPosition(p);
this->Distance->SetPoint1DisplayPosition(p);
}
else
{
this->Measure->SetPoint2DisplayPosition(p);
this->Distance->SetPoint2DisplayPosition(p);
}
// Side effect of a render here
if ( enabled )
{
this->MeasureWidget->SetEnabled(1);
this->DistanceWidget->SetEnabled(1);
}
}
}
// The actual test function
int TestMeasureWidget( int argc, char *argv[] )
int TestDistanceWidget( int argc, char *argv[] )
{
// Create the RenderWindow, Renderer and both Actors
//
......@@ -142,18 +142,18 @@ int TestMeasureWidget( int argc, char *argv[] )
// Create the widget and its representation
vtkPointHandleRepresentation2D *handle = vtkPointHandleRepresentation2D::New();
handle->GetProperty()->SetColor(1,0,0);
vtkMeasureRepresentation2D *rep = vtkMeasureRepresentation2D::New();
vtkDistanceRepresentation2D *rep = vtkDistanceRepresentation2D::New();
rep->SetHandleRepresentation(handle);
vtkMeasureWidget *widget = vtkMeasureWidget::New();
vtkDistanceWidget *widget = vtkDistanceWidget::New();
widget->SetInteractor(iren);
widget->SetRepresentation(rep);
vtkMeasureCallback *mcbk = vtkMeasureCallback::New();
vtkDistanceCallback *mcbk = vtkDistanceCallback::New();
mcbk->Renderer = ren1;
mcbk->RenderWindow = renWin;
mcbk->Measure = rep;
mcbk->MeasureWidget = widget;
mcbk->Distance = rep;
mcbk->DistanceWidget = widget;
// widget->AddObserver(vtkCommand::PlacePointEvent,mcbk);
// widget->AddObserver(vtkCommand::InteractionEvent,mcbk);
// widget->AddObserver(vtkCommand::EndInteractionEvent,mcbk);
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestRotationWidget.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 vtkSliderWidget.
// First include the required header files for the VTK classes we are using.
#include "vtkRotationWidget.h"
#include "vtkRotationRepresentation.h"
#include "vtkCoordinate.h"
#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCommand.h"
#include "vtkInteractorEventRecorder.h"
#include "vtkRegressionTestImage.h"
#include "vtkDebugLeaks.h"
// This does the actual work: updates the probe.
// Callback for the interaction
class vtkRotationCallback : public vtkCommand
{
public:
static vtkRotationCallback *New()
{ return new vtkRotationCallback; }
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
vtkRotationWidget *rotationWidget =
reinterpret_cast<vtkRotationWidget*>(caller);
}
vtkRotationCallback():Sphere(0) {}
vtkSphereSource *Sphere;
};
int TestRotationWidget( int argc, char *argv[] )
{
// Create a mace out of filters.
//
vtkSphereSource *sphereSource = vtkSphereSource::New();
sphereSource->SetCenter(1,1,1);
sphereSource->SetThetaResolution(16);
sphereSource->SetPhiResolution(8);
sphereSource->SetRadius(2.2);
vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
sphereMapper->SetInput(sphereSource->GetOutput());
vtkActor *sphereActor = vtkActor::New();
sphereActor->SetMapper(sphereMapper);
sphereActor->VisibilityOn();
// Create the RenderWindow, Renderer and both Actors
//
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// VTK widgets consist of two parts: the widget part that rotations event processing;
// and the widget representation that defines how the widget appears in the scene
// (i.e., matters pertaining to geometry).
vtkRotationRepresentation *rotationRep = vtkRotationRepresentation::New();
rotationRep->PlaceWidget(sphereActor->GetBounds());
vtkRotationWidget *rotationWidget = vtkRotationWidget::New();
rotationWidget->SetInteractor(iren);
rotationWidget->SetRepresentation(rotationRep);
vtkRotationCallback *callback = vtkRotationCallback::New();
callback->Sphere = sphereSource;
rotationWidget->AddObserver(vtkCommand::InteractionEvent,callback);
ren1->AddActor(sphereActor);
// Add the actors to the renderer, set the background and size
//
ren1->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(300, 300);
// record events
vtkInteractorEventRecorder *recorder = vtkInteractorEventRecorder::New();
recorder->SetInteractor(iren);
recorder->SetFileName("c:/record.log");
// recorder->Record();
// recorder->ReadFromInputStringOn();
// recorder->SetInputString(eventLog);
// render the image
//
iren->Initialize();
renWin->Render();
// recorder->Play();
// Remove the observers so we can go interactive. Without this the "-I"
// testing option fails.
recorder->Off();
int retVal = vtkRegressionTestImage( renWin );
if ( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
sphereSource->Delete();
sphereMapper->Delete();
sphereActor->Delete();
iren->Delete();
renWin->Delete();
ren1->Delete();
rotationRep->Delete();
rotationWidget->Delete();
callback->Delete();
recorder->Delete();
return !retVal;
}
......@@ -21,8 +21,9 @@
#include "vtkWidgetCallbackMapper.h"
#include "vtkRenderer.h"
#include "vtkEvent.h"
#include "vtkWidgetEvent.h"
vtkCxxRevisionMacro(vtkAbstractWidget, "1.2");
vtkCxxRevisionMacro(vtkAbstractWidget, "1.3");
//----------------------------------------------------------------------
vtkAbstractWidget::vtkAbstractWidget()
......
......@@ -23,8 +23,9 @@
#include "vtkWidgetEventTranslator.h"
#include "vtkWidgetCallbackMapper.h"
#include "vtkEvent.h"
#include "vtkWidgetEvent.h"
vtkCxxRevisionMacro(vtkAffineWidget, "1.2");
vtkCxxRevisionMacro(vtkAffineWidget, "1.3");
vtkStandardNewMacro(vtkAffineWidget);
//----------------------------------------------------------------------------------
......
......@@ -44,7 +44,7 @@ public:
// Description:
// Standard VTK methods.
vtkTypeRevisionMacro(vtkAngleRepresentation2D,vtkWidgetRepresentation);
vtkTypeRevisionMacro(vtkAngleRepresentation2D,vtkAngleRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -23,8 +23,9 @@
#include "vtkHandleRepresentation.h"
#include "vtkCoordinate.h"
#include "vtkWidgetCallbackMapper.h"
#include "vtkWidgetEvent.h"
vtkCxxRevisionMacro(vtkAngleWidget, "1.2");
vtkCxxRevisionMacro(vtkAngleWidget, "1.3");
vtkStandardNewMacro(vtkAngleWidget);
......
......@@ -23,9 +23,10 @@
#include "vtkWidgetEventTranslator.h"
#include "vtkWidgetCallbackMapper.h"
#include "vtkEvent.h"
#include "vtkWidgetEvent.h"
vtkCxxRevisionMacro(vtkBorderWidget, "1.2");
vtkCxxRevisionMacro(vtkBorderWidget, "1.3");
vtkStandardNewMacro(vtkBorderWidget);
......
......@@ -23,13 +23,14 @@
#include "vtkSphereSource.h"
#include "vtkProperty.h"
#include "vtkEvent.h"
#include "vtkWidgetEvent.h"
#include <vtkstd/vector>
#include <vtkstd/set>
#include <vtkstd/algorithm>
#include <vtkstd/iterator>
vtkCxxRevisionMacro(vtkContourWidget, "1.2");
vtkCxxRevisionMacro(vtkContourWidget, "1.3");
vtkStandardNewMacro(vtkContourWidget);
//----------------------------------------------------------------------
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMeasureRepresentation.cxx
Module: vtkDistanceRepresentation.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
......@@ -12,7 +12,7 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkMeasureRepresentation.h"
#include "vtkDistanceRepresentation.h"
#include "vtkHandleRepresentation.h"
#include "vtkCoordinate.h"
#include "vtkRenderer.h"
......@@ -21,13 +21,12 @@
#include "vtkInteractorObserver.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkMeasureRepresentation, "1.2");
vtkCxxSetObjectMacro(vtkMeasureRepresentation,HandleRepresentation,vtkHandleRepresentation);
vtkCxxRevisionMacro(vtkDistanceRepresentation, "1.1");
vtkCxxSetObjectMacro(vtkDistanceRepresentation,HandleRepresentation,vtkHandleRepresentation);
//----------------------------------------------------------------------
vtkMeasureRepresentation::vtkMeasureRepresentation()
vtkDistanceRepresentation::vtkDistanceRepresentation()
{
this->HandleRepresentation = NULL;
this->Point1Representation = NULL;
......@@ -38,7 +37,7 @@ vtkMeasureRepresentation::vtkMeasureRepresentation()
}
//----------------------------------------------------------------------
vtkMeasureRepresentation::~vtkMeasureRepresentation()
vtkDistanceRepresentation::~vtkDistanceRepresentation()
{
if ( this->HandleRepresentation )
{
......@@ -56,7 +55,7 @@ vtkMeasureRepresentation::~vtkMeasureRepresentation()
//----------------------------------------------------------------------
void vtkMeasureRepresentation::InstantiateHandleRepresentation()
void vtkDistanceRepresentation::InstantiateHandleRepresentation()
{
if ( ! this->Point1Representation )
{
......@@ -73,19 +72,19 @@ void vtkMeasureRepresentation::InstantiateHandleRepresentation()
//----------------------------------------------------------------------
void vtkMeasureRepresentation::GetPoint1WorldPosition(double pos[3])
void vtkDistanceRepresentation::GetPoint1WorldPosition(double pos[3])
{
this->Point1Representation->GetWorldPosition(pos);
}
//----------------------------------------------------------------------
void vtkMeasureRepresentation::GetPoint2WorldPosition(double pos[3])
void vtkDistanceRepresentation::GetPoint2WorldPosition(double pos[3])
{
this->Point2Representation->GetWorldPosition(pos);
}
//----------------------------------------------------------------------
int vtkMeasureRepresentation::ComputeInteractionState(int X, int Y, int vtkNotUsed(modify))
int vtkDistanceRepresentation::ComputeInteractionState(int X, int Y, int vtkNotUsed(modify))