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 
28 #ifndef vtkContextScene_h
29 #define vtkContextScene_h
30 
31 #include "vtkRenderingContext2DModule.h" // For export macro
32 #include "vtkObject.h"
33 #include "vtkWeakPointer.h" // Needed for weak pointer to the window.
34 #include "vtkVector.h" // For vtkVector return type.
35 
36 class vtkContext2D;
38 class vtkTransform2D;
40 class vtkContextKeyEvent;
43 
44 class vtkAnnotationLink;
45 
46 class vtkRenderer;
48 
50 {
51 public:
52  vtkTypeMacro(vtkContextScene, vtkObject);
53  virtual void PrintSelf(ostream &os, vtkIndent indent);
54 
56  static vtkContextScene * New();
57 
60  virtual bool Paint(vtkContext2D *painter);
61 
64  unsigned int AddItem(vtkAbstractContextItem* item);
65 
69  bool RemoveItem(vtkAbstractContextItem* item);
70 
74  bool RemoveItem(unsigned int index);
75 
78  vtkAbstractContextItem* GetItem(unsigned int index);
79 
81  unsigned int GetNumberOfItems();
82 
84  void ClearItems();
85 
87  virtual void SetAnnotationLink(vtkAnnotationLink *link);
88 
90 
91  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
93 
95 
96  vtkSetVector2Macro(Geometry, int);
98 
100 
101  vtkGetVector2Macro(Geometry, int);
103 
105 
106  vtkSetMacro(UseBufferId, bool);
108 
110 
111  vtkGetMacro(UseBufferId, bool);
113 
115  virtual int GetViewWidth();
116 
118  virtual int GetViewHeight();
119 
121  int GetSceneWidth();
122 
124  int GetSceneHeight();
125 
127 
130  vtkSetMacro(ScaleTiles, bool);
131  vtkGetMacro(ScaleTiles, bool);
132  vtkBooleanMacro(ScaleTiles, bool);
134 
139  vtkVector2i GetLogicalTileScale();
140 
143  virtual void SetRenderer(vtkRenderer *renderer);
144 
146 
149  void SetDirty(bool isDirty);
150  bool GetDirty()const;
152 
153 //BTX
155  void ReleaseGraphicsResources();
156 
160  vtkWeakPointer<vtkContext2D> GetLastPainter();
161 
165  vtkAbstractContextBufferId *GetBufferId();
166 
168  virtual void SetTransform(vtkTransform2D *transform);
169 
171  vtkTransform2D* GetTransform();
172 
174  bool HasTransform() { return this->Transform != 0; }
175 
177 
178  enum {
179  SELECTION_NONE = 0,
183  SELECTION_TOGGLE
184  };
186 
187 protected:
188  vtkContextScene();
189  ~vtkContextScene();
190 
192  virtual bool ProcessSelectionEvent(unsigned int rect[5]);
193 
195  virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
196 
198  virtual bool ButtonPressEvent(const vtkContextMouseEvent &event);
199 
201  virtual bool ButtonReleaseEvent(const vtkContextMouseEvent &event);
202 
204  virtual bool DoubleClickEvent(const vtkContextMouseEvent &event);
205 
208  virtual bool MouseWheelEvent(int delta, const vtkContextMouseEvent &event);
209 
211  virtual bool KeyPressEvent(const vtkContextKeyEvent& keyEvent);
212 
214  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& keyEvent);
215 
218  virtual void PaintIds();
219 
221  void TestBufferIdSupport();
222 
226  vtkIdType GetPickedItem(int x, int y);
227 
230  vtkAbstractContextItem* GetPickedItem();
231 
233  void UpdateBufferId();
234 
236 
237  // Store the chart dimensions - width, height of scene in pixels
238  int Geometry[2];
239 
243 
245 
246  class Private;
247  Private *Storage;
249 
254 
256 
258 
261 
263 
266 
268 
271 
272 private:
273  vtkContextScene(const vtkContextScene &); // Not implemented.
274  void operator=(const vtkContextScene &); // Not implemented.
275 
276  typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
277  bool ProcessItem(vtkAbstractContextItem* cur,
278  const vtkContextMouseEvent& event,
279  MouseEvents eventPtr);
280  void EventCopy(const vtkContextMouseEvent &event);
281 //ETX
282 };
283 
284 #endif //vtkContextScene_h
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:61
Private implementation for scene/items.
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkWeakPointer< vtkRenderer > Renderer
int vtkIdType
Definition: vtkType.h:275
vtkWeakPointer< vtkContext2D > LastPainter
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
An interactor for chart views It observes the user events (mouse events) and propagates them to the s...
virtual void PrintSelf(ostream &os, vtkIndent indent)
#define VTKRENDERINGCONTEXT2D_EXPORT
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:38
describes linear transformations via a 3x3 matrix
2D array of ids, used for picking.
vtkContextScenePrivate * Children
vtkAbstractContextBufferId * BufferId
base class for items that are part of a vtkContextScene.
static vtkObject * New()
vtkTransform2D * Transform
vtkAnnotationLink * AnnotationLink