VTK  9.0.3
vtkBalloonWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBalloonWidget.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 =========================================================================*/
71 #ifndef vtkBalloonWidget_h
72 #define vtkBalloonWidget_h
73 
74 #include "vtkHoverWidget.h"
75 #include "vtkInteractionWidgetsModule.h" // For export macro
76 
78 class vtkProp;
80 class vtkStdString;
81 class vtkPropMap;
82 class vtkImageData;
83 
84 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonWidget : public vtkHoverWidget
85 {
86 public:
90  static vtkBalloonWidget* New();
91 
93 
97  void PrintSelf(ostream& os, vtkIndent indent) override;
99 
104  void SetEnabled(int) override;
105 
112  {
114  }
115 
120  {
121  return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);
122  }
123 
128 
130 
134  void AddBalloon(vtkProp* prop, vtkStdString* str, vtkImageData* img);
135  void AddBalloon(vtkProp* prop, const char* str, vtkImageData* img);
136  void AddBalloon(vtkProp* prop, const char* str) // for wrapping
137  {
138  this->AddBalloon(prop, str, nullptr);
139  }
140  void RemoveBalloon(vtkProp* prop);
142 
144 
150  const char* GetBalloonString(vtkProp* prop);
153 
155 
159  void UpdateBalloonString(vtkProp* prop, const char* str);
162 
167  virtual vtkProp* GetCurrentProp() { return this->CurrentProp; }
168 
170 
177  vtkGetObjectMacro(Picker, vtkAbstractPropPicker);
179 
180  /*
181  * Register internal Pickers within PickingManager
182  */
183  void RegisterPickers() override;
184 
185 protected:
187  ~vtkBalloonWidget() override;
188 
189  // This class implements the method called from its superclass.
190  int SubclassEndHoverAction() override;
191  int SubclassHoverAction() override;
192 
193  // Classes for managing balloons
194  vtkPropMap* PropMap; // PIMPL'd map of (vtkProp,vtkStdString)
195 
196  // Support for picking
198 
199  // The vtkProp that is being hovered over (which may be nullptr)
201 
202 private:
203  vtkBalloonWidget(const vtkBalloonWidget&) = delete;
204  void operator=(const vtkBalloonWidget&) = delete;
205 };
206 
207 #endif
abstract API for pickers that can pick an instance of vtkProp
void SetWidgetRepresentation(vtkWidgetRepresentation *r)
vtkWidgetRepresentation * WidgetRep
represent the vtkBalloonWidget
popup text balloons above instance of vtkProp when hovering occurs
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
void SetEnabled(int) override
The method for activating and deactivating this widget.
~vtkBalloonWidget() override
const char * GetBalloonString(vtkProp *prop)
Methods to retrieve the information associated with each vtkProp (i.e., the information that makes up...
vtkBalloonRepresentation * GetBalloonRepresentation()
Return the representation as a vtkBalloonRepresentation.
void RemoveBalloon(vtkProp *prop)
vtkPropMap * PropMap
virtual vtkProp * GetCurrentProp()
Return the current vtkProp that is being hovered over.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetPicker(vtkAbstractPropPicker *)
Set/Get the object used to perform pick operations.
void UpdateBalloonImage(vtkProp *prop, vtkImageData *image)
void AddBalloon(vtkProp *prop, const char *str)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void UpdateBalloonString(vtkProp *prop, const char *str)
Update the balloon string or image.
static vtkBalloonWidget * New()
Instantiate this class.
int SubclassHoverAction() override
void SetRepresentation(vtkBalloonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
int SubclassEndHoverAction() override
void AddBalloon(vtkProp *prop, vtkStdString *str, vtkImageData *img)
Add and remove text and/or an image to be associated with a vtkProp.
vtkAbstractPropPicker * Picker
void AddBalloon(vtkProp *prop, const char *str, vtkImageData *img)
vtkImageData * GetBalloonImage(vtkProp *prop)
invoke a vtkTimerEvent when hovering
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
abstract class defines interface between the widget and widget representation classes
@ image
Definition: vtkX3D.h:380