00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __vtkKWRenderWidget_h
00025 #define __vtkKWRenderWidget_h
00026
00027 #include "vtkKWCompositeWidget.h"
00028 #include "vtkWindows.h"
00029
00030 class vtkCamera;
00031 class vtkCornerAnnotation;
00032 class vtkProp;
00033 class vtkRenderWindow;
00034 class vtkRenderer;
00035 class vtkTextActor;
00036 class vtkKWMenu;
00037 class vtkKWRenderWidgetInternals;
00038 class vtkRenderWindowInteractor;
00039
00040 class KWWidgets_EXPORT vtkKWRenderWidget : public vtkKWCompositeWidget
00041 {
00042 public:
00043 static vtkKWRenderWidget* New();
00044 vtkTypeRevisionMacro(vtkKWRenderWidget, vtkKWCompositeWidget);
00045 void PrintSelf(ostream& os, vtkIndent indent);
00046
00047
00048
00049
00050
00051
00052 virtual void Close();
00053
00054
00055
00056 virtual void Render();
00057
00058
00059
00060 vtkGetMacro(RenderState, int);
00061 vtkSetClampMacro(RenderState, int, 0, 1);
00062 vtkBooleanMacro(RenderState, int);
00063
00064
00065
00066
00067 enum
00068 {
00069 InteractiveRender = 0,
00070 StillRender = 1,
00071 DisabledRender = 2,
00072 SingleRender = 3
00073 };
00074
00075 vtkSetClampMacro(RenderMode, int,
00076 vtkKWRenderWidget::InteractiveRender,
00077 vtkKWRenderWidget::SingleRender);
00078 vtkGetMacro(RenderMode, int);
00079 virtual void SetRenderModeToInteractive()
00080 { this->SetRenderMode(vtkKWRenderWidget::InteractiveRender); };
00081 virtual void SetRenderModeToStill()
00082 { this->SetRenderMode(vtkKWRenderWidget::StillRender); };
00083 virtual void SetRenderModeToSingle()
00084 { this->SetRenderMode(vtkKWRenderWidget::SingleRender); };
00085 virtual void SetRenderModeToDisabled()
00086 { this->SetRenderMode(vtkKWRenderWidget::DisabledRender); };
00087
00088
00089
00090
00091
00092 virtual void SetCollapsingRenders(int);
00093 vtkBooleanMacro(CollapsingRenders, int);
00094 vtkGetMacro(CollapsingRenders, int);
00095
00096
00097
00098
00099 virtual void Reset();
00100
00101
00102
00103
00104
00105
00106 virtual void ResetCamera();
00107 virtual void ResetCameraClippingRange();
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 virtual void AddBindings();
00120 virtual void RemoveBindings();
00121 virtual void AddInteractionBindings();
00122 virtual void RemoveInteractionBindings();
00123
00124
00125
00126
00127
00128 virtual void SetAnnotationsVisibility(int v);
00129 vtkBooleanMacro(AnnotationsVisibility, int);
00130
00131
00132
00133
00134
00135
00136 virtual void SetCornerAnnotationVisibility(int v);
00137 virtual int GetCornerAnnotationVisibility();
00138 virtual void ToggleCornerAnnotationVisibility();
00139 vtkBooleanMacro(CornerAnnotationVisibility, int);
00140 virtual void SetCornerAnnotationColor(double r, double g, double b);
00141 virtual void SetCornerAnnotationColor(double *rgb)
00142 { this->SetCornerAnnotationColor(rgb[0], rgb[1], rgb[2]); };
00143 virtual double* GetCornerAnnotationColor();
00144 vtkGetObjectMacro(CornerAnnotation, vtkCornerAnnotation);
00145 vtkGetMacro(SupportCornerAnnotation, int);
00146 virtual void SetSupportCornerAnnotation(int);
00147 vtkBooleanMacro(SupportCornerAnnotation, int);
00148
00149
00150
00151 virtual void SetHeaderAnnotationVisibility(int v);
00152 virtual int GetHeaderAnnotationVisibility();
00153 virtual void ToggleHeaderAnnotationVisibility();
00154 vtkBooleanMacro(HeaderAnnotationVisibility, int);
00155 virtual void SetHeaderAnnotationColor(double r, double g, double b);
00156 virtual void SetHeaderAnnotationColor(double *rgb)
00157 { this->SetHeaderAnnotationColor(rgb[0], rgb[1], rgb[2]); };
00158 virtual double* GetHeaderAnnotationColor();
00159 virtual void SetHeaderAnnotationText(const char*);
00160 virtual char* GetHeaderAnnotationText();
00161 vtkGetObjectMacro(HeaderAnnotation, vtkTextActor);
00162
00163
00164
00165 virtual void SetDistanceUnits(const char*);
00166 vtkGetStringMacro(DistanceUnits);
00167
00168
00169
00170 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00171 virtual vtkRenderWindowInteractor* GetRenderWindowInteractor();
00172
00173
00174
00175 vtkGetObjectMacro(VTKWidget, vtkKWCoreWidget);
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 virtual vtkRenderer* GetRenderer() { return this->GetNthRenderer(0); }
00186 virtual vtkRenderer* GetNthRenderer(int index);
00187 virtual int GetNumberOfRenderers();
00188 virtual int GetRendererIndex(vtkRenderer*);
00189 virtual void AddRenderer(vtkRenderer*);
00190 virtual void RemoveRenderer(vtkRenderer*);
00191 virtual void RemoveNthRenderer(int index);
00192 virtual void RemoveAllRenderers();
00193
00194
00195
00196
00197 virtual vtkRenderer* GetOverlayRenderer()
00198 { return this->GetNthOverlayRenderer(0); }
00199 virtual vtkRenderer* GetNthOverlayRenderer(int index);
00200 virtual int GetNumberOfOverlayRenderers();
00201 virtual int GetOverlayRendererIndex(vtkRenderer*);
00202 virtual void AddOverlayRenderer(vtkRenderer*);
00203 virtual void RemoveOverlayRenderer(vtkRenderer*);
00204 virtual void RemoveNthOverlayRenderer(int index);
00205 virtual void RemoveAllOverlayRenderers();
00206
00207
00208
00209
00210 virtual void GetRendererBackgroundColor(double *r, double *g, double *b);
00211 virtual void SetRendererBackgroundColor(double r, double g, double b);
00212 virtual void SetRendererBackgroundColor(double rgb[3])
00213 { this->SetRendererBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00214 virtual void GetRendererBackgroundColor2(double *r, double *g, double *b);
00215 virtual void SetRendererBackgroundColor2(double r, double g, double b);
00216 virtual void SetRendererBackgroundColor2(double rgb[3])
00217 { this->SetRendererBackgroundColor2(rgb[0], rgb[1], rgb[2]); };
00218 virtual void SetRendererGradientBackground(int);
00219 virtual int GetRendererGradientBackground();
00220 virtual void ToggleRendererGradientBackground();
00221
00222
00223
00224
00225
00226 virtual void AddViewProp(vtkProp *prop);
00227 virtual void AddViewPropToNthRenderer(vtkProp *p, int index);
00228 virtual void AddOverlayViewProp(vtkProp *prop);
00229 virtual void AddViewPropToNthOverlayRenderer(vtkProp *p, int index);
00230
00231
00232
00233 virtual int HasViewProp(vtkProp *prop);
00234 virtual void RemoveViewProp(vtkProp *prop);
00235 virtual void RemoveAllViewProps();
00236
00237
00238
00239
00240
00241 virtual void ComputeVisiblePropBounds(int index, double bounds[6]);
00242
00243
00244
00245 virtual void SetPrinting(int arg);
00246 vtkBooleanMacro(Printing, int);
00247 vtkGetMacro(Printing, int);
00248
00249
00250
00251 vtkBooleanMacro(OffScreenRendering, int);
00252 virtual void SetOffScreenRendering(int);
00253 virtual int GetOffScreenRendering();
00254
00255
00256
00257
00258 vtkSetMacro(UseContextMenu, int);
00259 vtkGetMacro(UseContextMenu, int);
00260 vtkBooleanMacro(UseContextMenu, int);
00261
00262
00263
00264
00265
00266
00267
00268
00269 virtual void UpdateEnableState();
00270
00271
00272
00273
00274
00275 virtual void Register(vtkObjectBase* o);
00276 virtual void UnRegister(vtkObjectBase* o);
00277
00278
00279
00280 #if defined(_WIN32) && !defined(__CYGWIN__)
00281 virtual void SetupPrint(RECT &rcDest, HDC ghdc,
00282 int printerPageSizeX, int printerPageSizeY,
00283 int printerDPIX, int printerDPIY,
00284 float scaleX, float scaleY,
00285 int screenSizeX, int screenSizeY);
00286 #endif
00287
00288
00289
00290 virtual void* GetMemoryDC();
00291
00292
00293
00294
00295
00296
00297 virtual void AddCallbackCommandObservers();
00298 virtual void RemoveCallbackCommandObservers();
00299
00300
00301
00302 virtual void MouseMoveCallback(
00303 int num, int x, int y, int ctrl, int shift, int alt);
00304 virtual void MouseWheelCallback(
00305 int delta, int ctrl, int shift, int alt);
00306 virtual void MouseButtonPressCallback(
00307 int num, int x, int y, int ctrl, int shift, int alt, int repeat);
00308 virtual void MouseButtonReleaseCallback(
00309 int num, int x, int y, int ctrl, int shift, int alt);
00310 virtual void KeyPressCallback(
00311 char key, int x, int y, int ctrl, int shift, int alt, char *keysym);
00312 virtual void KeyReleaseCallback(
00313 char key, int x, int y, int ctrl, int shift, int alt, char *keysym);
00314 virtual void ConfigureCallback(int width, int height);
00315 virtual void ExposeCallback();
00316 virtual void EnterCallback(int x, int y);
00317 virtual void LeaveCallback(int x, int y);
00318 virtual void FocusInCallback();
00319 virtual void FocusOutCallback();
00320 virtual int RendererBackgroundColorCallback();
00321 virtual int RendererBackgroundColor2Callback();
00322 virtual void RendererGradientBackgroundCallback();
00323
00324
00325
00326
00327 enum
00328 {
00329 CornerAnnotationVisibilityChangedEvent = 24000,
00330 RendererGradientBackgroundChangedEvent,
00331 RendererBackgroundColorChangedEvent,
00332 RendererBackgroundColor2ChangedEvent
00333 };
00334
00335
00336
00337
00338 vtkGetStringMacro(RendererBackgroundColorRegKey);
00339 vtkSetStringMacro(RendererBackgroundColorRegKey);
00340 vtkGetStringMacro(RendererBackgroundColor2RegKey);
00341 vtkSetStringMacro(RendererBackgroundColor2RegKey);
00342 vtkGetStringMacro(RendererGradientBackgroundRegKey);
00343 vtkSetStringMacro(RendererGradientBackgroundRegKey);
00344
00345 protected:
00346 vtkKWRenderWidget();
00347 ~vtkKWRenderWidget();
00348
00349
00350
00351 virtual void CreateWidget();
00352
00353 vtkKWCoreWidget *VTKWidget;
00354 vtkRenderWindow *RenderWindow;
00355 vtkCornerAnnotation *CornerAnnotation;
00356 vtkTextActor *HeaderAnnotation;
00357
00358 int RenderMode;
00359 int PreviousRenderMode;
00360 int InExpose;
00361 int RenderState;
00362 int Printing;
00363
00364 char *DistanceUnits;
00365
00366 int CollapsingRenders;
00367 int CollapsingRendersCount;
00368
00369
00370
00371
00372
00373 virtual void CreateDefaultRenderers();
00374
00375
00376
00377
00378
00379 virtual void InstallRenderers();
00380
00381
00382
00383 virtual void SetRenderersDefaultValues();
00384
00385
00386
00387
00388 virtual void UpdateAccordingToUnits() {};
00389
00390
00391
00392 virtual void SetupMemoryRendering(int width, int height, void *cd);
00393 virtual void ResumeScreenRendering();
00394
00395
00396
00397
00398
00399 virtual void ProcessCallbackCommandEvents(
00400 vtkObject *caller, unsigned long event, void *calldata);
00401
00402
00403
00404 int UseContextMenu;
00405 vtkKWMenu *ContextMenu;
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421 virtual void PopulateContextMenu(vtkKWMenu*);
00422 virtual void PopulateContextMenuWithInteractionEntries(vtkKWMenu*) {};
00423 virtual void PopulateContextMenuWithAnnotationEntries(vtkKWMenu*);
00424 virtual void PopulateContextMenuWithOptionEntries(vtkKWMenu*) {};
00425 virtual void PopulateContextMenuWithCameraEntries(vtkKWMenu*);
00426 virtual void PopulateContextMenuWithColorEntries(vtkKWMenu*);
00427
00428
00429
00430 virtual void UpdateRenderWindowInteractorSize(int width, int height);
00431
00432
00433
00434 vtkKWRenderWidgetInternals *Internals;
00435
00436 int SupportCornerAnnotation;
00437
00438
00439
00440 char *RendererBackgroundColorRegKey;
00441 char *RendererBackgroundColor2RegKey;
00442 char *RendererGradientBackgroundRegKey;
00443
00444 private:
00445 vtkKWRenderWidget(const vtkKWRenderWidget&);
00446 void operator=(const vtkKWRenderWidget&);
00447 };
00448
00449 #endif
00450