VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
35 class vtkContext2D;
37 class vtkTransform2D;
39 class vtkContextKeyEvent;
42 
43 class vtkAnnotationLink;
44 
45 class vtkRenderer;
47 
49 {
50 public:
52  virtual void PrintSelf(ostream &os, vtkIndent indent);
53 
55  static vtkContextScene * New();
56 
59  virtual bool Paint(vtkContext2D *painter);
60 
63  unsigned int AddItem(vtkAbstractContextItem* item);
64 
68  bool RemoveItem(vtkAbstractContextItem* item);
69 
73  bool RemoveItem(unsigned int index);
74 
77  vtkAbstractContextItem* GetItem(unsigned int index);
78 
80  unsigned int GetNumberOfItems();
81 
83  void ClearItems();
84 
86  virtual void SetAnnotationLink(vtkAnnotationLink *link);
87 
89 
90  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
92 
94 
95  vtkSetVector2Macro(Geometry, int);
97 
99 
100  vtkGetVector2Macro(Geometry, int);
102 
104 
105  vtkSetMacro(UseBufferId, bool);
107 
109 
110  vtkGetMacro(UseBufferId, bool);
112 
114  virtual int GetViewWidth();
115 
117  virtual int GetViewHeight();
118 
120  int GetSceneWidth();
121 
123  int GetSceneHeight();
124 
126 
129  vtkSetMacro(ScaleTiles, bool);
130  vtkGetMacro(ScaleTiles, bool);
131  vtkBooleanMacro(ScaleTiles, bool);
133 
136  virtual void SetRenderer(vtkRenderer *renderer);
137 
139 
142  void SetDirty(bool isDirty);
143  bool GetDirty()const;
145 
146 //BTX
148  void ReleaseGraphicsResources();
149 
153  vtkWeakPointer<vtkContext2D> GetLastPainter();
154 
158  vtkAbstractContextBufferId *GetBufferId();
159 
161  virtual void SetTransform(vtkTransform2D *transform);
162 
164  vtkTransform2D* GetTransform();
165 
167  bool HasTransform() { return this->Transform != 0; }
168 
170 
171  enum {
172  SELECTION_NONE = 0,
176  SELECTION_TOGGLE
177  };
179 
180 protected:
181  vtkContextScene();
182  ~vtkContextScene();
183 
185  virtual bool ProcessSelectionEvent(unsigned int rect[5]);
186 
188  virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
189 
191  virtual bool ButtonPressEvent(const vtkContextMouseEvent &event);
192 
194  virtual bool ButtonReleaseEvent(const vtkContextMouseEvent &event);
195 
197  virtual bool DoubleClickEvent(const vtkContextMouseEvent &event);
198 
201  virtual bool MouseWheelEvent(int delta, const vtkContextMouseEvent &event);
202 
204  virtual bool KeyPressEvent(const vtkContextKeyEvent& keyEvent);
205 
207  virtual bool KeyReleaseEvent(const vtkContextKeyEvent& keyEvent);
208 
211  virtual void PaintIds();
212 
214  void TestBufferIdSupport();
215 
219  vtkIdType GetPickedItem(int x, int y);
220 
223  vtkAbstractContextItem* GetPickedItem();
224 
226  void UpdateBufferId();
227 
229 
230  // Store the chart dimensions - width, height of scene in pixels
231  int Geometry[2];
232 
236 
238 
239  class Private;
240  Private *Storage;
242 
247 
249 
251 
254 
256 
259 
261 
264 
265 private:
266  vtkContextScene(const vtkContextScene &); // Not implemented.
267  void operator=(const vtkContextScene &); // Not implemented.
268 
269  typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
270  bool ProcessItem(vtkAbstractContextItem* cur,
272  MouseEvents eventPtr);
273  void EventCopy(const vtkContextMouseEvent &event);
274 //ETX
275 };
276 
277 #endif //__vtkContextScene_h
GLuint GLenum GLenum transform
Definition: vtkgl.h:16451
data structure to represent key events.
abstract base class for most VTK objects
Definition: vtkObject.h:61
GLuint index
Definition: vtkgl.h:11983
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
Private implementation for scene/items.
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkWeakPointer< vtkRenderer > Renderer
int vtkIdType
Definition: vtkType.h:268
vtkWeakPointer< vtkContext2D > LastPainter
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
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.
struct _cl_event * event
Definition: vtkgl.h:14387
a simple class to control print indentation
Definition: vtkIndent.h:38
describes linear transformations via a 3x3 matrix
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
2D array of ids, used for picking.
vtkContextScenePrivate * Children
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:260
vtkAbstractContextBufferId * BufferId
base class for items that are part of a vtkContextScene.
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
static vtkObject * New()
vtkTransform2D * Transform
vtkAnnotationLink * AnnotationLink
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69