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 
29 #ifndef vtkContextScene_h
30 #define vtkContextScene_h
31 
32 #include "vtkRenderingContext2DModule.h" // For export macro
33 #include "vtkObject.h"
34 #include "vtkWeakPointer.h" // Needed for weak pointer to the window.
35 #include "vtkVector.h" // For vtkVector return type.
36 
37 class vtkContext2D;
39 class vtkTransform2D;
41 class vtkContextKeyEvent;
44 
45 class vtkAnnotationLink;
46 
47 class vtkRenderer;
49 
50 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextScene : public vtkObject
51 {
52 public:
53  vtkTypeMacro(vtkContextScene, vtkObject);
54  virtual void PrintSelf(ostream &os, vtkIndent indent);
55 
59  static vtkContextScene * New();
60 
64  virtual bool Paint(vtkContext2D *painter);
65 
70  unsigned int AddItem(vtkAbstractContextItem* item);
71 
77  bool RemoveItem(vtkAbstractContextItem* item);
78 
84  bool RemoveItem(unsigned int index);
85 
90  vtkAbstractContextItem* GetItem(unsigned int index);
91 
95  unsigned int GetNumberOfItems();
96 
100  void ClearItems();
101 
105  virtual void SetAnnotationLink(vtkAnnotationLink *link);
106 
108 
111  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
113 
115 
118  vtkSetVector2Macro(Geometry, int);
120 
122 
125  vtkGetVector2Macro(Geometry, int);
127 
129 
132  vtkSetMacro(UseBufferId, bool);
134 
136 
139  vtkGetMacro(UseBufferId, bool);
141 
145  virtual int GetViewWidth();
146 
150  virtual int GetViewHeight();
151 
155  int GetSceneWidth();
156 
160  int GetSceneHeight();
161 
163 
168  vtkSetMacro(ScaleTiles, bool);
169  vtkGetMacro(ScaleTiles, bool);
170  vtkBooleanMacro(ScaleTiles, bool);
172 
179  vtkVector2i GetLogicalTileScale();
180 
182 
186  virtual void SetRenderer(vtkRenderer *renderer);
187  virtual vtkRenderer* GetRenderer();
189 
191 
196  void SetDirty(bool isDirty);
197  bool GetDirty()const;
199 
203  void ReleaseGraphicsResources();
204 
210  vtkWeakPointer<vtkContext2D> GetLastPainter();
211 
217  vtkAbstractContextBufferId *GetBufferId();
218 
222  virtual void SetTransform(vtkTransform2D *transform);
223 
227  vtkTransform2D* GetTransform();
228 
232  bool HasTransform() { return this->Transform != 0; }
233 
237  enum {
238  SELECTION_NONE = 0,
242  SELECTION_TOGGLE
243  };
244 
245 protected:
246  vtkContextScene();
247  ~vtkContextScene();
248 
252  virtual bool ProcessSelectionEvent(unsigned int rect[5]);
253 
257  virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
258 
262  virtual bool ButtonPressEvent(const vtkContextMouseEvent &event);
263 
267  virtual bool ButtonReleaseEvent(const vtkContextMouseEvent &event);
268 
272  virtual bool DoubleClickEvent(const vtkContextMouseEvent &event);
273 
277  virtual bool MouseWheelEvent(int delta, const vtkContextMouseEvent &event);
278 
282  virtual bool KeyPressEvent(const vtkContextKeyEvent& keyEvent);
283 
287  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& keyEvent);
288 
293  virtual void PaintIds();
294 
298  void TestBufferIdSupport();
299 
305  vtkIdType GetPickedItem(int x, int y);
306 
311  vtkAbstractContextItem* GetPickedItem();
312 
316  void UpdateBufferId();
317 
319 
320  // Store the chart dimensions - width, height of scene in pixels
321  int Geometry[2];
322 
328 
330 
333  class Private;
334  Private *Storage;
336 
343 
345 
347 
350 
352 
355 
357 
362 
363 private:
364  vtkContextScene(const vtkContextScene &) VTK_DELETE_FUNCTION;
365  void operator=(const vtkContextScene &) VTK_DELETE_FUNCTION;
366 
367  typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
368  bool ProcessItem(vtkAbstractContextItem* cur,
369  const vtkContextMouseEvent& event,
370  MouseEvents eventPtr);
371  void EventCopy(const vtkContextMouseEvent &event);
372 
373 };
374 
375 #endif //vtkContextScene_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:63
vtkWeakPointer< vtkRenderer > Renderer
bool HasTransform()
Check whether the scene has a transform.
int vtkIdType
Definition: vtkType.h:287
vtkWeakPointer< vtkContext2D > LastPainter
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
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:39
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:327
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.
vtkContextScenePrivate * Children
This structure provides a list of children, along with convenience functions to paint the children et...
vtkAbstractContextBufferId * BufferId
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...
vtkTransform2D * Transform
The scene level transform.
vtkAnnotationLink * AnnotationLink
Transform
Definition: ADIOSDefs.h:39