ParaView
vtkGridAxes2DActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridAxes2DActor.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 =========================================================================*/
20 #ifndef vtkGridAxes2DActor_h
21 #define vtkGridAxes2DActor_h
22 
23 #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
24 #include "vtkProp3D.h"
25 
26 #include "vtkGridAxesHelper.h" // needed of Helper
27 #include "vtkGridAxesPlane2DActor.h" // needed for inline methods
28 #include "vtkNew.h" // needed for vtkNew.
29 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
30 #include "vtkStdString.h" // needed for vtkStdString.
31 
32 class vtkAxis;
33 class vtkContextScene;
34 class vtkDoubleArray;
35 class vtkProperty;
36 class vtkTextProperty;
37 
38 class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkGridAxes2DActor : public vtkProp3D
39 {
40 public:
41  static vtkGridAxes2DActor* New();
42  vtkTypeMacro(vtkGridAxes2DActor, vtkProp3D);
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
46 
51  vtkSetVector6Macro(GridBounds, double);
52  vtkGetVector6Macro(GridBounds, double);
54 
55  // These are in the same order as the faces of a vtkVoxel.
56  enum Faces
57  {
64  };
65 
67 
70  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
71  vtkGetMacro(Face, int);
73 
78  {
85  };
86 
88 
91  vtkSetMacro(LabelMask, unsigned int);
92  vtkGetMacro(LabelMask, unsigned int);
94 
96 
103  vtkSetMacro(EnableLayerSupport, bool);
104  vtkGetMacro(EnableLayerSupport, bool);
105  vtkBooleanMacro(EnableLayerSupport, bool);
107 
109 
113  vtkSetMacro(BackgroundLayer, int);
114  vtkGetMacro(BackgroundLayer, int);
116 
118 
122  vtkSetMacro(GeometryLayer, int);
123  vtkGetMacro(GeometryLayer, int);
125 
127 
131  vtkSetMacro(ForegroundLayer, int);
132  vtkGetMacro(ForegroundLayer, int);
134 
136 
139  void SetProperty(vtkProperty*);
140  vtkProperty* GetProperty();
142 
144 
148  void SetTitleTextProperty(int axis, vtkTextProperty*);
149  vtkTextProperty* GetTitleTextProperty(int axis);
151 
153 
157  void SetLabelTextProperty(int axis, vtkTextProperty*);
158  vtkTextProperty* GetLabelTextProperty(int axis);
160 
162 
165  void SetTitle(int axis, const vtkStdString& title);
166  const vtkStdString& GetTitle(int axis);
168 
170 
174  void SetNotation(int axis, int notation);
175  int GetNotation(int axis);
177 
179 
182  void SetPrecision(int axis, int val);
183  int GetPrecision(int axis);
185 
191  void SetCustomTickPositions(int axis, vtkDoubleArray* positions);
192 
193  //---------------------------------------------------------------------------
194  // *** Properties to control grid rendering ***
195  //---------------------------------------------------------------------------
196 
200  void SetGenerateGrid(bool val) { this->PlaneActor->SetGenerateGrid(val); }
201  bool GetGenerateGrid() { return this->PlaneActor->GetGenerateGrid(); }
202  vtkBooleanMacro(GenerateGrid, bool);
203 
208  void SetGenerateEdges(bool val) { this->PlaneActor->SetGenerateEdges(val); }
209  bool GetGenerateEdges() { return this->PlaneActor->GetGenerateEdges(); }
210  vtkBooleanMacro(GenerateEdges, bool);
211 
212  // Turn off to not generate the markers for the tick positions. Which egdes
213  // are rendered is defined by the TickMask.
214  void SetGenerateTicks(bool val) { this->PlaneActor->SetGenerateTicks(val); }
215  bool GetGenerateTicks() { return this->PlaneActor->GetGenerateTicks(); }
216  vtkBooleanMacro(GenerateTicks, bool);
217 
218  //--------------------------------------------------------------------------
219  // Methods for vtkProp3D API.
220  //--------------------------------------------------------------------------
221 
223 
226  virtual double* GetBounds()
227  {
228  this->GetGridBounds(this->Bounds);
229  return this->Bounds;
230  }
232 
233  virtual int RenderOpaqueGeometry(vtkViewport*);
234  virtual int RenderTranslucentPolygonalGeometry(vtkViewport* viewport);
235  virtual int RenderOverlay(vtkViewport* viewport);
236  virtual int HasTranslucentPolygonalGeometry();
237  virtual void ReleaseGraphicsResources(vtkWindow*);
238 
242  vtkMTimeType GetMTime();
243 
244 protected:
247 
248  bool Update(vtkViewport* viewport);
249  void UpdateTextProperties(vtkViewport* viewport);
250  void UpdateLabelPositions(vtkViewport* viewport);
251  void UpdateTextActors(vtkViewport* viewport);
252  friend class vtkGridAxes3DActor;
253 
254  double GridBounds[6];
255  int Face;
256  unsigned int LabelMask;
257 
262 
263  vtkTuple<vtkSmartPointer<vtkTextProperty>, 3> TitleTextProperty;
264  vtkTuple<vtkSmartPointer<vtkTextProperty>, 3> LabelTextProperty;
265  vtkTuple<vtkStdString, 3> Titles;
266 
267  vtkNew<vtkGridAxesHelper> Helper;
268  vtkSmartPointer<vtkGridAxesPlane2DActor> PlaneActor;
269  vtkNew<vtkAxis> AxisHelpers[3];
270  vtkNew<vtkContextScene> AxisHelperScene;
272 
273 private:
274  vtkGridAxes2DActor(const vtkGridAxes2DActor&) VTK_DELETE_FUNCTION;
275  void operator=(const vtkGridAxes2DActor&) VTK_DELETE_FUNCTION;
276 
277  class vtkLabels;
278  vtkLabels* Labels;
279  friend class vtkLabels;
280 
281  bool DoRender;
282 };
283 
284 #endif
vtkTimeStamp UpdateLabelTextPropertiesMTime
vtkTuple< vtkStdString, 3 > Titles
vtkNew< vtkGridAxesHelper > Helper
vtkTuple< vtkSmartPointer< vtkTextProperty >, 3 > TitleTextProperty
vtkSmartPointer< vtkGridAxesPlane2DActor > PlaneActor
vtkTuple< vtkSmartPointer< vtkTextProperty >, 3 > LabelTextProperty
void SetGenerateGrid(bool val)
Turn off to not generate polydata for the plane&#39;s grid.
void SetGenerateTicks(bool val)
LabelMasks
Valid values for LabelMask.
void SetGenerateEdges(bool val)
Turn off to not generate the polydata for the plane&#39;s edges.
virtual double * GetBounds()
Returns the prop bounds.
vtkNew< vtkContextScene > AxisHelperScene