00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00022 #ifndef __vtkKWRenderWidget_h
00023 #define __vtkKWRenderWidget_h
00024
00025 #include "vtkKWCompositeWidget.h"
00026 #include "vtkWindows.h"
00027
00028 class vtkCamera;
00029 class vtkCornerAnnotation;
00030 class vtkKWGenericRenderWindowInteractor;
00031 class vtkProp;
00032 class vtkRenderWindow;
00033 class vtkRenderer;
00034 class vtkTextActor;
00035 class vtkKWMenu;
00036
00037 class KWWIDGETS_EXPORT vtkKWRenderWidget : public vtkKWCompositeWidget
00038 {
00039 public:
00040 static vtkKWRenderWidget* New();
00041 vtkTypeRevisionMacro(vtkKWRenderWidget, vtkKWCompositeWidget);
00042 void PrintSelf(ostream& os, vtkIndent indent);
00043
00045 virtual void Create(vtkKWApplication *app);
00046
00050 virtual void Close();
00051
00053 virtual void Render();
00054
00056
00057 vtkGetMacro(RenderState, int);
00058 vtkSetClampMacro(RenderState, int, 0, 1);
00059 vtkBooleanMacro(RenderState, int);
00061
00063
00064 enum
00065 {
00066 InteractiveRender = 0,
00067 StillRender = 1,
00068 DisabledRender = 2,
00069 SingleRender = 3
00070 };
00071
00072 vtkSetClampMacro(RenderMode, int,
00073 vtkKWRenderWidget::InteractiveRender,
00074 vtkKWRenderWidget::SingleRender);
00075 vtkGetMacro(RenderMode, int);
00076 virtual void SetRenderModeToInteractive()
00077 { this->SetRenderMode(vtkKWRenderWidget::InteractiveRender); };
00078 virtual void SetRenderModeToStill()
00079 { this->SetRenderMode(vtkKWRenderWidget::StillRender); };
00080 virtual void SetRenderModeToSingle()
00081 { this->SetRenderMode(vtkKWRenderWidget::SingleRender); };
00082 virtual void SetRenderModeToDisabled()
00083 { this->SetRenderMode(vtkKWRenderWidget::DisabledRender); };
00085
00087
00090 virtual void SetCollapsingRenders(int);
00091 vtkBooleanMacro(CollapsingRenders, int);
00092 vtkGetMacro(CollapsingRenders, int);
00094
00097 virtual void Reset();
00098
00100 virtual void ResetCamera();
00101
00103 vtkCamera *GetCurrentCamera();
00104
00106
00115 virtual void AddBindings();
00116 virtual void RemoveBindings();
00117 virtual void AddInteractionBindings();
00118 virtual void RemoveInteractionBindings();
00120
00122
00123 virtual void AddViewProp(vtkProp *prop);
00124 virtual void AddOverlayViewProp(vtkProp *prop);
00125 virtual void RemoveViewProp(vtkProp *prop);
00126 virtual int HasViewProp(vtkProp *prop);
00127 virtual void RemoveAllViewProps();
00129
00131
00132 virtual void GetRendererBackgroundColor(double *r, double *g, double *b);
00133 virtual void SetRendererBackgroundColor(double r, double g, double b);
00134 virtual void SetRendererBackgroundColor(double rgb[3])
00135 { this->SetRendererBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00137
00139
00142 virtual void SetAnnotationsVisibility(int v);
00143 vtkBooleanMacro(AnnotationsVisibility, int);
00145
00147
00148 virtual void SetCornerAnnotationVisibility(int v);
00149 virtual int GetCornerAnnotationVisibility();
00150 virtual void ToggleCornerAnnotationVisibility();
00151 vtkBooleanMacro(CornerAnnotationVisibility, int);
00152 virtual void SetCornerAnnotationColor(double r, double g, double b);
00153 virtual void SetCornerAnnotationColor(double *rgb)
00154 { this->SetCornerAnnotationColor(rgb[0], rgb[1], rgb[2]); };
00155 virtual double* GetCornerAnnotationColor();
00156 vtkGetObjectMacro(CornerAnnotation, vtkCornerAnnotation);
00158
00160
00161 virtual void SetHeaderAnnotationVisibility(int v);
00162 virtual int GetHeaderAnnotationVisibility();
00163 virtual void ToggleHeaderAnnotationVisibility();
00164 vtkBooleanMacro(HeaderAnnotationVisibility, int);
00165 virtual void SetHeaderAnnotationColor(double r, double g, double b);
00166 virtual void SetHeaderAnnotationColor(double *rgb)
00167 { this->SetHeaderAnnotationColor(rgb[0], rgb[1], rgb[2]); };
00168 virtual double* GetHeaderAnnotationColor();
00169 virtual void SetHeaderAnnotationText(const char*);
00170 virtual char* GetHeaderAnnotationText();
00171 vtkGetObjectMacro(HeaderAnnotation, vtkTextActor);
00173
00175
00176 virtual void SetDistanceUnits(const char*);
00177 vtkGetStringMacro(DistanceUnits);
00179
00181
00182 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00184
00186
00187 vtkGetObjectMacro(VTKWidget, vtkKWCoreWidget);
00189
00191
00196 virtual vtkRenderer* GetRenderer() { return this->GetNthRenderer(0); }
00197 virtual vtkRenderer* GetOverlayRenderer();
00198 virtual vtkRenderer* GetNthRenderer(int index);
00199 virtual int GetNumberOfRenderers();
00200 virtual int GetRendererIndex(vtkRenderer*);
00202
00204
00205 virtual void SetPrinting(int arg);
00206 vtkBooleanMacro(Printing, int);
00207 vtkGetMacro(Printing, int);
00209
00211
00212 vtkBooleanMacro(OffScreenRendering, int);
00213 virtual void SetOffScreenRendering(int);
00214 virtual int GetOffScreenRendering();
00216
00218
00220 vtkSetMacro(UseContextMenu, int);
00221 vtkGetMacro(UseContextMenu, int);
00222 vtkBooleanMacro(UseContextMenu, int);
00224
00231 virtual void UpdateEnableState();
00232
00234
00237 virtual void Register(vtkObjectBase* o);
00238 virtual void UnRegister(vtkObjectBase* o);
00240
00242
00243 virtual void MouseMoveCallback(int num, int x, int y);
00244 virtual void MouseWheelCallback(int delta);
00245 virtual void MouseButtonPressCallback(
00246 int num, int x, int y, int ctrl, int shift);
00247 virtual void MouseButtonReleaseCallback(int num, int x, int y);
00248 virtual void KeyPressCallback(
00249 char key, int x, int y, int ctrl, int shift, char *keysym);
00250 virtual void ConfigureCallback(int width, int height);
00251 virtual void ExposeCallback();
00252 virtual void EnterCallback(int , int ) {};
00253 virtual void FocusInCallback();
00254 virtual void FocusOutCallback();
00256
00258
00259 #ifdef _WIN32
00260 virtual void SetupPrint(RECT &rcDest, HDC ghdc,
00261 int printerPageSizeX, int printerPageSizeY,
00262 int printerDPIX, int printerDPIY,
00263 float scaleX, float scaleY,
00264 int screenSizeX, int screenSizeY);
00266 #endif
00267
00269 virtual void* GetMemoryDC();
00270
00272
00276 virtual void AddCallbackCommandObservers();
00277 virtual void RemoveCallbackCommandObservers();
00279
00280 protected:
00281 vtkKWRenderWidget();
00282 ~vtkKWRenderWidget();
00283
00284 vtkKWCoreWidget *VTKWidget;
00285 vtkRenderWindow *RenderWindow;
00286 vtkKWGenericRenderWindowInteractor *Interactor;
00287 vtkCornerAnnotation *CornerAnnotation;
00288 vtkTextActor *HeaderAnnotation;
00289
00290 int RenderMode;
00291 int PreviousRenderMode;
00292 int InExpose;
00293 int RenderState;
00294 int Printing;
00295
00296 Tcl_TimerToken InteractorTimerToken;
00297
00298 char *DistanceUnits;
00299
00300 int CollapsingRenders;
00301 int CollapsingRendersCount;
00302
00305 virtual void UpdateAccordingToUnits() {};
00306
00308
00309 virtual void SetupMemoryRendering(int width, int height, void *cd);
00310 virtual void ResumeScreenRendering();
00312
00314
00317 virtual void ProcessCallbackCommandEvents(
00318 vtkObject *caller, unsigned long event, void *calldata);
00320
00321
00322
00323 int UseContextMenu;
00324 vtkKWMenu *ContextMenu;
00325
00327
00331 virtual void PopulateContextMenu(vtkKWMenu*);
00332 virtual void PopulateAnnotationMenu(vtkKWMenu*);
00334
00335 private:
00336 vtkKWRenderWidget(const vtkKWRenderWidget&);
00337 void operator=(const vtkKWRenderWidget&);
00338
00339
00340
00341
00342
00343 vtkRenderer *Renderer;
00344 vtkRenderer *OverlayRenderer;
00345 };
00346
00347 #endif
00348