1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkCursor3D.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkCursor3D - generate a 3D cursor representation
16 // .SECTION Description
17 // vtkCursor3D is an object that generates a 3D representation of a cursor.
18 // The cursor consists of a wireframe bounding box, three intersecting
19 // axes lines that meet at the cursor focus, and "shadows" or projections
20 // of the axes against the sides of the bounding box. Each of these
21 // components can be turned on/off.
22 //
23 // This filter generates two output datasets. The first (Output) is just the
24 // geometric representation of the cursor. The second (Focus) is a single
25 // point at the focal point.
26 
27 #ifndef vtkCursor3D_h
28 #define vtkCursor3D_h
29 
30 #include "vtkFiltersGeneralModule.h" // For export macro
31 #include "vtkPolyDataAlgorithm.h"
32 
33 class VTKFILTERSGENERAL_EXPORT vtkCursor3D : public vtkPolyDataAlgorithm
34 {
35 public:
36   vtkTypeMacro(vtkCursor3D,vtkPolyDataAlgorithm);
37   void PrintSelf(ostream& os, vtkIndent indent);
38 
39   // Description:
40   // Construct with model bounds = (-1,1,-1,1,-1,1), focal point = (0,0,0),
41   // all parts of cursor visible, and wrapping off.
42   static vtkCursor3D *New();
43 
44   // Description:
45   // Set / get the boundary of the 3D cursor.
46   void SetModelBounds(double xmin, double xmax, double ymin, double ymax,
47                       double zmin, double zmax);
48   void SetModelBounds(const double bounds[6]);
49   vtkGetVectorMacro(ModelBounds,double,6);
50 
51   // Description:
52   // Set/Get the position of cursor focus. If translation mode is on,
53   // then the entire cursor (including bounding box, cursor, and shadows)
54   // is translated. Otherwise, the focal point will either be clamped to the
55   // bounding box, or wrapped, if Wrap is on. (Note: this behavior requires
56   // that the bounding box is set prior to the focal point.)
57   void SetFocalPoint(double x[3]);
SetFocalPoint(double x,double y,double z)58   void SetFocalPoint(double x, double y, double z)
59     {
60       double xyz[3];
61       xyz[0] = x; xyz[1] = y; xyz[2] = z;
62       this->SetFocalPoint(xyz);
63     }
64   vtkGetVectorMacro(FocalPoint,double,3);
65 
66   // Description:
67   // Turn on/off the wireframe bounding box.
68   vtkSetMacro(Outline,int);
69   vtkGetMacro(Outline,int);
70   vtkBooleanMacro(Outline,int);
71 
72   // Description:
73   // Turn on/off the wireframe axes.
74   vtkSetMacro(Axes,int);
75   vtkGetMacro(Axes,int);
76   vtkBooleanMacro(Axes,int);
77 
78   // Description:
79   // Turn on/off the wireframe x-shadows.
80   vtkSetMacro(XShadows,int);
81   vtkGetMacro(XShadows,int);
82   vtkBooleanMacro(XShadows,int);
83 
84   // Description:
85   // Turn on/off the wireframe y-shadows.
86   vtkSetMacro(YShadows,int);
87   vtkGetMacro(YShadows,int);
88   vtkBooleanMacro(YShadows,int);
89 
90   // Description:
91   // Turn on/off the wireframe z-shadows.
92   vtkSetMacro(ZShadows,int);
93   vtkGetMacro(ZShadows,int);
94   vtkBooleanMacro(ZShadows,int);
95 
96   // Description:
97   // Enable/disable the translation mode. If on, changes in cursor position
98   // cause the entire widget to translate along with the cursor.
99   // By default, translation mode is off.
100   vtkSetMacro(TranslationMode,int);
101   vtkGetMacro(TranslationMode,int);
102   vtkBooleanMacro(TranslationMode,int);
103 
104   // Description:
105   // Turn on/off cursor wrapping. If the cursor focus moves outside the
106   // specified bounds, the cursor will either be restrained against the
107   // nearest "wall" (Wrap=off), or it will wrap around (Wrap=on).
108   vtkSetMacro(Wrap,int);
109   vtkGetMacro(Wrap,int);
110   vtkBooleanMacro(Wrap,int);
111 
112   // Description:
113   // Get the focus for this filter.
GetFocus()114   vtkPolyData *GetFocus() {return this->Focus;};
115 
116   // Description:
117   // Turn every part of the 3D cursor on or off.
118   void AllOn();
119   void AllOff();
120 
121 protected:
122   vtkCursor3D();
123   ~vtkCursor3D();
124 
125   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
126 
127   vtkPolyData *Focus;
128   double ModelBounds[6];
129   double FocalPoint[3];
130   int Outline;
131   int Axes;
132   int XShadows;
133   int YShadows;
134   int ZShadows;
135   int TranslationMode;
136   int Wrap;
137 
138 private:
139   vtkCursor3D(const vtkCursor3D&);  // Not implemented.
140   void operator=(const vtkCursor3D&);  // Not implemented.
141 };
142 
143 #endif
144