#include "vtkDataSet3DCroppingPlaneCallback.h" #include #include #include #include #include void vtkDataSet3DCroppingPlaneCallback::Execute ( vtkObject *caller, unsigned long, void* ) { if( !this->PlaneWidget ) { return; } this->PlaneWidget->GetPlane (this->Plane); } unsigned int vtkDataSet3DCroppingPlaneCallback::AddInput (vtkDataSet* dataset) { if (!dataset) return 9999; if( !this->PlaneWidget ) return 9999; if (!this->Plane) this->Plane = vtkPlane::New(); this->PlaneWidget->GetPlane (this->Plane); if (!this->Plane) return 9999; vtkClipDataSet* clipper = vtkClipDataSet::New(); clipper->SetInput (dataset); clipper->SetClipFunction (this->Plane); clipper->Update(); this->InputList.push_back (dataset); if (!clipper->GetOutput()) { return 9999; } this->OutputList.push_back (clipper->GetOutput()); clipper->GetOutput()->Register(this); clipper->Delete(); return (this->InputList.size()-1); } unsigned int vtkDataSet3DCroppingPlaneCallback::RemoveInput (vtkDataSet* dataset) { return 9999; } vtkDataSet* vtkDataSet3DCroppingPlaneCallback::GetInput (unsigned int i) { if (i >= this->InputList.size()) return NULL; return this->InputList[i]; } vtkDataSet* vtkDataSet3DCroppingPlaneCallback::GetOutput (unsigned int i) { if (i >= this->OutputList.size()) return NULL; return this->OutputList[i]; }