vtkInteractorStyleCutter Class Reference

#include <vtkInteractorStyleCutter.h>

List of all members.

Public Member Functions

 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
vtkInteractorStyleCutter * 
New ()

Protected Member Functions

 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

Private Member Functions

 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, Lines, LoopPoints, Moving, 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   //thanks
00058   pd->Delete();
00059   bboxMapper->Delete();
00060 }

vtkInteractorStyleCutter::~vtkInteractorStyleCutter (  )  [protected]

Definition at line 63 of file vtkInteractorStyleCutter.cxx.

References BboxActor, Lines, LoopPoints, and Points.

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

vtkInteractorStyleCutter::vtkInteractorStyleCutter ( const vtkInteractorStyleCutter &   )  [private]


Member Function Documentation

static vtkInteractorStyleCutter* vtkInteractorStyleCutter::New (  )  [static]

Referenced by vtk3DSurfaceSTLWidget::SetCuttingMode().

Here is the caller graph for this function:

vtkInteractorStyleCutter::vtkTypeRevisionMacro ( vtkInteractorStyleCutter  ,
vtkInteractorStyle   
)

void vtkInteractorStyleCutter::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

Definition at line 189 of file vtkInteractorStyleCutter.cxx.

00190 {
00191   this->Superclass::PrintSelf(os, indent);
00192 }

void vtkInteractorStyleCutter::OnMouseMove (  )  [virtual]

Definition at line 72 of file vtkInteractorStyleCutter.cxx.

References CurrentPosition, and Points.

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

void vtkInteractorStyleCutter::OnLeftButtonDown (  )  [virtual]

Definition at line 90 of file vtkInteractorStyleCutter.cxx.

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

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

Here is the call graph for this function:

void vtkInteractorStyleCutter::OnRightButtonDown (  )  [virtual]

Definition at line 124 of file vtkInteractorStyleCutter.cxx.

References EndLoop(), Moving, and Points.

00125 {
00126   if (!this->Interactor || !this->Moving)
00127     {
00128     return;
00129     }
00130   
00131   double xyz[3];
00132   this->Points->GetPoint( 0, xyz );
00133   this->Points->SetPoint(this->PointID, xyz);
00134 
00135   //Save current state
00136   this->EndLoop();
00137 
00138   this->Interactor->Render();
00139   this->Moving = 0;
00140 }

Here is the call graph for this function:

void vtkInteractorStyleCutter::VisibilityOff (  ) 

Definition at line 184 of file vtkInteractorStyleCutter.cxx.

References BboxActor.

Referenced by vtk3DSurfaceSTLWidget::SetCuttingMode().

00185 {
00186   this->BboxActor->VisibilityOff();
00187 }

Here is the caller graph for this function:

vtkInteractorStyleCutter::vtkGetObjectMacro ( LoopPoints  ,
vtkPoints   
)

vtkInteractorStyleCutter::vtkGetVector3Macro ( Direction  ,
double   
)

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

Definition at line 153 of file vtkInteractorStyleCutter.cxx.

References LoopPoints, and Points.

Referenced by OnRightButtonDown().

00154 {
00155   double pi[3],fpi[4];
00156   int numPts = this->Points->GetNumberOfPoints()-1;
00157   this->LoopPoints->SetNumberOfPoints( numPts );
00158   vtkCamera *camera = this->CurrentRenderer->GetActiveCamera();
00159   int state = camera->GetParallelProjection ();
00160   camera->ParallelProjectionOn();
00161 
00162   for (int i=0; i < numPts; i++)
00163   {
00164     this->Points->GetPoint(i, pi);
00165     this->CurrentRenderer->SetDisplayPoint(pi[0], pi[1], 0);
00166     this->CurrentRenderer->DisplayToWorld();
00167 
00168     this->CurrentRenderer->GetWorldPoint( fpi );
00169     if ( fpi[3] )
00170     {
00171       fpi[0] /= fpi[3];
00172       fpi[1] /= fpi[3];
00173       fpi[2] /= fpi[3];
00174     }
00175     this->LoopPoints->SetPoint( i, fpi[0], fpi[1], fpi[2] );
00176   }
00177 
00178   //Set direction of extrusion, should save this state before camera moves
00179   camera->GetDirectionOfProjection( this->Direction );
00180   //camera->SetParallelProjection( state );
00181 }

Here is the caller graph for this function:

void vtkInteractorStyleCutter::Initialize (  )  [protected]

Definition at line 143 of file vtkInteractorStyleCutter.cxx.

References Lines, PointID, and Points.

Referenced by OnLeftButtonDown().

00144 {
00145   this->Points->Reset();
00146   this->Lines->Reset();
00147 
00148   this->PointID = this->Points->InsertNextPoint( 0, 0, 0);
00149   this->Lines->InsertNextCell( 1 );
00150   this->Lines->InsertCellPoint( 0 );
00151 }

Here is the caller graph for this function:

void vtkInteractorStyleCutter::operator= ( const vtkInteractorStyleCutter &   )  [private]


Member Data Documentation

int vtkInteractorStyleCutter::CurrentPosition[2] [protected]

Definition at line 61 of file vtkInteractorStyleCutter.h.

Referenced by OnLeftButtonDown(), OnMouseMove(), and vtkInteractorStyleCutter().

double vtkInteractorStyleCutter::Direction[3] [protected]

Definition at line 62 of file vtkInteractorStyleCutter.h.

Referenced by vtkInteractorStyleCutter().

vtkPoints* vtkInteractorStyleCutter::Points [protected]

Definition at line 65 of file vtkInteractorStyleCutter.h.

Referenced by EndLoop(), Initialize(), OnLeftButtonDown(), OnMouseMove(), OnRightButtonDown(), vtkInteractorStyleCutter(), and ~vtkInteractorStyleCutter().

vtkIdType vtkInteractorStyleCutter::PointID [protected]

Definition at line 68 of file vtkInteractorStyleCutter.h.

Referenced by Initialize(), and OnLeftButtonDown().

int vtkInteractorStyleCutter::Moving [protected]

Definition at line 71 of file vtkInteractorStyleCutter.h.

Referenced by OnLeftButtonDown(), OnRightButtonDown(), and vtkInteractorStyleCutter().

vtkActor2D* vtkInteractorStyleCutter::BboxActor [protected]

Definition at line 73 of file vtkInteractorStyleCutter.h.

Referenced by OnLeftButtonDown(), VisibilityOff(), vtkInteractorStyleCutter(), and ~vtkInteractorStyleCutter().

vtkCellArray* vtkInteractorStyleCutter::Lines [protected]

Definition at line 74 of file vtkInteractorStyleCutter.h.

Referenced by Initialize(), OnLeftButtonDown(), vtkInteractorStyleCutter(), and ~vtkInteractorStyleCutter().

vtkPoints* vtkInteractorStyleCutter::LoopPoints [protected]

Definition at line 75 of file vtkInteractorStyleCutter.h.

Referenced by EndLoop(), vtkInteractorStyleCutter(), and ~vtkInteractorStyleCutter().


The documentation for this class was generated from the following files:
Generated on Wed Jul 29 16:36:15 2009 for creaMaracasVisu_lib by  doxygen 1.5.3