vtkInteractorStyleCutter Class Reference

#include <vtkInteractorStyleCutter.h>

List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkInteractorStyleCutter, vtkInteractorStyle)
void PrintSelf (ostream &os, vtkIndent indent)
bool Finished ()
virtual void OnMouseMove ()
virtual void OnLeftButtonDown ()
virtual void OnRightButtonDown ()
void VisibilityOff ()
 vtkGetObjectMacro (LoopPoints, vtkPoints)
 vtkGetVector3Macro (Direction, double)
 vtkTypeRevisionMacro (vtkInteractorStyleCutter, vtkInteractorStyle)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void OnMouseMove ()
virtual void OnLeftButtonDown ()
virtual void OnRightButtonDown ()
void VisibilityOff ()
 vtkGetObjectMacro (LoopPoints, vtkPoints)
 vtkGetVector3Macro (Direction, double)

Static Public Member Functions

static vtkInteractorStyleCutterNew ()
static vtkInteractorStyleCutterNew ()

Protected Member Functions

 vtkInteractorStyleCutter ()
 ~vtkInteractorStyleCutter ()
virtual void EndLoop ()
void Initialize ()
 vtkInteractorStyleCutter ()
 ~vtkInteractorStyleCutter ()
virtual void EndLoop ()
void Initialize ()

Protected Attributes

int CurrentPosition [2]
double Direction [3]
vtkPoints * Points
vtkIdType PointID
int Moving
vtkActor2D * BboxActor
vtkCellArray * Lines
vtkPoints * LoopPoints
bool finished

Private Member Functions

 vtkInteractorStyleCutter (const vtkInteractorStyleCutter &)
void operator= (const vtkInteractorStyleCutter &)
 vtkInteractorStyleCutter (const vtkInteractorStyleCutter &)
void operator= (const vtkInteractorStyleCutter &)

Detailed Description

Definition at line 32 of file vtkInteractorStyleCutter.h.


Constructor & Destructor Documentation

vtkInteractorStyleCutter::vtkInteractorStyleCutter (  )  [protected]

Definition at line 35 of file vtkInteractorStyleCutter.cxx.

References BboxActor, CurrentPosition, Direction, finished, Lines, LoopPoints, Moving, New(), and Points.

00036 {
00037   this->CurrentPosition[0] = this->CurrentPosition[1] = 0;
00038   this->Direction[0] = this->Direction[1] = this->Direction[2] = 0.;
00039   this->Moving = 0;
00040 
00041   this->Points = vtkPoints::New();
00042   this->Lines = vtkCellArray::New();
00043   this->LoopPoints = vtkPoints::New();
00044 
00045   vtkPolyData *pd = vtkPolyData::New();
00046   pd->SetPoints( Points );
00047   pd->SetLines( Lines );
00048    
00049   vtkPolyDataMapper2D *bboxMapper = vtkPolyDataMapper2D::New();
00050   bboxMapper->SetInput( pd );
00051    
00052   this->BboxActor = vtkActor2D::New();
00053   this->BboxActor->SetMapper( bboxMapper );
00054   this->BboxActor->GetProperty()->SetColor(1, 0, 0);
00055   this->BboxActor->VisibilityOff();
00056 
00057   finished = false;
00058 
00059   //thanks
00060   pd->Delete();
00061   bboxMapper->Delete();
00062 }

Here is the call graph for this function:

vtkInteractorStyleCutter::~vtkInteractorStyleCutter (  )  [protected]

Definition at line 65 of file vtkInteractorStyleCutter.cxx.

References BboxActor, Lines, LoopPoints, and Points.

00066 {
00067   this->Points->Delete();
00068   this->BboxActor->Delete();
00069   this->Lines->Delete();
00070   this->LoopPoints->Delete();
00071 }

vtkInteractorStyleCutter::vtkInteractorStyleCutter ( const vtkInteractorStyleCutter  )  [private]
vtkInteractorStyleCutter::vtkInteractorStyleCutter (  )  [protected]
vtkInteractorStyleCutter::~vtkInteractorStyleCutter (  )  [protected]
vtkInteractorStyleCutter::vtkInteractorStyleCutter ( const vtkInteractorStyleCutter  )  [private]

