VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPainter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00016 /* 00017 * Copyright 2004 Sandia Corporation. 00018 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00019 * license for use of this work by or on behalf of the 00020 * U.S. Government. Redistribution and use in source and binary forms, with 00021 * or without modification, are permitted provided that this Notice and any 00022 * statement of authorship are reproduced on all copies. 00023 */ 00024 00045 #ifndef __vtkPainter_h 00046 #define __vtkPainter_h 00047 00048 #include "vtkObject.h" 00049 #include "vtkWeakPointer.h" // needed for vtkWeakPointer. 00050 00051 class vtkAbstractArray; 00052 class vtkActor; 00053 class vtkDataObject; 00054 class vtkDataSet; 00055 class vtkInformation; 00056 class vtkInformationIntegerKey; 00057 class vtkPainterObserver; 00058 class vtkRenderer; 00059 class vtkTimerLog; 00060 class vtkWindow; 00061 00062 class VTK_RENDERING_EXPORT vtkPainter : public vtkObject 00063 { 00064 public: 00065 vtkTypeMacro(vtkPainter, vtkObject); 00066 virtual void PrintSelf(ostream &os, vtkIndent indent); 00067 00072 static vtkInformationIntegerKey* STATIC_DATA(); 00073 00078 static vtkInformationIntegerKey* CONSERVE_MEMORY(); 00079 00083 static vtkInformationIntegerKey* HIGH_QUALITY(); 00084 00086 00087 vtkGetObjectMacro(Information, vtkInformation); 00088 virtual void SetInformation(vtkInformation*); 00090 00092 00094 vtkGetObjectMacro(DelegatePainter, vtkPainter); 00095 virtual void SetDelegatePainter(vtkPainter*); 00097 00099 00100 virtual void Register(vtkObjectBase *o); 00101 virtual void UnRegister(vtkObjectBase *o); 00103 00104 //BTX 00105 enum { 00106 VERTS = 0x1, 00107 LINES = 0x2, 00108 POLYS = 0x4, 00109 STRIPS = 0x8 00110 }; 00111 //ETX 00112 00114 00119 virtual void Render(vtkRenderer* renderer, vtkActor* actor, 00120 unsigned long typeflags, bool forceCompileOnly); 00122 00127 virtual void ReleaseGraphicsResources(vtkWindow *); 00128 00130 00131 vtkSetClampMacro(Progress,double,0.0,1.0); 00132 vtkGetMacro(Progress,double); 00134 00138 virtual double GetTimeToDraw(); 00139 00143 virtual void UpdateBounds(double bounds[6]); 00144 00146 00148 void SetInput(vtkDataObject*); 00149 vtkGetObjectMacro(Input, vtkDataObject); 00151 00153 00155 virtual vtkDataObject* GetOutput() 00156 { return this->Input; } 00158 00159 //BTX 00160 protected: 00161 vtkPainter(); 00162 ~vtkPainter(); 00163 00165 virtual void ReportReferences(vtkGarbageCollector *collector); 00166 00172 void UpdateDelegatePainter(); 00173 00177 virtual void PassInformation(vtkPainter* toPainter); 00178 00183 virtual void PrepareForRendering(vtkRenderer*, vtkActor*) { } 00184 00186 00191 virtual void RenderInternal(vtkRenderer* renderer, vtkActor* actor, 00192 unsigned long typeflags, bool forceCompileOnly); 00194 00197 virtual void UpdateDelegateProgress(vtkPainter* delegate, double amount); 00198 00201 virtual void ProcessInformation(vtkInformation*) { } 00202 00205 virtual void ObserverPainterProgress(vtkPainter* toObserve); 00206 00210 void UpdateProgress(double amount); 00211 00213 00214 vtkAbstractArray* GetInputArrayToProcess(int fieldAssociation, 00215 int fieldAttributeType, 00216 vtkDataSet* ds, 00217 bool *use_cell_data=0); 00218 vtkAbstractArray* GetInputArrayToProcess(int fieldAssociation, 00219 const char* name, vtkDataSet* dsl, 00220 bool *use_cell_data=0); 00222 00223 // Time of most recent call to ProcessInformation(). 00224 vtkTimeStamp InformationProcessTime; 00225 friend class vtkPainterObserver; 00226 vtkPainterObserver* Observer; 00227 00228 vtkInformation* Information; 00229 vtkPainter* DelegatePainter; 00230 00231 double Progress; 00232 double ProgressOffset; 00233 double ProgressScaleFactor; 00234 00235 double TimeToDraw; 00236 vtkTimerLog* Timer; 00237 00238 vtkWeakPointer<vtkWindow> LastWindow; // Window used for previous render. 00239 // This is not reference counted. 00240 private: 00241 vtkPainter(const vtkPainter &); // Not implemented. 00242 void operator=(const vtkPainter &); // Not implemented. 00243 00244 vtkDataObject* Input; 00245 //ETX 00246 }; 00247 00248 #endif //__vtkPainter_h