00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00025 #ifndef __vtkContextScene_h
00026 #define __vtkContextScene_h
00027
00028 #include "vtkObject.h"
00029 #include "vtkWeakPointer.h"
00030 #include "vtkVector.h"
00031
00032 class vtkContext2D;
00033 class vtkContextItem;
00034 class vtkTransform2D;
00035 class vtkContextMouseEvent;
00036
00037 class vtkInteractorStyle;
00038 class vtkAnnotationLink;
00039
00040 class vtkRenderer;
00041 class vtkContextBufferId;
00042
00043 class VTK_CHARTS_EXPORT vtkContextScene : public vtkObject
00044 {
00045 public:
00046 vtkTypeRevisionMacro(vtkContextScene, vtkObject);
00047 virtual void PrintSelf(ostream &os, vtkIndent indent);
00048
00050 static vtkContextScene * New();
00051
00054 virtual bool Paint(vtkContext2D *painter);
00055
00057 void AddItem(vtkContextItem *item);
00058
00060 int GetNumberOfItems();
00061
00062
00063 vtkContextItem * GetItem(int index);
00064
00066 virtual void SetAnnotationLink(vtkAnnotationLink *link);
00067
00069
00070 vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
00072
00074
00075 vtkSetVector2Macro(Geometry, int);
00077
00079
00080 vtkGetVector2Macro(Geometry, int);
00082
00084
00085 vtkSetMacro(UseBufferId, bool);
00087
00089
00090 vtkGetMacro(UseBufferId, bool);
00092
00094 virtual int GetViewWidth();
00095
00097 virtual int GetViewHeight();
00098
00100 int GetSceneWidth();
00101
00103 int GetSceneHeight();
00104
00106 void SetInteractorStyle(vtkInteractorStyle *interactor);
00107
00110 virtual void SetRenderer(vtkRenderer *renderer);
00111
00115 void SetDirty(bool isDirty);
00116
00117
00121 vtkWeakPointer<vtkContext2D> GetLastPainter();
00122
00126 vtkContextBufferId *GetBufferId();
00127
00129 virtual void SetTransform(vtkTransform2D *transform);
00130
00132 vtkTransform2D* GetTransform();
00133
00135 bool HasTransform() { return this->Transform != 0; }
00136
00137 protected:
00138 vtkContextScene();
00139 ~vtkContextScene();
00140
00144 void CheckForRepaint();
00145
00147
00149 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
00150 void* callData);
00152
00154 virtual void ProcessSelectionEvent(vtkObject* caller, void* callData);
00155
00157 virtual void MouseMoveEvent(int x, int y);
00158
00160 virtual void ButtonPressEvent(int button, int x, int y);
00161
00163 virtual void ButtonReleaseEvent(int button, int x, int y);
00164
00167 virtual void MouseWheelEvent(int delta, int x, int y);
00168
00171 virtual void PaintIds();
00172
00176 vtkIdType GetPickedItem(int x, int y);
00177
00179 void UpdateBufferId();
00180
00181 vtkAnnotationLink *AnnotationLink;
00182
00183
00184 int Geometry[2];
00185
00187
00188 class Command;
00189 friend class Command;
00190 Command *Observer;
00192
00194
00195 class Private;
00196 Private *Storage;
00198
00199 vtkWeakPointer<vtkContext2D> LastPainter;
00200
00201 vtkWeakPointer<vtkRenderer> Renderer;
00202
00203 vtkContextBufferId *BufferId;
00204 bool BufferIdDirty;
00205
00206 bool UseBufferId;
00207
00209 vtkTransform2D* Transform;
00210
00212 void PerformTransform(vtkTransform2D *transform, vtkContextMouseEvent &mouse);
00213
00214 private:
00215 vtkContextScene(const vtkContextScene &);
00216 void operator=(const vtkContextScene &);
00217
00218 };
00219
00220
00223 class vtkContextMouseEvent
00224 {
00225 public:
00227
00228 enum {
00229 LEFT_BUTTON = 0,
00230 MIDDLE_BUTTON,
00231 RIGHT_BUTTON
00232 };
00234
00236 vtkVector2f Pos;
00237
00239 vtkVector2f ScenePos;
00240
00242 vtkVector2i ScreenPos;
00243
00245 vtkVector2f LastPos;
00246
00248 vtkVector2f LastScenePos;
00249
00251 vtkVector2i LastScreenPos;
00252
00254 int Button;
00255 };
00256
00257
00258 #endif //__vtkContextScene_h