VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/Export/vtkGL2PSExporter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGL2PSExporter.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 =========================================================================*/
00079 #ifndef vtkGL2PSExporter_h
00080 #define vtkGL2PSExporter_h
00081 
00082 #include "vtkIOExportModule.h" // For export macro
00083 #include "vtkExporter.h"
00084 
00085 #include "vtkNew.h" // For vtkNew
00086 
00087 class vtkActor2D;
00088 class vtkCollection;
00089 class vtkCoordinate;
00090 class vtkImageData;
00091 class vtkIntArray;
00092 class vtkLabeledDataMapper;
00093 class vtkMatrix4x4;
00094 class vtkPath;
00095 class vtkProp;
00096 class vtkPropCollection;
00097 class vtkProp3DCollection;
00098 class vtkRenderer;
00099 class vtkRendererCollection;
00100 class vtkScalarBarActor;
00101 class vtkTextActor;
00102 class vtkTextActor3D;
00103 class vtkTextMapper;
00104 class vtkTextProperty;
00105 
00106 class VTKIOEXPORT_EXPORT vtkGL2PSExporter : public vtkExporter
00107 {
00108 public:
00109   static vtkGL2PSExporter *New();
00110   vtkTypeMacro(vtkGL2PSExporter,vtkExporter);
00111   void PrintSelf(ostream& os, vtkIndent indent);
00112 
00114 
00117   vtkSetStringMacro(FilePrefix);
00118   vtkGetStringMacro(FilePrefix);
00120 
00122 
00128   vtkSetMacro(BufferSize, int);
00129   vtkGetMacro(BufferSize, int);
00131 
00133 
00135   vtkSetStringMacro(Title);
00136   vtkGetStringMacro(Title);
00138 
00139 //BTX
00140   enum OutputFormat
00141   {
00142       PS_FILE,
00143       EPS_FILE,
00144       PDF_FILE,
00145       TEX_FILE,
00146       SVG_FILE
00147   };
00148 //ETX
00149 
00151 
00156   void UsePainterSettings()
00157   {
00158     this->SetSortToOff();
00159     this->SetSimpleLineOffset(0);
00160   }
00162 
00164 
00168   vtkSetClampMacro(FileFormat, int, PS_FILE, SVG_FILE);
00169   vtkGetMacro(FileFormat, int);
00170   void SetFileFormatToPS()
00171     {this->SetFileFormat(PS_FILE);};
00172   void SetFileFormatToEPS()
00173     {this->SetFileFormat(EPS_FILE);};
00174   void SetFileFormatToPDF()
00175     {this->SetFileFormat(PDF_FILE);};
00176   void SetFileFormatToTeX()
00177     {this->SetFileFormat(TEX_FILE);};
00178   void SetFileFormatToSVG()
00179     {this->SetFileFormat(SVG_FILE);};
00180   const char *GetFileFormatAsString();
00182 
00183 //BTX
00184   enum SortScheme
00185   {
00186       NO_SORT=0,
00187       SIMPLE_SORT=1,
00188       BSP_SORT=2
00189   };
00190 //ETX
00191 
00193 
00196   vtkSetClampMacro(Sort, int, NO_SORT, BSP_SORT);
00197   vtkGetMacro(Sort,int);
00198   void SetSortToOff()
00199     {this->SetSort(NO_SORT);};
00200   void SetSortToSimple()
00201     {this->SetSort(SIMPLE_SORT);};
00202   void SetSortToBSP()
00203     {this->SetSort(BSP_SORT);};
00204   const char *GetSortAsString();
00206 
00208 
00210   vtkSetMacro(Compress, int);
00211   vtkGetMacro(Compress, int);
00212   vtkBooleanMacro(Compress, int);
00214 
00216 
00218   vtkSetMacro(DrawBackground, int);
00219   vtkGetMacro(DrawBackground, int);
00220   vtkBooleanMacro(DrawBackground, int);
00222 
00224 
00227   vtkSetMacro(SimpleLineOffset, int);
00228   vtkGetMacro(SimpleLineOffset, int);
00229   vtkBooleanMacro(SimpleLineOffset, int);
00231 
00233 
00235   vtkSetMacro(Silent, int);
00236   vtkGetMacro(Silent, int);
00237   vtkBooleanMacro(Silent, int);
00239 
00241 
00244   vtkSetMacro(BestRoot, int);
00245   vtkGetMacro(BestRoot, int);
00246   vtkBooleanMacro(BestRoot, int);
00248 
00250 
00253   vtkSetMacro(Text, int);
00254   vtkGetMacro(Text, int);
00255   vtkBooleanMacro(Text, int);
00257 
00259 
00261   vtkSetMacro(Landscape, int);
00262   vtkGetMacro(Landscape, int);
00263   vtkBooleanMacro(Landscape, int);
00265 
00267 
00270   vtkSetMacro(PS3Shading, int);
00271   vtkGetMacro(PS3Shading, int);
00272   vtkBooleanMacro(PS3Shading, int);
00274 
00276 
00279   vtkSetMacro(OcclusionCull, int);
00280   vtkGetMacro(OcclusionCull, int);
00281   vtkBooleanMacro(OcclusionCull, int);
00283 
00285 
00289   vtkSetMacro(Write3DPropsAsRasterImage, int);
00290   vtkGetMacro(Write3DPropsAsRasterImage, int);
00291   vtkBooleanMacro(Write3DPropsAsRasterImage, int);
00293 
00295 
00298   vtkSetMacro(TextAsPath, bool);
00299   vtkGetMacro(TextAsPath, bool);
00300   vtkBooleanMacro(TextAsPath, bool);
00302 
00304 
00309   void SetRasterExclusions(vtkPropCollection*);
00310   vtkGetObjectMacro(RasterExclusions, vtkPropCollection);
00312 
00314 
00316   vtkSetMacro(PointSizeFactor, float);
00317   vtkGetMacro(PointSizeFactor, float);
00319 
00321 
00323   vtkSetMacro(LineWidthFactor, float);
00324   vtkGetMacro(LineWidthFactor, float);
00326 
00327 protected:
00328   vtkGL2PSExporter();
00329   ~vtkGL2PSExporter();
00330 
00331   void WriteData();
00332 
00333   int GetGL2PSOptions();
00334   int GetGL2PSSort();
00335   int GetGL2PSFormat();
00336   const char *GetFileExtension();
00337 
00338   void SavePropVisibility(vtkRendererCollection *renCol,
00339                           vtkIntArray *volVis, vtkIntArray *actVis,
00340                           vtkIntArray *act2dVis);
00341   void RestorePropVisibility(vtkRendererCollection *renCol,
00342                              vtkIntArray *volVis, vtkIntArray *actVis,
00343                              vtkIntArray *act2dVis);
00344   void Turn3DPropsOff(vtkRendererCollection *renCol);
00345   void Turn2DPropsOff(vtkRendererCollection *renCol);
00346   void GetVisibleContextActors(vtkPropCollection *contextActors,
00347                                vtkRendererCollection *renCol);
00348   void SetPropVisibilities(vtkPropCollection *col, int vis);
00349 
00350   void DrawSpecialProps(vtkCollection *propCol, vtkRendererCollection *renCol);
00352 
00354   virtual void HandleSpecialProp(vtkProp *prop, vtkRenderer *ren);
00355   void DrawTextActor(vtkTextActor *textAct, vtkRenderer *ren);
00356   void DrawTextActor3D(vtkTextActor3D *textAct, vtkRenderer *ren);
00357   void DrawTextMapper(vtkTextMapper *textMap, vtkActor2D *textAct,
00358                       vtkRenderer *ren);
00359   void DrawLabeledDataMapper(vtkLabeledDataMapper *mapper, vtkRenderer *ren);
00360   void DrawScalarBarActor(vtkScalarBarActor *bar, vtkRenderer *ren);
00361   void DrawViewportTextOverlay(const char *string, vtkTextProperty *tprop,
00362                                vtkCoordinate *coord, vtkRenderer *ren);
00364 
00368   void CopyPixels(int copyRect[4], vtkRenderer *ren);
00369 
00370   void DrawContextActors(vtkPropCollection *contextActs,
00371                          vtkRendererCollection *renCol);
00372 
00373 
00374   vtkPropCollection *RasterExclusions;
00375 
00376   char *FilePrefix;
00377   char *Title;
00378   int FileFormat;
00379   int BufferSize;
00380   int Sort;
00381   int Compress;
00382   int DrawBackground;
00383   int SimpleLineOffset;
00384   int Silent;
00385   int BestRoot;
00386   int Text;
00387   int Landscape;
00388   int PS3Shading;
00389   int OcclusionCull;
00390   int Write3DPropsAsRasterImage;
00391   bool TextAsPath;
00392   float PointSizeFactor;
00393   float LineWidthFactor;
00394 
00395   vtkNew<vtkImageData> PixelData;
00396 
00397 private:
00398   vtkGL2PSExporter(const vtkGL2PSExporter&); // Not implemented
00399   void operator=(const vtkGL2PSExporter&); // Not implemented
00400 };
00401 
00402 inline const char *vtkGL2PSExporter::GetSortAsString(void)
00403 {
00404   if ( this->Sort == NO_SORT )
00405     {
00406     return "Off";
00407     }
00408   else if ( this->Sort == SIMPLE_SORT )
00409     {
00410     return "Simple";
00411     }
00412   else
00413     {
00414     return "BSP";
00415     }
00416 }
00417 
00418 inline const char *vtkGL2PSExporter::GetFileFormatAsString(void)
00419 {
00420   if ( this->FileFormat == PS_FILE )
00421     {
00422     return "PS";
00423     }
00424   else if ( this->FileFormat == EPS_FILE )
00425     {
00426     return "EPS";
00427     }
00428   else if ( this->FileFormat == PDF_FILE )
00429     {
00430     return "PDF";
00431     }
00432   else if ( this->FileFormat == TEX_FILE )
00433     {
00434     return "TeX";
00435     }
00436   else
00437     {
00438     return "SVG";
00439     }
00440 }
00441 
00442 #endif