00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00028 #ifndef __vtkContextScene_h
00029 #define __vtkContextScene_h
00030
00031 #include "vtkObject.h"
00032 #include "vtkWeakPointer.h"
00033
00034 class vtkContext2D;
00035 class vtkAbstractContextItem;
00036 class vtkTransform2D;
00037 class vtkContextMouseEvent;
00038 class vtkContextScenePrivate;
00039 class vtkContextInteractorStyle;
00040
00041 class vtkAnnotationLink;
00042
00043 class vtkRenderer;
00044 class vtkAbstractContextBufferId;
00045
00046 class VTK_CHARTS_EXPORT vtkContextScene : public vtkObject
00047 {
00048 public:
00049 vtkTypeMacro(vtkContextScene, vtkObject);
00050 virtual void PrintSelf(ostream &os, vtkIndent indent);
00051
00053 static vtkContextScene * New();
00054
00057 virtual bool Paint(vtkContext2D *painter);
00058
00061 unsigned int AddItem(vtkAbstractContextItem* item);
00062
00066 bool RemoveItem(vtkAbstractContextItem* item);
00067
00071 bool RemoveItem(unsigned int index);
00072
00075 vtkAbstractContextItem* GetItem(unsigned int index);
00076
00078 unsigned int GetNumberOfItems();
00079
00081 void ClearItems();
00082
00084 virtual void SetAnnotationLink(vtkAnnotationLink *link);
00085
00087
00088 vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
00090
00092
00093 vtkSetVector2Macro(Geometry, int);
00095
00097
00098 vtkGetVector2Macro(Geometry, int);
00100
00102
00103 vtkSetMacro(UseBufferId, bool);
00105
00107
00108 vtkGetMacro(UseBufferId, bool);
00110
00112 virtual int GetViewWidth();
00113
00115 virtual int GetViewHeight();
00116
00118 int GetSceneWidth();
00119
00121 int GetSceneHeight();
00122
00124
00127 vtkSetMacro(ScaleTiles, bool);
00128 vtkGetMacro(ScaleTiles, bool);
00129 vtkBooleanMacro(ScaleTiles, bool);
00131
00134 virtual void SetRenderer(vtkRenderer *renderer);
00135
00137
00140 void SetDirty(bool isDirty);
00141 bool GetDirty()const;
00143
00144
00146 void ReleaseGraphicsResources();
00147
00151 vtkWeakPointer<vtkContext2D> GetLastPainter();
00152
00156 vtkAbstractContextBufferId *GetBufferId();
00157
00159 virtual void SetTransform(vtkTransform2D *transform);
00160
00162 vtkTransform2D* GetTransform();
00163
00165 bool HasTransform() { return this->Transform != 0; }
00166
00167 protected:
00168 vtkContextScene();
00169 ~vtkContextScene();
00170
00172
00174 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
00175 void* callData);
00177
00179 virtual bool ProcessSelectionEvent(unsigned int rect[5]);
00180
00182 virtual bool MouseMoveEvent(int x, int y);
00183
00185 virtual bool ButtonPressEvent(int button, int x, int y);
00186
00188 virtual bool ButtonReleaseEvent(int button, int x, int y);
00189
00191 virtual bool DoubleClickEvent(int button, int x, int y);
00192
00195 virtual bool MouseWheelEvent(int delta, int x, int y);
00196
00199 virtual void PaintIds();
00200
00202 void TestBufferIdSupport();
00203
00207 vtkIdType GetPickedItem(int x, int y);
00208
00211 vtkAbstractContextItem* GetPickedItem();
00212
00214 void UpdateBufferId();
00215
00216 vtkAnnotationLink *AnnotationLink;
00217
00218
00219 int Geometry[2];
00220
00223 friend class vtkContextInteractorStyle;
00224
00226
00227 class Private;
00228 Private *Storage;
00230
00234 vtkContextScenePrivate* Children;
00235
00236 vtkWeakPointer<vtkContext2D> LastPainter;
00237
00238 vtkWeakPointer<vtkRenderer> Renderer;
00239
00240 vtkAbstractContextBufferId *BufferId;
00241 bool BufferIdDirty;
00242
00243 bool UseBufferId;
00244
00245 bool BufferIdSupportTested;
00246 bool BufferIdSupported;
00247
00248 bool ScaleTiles;
00249
00251 vtkTransform2D* Transform;
00252
00253 private:
00254 vtkContextScene(const vtkContextScene &);
00255 void operator=(const vtkContextScene &);
00256
00257 typedef bool (vtkAbstractContextItem::* MouseEvents)(const vtkContextMouseEvent&);
00258 bool ProcessItem(vtkAbstractContextItem* cur,
00259 const vtkContextMouseEvent& event,
00260 MouseEvents eventPtr);
00261
00262 };
00263
00264 #endif //__vtkContextScene_h