VTK  9.2.6
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=========================================================================*/
101#ifndef vtkBorderRepresentation_h
102#define vtkBorderRepresentation_h
103
104#include "vtkCoordinate.h" //Because of the viewport coordinate macro
105#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
106#include "vtkInteractionWidgetsModule.h" // For export macro
108
109#include "vtkNew.h" // for ivars
110
111class vtkPoints;
112class vtkPolyData;
113class vtkTransform;
116class vtkActor2D;
117class vtkProperty2D;
118class vtkCellArray;
119
120class VTKINTERACTIONWIDGETS_EXPORT vtkBorderRepresentation : public vtkWidgetRepresentation
121{
122public:
127
129
133 void PrintSelf(ostream& os, vtkIndent indent) override;
135
137
146 vtkViewportCoordinateMacro(Position);
147 vtkViewportCoordinateMacro(Position2);
149
150 enum
151 {
152 BORDER_OFF = 0,
154 BORDER_ACTIVE
155 };
156
158
169 virtual void SetShowBorder(int border);
172 virtual int GetShowBorder();
173 void SetShowBorderToOff() { this->SetShowBorder(BORDER_OFF); }
174 void SetShowBorderToOn() { this->SetShowBorder(BORDER_ON); }
175 void SetShowBorderToActive() { this->SetShowBorder(BORDER_ACTIVE); }
177
179
184 vtkSetClampMacro(ShowVerticalBorder, int, BORDER_OFF, BORDER_ACTIVE);
185 vtkGetMacro(ShowVerticalBorder, int);
187
189
194 vtkSetClampMacro(ShowHorizontalBorder, int, BORDER_OFF, BORDER_ACTIVE);
195 vtkGetMacro(ShowHorizontalBorder, int);
197
199
202 vtkGetObjectMacro(BorderProperty, vtkProperty2D);
204
206
211 virtual void SetShowPolygon(int border);
212 virtual int GetShowPolygon();
213 void SetShowPolygonToOff() { this->SetShowPolygon(BORDER_OFF); }
214 void SetShowPolygonToOn() { this->SetShowPolygon(BORDER_ON); }
215 void SetShowPolygonToActive() { this->SetShowPolygon(BORDER_ACTIVE); }
217
219
224 vtkSetClampMacro(ShowPolygonBackground, int, BORDER_OFF, BORDER_ACTIVE);
225 vtkGetMacro(ShowPolygonBackground, int);
227
229
239 vtkSetMacro(EnforceNormalizedViewportBounds, vtkTypeBool);
240 vtkGetMacro(EnforceNormalizedViewportBounds, vtkTypeBool);
241 vtkBooleanMacro(EnforceNormalizedViewportBounds, vtkTypeBool);
243
245
254 vtkSetMacro(ProportionalResize, vtkTypeBool);
255 vtkGetMacro(ProportionalResize, vtkTypeBool);
256 vtkBooleanMacro(ProportionalResize, vtkTypeBool);
258
260
267 vtkSetVector2Macro(MinimumNormalizedViewportSize, double);
268 vtkGetVector2Macro(MinimumNormalizedViewportSize, double);
270
272
279 vtkSetVector2Macro(MinimumSize, int);
280 vtkGetVector2Macro(MinimumSize, int);
281 vtkSetVector2Macro(MaximumSize, int);
282 vtkGetVector2Macro(MaximumSize, int);
284
286
293 vtkSetClampMacro(Tolerance, int, 1, 10);
294 vtkGetMacro(Tolerance, int);
296
298
302 vtkGetVectorMacro(SelectionPoint, double, 2);
304
306
311 vtkSetMacro(Moving, vtkTypeBool);
312 vtkGetMacro(Moving, vtkTypeBool);
313 vtkBooleanMacro(Moving, vtkTypeBool);
315
316 enum
317 {
318 AnyLocation = 0,
324 UpperCenter
325 };
326
328
339 virtual void SetWindowLocation(int enumLocation);
340 vtkGetMacro(WindowLocation, int);
342
347 {
348 Outside = 0,
357 AdjustingE3
358 };
359#if !defined(VTK_LEGACY_REMOVE)
360 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
362#endif
363
364 vtkSetClampMacro(InteractionState, int, 0, AdjustingE3);
365
371
373
377 void BuildRepresentation() override;
378 void StartWidgetInteraction(double eventPos[2]) override;
379 void WidgetInteraction(double eventPos[2]) override;
380 virtual void GetSize(double size[2])
381 {
382 size[0] = 1.0;
383 size[1] = 1.0;
384 }
385 int ComputeInteractionState(int X, int Y, int modify = 0) override;
387
389
400
402 "SetBWActorDisplayOverlay is deprecated. Use "
403 "SetBWActorDisplayOverlayEdges or SetBWActorDisplayOverlayPolygon instead.")
404 void SetBWActorDisplayOverlay(bool);
405
406 void SetBWActorDisplayOverlayEdges(bool);
407 void SetBWActorDisplayOverlayPolygon(bool);
408
410
414 vtkSetVector3Macro(BorderColor, double);
415 vtkGetVector3Macro(BorderColor, double);
417
419
423 vtkSetClampMacro(BorderThickness, float, 0, VTK_FLOAT_MAX);
424 vtkGetMacro(BorderThickness, float);
426
428
436 vtkSetClampMacro(CornerRadiusStrength, double, 0.0, 1.0);
437 vtkGetMacro(CornerRadiusStrength, double);
439
441
446 vtkSetClampMacro(CornerResolution, int, 0, 1000);
447 vtkGetMacro(CornerResolution, int);
449
451
455 vtkSetVector3Macro(PolygonColor, double);
456 vtkGetVector3Macro(PolygonColor, double);
458
460
464 vtkSetClampMacro(PolygonOpacity, double, 0.0, 1.0);
465 vtkGetMacro(PolygonOpacity, double);
467
469
472 void SetPolygonRGBA(double rgba[4]);
473 void SetPolygonRGBA(double r, double g, double b, double a);
474
478 void GetPolygonRGBA(double rgba[4]);
479 void GetPolygonRGBA(double& r, double& g, double& b, double& a);
481
482protected:
485
486 // Ivars
487 int ShowVerticalBorder = BORDER_ON;
488 int ShowHorizontalBorder = BORDER_ON;
489 int ShowPolygonBackground = BORDER_ON;
490 vtkNew<vtkProperty2D> BorderProperty;
491 vtkNew<vtkProperty2D> PolygonProperty;
492 vtkTypeBool EnforceNormalizedViewportBounds = 0;
493 vtkTypeBool ProportionalResize = 0;
494 int Tolerance = 3;
495 vtkTypeBool Moving = 0;
496 double SelectionPoint[2] = { 0.0, 0.0 };
497
498 // Layout (position of lower left and upper right corners of border)
501
502 // Window location by enumeration
503 int WindowLocation = AnyLocation;
504 virtual void UpdateWindowLocation();
505
506 // Sometimes subclasses must negotiate with their superclasses
507 // to achieve the correct layout.
509 virtual void NegotiateLayout();
510
511 // Update the border visibility based on InteractionState.
512 // See Also: SetShowHorizontalBorder(), SetShowHorizontalBorder(),
513 // ComputeInteractionState()
514 virtual void UpdateShowBorder();
515
516 // Keep track of start position when moving border
517 double StartPosition[2];
518
519 // Border representation. Subclasses may use the BWTransform class
520 // to transform their geometry into the region surrounded by the border.
531
532 // Constraints on size
533 double MinimumNormalizedViewportSize[2] = { 0.0, 0.0 };
534 int MinimumSize[2] = { 1, 1 };
535 int MaximumSize[2] = { VTK_INT_MAX, VTK_INT_MAX };
536
537 // Properties of the border
538 double BorderColor[3] = { 1.0, 1.0, 1.0 };
539 float BorderThickness = 1.0;
540 double CornerRadiusStrength = 0.0;
541 int CornerResolution = 20;
542
543 // Properties of the inner polygon (ie. the background)
544 double PolygonColor[3] = { 1.0, 1.0, 1.0 };
545 double PolygonOpacity = 0.0;
546
551
560 vtkIdType xPt, vtkIdType yPt, const double startAngle);
561
562private:
564 void operator=(const vtkBorderRepresentation&) = delete;
565};
566
567#endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
represent a vtkBorderWidget
virtual void GetSize(double size[2])
Subclasses should implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
virtual int GetShowBorderMinValue()
Specify when and if the border should appear.
vtkNew< vtkPolyDataMapper2D > BWMapperEdges
void SetShowPolygonToOn()
Specify when and if the border's polygon background should appear.
vtkNew< vtkActor2D > BWActorPolygon
void SetShowBorderToActive()
Specify when and if the border should appear.
void WidgetInteraction(double eventPos[2]) override
Subclasses should implement these methods.
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
void SetShowPolygonToOff()
Specify when and if the border's polygon background should appear.
virtual void SetWindowLocation(int enumLocation)
Set the representation position, by enumeration ( AnyLocation = 0, LowerLeftCorner,...
static vtkBorderRepresentation * New()
Instantiate this class.
vtkNew< vtkCoordinate > PositionCoordinate
void ComputeRoundCorners()
Create all 4 round corners with the specified radius and resolution.
vtkNew< vtkCoordinate > Position2Coordinate
virtual void NegotiateLayout()
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
int ComputeInteractionState(int X, int Y, int modify=0) override
Subclasses should implement these methods.
void SetShowBorderToOn()
Specify when and if the border should appear.
InteractionStateType
Define the various states that the representation can be in.
virtual void SetShowBorder(int border)
Specify when and if the border should appear.
void StartWidgetInteraction(double eventPos[2]) override
Subclasses should implement these methods.
vtkNew< vtkTransform > BWTransform
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
virtual int GetShowPolygon()
Specify when and if the border's polygon background should appear.
virtual int GetShowBorderMaxValue()
Specify when and if the border should appear.
void PrintSelf(ostream &os, vtkIndent indent) override
Define standard methods.
virtual void UpdateWindowLocation()
void SetShowPolygonToActive()
Specify when and if the border's polygon background should appear.
vtkNew< vtkPolyDataMapper2D > BWMapperPolygon
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
void BuildRepresentation() override
Subclasses should implement these methods.
virtual void SetShowPolygon(int border)
Specify when and if the border's polygon background should appear.
void ComputeOneRoundCorner(vtkCellArray *polys, vtkPoints *points, const double radius, vtkIdType xPt, vtkIdType yPt, const double startAngle)
Create a quarter circle centered in point[idCenterX].x, point[idCenterY].y), of radius 'radius' with ...
virtual int GetShowBorder()
Specify when and if the border should appear.
vtkNew< vtkPolyData > PolyDataEdges
vtkNew< vtkActor2D > BWActorEdges
vtkNew< vtkTransformPolyDataFilter > BWTransformFilter
vtkNew< vtkPolyData > BWPolyData
void SetShowBorderToOff()
Specify when and if the border should appear.
vtkNew< vtkPolyData > PolyDataPolygon
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkMTimeType GetMTime() override
Return the MTime of this object.
virtual void UpdateShowBorder()
object to represent cell connectivity
Definition: vtkCellArray.h:296
a simple class to control print indentation
Definition: vtkIndent.h:119
Allocate and hold a VTK object.
Definition: vtkNew.h:171
represent and manipulate 3D points
Definition: vtkPoints.h:149
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
an ordered list of Props
represent surface properties of a 2D image
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
abstract specification for Viewports
Definition: vtkViewport.h:56
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ points
Definition: vtkX3D.h:452
@ startAngle
Definition: vtkX3D.h:492
@ radius
Definition: vtkX3D.h:258
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_FLOAT_MAX
Definition: vtkType.h:163