Commit 93198384 authored by Dean Inglis's avatar Dean Inglis
Browse files

FIX: SetResolution problem - fixing purify errors

parent 50cfd0c6
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "vtkSphereSource.h" #include "vtkSphereSource.h"
#include "vtkTransform.h" #include "vtkTransform.h"
vtkCxxRevisionMacro(vtkSplineWidget, "1.3"); vtkCxxRevisionMacro(vtkSplineWidget, "1.4");
vtkStandardNewMacro(vtkSplineWidget); vtkStandardNewMacro(vtkSplineWidget);
vtkSplineWidget::vtkSplineWidget() vtkSplineWidget::vtkSplineWidget()
...@@ -530,6 +530,7 @@ void vtkSplineWidget::HighlightLine(int highlight) ...@@ -530,6 +530,7 @@ void vtkSplineWidget::HighlightLine(int highlight)
{ {
if ( highlight ) if ( highlight )
{ {
this->ValidPick = 1;
this->LinePicker->GetPickPosition(this->LastPickPosition); this->LinePicker->GetPickPosition(this->LastPickPosition);
this->LineActor->SetProperty(this->SelectedLineProperty); this->LineActor->SetProperty(this->SelectedLineProperty);
} }
...@@ -613,7 +614,7 @@ void vtkSplineWidget::OnMiddleButtonDown() ...@@ -613,7 +614,7 @@ void vtkSplineWidget::OnMiddleButtonDown()
int Y = this->Interactor->GetEventPosition()[1]; int Y = this->Interactor->GetEventPosition()[1];
// Okay, we can process this. Try to pick handles first; // Okay, we can process this. Try to pick handles first;
// if no handles picked, then pick the bounding box. // if no handles picked, then try to pick the line.
vtkAssemblyPath *path; vtkAssemblyPath *path;
this->Interactor->FindPokedRenderer(X,Y); this->Interactor->FindPokedRenderer(X,Y);
this->HandlePicker->Pick(X,Y,0.0,this->CurrentRenderer); this->HandlePicker->Pick(X,Y,0.0,this->CurrentRenderer);
...@@ -1171,10 +1172,9 @@ void vtkSplineWidget::SetResolution(int resolution) ...@@ -1171,10 +1172,9 @@ void vtkSplineWidget::SetResolution(int resolution)
return; return;
} }
this->Resolution = resolution; this->NumberOfSplinePoints = resolution + 1;
this->NumberOfSplinePoints = this->Resolution + 1;
if(resolution > this->Resolution) if(resolution > this->Resolution) //only delete when necessary
{ {
delete [] this->SplinePositions; delete [] this->SplinePositions;
if ( (this->SplinePositions = new float[this->NumberOfSplinePoints]) == NULL ) if ( (this->SplinePositions = new float[this->NumberOfSplinePoints]) == NULL )
...@@ -1184,6 +1184,10 @@ void vtkSplineWidget::SetResolution(int resolution) ...@@ -1184,6 +1184,10 @@ void vtkSplineWidget::SetResolution(int resolution)
} }
} }
this->Resolution = resolution;
this->LinePicker->DeletePickList(this->LineActor);
vtkPoints* points = this->LineData->GetPoints(); vtkPoints* points = this->LineData->GetPoints();
points->Allocate(this->NumberOfSplinePoints); points->Allocate(this->NumberOfSplinePoints);
vtkCellArray* lines = this->LineData->GetLines(); vtkCellArray* lines = this->LineData->GetLines();
...@@ -1207,6 +1211,7 @@ void vtkSplineWidget::SetResolution(int resolution) ...@@ -1207,6 +1211,7 @@ void vtkSplineWidget::SetResolution(int resolution)
this->LineData->Update(); this->LineData->Update();
this->LineMapper->Update(); this->LineMapper->Update();
this->LineActor->Modified(); this->LineActor->Modified();
this->LinePicker->AddPickList(this->LineActor);
} }
void vtkSplineWidget::GetPolyData(vtkPolyData *pd) void vtkSplineWidget::GetPolyData(vtkPolyData *pd)
......
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