00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkInteractorStyleCutter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2010/02/24 14:00:46 $ 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 bool Finished(); 00041 00042 // Description: 00043 // Event bindings controlling the effects of pressing mouse buttons 00044 // or moving the mouse. 00045 virtual void OnMouseMove(); 00046 virtual void OnLeftButtonDown(); 00047 virtual void OnRightButtonDown(); 00048 void VisibilityOff(); 00049 00050 vtkGetObjectMacro(LoopPoints,vtkPoints); 00051 vtkGetVector3Macro(Direction,double); 00052 00053 protected: 00054 vtkInteractorStyleCutter(); 00055 ~vtkInteractorStyleCutter(); 00056 00057 //This method is designed for vtkImplicitSelectionLoop where the loop 00058 //should not be closed, the function is virtual to override this behavior 00059 virtual void EndLoop(); 00060 void Initialize(); 00061 00062 int CurrentPosition[2]; 00063 double Direction[3]; 00064 00065 //Points selected by the user 00066 vtkPoints *Points; 00067 00068 //Current point id: 00069 vtkIdType PointID; 00070 00071 //bool which determine if user has press the left button first 00072 int Moving; 00073 00074 vtkActor2D *BboxActor; 00075 vtkCellArray *Lines; 00076 vtkPoints *LoopPoints; 00077 bool finished; 00078 00079 private: 00080 vtkInteractorStyleCutter(const vtkInteractorStyleCutter&); // Not implemented 00081 void operator=(const vtkInteractorStyleCutter&); // Not implemented 00082 }; 00083 00084 #endif