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 "vtkObject.h"
32 #include "vtkWeakPointer.h" // Needed for weak pointer to the window.
33 
34 class vtkContext2D;
36 class vtkTransform2D;
40 
41 class vtkAnnotationLink;
42 
43 class vtkRenderer;
45 
47 {
48 public:
49  vtkTypeMacro(vtkContextScene, vtkObject);
50  virtual void PrintSelf(ostream &os, vtkIndent indent);
51 
53  static vtkContextScene * New();
54 
57  virtual bool Paint(vtkContext2D *painter);
58 
61  unsigned int AddItem(vtkAbstractContextItem* item);
62 
66  bool RemoveItem(vtkAbstractContextItem* item);
67 
71  bool RemoveItem(unsigned int index);
72 
75  vtkAbstractContextItem* GetItem(unsigned int index);
76 
78  unsigned int GetNumberOfItems();
79 
81  void ClearItems();
82 
84  virtual void SetAnnotationLink(vtkAnnotationLink *link);
85 
87 
88  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
90 
92 
93  vtkSetVector2Macro(Geometry, int);
95 
97 
98  vtkGetVector2Macro(Geometry, int);
100 
102 
103  vtkSetMacro(UseBufferId, bool);
105 
107 
108  vtkGetMacro(UseBufferId, bool);
110 
112  virtual int GetViewWidth();
113 
115  virtual int GetViewHeight();
116 
118  int GetSceneWidth();
119 
121  int GetSceneHeight();
122 
124 
127  vtkSetMacro(ScaleTiles, bool);
128  vtkGetMacro(ScaleTiles, bool);
129  vtkBooleanMacro(ScaleTiles, bool);
131 
134  virtual void SetRenderer(vtkRenderer *renderer);
135 
137 
140  void SetDirty(bool isDirty);
141  bool GetDirty()const;
143 
144 //BTX
146  void ReleaseGraphicsResources();
147 
151  vtkWeakPointer<vtkContext2D> GetLastPainter();
152 
156  vtkAbstractContextBufferId *GetBufferId();
157 
159  virtual void SetTransform(vtkTransform2D *transform);
160 
162  vtkTransform2D* GetTransform();
163 
165  bool HasTransform() { return this->Transform != 0; }
166 
167 protected:
168  vtkContextScene();
169  ~vtkContextScene();
170 
172 
174  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
175  void* callData);
177 
179  virtual bool ProcessSelectionEvent(unsigned int rect[5]);
180 
182  virtual bool MouseMoveEvent(int x, int y);
183 
185  virtual bool ButtonPressEvent(int button, int x, int y);
186 
188  virtual bool ButtonReleaseEvent(int button, int x, int y);
189 
191  virtual bool DoubleClickEvent(int button, int x, int y);
192 
195  virtual bool MouseWheelEvent(int delta, int x, int y);
196 
199  virtual void PaintIds();
200 
202  void TestBufferIdSupport();
203 
207  vtkIdType GetPickedItem(int x, int y);
208 
211  vtkAbstractContextItem* GetPickedItem();
212 
214  void UpdateBufferId();
215 
216  vtkAnnotationLink *AnnotationLink;
217 
218  // Store the chart dimensions - width, height of scene in pixels
219  int Geometry[2];
220 
224 
226 
227  class Private;
228  Private *Storage;
230 
235 
237 
239 
242 
244 
247 
249 
252 
253 private:
254  vtkContextScene(const vtkContextScene &); // Not implemented.
255  void operator=(const vtkContextScene &); // Not implemented.
256 
257  typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
258  bool ProcessItem(vtkAbstractContextItem* cur,
259  const vtkContextMouseEvent& event,
260  MouseEvents eventPtr);
261 //ETX
262 };
263 
264 #endif //__vtkContextScene_h
#define VTK_CHARTS_EXPORT
abstract base class for most VTK objects
Definition: vtkObject.h:60
Private implementation for scene/items.
vtkWeakPointer< vtkRenderer > Renderer
int vtkIdType
Definition: vtkType.h:255
vtkWeakPointer< vtkContext2D > LastPainter
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
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)
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:37
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