VTK
vtkContextScene.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextScene.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 =========================================================================*/
15 
26 #ifndef vtkContextScene_h
27 #define vtkContextScene_h
28 
29 #include "vtkRenderingContext2DModule.h" // For export macro
30 #include "vtkObject.h"
31 #include "vtkWeakPointer.h" // Needed for weak pointer to the window.
32 #include "vtkVector.h" // For vtkVector return type.
33 
34 class vtkContext2D;
36 class vtkTransform2D;
38 class vtkContextKeyEvent;
41 
42 class vtkAnnotationLink;
43 
44 class vtkRenderer;
46 
47 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextScene : public vtkObject
48 {
49 public:
50  vtkTypeMacro(vtkContextScene, vtkObject);
51  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
52 
56  static vtkContextScene * New();
57 
61  virtual bool Paint(vtkContext2D *painter);
62 
67  unsigned int AddItem(vtkAbstractContextItem* item);
68 
74  bool RemoveItem(vtkAbstractContextItem* item);
75 
81  bool RemoveItem(unsigned int index);
82 
87  vtkAbstractContextItem* GetItem(unsigned int index);
88 
92  unsigned int GetNumberOfItems();
93 
97  void ClearItems();
98 
102  virtual void SetAnnotationLink(vtkAnnotationLink *link);
103 
105 
108  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
110 
112 
115  vtkSetVector2Macro(Geometry, int);
117 
119 
122  vtkGetVector2Macro(Geometry, int);
124 
126 
129  vtkSetMacro(UseBufferId, bool);
131 
133 
136  vtkGetMacro(UseBufferId, bool);
138 
142  virtual int GetViewWidth();
143 
147  virtual int GetViewHeight();
148 
152  int GetSceneWidth();
153 
157  int GetSceneHeight();
158 
160 
165  vtkSetMacro(ScaleTiles, bool);
166  vtkGetMacro(ScaleTiles, bool);
167  vtkBooleanMacro(ScaleTiles, bool);
169 
176  vtkVector2i GetLogicalTileScale();
177 
179 
183  virtual void SetRenderer(vtkRenderer *renderer);
184  virtual vtkRenderer* GetRenderer();
186 
188 
193  void SetDirty(bool isDirty);
194  bool GetDirty()const;
196 
200  void ReleaseGraphicsResources();
201 
207  vtkWeakPointer<vtkContext2D> GetLastPainter();
208 
214  vtkAbstractContextBufferId *GetBufferId();
215 
219  virtual void SetTransform(vtkTransform2D *transform);
220 
224  vtkTransform2D* GetTransform();
225 
229  bool HasTransform() { return this->Transform != 0; }
230 
234  enum {
235  SELECTION_NONE = 0,
239  SELECTION_TOGGLE
240  };
241 
242 protected:
243  vtkContextScene();
244  ~vtkContextScene() VTK_OVERRIDE;
245 
249  virtual bool ProcessSelectionEvent(unsigned int rect[5]);
250 
254  virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
255 
259  virtual bool ButtonPressEvent(const vtkContextMouseEvent &event);
260 
264  virtual bool ButtonReleaseEvent(const vtkContextMouseEvent &event);
265 
269  virtual bool DoubleClickEvent(const vtkContextMouseEvent &event);
270 
274  virtual bool MouseWheelEvent(int delta, const vtkContextMouseEvent &event);
275 
279  virtual bool KeyPressEvent(const vtkContextKeyEvent& keyEvent);
280 
284  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& keyEvent);
285 
290  virtual void PaintIds();
291 
295  void TestBufferIdSupport();
296 
302  vtkIdType GetPickedItem(int x, int y);
303 
308  vtkAbstractContextItem* GetPickedItem();
309 
313  void UpdateBufferId();
314 
315  vtkAnnotationLink *AnnotationLink;
316 
317  // Store the chart dimensions - width, height of scene in pixels
318  int Geometry[2];
319 
325 
327 
330  class Private;
331  Private *Storage;
333 
340 
342 
344 
346  bool BufferIdDirty;
347 
348  bool UseBufferId;
349 
350  bool BufferIdSupportTested;
351  bool BufferIdSupported;
352 
353  bool ScaleTiles;
354 
359 
360 private:
361  vtkContextScene(const vtkContextScene &) VTK_DELETE_FUNCTION;
362  void operator=(const vtkContextScene &) VTK_DELETE_FUNCTION;
363 
364  typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
365  bool ProcessItem(vtkAbstractContextItem* cur,
366  const vtkContextMouseEvent& event,
367  MouseEvents eventPtr);
368  void EventCopy(const vtkContextMouseEvent &event);
369 
370 };
371 
372 #endif //vtkContextScene_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Private implementation for scene/items.
abstract specification for renderers
Definition: vtkRenderer.h:57
bool HasTransform()
Check whether the scene has a transform.
int vtkIdType
Definition: vtkType.h:345
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
An interactor for chart views.
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:324
describes linear transformations via a 3x3 matrix
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
2D array of ids, used for picking.
base class for items that are part of a vtkContextScene.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Transform
Definition: ADIOSDefs.h:39