Commit 38bb97bb authored by Max Smolens's avatar Max Smolens Committed by Kitware Robot

Merge topic 'fix-multiple-vtkinteractioncallback-classes'

9ecc0554 Fix variable names in vtkImplicitCylinderWidget test
e8170ff5 Fix multiple definitions of vtkInteractionCallback
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1592
parents 7b7175dd 9ecc0554
Pipeline #18602 pending with stage
......@@ -286,10 +286,10 @@ public:
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
vtkImplicitCylinderWidget *planeWidget =
vtkImplicitCylinderWidget *cylWidget =
reinterpret_cast<vtkImplicitCylinderWidget*>(caller);
vtkImplicitCylinderRepresentation *rep =
reinterpret_cast<vtkImplicitCylinderRepresentation*>(planeWidget->GetRepresentation());
reinterpret_cast<vtkImplicitCylinderRepresentation*>(cylWidget->GetRepresentation());
rep->GetCylinder(this->Cylinder);
this->Actor->VisibilityOn();
}
......@@ -379,11 +379,11 @@ int TestImplicitCylinderWidget2(int vtkNotUsed(argc), char *vtkNotUsed(argv)[])
rep->SetPlaceFactor(1.25);
rep->PlaceWidget(glyph->GetOutput()->GetBounds());
vtkSmartPointer<vtkImplicitCylinderWidget> planeWidget =
vtkSmartPointer<vtkImplicitCylinderWidget> cylWidget =
vtkSmartPointer<vtkImplicitCylinderWidget>::New();
planeWidget->SetInteractor(iren);
planeWidget->SetRepresentation(rep);
planeWidget->AddObserver(vtkCommand::InteractionEvent,myCallback);
cylWidget->SetInteractor(iren);
cylWidget->SetRepresentation(rep);
cylWidget->AddObserver(vtkCommand::InteractionEvent,myCallback);
ren1->AddActor(maceActor);
ren1->AddActor(selectActor);
......@@ -396,7 +396,7 @@ int TestImplicitCylinderWidget2(int vtkNotUsed(argc), char *vtkNotUsed(argv)[])
// Tests
double wbounds[6];
double center[3], center1[3], center2[3];
planeWidget->SetEnabled(1);
cylWidget->SetEnabled(1);
rep->GetCenter(center);
// #1: With ConstrainCenter on, center SHOULD NOT be settable outside widget bounds
......@@ -433,7 +433,7 @@ int TestImplicitCylinderWidget2(int vtkNotUsed(argc), char *vtkNotUsed(argv)[])
}
rep->SetCenter(center);
planeWidget->SetEnabled(0);
cylWidget->SetEnabled(0);
// #3: With ConstrainCenter on and OutsideBounds off, the translation of the
// widget should be limited
......
......@@ -30,26 +30,6 @@
vtkStandardNewMacro(vtkImplicitCylinderWidget);
// The implicit cylinder widget observes its representation. The representation
// may invoke an InteractionEvent when the camera moves when LockedNormalToCamera
// is enabled.
class vtkInteractionCallback : public vtkCommand
{
public:
static vtkInteractionCallback *New()
{ return new vtkInteractionCallback; }
virtual void Execute(vtkObject*, unsigned long eventId, void*)
{
switch (eventId)
{
case vtkCommand::ModifiedEvent:
this->CylinderWidget->InvokeInteractionCallback();
break;
}
}
vtkImplicitCylinderWidget *CylinderWidget;
};
//----------------------------------------------------------------------------
vtkImplicitCylinderWidget::vtkImplicitCylinderWidget()
{
......@@ -93,15 +73,11 @@ vtkImplicitCylinderWidget::vtkImplicitCylinderWidget()
vtkEvent::AnyModifier, 29, 1, "Left",
vtkWidgetEvent::Down,
this, vtkImplicitCylinderWidget::MoveCylinderAction);
this->InteractionCallback = vtkInteractionCallback::New();
this->InteractionCallback->CylinderWidget = this;
}
//----------------------------------------------------------------------------
vtkImplicitCylinderWidget::~vtkImplicitCylinderWidget()
{
this->InteractionCallback->Delete();
}
//----------------------------------------------------------------------
......@@ -336,11 +312,6 @@ void vtkImplicitCylinderWidget::SetEnabled(int enabling)
return;
}
if(this->GetCurrentRenderer() && !enabling)
{
this->GetCurrentRenderer()->GetActiveCamera()->RemoveObserver(this->InteractionCallback);
}
Superclass::SetEnabled(enabling);
}
......@@ -385,21 +356,6 @@ int vtkImplicitCylinderWidget::UpdateCursorShape( int state )
return 0;
}
//----------------------------------------------------------------------------
void vtkImplicitCylinderWidget::InvokeInteractionCallback()
{
unsigned long previousMtime;
vtkImplicitCylinderRepresentation* widgetRep =
reinterpret_cast<vtkImplicitCylinderRepresentation*>(this->WidgetRep);
previousMtime = widgetRep->GetMTime();
if(widgetRep->GetMTime() > previousMtime)
{
this->InvokeEvent(vtkCommand::InteractionEvent,NULL);
}
}
//----------------------------------------------------------------------------
void vtkImplicitCylinderWidget::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -87,12 +87,9 @@
#include "vtkAbstractWidget.h"
class vtkImplicitCylinderRepresentation;
class vtkInteractionCallback;
class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitCylinderWidget : public vtkAbstractWidget
{
friend class vtkInteractionCallback;
public:
// Description:
// Instantiate the object.
......@@ -144,11 +141,6 @@ protected:
// if the cursor shape requested is different from the existing one.
int UpdateCursorShape( int interactionState );
// Description:
// Handle the interaction callback that may come from the representation
vtkInteractionCallback *InteractionCallback;
void InvokeInteractionCallback();
private:
vtkImplicitCylinderWidget(const vtkImplicitCylinderWidget&); //Not implemented
void operator=(const vtkImplicitCylinderWidget&); //Not implemented
......
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