00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkInteractorStyleCutter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009/05/14 13:54:57 $ 00007 Version: $Revision: 1.1 $ 00008 00009 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00010 All rights reserved. 00011 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00012 00013 This software is distributed WITHOUT ANY WARRANTY; without even 00014 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 PURPOSE. See the above copyright notice for more information. 00016 00017 =========================================================================*/ 00018 // .NAME vtkInteractorStyleCutter - 00019 // .SECTION Description 00020 // This interactor style allows the user to draw a rectangle in the render 00021 // window using the left mouse button. 00022 00023 #ifndef __vtkInteractorStyleCutter_h 00024 #define __vtkInteractorStyleCutter_h 00025 00026 #include <vtkInteractorStyle.h> 00027 00028 class vtkPoints; 00029 class vtkActor2D; 00030 class vtkCellArray; 00031 00032 class vtkInteractorStyleCutter : public vtkInteractorStyle 00033 { 00034 public: 00035 // Description: 00036 // Instantiate the object. 00037 static vtkInteractorStyleCutter *New(); 00038 vtkTypeRevisionMacro(vtkInteractorStyleCutter, vtkInteractorStyle); 00039 void PrintSelf(ostream& os, vtkIndent indent); 00040 00041 // Description: 00042 // Event bindings controlling the effects of pressing mouse buttons 00043 // or moving the mouse. 00044 virtual void OnMouseMove(); 00045 virtual void OnLeftButtonDown(); 00046 virtual void OnRightButtonDown(); 00047 void VisibilityOff(); 00048 00049 vtkGetObjectMacro(LoopPoints,vtkPoints); 00050 vtkGetVector3Macro(Direction,double); 00051 00052 protected: 00053 vtkInteractorStyleCutter(); 00054 ~vtkInteractorStyleCutter(); 00055 00056 //This method is designed for vtkImplicitSelectionLoop where the loop 00057 //should not be closed, the function is virtual to override this behavior 00058 virtual void EndLoop(); 00059 void Initialize(); 00060 00061 int CurrentPosition[2]; 00062 double Direction[3]; 00063 00064 //Points selected by the user 00065 vtkPoints *Points; 00066 00067 //Current point id: 00068 vtkIdType PointID; 00069 00070 //bool which determine if user has press the left button first 00071 int Moving; 00072 00073 vtkActor2D *BboxActor; 00074 vtkCellArray *Lines; 00075 vtkPoints *LoopPoints; 00076 00077 private: 00078 vtkInteractorStyleCutter(const vtkInteractorStyleCutter&); // Not implemented 00079 void operator=(const vtkInteractorStyleCutter&); // Not implemented 00080 }; 00081 00082 #endif