VTK  9.1.20211115
vtkBiDimensionalRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBiDimensionalRepresentation.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 =========================================================================*/
43 #ifndef vtkBiDimensionalRepresentation_h
44 #define vtkBiDimensionalRepresentation_h
45 
46 #include "vtkInteractionWidgetsModule.h" // For export macro
48 
50 
51 class VTKINTERACTIONWIDGETS_EXPORT vtkBiDimensionalRepresentation : public vtkWidgetRepresentation
52 {
53 public:
55 
59  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
68  virtual void SetPoint1WorldPosition(double pos[3]);
69  virtual void SetPoint2WorldPosition(double pos[3]);
70  virtual void SetPoint3WorldPosition(double pos[3]);
71  virtual void SetPoint4WorldPosition(double pos[3]);
72  virtual void GetPoint1WorldPosition(double pos[3]);
73  virtual void GetPoint2WorldPosition(double pos[3]);
74  virtual void GetPoint3WorldPosition(double pos[3]);
75  virtual void GetPoint4WorldPosition(double pos[3]);
76  virtual void SetPoint1DisplayPosition(double pos[3]);
77  virtual void SetPoint2DisplayPosition(double pos[3]);
78  virtual void SetPoint3DisplayPosition(double pos[3]);
79  virtual void SetPoint4DisplayPosition(double pos[3]);
80  virtual void GetPoint1DisplayPosition(double pos[3]);
81  virtual void GetPoint2DisplayPosition(double pos[3]);
82  virtual void GetPoint3DisplayPosition(double pos[3]);
83  virtual void GetPoint4DisplayPosition(double pos[3]);
85 
87 
93  vtkGetObjectMacro(Point1Representation, vtkHandleRepresentation);
94  vtkGetObjectMacro(Point2Representation, vtkHandleRepresentation);
95  vtkGetObjectMacro(Point3Representation, vtkHandleRepresentation);
96  vtkGetObjectMacro(Point4Representation, vtkHandleRepresentation);
98 
100 
106  vtkSetMacro(Line1Visibility, vtkTypeBool);
107  vtkGetMacro(Line1Visibility, vtkTypeBool);
108  vtkBooleanMacro(Line1Visibility, vtkTypeBool);
109  vtkSetMacro(Line2Visibility, vtkTypeBool);
110  vtkGetMacro(Line2Visibility, vtkTypeBool);
111  vtkBooleanMacro(Line2Visibility, vtkTypeBool);
113 
115 
129 
131 
136  vtkSetClampMacro(Tolerance, int, 1, 100);
137  vtkGetMacro(Tolerance, int);
139 
144  virtual double GetLength1();
145 
150  virtual double GetLength2();
151 
153 
158  vtkSetStringMacro(LabelFormat);
159  vtkGetStringMacro(LabelFormat);
161 
162  // Used to communicate about the state of the representation
163  enum
164  {
165  Outside = 0,
174  OnCenter
175  };
176 
178 
182  vtkSetMacro(ShowLabelAboveWidget, vtkTypeBool);
183  vtkGetMacro(ShowLabelAboveWidget, vtkTypeBool);
184  vtkBooleanMacro(ShowLabelAboveWidget, vtkTypeBool);
186 
188 
191  void SetID(vtkIdType id);
192  vtkGetMacro(ID, vtkIdType);
194 
198  virtual char* GetLabelText() = 0;
199 
201 
204  virtual double* GetLabelPosition() = 0;
205  virtual void GetLabelPosition(double pos[3]) = 0;
206  virtual void GetWorldLabelPosition(double pos[3]) = 0;
208 
210 
213  virtual void StartWidgetDefinition(double e[2]) = 0;
214  virtual void Point2WidgetInteraction(double e[2]) = 0;
215  virtual void Point3WidgetInteraction(double e[2]) = 0;
216  virtual void StartWidgetManipulation(double e[2]) = 0;
218 
219 protected:
222 
223  // Keep track if modifier is set
224  int Modifier;
225 
226  // The handle and the rep used to close the handles
232 
233  // Selection tolerance for the handles
235 
236  // Visibility of the lines
239 
242 
243  // Internal variables
244  double P1World[3];
245  double P2World[3];
246  double P3World[3];
247  double P4World[3];
248  double P21World[3];
249  double P43World[3];
250  double T21;
251  double T43;
252  double CenterWorld[3];
253  double StartEventPositionWorld[4];
254 
255  // Format for printing the distance
256  char* LabelFormat;
257 
258  // toggle to determine whether to place text above or below widget
260 
261 private:
263  void operator=(const vtkBiDimensionalRepresentation&) = delete;
264 };
265 
266 #endif
represent the vtkBiDimensionalWidget
virtual void GetPoint2DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void SetPoint1DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual double GetLength2()
Return the length of the line defined by (Point3,Point4).
virtual void GetPoint1WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void StartWidgetManipulation(double e[2])=0
These are methods that satisfy vtkWidgetRepresentation's API.
virtual char * GetLabelText()=0
Get the text shown in the widget's label.
virtual void Point2WidgetInteraction(double e[2])=0
These are methods that satisfy vtkWidgetRepresentation's API.
void SetHandleRepresentation(vtkHandleRepresentation *handle)
This method is used to specify the type of handle representation to use for the four internal vtkHand...
virtual void SetPoint3DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void SetPoint2WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void GetPoint4DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void Point3WidgetInteraction(double e[2])=0
These are methods that satisfy vtkWidgetRepresentation's API.
~vtkBiDimensionalRepresentation() override
virtual void GetPoint2WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void SetPoint1WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual double * GetLabelPosition()=0
Get the position of the widget's label in display coordinates.
virtual void GetPoint4WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void StartWidgetDefinition(double e[2])=0
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetPoint4DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void SetPoint2DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
void SetID(vtkIdType id)
Set/get the id to display in the label.
virtual void SetPoint3WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void GetPoint1DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void GetWorldLabelPosition(double pos[3])=0
Get the position of the widget's label in display coordinates.
virtual void GetPoint3WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void SetPoint4WorldPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void GetPoint3DisplayPosition(double pos[3])
Methods to Set/Get the coordinates of the four points defining this representation.
virtual void GetLabelPosition(double pos[3])=0
Get the position of the widget's label in display coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual double GetLength1()
Return the length of the line defined by (Point1,Point2).
virtual void InstantiateHandleRepresentation()
This method is used to specify the type of handle representation to use for the four internal vtkHand...
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332