VTK  9.1.0
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 =========================================================================*/
90 #ifndef vtkBalloonWidget_h
91 #define vtkBalloonWidget_h
92 
93 #include "vtkHoverWidget.h"
94 #include "vtkInteractionWidgetsModule.h" // For export macro
95 
97 class vtkProp;
99 class vtkStdString;
100 class vtkPropMap;
101 class vtkImageData;
102 
103 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonWidget : public vtkHoverWidget
104 {
105 public:
110 
112 
116  void PrintSelf(ostream& os, vtkIndent indent) override;
118 
123  void SetEnabled(int) override;
124 
131  {
133  }
134 
139  {
140  return reinterpret_cast<vtkBalloonRepresentation*>(this->WidgetRep);
141  }
142 
147 
149 
153  void AddBalloon(vtkProp* prop, vtkStdString* str, vtkImageData* img);
154  void AddBalloon(vtkProp* prop, const char* str, vtkImageData* img);
155  void AddBalloon(vtkProp* prop, const char* str) // for wrapping
156  {
157  this->AddBalloon(prop, str, nullptr);
158  }
159  void RemoveBalloon(vtkProp* prop);
161 
163 
169  const char* GetBalloonString(vtkProp* prop);
172 
174 
178  void UpdateBalloonString(vtkProp* prop, const char* str);
181 
186  virtual vtkProp* GetCurrentProp() { return this->CurrentProp; }
187 
189 
196  vtkGetObjectMacro(Picker, vtkAbstractPropPicker);
198 
199  /*
200  * Register internal Pickers within PickingManager
201  */
202  void RegisterPickers() override;
203 
204 protected:
206  ~vtkBalloonWidget() override;
207 
208  // This class implements the method called from its superclass.
209  int SubclassEndHoverAction() override;
210  int SubclassHoverAction() override;
211 
212  // Classes for managing balloons
213  vtkPropMap* PropMap; // PIMPL'd map of (vtkProp,vtkStdString)
214 
215  // Support for picking
217 
218  // The vtkProp that is being hovered over (which may be nullptr)
220 
221 private:
222  vtkBalloonWidget(const vtkBalloonWidget&) = delete;
223  void operator=(const vtkBalloonWidget&) = delete;
224 };
225 
226 #endif
vtkBalloonWidget::vtkBalloonWidget
vtkBalloonWidget()
vtkBalloonWidget::SetPicker
void SetPicker(vtkAbstractPropPicker *)
Set/Get the object used to perform pick operations.
vtkBalloonWidget
popup text balloons above instance of vtkProp when hovering occurs
Definition: vtkBalloonWidget.h:104
vtkBalloonWidget::New
static vtkBalloonWidget * New()
Instantiate this class.
vtkBalloonWidget::SetEnabled
void SetEnabled(int) override
The method for activating and deactivating this widget.
vtkBalloonWidget::UpdateBalloonImage
void UpdateBalloonImage(vtkProp *prop, vtkImageData *image)
Update the balloon string or image.
vtkBalloonWidget::Picker
vtkAbstractPropPicker * Picker
Definition: vtkBalloonWidget.h:216
vtkBalloonWidget::RemoveBalloon
void RemoveBalloon(vtkProp *prop)
Add and remove text and/or an image to be associated with a vtkProp.
vtkX3D::image
@ image
Definition: vtkX3D.h:380
vtkHoverWidget
invoke a vtkTimerEvent when hovering
Definition: vtkHoverWidget.h:102
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:175
vtkBalloonWidget::GetCurrentProp
virtual vtkProp * GetCurrentProp()
Return the current vtkProp that is being hovered over.
Definition: vtkBalloonWidget.h:186
vtkBalloonWidget::AddBalloon
void AddBalloon(vtkProp *prop, const char *str)
Add and remove text and/or an image to be associated with a vtkProp.
Definition: vtkBalloonWidget.h:155
vtkBalloonWidget::PropMap
vtkPropMap * PropMap
Definition: vtkBalloonWidget.h:213
vtkBalloonWidget::SubclassHoverAction
int SubclassHoverAction() override
vtkBalloonWidget::SetRepresentation
void SetRepresentation(vtkBalloonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkBalloonWidget.h:130
vtkBalloonWidget::RegisterPickers
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkBalloonWidget::GetBalloonString
const char * GetBalloonString(vtkProp *prop)
Methods to retrieve the information associated with each vtkProp (i.e., the information that makes up...
vtkBalloonWidget::GetBalloonImage
vtkImageData * GetBalloonImage(vtkProp *prop)
Methods to retrieve the information associated with each vtkProp (i.e., the information that makes up...
vtkBalloonWidget::AddBalloon
void AddBalloon(vtkProp *prop, vtkStdString *str, vtkImageData *img)
Add and remove text and/or an image to be associated with a vtkProp.
vtkBalloonWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkBalloonWidget::~vtkBalloonWidget
~vtkBalloonWidget() override
vtkAbstractPropPicker
abstract API for pickers that can pick an instance of vtkProp
Definition: vtkAbstractPropPicker.h:80
vtkBalloonRepresentation
represent the vtkBalloonWidget
Definition: vtkBalloonRepresentation.h:96
vtkBalloonWidget::CurrentProp
vtkProp * CurrentProp
Definition: vtkBalloonWidget.h:219
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
vtkBalloonWidget::UpdateBalloonString
void UpdateBalloonString(vtkProp *prop, const char *str)
Update the balloon string or image.
vtkHoverWidget.h
vtkBalloonWidget::AddBalloon
void AddBalloon(vtkProp *prop, const char *str, vtkImageData *img)
Add and remove text and/or an image to be associated with a vtkProp.
vtkBalloonWidget::GetBalloonRepresentation
vtkBalloonRepresentation * GetBalloonRepresentation()
Return the representation as a vtkBalloonRepresentation.
Definition: vtkBalloonWidget.h:138
vtkBalloonWidget::SubclassEndHoverAction
int SubclassEndHoverAction() override
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
vtkAbstractWidget::SetWidgetRepresentation
void SetWidgetRepresentation(vtkWidgetRepresentation *r)
vtkBalloonWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for a VTK class.