Member Function Documentation

virtual void vtkInteractorStyleCutter::EndLoop (  )  [protected, virtual]
void vtkInteractorStyleCutter::EndLoop (  )  [protected, virtual]

Definition at line 164 of file vtkInteractorStyleCutter.cxx.

References Direction, LoopPoints, and Points.

Referenced by OnRightButtonDown().

00165 {
00166   double pi[3],fpi[4];
00167   int numPts = this->Points->GetNumberOfPoints()-1;
00168   this->LoopPoints->SetNumberOfPoints( numPts );
00169   vtkCamera *camera = this->CurrentRenderer->GetActiveCamera();
00170   //int state = camera->GetParallelProjection ();
00171   camera->ParallelProjectionOn();
00172 
00173   for (int i=0; i < numPts; i++)
00174   {
00175     this->Points->GetPoint(i, pi);
00176     this->CurrentRenderer->SetDisplayPoint(pi[0], pi[1], 0);
00177     this->CurrentRenderer->DisplayToWorld();
00178 
00179     this->CurrentRenderer->GetWorldPoint( fpi );
00180     if ( fpi[3] )
00181     {
00182       fpi[0] /= fpi[3];
00183       fpi[1] /= fpi[3];
00184       fpi[2] /= fpi[3];
00185     }
00186     this->LoopPoints->SetPoint( i, fpi[0], fpi[1], fpi[2] );
00187   }
00188 
00189   //Set direction of extrusion, should save this state before camera moves
00190   camera->GetDirectionOfProjection( this->Direction );
00191   //camera->SetParallelProjection( state );
00192 }

Here is the caller graph for this function:

bool vtkInteractorStyleCutter::Finished (  ) 

Definition at line 128 of file vtkInteractorStyleCutter.cxx.

References finished.

Referenced by CutModelManager::UpdatePolygon().

00129 {
00130     return finished;
00131 }

Here is the caller graph for this function:

void vtkInteractorStyleCutter::Initialize (  )  [protected]
void vtkInteractorStyleCutter::Initialize (  )  [protected]

Definition at line 154 of file vtkInteractorStyleCutter.cxx.

References Lines, PointID, and Points.

Referenced by OnLeftButtonDown().

00155 {
00156   this->Points->Reset();
00157   this->Lines->Reset();
00158 
00159   this->PointID = this->Points->InsertNextPoint( 0, 0, 0);
00160   this->Lines->InsertNextCell( 1 );
00161   this->Lines->InsertCellPoint( 0 );
00162 }

Here is the caller graph for this function:

static vtkInteractorStyleCutter* vtkInteractorStyleCutter::New (  )  [static]
static vtkInteractorStyleCutter* vtkInteractorStyleCutter::New (  )  [static]
virtual void vtkInteractorStyleCutter::OnLeftButtonDown (  )  [virtual]
void vtkInteractorStyleCutter::OnLeftButtonDown (  )  [virtual]

Definition at line 92 of file vtkInteractorStyleCutter.cxx.

References BboxActor, CurrentPosition, finished, Initialize(), Lines, Moving, PointID, and Points.

00093 {
00094   if (!this->Interactor)
00095     {
00096     return;
00097     }
00098 
00099         finished = false;
00100   
00101   this->CurrentPosition[0] = this->Interactor->GetEventPosition()[0];
00102   this->CurrentPosition[1] = this->Interactor->GetEventPosition()[1];  
00103 
00104   if(!this->Moving)
00105     {
00106     this->Initialize();
00107 
00108     //Call this before accessing CurrentRenderer
00109     this->FindPokedRenderer(this->CurrentPosition[0], this->CurrentPosition[1]);
00110         this->CurrentRenderer->AddViewProp(BboxActor);
00111     }
00112 
00113   this->Moving = 1;
00114 
00115   this->Points->SetPoint(this->PointID, this->CurrentPosition[0],
00116     this->CurrentPosition[1], 0);
00117   this->PointID = this->Points->InsertNextPoint( this->CurrentPosition[0], 
00118     this->CurrentPosition[1], 0);
00119 
00120   this->Lines->InsertCellPoint( this->PointID );
00121   this->Lines->UpdateCellCount( this->PointID + 1 );
00122   this->BboxActor->VisibilityOn();
00123 
00124   this->Interactor->Render();
00125 }

