VTK
vtkBorderRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBorderRepresentation.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 =========================================================================*/
39 #ifndef vtkBorderRepresentation_h
40 #define vtkBorderRepresentation_h
41 
42 #include "vtkInteractionWidgetsModule.h" // For export macro
44 #include "vtkCoordinate.h" //Because of the viewport coordinate macro
45 
46 class vtkPoints;
47 class vtkPolyData;
48 class vtkTransform;
51 class vtkActor2D;
52 class vtkProperty2D;
53 
54 
55 class VTKINTERACTIONWIDGETS_EXPORT vtkBorderRepresentation : public vtkWidgetRepresentation
56 {
57 public:
61  static vtkBorderRepresentation *New();
62 
64 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
81  vtkViewportCoordinateMacro(Position);
82  vtkViewportCoordinateMacro(Position2);
84 
85  enum {BORDER_OFF=0,BORDER_ON,BORDER_ACTIVE};
86 
88 
99  virtual void SetShowBorder(int border);
100  virtual int GetShowBorderMinValue();
101  virtual int GetShowBorderMaxValue();
102  virtual int GetShowBorder();
103  void SetShowBorderToOff() {this->SetShowBorder(BORDER_OFF);}
104  void SetShowBorderToOn() {this->SetShowBorder(BORDER_ON);}
105  void SetShowBorderToActive() {this->SetShowBorder(BORDER_ACTIVE);}
107 
109 
113  vtkSetClampMacro(ShowVerticalBorder,int,BORDER_OFF,BORDER_ACTIVE);
114  vtkGetMacro(ShowVerticalBorder,int);
116 
118 
122  vtkSetClampMacro(ShowHorizontalBorder,int,BORDER_OFF,BORDER_ACTIVE);
123  vtkGetMacro(ShowHorizontalBorder,int);
125 
127 
130  vtkGetObjectMacro(BorderProperty,vtkProperty2D);
132 
134 
141  vtkSetMacro(ProportionalResize,vtkTypeBool);
142  vtkGetMacro(ProportionalResize,vtkTypeBool);
143  vtkBooleanMacro(ProportionalResize,vtkTypeBool);
145 
147 
152  vtkSetVector2Macro(MinimumSize,int);
153  vtkGetVector2Macro(MinimumSize,int);
154  vtkSetVector2Macro(MaximumSize,int);
155  vtkGetVector2Macro(MaximumSize,int);
157 
159 
164  vtkSetClampMacro(Tolerance,int,1,10);
165  vtkGetMacro(Tolerance,int);
167 
169 
173  vtkGetVectorMacro(SelectionPoint,double,2);
175 
177 
182  vtkSetMacro(Moving,vtkTypeBool);
183  vtkGetMacro(Moving,vtkTypeBool);
184  vtkBooleanMacro(Moving,vtkTypeBool);
186 
191  {
192  Outside=0,
201  AdjustingE3
202  };
203 
208  vtkMTimeType GetMTime() override;
209 
211 
215  void BuildRepresentation() override;
216  void StartWidgetInteraction(double eventPos[2]) override;
217  void WidgetInteraction(double eventPos[2]) override;
218  virtual void GetSize(double size[2])
219  {size[0]=1.0; size[1]=1.0;}
220  int ComputeInteractionState(int X, int Y, int modify=0) override;
222 
224 
228  void GetActors2D(vtkPropCollection*) override;
229  void ReleaseGraphicsResources(vtkWindow*) override;
230  int RenderOverlay(vtkViewport*) override;
231  int RenderOpaqueGeometry(vtkViewport*) override;
233  int HasTranslucentPolygonalGeometry() override;
235 
236 protected:
238  ~vtkBorderRepresentation() override;
239 
240  // Ivars
247  double SelectionPoint[2];
248 
249  // Layout (position of lower left and upper right corners of border)
252 
253  // Sometimes subclasses must negotiate with their superclasses
254  // to achieve the correct layout.
256  virtual void NegotiateLayout();
257 
258  // Update the border visibility based on InteractionState.
259  // See Also: SetShowHorizontalBorder(), SetShowHorizontalBorder(),
260  // ComputeInteractionState()
261  virtual void UpdateShowBorder();
262 
263  // Keep track of start position when moving border
264  double StartPosition[2];
265 
266  // Border representation. Subclasses may use the BWTransform class
267  // to transform their geometry into the region surrounded by the border.
274 
275  // Constraints on size
276  int MinimumSize[2];
277  int MaximumSize[2];
278 
279 private:
281  void operator=(const vtkBorderRepresentation&) = delete;
282 };
283 
284 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:44
void GetActors2D(vtkPropCollection *) override
virtual void StartWidgetInteraction(double eventPos[2])
vtkTransformPolyDataFilter * BWTransformFilter
a actor that draws 2D data
Definition: vtkActor2D.h:39
void SetShowBorderToOff()
Specify when and if the border should appear.
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defines interface between the widget and widget representation classes
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
virtual void GetSize(double size[2])
Subclasses should implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
void SetShowBorderToOn()
Specify when and if the border should appear.
int HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetShowBorderToActive()
Specify when and if the border should appear.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual vtkMTimeType GetMTime()
Return this object's modified time.
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
represent a vtkBorderWidget
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:72
_InteractionState
Define the various states that the representation can be in.
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkPolyDataMapper2D * BWMapper
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:33