VTK
vtkCaptionRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCaptionRepresentation.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 =========================================================================*/
36 #ifndef vtkCaptionRepresentation_h
37 #define vtkCaptionRepresentation_h
38 
39 #include "vtkInteractionWidgetsModule.h" // For export macro
41 
42 class vtkRenderer;
43 class vtkCaptionActor2D;
44 class vtkConeSource;
46 
47 
48 class VTKINTERACTIONWIDGETS_EXPORT vtkCaptionRepresentation : public vtkBorderRepresentation
49 {
50 public:
54  static vtkCaptionRepresentation *New();
55 
57 
61  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
63 
65 
69  void SetAnchorPosition(double pos[3]);
70  void GetAnchorPosition(double pos[3]);
72 
74 
78  void SetCaptionActor2D(vtkCaptionActor2D *captionActor);
79  vtkGetObjectMacro(CaptionActor2D,vtkCaptionActor2D);
81 
83 
88  void SetAnchorRepresentation(vtkPointHandleRepresentation3D*);
89  vtkGetObjectMacro(AnchorRepresentation,vtkPointHandleRepresentation3D);
91 
95  void BuildRepresentation() VTK_OVERRIDE;
96  void GetSize(double size[2]) VTK_OVERRIDE
97  {size[0]=2.0; size[1]=2.0;}
98 
100 
104  void GetActors2D(vtkPropCollection*) VTK_OVERRIDE;
105  void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
106  int RenderOverlay(vtkViewport*) VTK_OVERRIDE;
107  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
109  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
111 
113 
117  vtkSetClampMacro(FontFactor, double, 0.1, 10.0);
118  vtkGetMacro(FontFactor, double);
120 
121 protected:
123  ~vtkCaptionRepresentation() VTK_OVERRIDE;
124 
125  // the text to manage
126  vtkCaptionActor2D *CaptionActor2D;
127  vtkConeSource *CaptionGlyph;
128 
129  int PointWidgetState;
130  int DisplayAttachmentPoint[2];
131  double FontFactor;
132 
133  // Internal representation for the anchor
134  vtkPointHandleRepresentation3D *AnchorRepresentation;
135 
136  // Check and adjust boundaries according to the size of the caption text
137  virtual void AdjustCaptionBoundary();
138 
139 private:
140  vtkCaptionRepresentation(const vtkCaptionRepresentation&) VTK_DELETE_FUNCTION;
141  void operator=(const vtkCaptionRepresentation&) VTK_DELETE_FUNCTION;
142 };
143 
144 #endif
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
int HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
represent the position of a point in 3D space
abstract specification for Viewports
Definition: vtkViewport.h:44
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
abstract specification for renderers
Definition: vtkRenderer.h:57
generate polygonal cone
Definition: vtkConeSource.h:38
static vtkBorderRepresentation * New()
Instantiate this class.
an ordered list of Props
void PrintSelf(ostream &os, vtkIndent indent) override
Define standard methods.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
represents vtkCaptionWidget in the scene
void BuildRepresentation() override
Subclasses should implement these methods.
a simple class to control print indentation
Definition: vtkIndent.h:33
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
represent a vtkBorderWidget
draw text label associated with a point