Here is the call graph for this function:

virtual void vtkInteractorStyleCutter::OnMouseMove (  )  [virtual]
void vtkInteractorStyleCutter::OnMouseMove (  )  [virtual]

Definition at line 74 of file vtkInteractorStyleCutter.cxx.

References CurrentPosition, Moving, PointID, and Points.

00075 {
00076   if (!this->Interactor || !this->Moving)
00077     {
00078     return;
00079     }
00080   
00081   this->CurrentPosition[0] = this->Interactor->GetEventPosition()[0];
00082   this->CurrentPosition[1] = this->Interactor->GetEventPosition()[1];  
00083   
00084   //mouse move event
00085   this->Points->SetPoint(this->PointID, this->CurrentPosition[0], 
00086     this->CurrentPosition[1], 0);
00087 
00088   this->Interactor->Render();
00089 }

virtual void vtkInteractorStyleCutter::OnRightButtonDown (  )  [virtual]
void vtkInteractorStyleCutter::OnRightButtonDown (  )  [virtual]

Definition at line 134 of file vtkInteractorStyleCutter.cxx.

References EndLoop(), finished, Moving, PointID, and Points.

00135 {
00136   if (!this->Interactor || !this->Moving)
00137     {
00138     return;
00139     }
00140   
00141   double xyz[3];
00142   this->Points->GetPoint( 0, xyz );
00143   this->Points->SetPoint(this->PointID, xyz);
00144 
00145   //Save current state
00146   this->EndLoop();
00147 
00148   this->Interactor->Render();
00149   this->Moving = 0;
00150   finished = true;
00151 }

Here is the call graph for this function:

void vtkInteractorStyleCutter::operator= ( const vtkInteractorStyleCutter  )  [private]
void vtkInteractorStyleCutter::operator= ( const vtkInteractorStyleCutter  )  [private]
void vtkInteractorStyleCutter::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
void vtkInteractorStyleCutter::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

Definition at line 200 of file vtkInteractorStyleCutter.cxx.

00201 {
00202   this->Superclass::PrintSelf(os, indent);
00203 }

void vtkInteractorStyleCutter::VisibilityOff (  ) 
void vtkInteractorStyleCutter::VisibilityOff (  ) 

Definition at line 195 of file vtkInteractorStyleCutter.cxx.

References BboxActor.

Referenced by vtk3DSurfaceSTLWidget::SetCuttingMode(), and CutModelManager::UpdatePolygon().

00196 {
00197   this->BboxActor->VisibilityOff();
00198 }

Here is the caller graph for this function:

vtkInteractorStyleCutter::vtkGetObjectMacro ( LoopPoints  ,
vtkPoints   
)
vtkInteractorStyleCutter::vtkGetObjectMacro ( LoopPoints  ,
vtkPoints   
)
vtkInteractorStyleCutter::vtkGetVector3Macro ( Direction  ,
double   
)
vtkInteractorStyleCutter::vtkGetVector3Macro ( Direction  ,
double   
)
vtkInteractorStyleCutter::vtkTypeRevisionMacro ( vtkInteractorStyleCutter  ,
vtkInteractorStyle   
)
vtkInteractorStyleCutter::vtkTypeRevisionMacro ( vtkInteractorStyleCutter  ,
vtkInteractorStyle   
)

Member Data Documentation

vtkActor2D * vtkInteractorStyleCutter::BboxActor [protected]

Definition at line 63 of file vtkInteractorStyleCutter.h.

Referenced by EndLoop(), and vtkInteractorStyleCutter().

vtkCellArray * vtkInteractorStyleCutter::Lines [protected]
vtkPoints * vtkInteractorStyleCutter::LoopPoints [protected]
vtkIdType vtkInteractorStyleCutter::PointID [protected]
vtkPoints * vtkInteractorStyleCutter::Points [protected]

The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1