VTK
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 vtkMatrix4x4;
00093 class vtkPath;
00094 class vtkProp;
00095 class vtkPropCollection;
00096 class vtkProp3DCollection;
00097 class vtkRenderer;
00098 class vtkRendererCollection;
00099 class vtkTextActor;
00100 class vtkTextActor3D;
00101 class vtkTextMapper;
00102 class vtkTextProperty;
00103 
00104 class VTKIOEXPORT_EXPORT vtkGL2PSExporter : public vtkExporter
00105 {
00106 public:
00107   static vtkGL2PSExporter *New();
00108   vtkTypeMacro(vtkGL2PSExporter,vtkExporter);
00109   void PrintSelf(ostream& os, vtkIndent indent);
00110 
00112 
00115   vtkSetStringMacro(FilePrefix);
00116   vtkGetStringMacro(FilePrefix);
00118 
00120 
00122   vtkSetStringMacro(Title);
00123   vtkGetStringMacro(Title);
00125 
00126 //BTX
00127   enum OutputFormat
00128   {
00129       PS_FILE,
00130       EPS_FILE,
00131       PDF_FILE,
00132       TEX_FILE,
00133       SVG_FILE
00134   };
00135 //ETX
00136 
00138 
00142   vtkSetClampMacro(FileFormat, int, PS_FILE, SVG_FILE);
00143   vtkGetMacro(FileFormat, int);
00144   void SetFileFormatToPS()
00145     {this->SetFileFormat(PS_FILE);};
00146   void SetFileFormatToEPS()
00147     {this->SetFileFormat(EPS_FILE);};
00148   void SetFileFormatToPDF()
00149     {this->SetFileFormat(PDF_FILE);};
00150   void SetFileFormatToTeX()
00151     {this->SetFileFormat(TEX_FILE);};
00152   void SetFileFormatToSVG()
00153     {this->SetFileFormat(SVG_FILE);};
00154   const char *GetFileFormatAsString();
00156 
00157 //BTX
00158   enum SortScheme
00159   {
00160       NO_SORT=0,
00161       SIMPLE_SORT=1,
00162       BSP_SORT=2
00163   };
00164 //ETX
00165 
00167 
00170   vtkSetClampMacro(Sort, int, NO_SORT, BSP_SORT);
00171   vtkGetMacro(Sort,int);
00172   void SetSortToOff()
00173     {this->SetSort(NO_SORT);};
00174   void SetSortToSimple()
00175     {this->SetSort(SIMPLE_SORT);};
00176   void SetSortToBSP()
00177     {this->SetSort(BSP_SORT);};
00178   const char *GetSortAsString();
00180 
00182 
00184   vtkSetMacro(Compress, int);
00185   vtkGetMacro(Compress, int);
00186   vtkBooleanMacro(Compress, int);
00188 
00190 
00192   vtkSetMacro(DrawBackground, int);
00193   vtkGetMacro(DrawBackground, int);
00194   vtkBooleanMacro(DrawBackground, int);
00196 
00198 
00201   vtkSetMacro(SimpleLineOffset, int);
00202   vtkGetMacro(SimpleLineOffset, int);
00203   vtkBooleanMacro(SimpleLineOffset, int);
00205 
00207 
00209   vtkSetMacro(Silent, int);
00210   vtkGetMacro(Silent, int);
00211   vtkBooleanMacro(Silent, int);
00213 
00215 
00218   vtkSetMacro(BestRoot, int);
00219   vtkGetMacro(BestRoot, int);
00220   vtkBooleanMacro(BestRoot, int);
00222 
00224 
00227   vtkSetMacro(Text, int);
00228   vtkGetMacro(Text, int);
00229   vtkBooleanMacro(Text, int);
00231 
00233 
00235   vtkSetMacro(Landscape, int);
00236   vtkGetMacro(Landscape, int);
00237   vtkBooleanMacro(Landscape, int);
00239 
00241 
00244   vtkSetMacro(PS3Shading, int);
00245   vtkGetMacro(PS3Shading, int);
00246   vtkBooleanMacro(PS3Shading, int);
00248 
00250 
00253   vtkSetMacro(OcclusionCull, int);
00254   vtkGetMacro(OcclusionCull, int);
00255   vtkBooleanMacro(OcclusionCull, int);
00257 
00259 
00263   vtkSetMacro(Write3DPropsAsRasterImage, int);
00264   vtkGetMacro(Write3DPropsAsRasterImage, int);
00265   vtkBooleanMacro(Write3DPropsAsRasterImage, int);
00267 
00269 
00272   vtkSetMacro(TextAsPath, bool);
00273   vtkGetMacro(TextAsPath, bool);
00274   vtkBooleanMacro(TextAsPath, bool);
00276 
00278 
00283   void SetRasterExclusions(vtkPropCollection*);
00284   vtkGetObjectMacro(RasterExclusions, vtkPropCollection);
00286 
00288 
00290   vtkSetMacro(PointSizeFactor, float);
00291   vtkGetMacro(PointSizeFactor, float);
00293 
00295 
00297   vtkSetMacro(LineWidthFactor, float);
00298   vtkGetMacro(LineWidthFactor, float);
00300 
00301 protected:
00302   vtkGL2PSExporter();
00303   ~vtkGL2PSExporter();
00304 
00305   void WriteData();
00306 
00307   int GetGL2PSOptions();
00308   int GetGL2PSSort();
00309   int GetGL2PSFormat();
00310   const char *GetFileExtension();
00311 
00312   void SavePropVisibility(vtkRendererCollection *renCol,
00313                           vtkIntArray *volVis, vtkIntArray *actVis,
00314                           vtkIntArray *act2dVis);
00315   void RestorePropVisibility(vtkRendererCollection *renCol,
00316                              vtkIntArray *volVis, vtkIntArray *actVis,
00317                              vtkIntArray *act2dVis);
00318   void Turn3DPropsOff(vtkRendererCollection *renCol);
00319   void Turn2DPropsOff(vtkRendererCollection *renCol);
00320   void GetVisibleContextActors(vtkPropCollection *contextActors,
00321                                vtkRendererCollection *renCol);
00322   void SetPropVisibilities(vtkPropCollection *col, int vis);
00323 
00324   void DrawSpecialProps(vtkCollection *propCol, vtkRendererCollection *renCol);
00326 
00328   virtual void HandleSpecialProp(vtkProp *prop, vtkRenderer *ren);
00329   void DrawTextActor(vtkTextActor *textAct, vtkRenderer *ren);
00330   void DrawTextActor3D(vtkTextActor3D *textAct, vtkRenderer *ren);
00331   void DrawTextMapper(vtkTextMapper *textMap, vtkActor2D *textAct,
00332                       vtkRenderer *ren);
00333   void DrawViewportTextOverlay(const char *string, vtkTextProperty *tprop,
00334                                vtkCoordinate *coord, vtkRenderer *ren);
00336 
00340   void CopyPixels(int copyRect[4], vtkRenderer *ren);
00341 
00342   void DrawContextActors(vtkPropCollection *contextActs,
00343                          vtkRendererCollection *renCol);
00344 
00345 
00346   vtkPropCollection *RasterExclusions;
00347 
00348   char *FilePrefix;
00349   char *Title;
00350   int FileFormat;
00351   int Sort;
00352   int Compress;
00353   int DrawBackground;
00354   int SimpleLineOffset;
00355   int Silent;
00356   int BestRoot;
00357   int Text;
00358   int Landscape;
00359   int PS3Shading;
00360   int OcclusionCull;
00361   int Write3DPropsAsRasterImage;
00362   bool TextAsPath;
00363   float PointSizeFactor;
00364   float LineWidthFactor;
00365 
00366   vtkNew<vtkImageData> PixelData;
00367 
00368 private:
00369   vtkGL2PSExporter(const vtkGL2PSExporter&); // Not implemented
00370   void operator=(const vtkGL2PSExporter&); // Not implemented
00371 };
00372 
00373 inline const char *vtkGL2PSExporter::GetSortAsString(void)
00374 {
00375   if ( this->Sort == NO_SORT )
00376     {
00377     return "Off";
00378     }
00379   else if ( this->Sort == SIMPLE_SORT )
00380     {
00381     return "Simple";
00382     }
00383   else
00384     {
00385     return "BSP";
00386     }
00387 }
00388 
00389 inline const char *vtkGL2PSExporter::GetFileFormatAsString(void)
00390 {
00391   if ( this->FileFormat == PS_FILE )
00392     {
00393     return "PS";
00394     }
00395   else if ( this->FileFormat == EPS_FILE )
00396     {
00397     return "EPS";
00398     }
00399   else if ( this->FileFormat == PDF_FILE )
00400     {
00401     return "PDF";
00402     }
00403   else if ( this->FileFormat == TEX_FILE )
00404     {
00405     return "TeX";
00406     }
00407   else
00408     {
00409     return "SVG";
00410     }
00411 }
00412 
00413 #endif