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 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 
00124   vtkSetStringMacro(Title);
00125   vtkGetStringMacro(Title);
00127 
00128 //BTX
00129   enum OutputFormat
00130   {
00131       PS_FILE,
00132       EPS_FILE,
00133       PDF_FILE,
00134       TEX_FILE,
00135       SVG_FILE
00136   };
00137 //ETX
00138 
00140 
00145   void UsePainterSettings()
00146   {
00147     this->SetSortToOff();
00148     this->SetSimpleLineOffset(0);
00149   }
00151 
00153 
00157   vtkSetClampMacro(FileFormat, int, PS_FILE, SVG_FILE);
00158   vtkGetMacro(FileFormat, int);
00159   void SetFileFormatToPS()
00160     {this->SetFileFormat(PS_FILE);};
00161   void SetFileFormatToEPS()
00162     {this->SetFileFormat(EPS_FILE);};
00163   void SetFileFormatToPDF()
00164     {this->SetFileFormat(PDF_FILE);};
00165   void SetFileFormatToTeX()
00166     {this->SetFileFormat(TEX_FILE);};
00167   void SetFileFormatToSVG()
00168     {this->SetFileFormat(SVG_FILE);};
00169   const char *GetFileFormatAsString();
00171 
00172 //BTX
00173   enum SortScheme
00174   {
00175       NO_SORT=0,
00176       SIMPLE_SORT=1,
00177       BSP_SORT=2
00178   };
00179 //ETX
00180 
00182 
00185   vtkSetClampMacro(Sort, int, NO_SORT, BSP_SORT);
00186   vtkGetMacro(Sort,int);
00187   void SetSortToOff()
00188     {this->SetSort(NO_SORT);};
00189   void SetSortToSimple()
00190     {this->SetSort(SIMPLE_SORT);};
00191   void SetSortToBSP()
00192     {this->SetSort(BSP_SORT);};
00193   const char *GetSortAsString();
00195 
00197 
00199   vtkSetMacro(Compress, int);
00200   vtkGetMacro(Compress, int);
00201   vtkBooleanMacro(Compress, int);
00203 
00205 
00207   vtkSetMacro(DrawBackground, int);
00208   vtkGetMacro(DrawBackground, int);
00209   vtkBooleanMacro(DrawBackground, int);
00211 
00213 
00216   vtkSetMacro(SimpleLineOffset, int);
00217   vtkGetMacro(SimpleLineOffset, int);
00218   vtkBooleanMacro(SimpleLineOffset, int);
00220 
00222 
00224   vtkSetMacro(Silent, int);
00225   vtkGetMacro(Silent, int);
00226   vtkBooleanMacro(Silent, int);
00228 
00230 
00233   vtkSetMacro(BestRoot, int);
00234   vtkGetMacro(BestRoot, int);
00235   vtkBooleanMacro(BestRoot, int);
00237 
00239 
00242   vtkSetMacro(Text, int);
00243   vtkGetMacro(Text, int);
00244   vtkBooleanMacro(Text, int);
00246 
00248 
00250   vtkSetMacro(Landscape, int);
00251   vtkGetMacro(Landscape, int);
00252   vtkBooleanMacro(Landscape, int);
00254 
00256 
00259   vtkSetMacro(PS3Shading, int);
00260   vtkGetMacro(PS3Shading, int);
00261   vtkBooleanMacro(PS3Shading, int);
00263 
00265 
00268   vtkSetMacro(OcclusionCull, int);
00269   vtkGetMacro(OcclusionCull, int);
00270   vtkBooleanMacro(OcclusionCull, int);
00272 
00274 
00278   vtkSetMacro(Write3DPropsAsRasterImage, int);
00279   vtkGetMacro(Write3DPropsAsRasterImage, int);
00280   vtkBooleanMacro(Write3DPropsAsRasterImage, int);
00282 
00284 
00287   vtkSetMacro(TextAsPath, bool);
00288   vtkGetMacro(TextAsPath, bool);
00289   vtkBooleanMacro(TextAsPath, bool);
00291 
00293 
00298   void SetRasterExclusions(vtkPropCollection*);
00299   vtkGetObjectMacro(RasterExclusions, vtkPropCollection);
00301 
00303 
00305   vtkSetMacro(PointSizeFactor, float);
00306   vtkGetMacro(PointSizeFactor, float);
00308 
00310 
00312   vtkSetMacro(LineWidthFactor, float);
00313   vtkGetMacro(LineWidthFactor, float);
00315 
00316 protected:
00317   vtkGL2PSExporter();
00318   ~vtkGL2PSExporter();
00319 
00320   void WriteData();
00321 
00322   int GetGL2PSOptions();
00323   int GetGL2PSSort();
00324   int GetGL2PSFormat();
00325   const char *GetFileExtension();
00326 
00327   void SavePropVisibility(vtkRendererCollection *renCol,
00328                           vtkIntArray *volVis, vtkIntArray *actVis,
00329                           vtkIntArray *act2dVis);
00330   void RestorePropVisibility(vtkRendererCollection *renCol,
00331                              vtkIntArray *volVis, vtkIntArray *actVis,
00332                              vtkIntArray *act2dVis);
00333   void Turn3DPropsOff(vtkRendererCollection *renCol);
00334   void Turn2DPropsOff(vtkRendererCollection *renCol);
00335   void GetVisibleContextActors(vtkPropCollection *contextActors,
00336                                vtkRendererCollection *renCol);
00337   void SetPropVisibilities(vtkPropCollection *col, int vis);
00338 
00339   void DrawSpecialProps(vtkCollection *propCol, vtkRendererCollection *renCol);
00341 
00343   virtual void HandleSpecialProp(vtkProp *prop, vtkRenderer *ren);
00344   void DrawTextActor(vtkTextActor *textAct, vtkRenderer *ren);
00345   void DrawTextActor3D(vtkTextActor3D *textAct, vtkRenderer *ren);
00346   void DrawTextMapper(vtkTextMapper *textMap, vtkActor2D *textAct,
00347                       vtkRenderer *ren);
00348   void DrawLabeledDataMapper(vtkLabeledDataMapper *mapper, vtkRenderer *ren);
00349   void DrawScalarBarActor(vtkScalarBarActor *bar, vtkRenderer *ren);
00350   void DrawViewportTextOverlay(const char *string, vtkTextProperty *tprop,
00351                                vtkCoordinate *coord, vtkRenderer *ren);
00353 
00357   void CopyPixels(int copyRect[4], vtkRenderer *ren);
00358 
00359   void DrawContextActors(vtkPropCollection *contextActs,
00360                          vtkRendererCollection *renCol);
00361 
00362 
00363   vtkPropCollection *RasterExclusions;
00364 
00365   char *FilePrefix;
00366   char *Title;
00367   int FileFormat;
00368   int Sort;
00369   int Compress;
00370   int DrawBackground;
00371   int SimpleLineOffset;
00372   int Silent;
00373   int BestRoot;
00374   int Text;
00375   int Landscape;
00376   int PS3Shading;
00377   int OcclusionCull;
00378   int Write3DPropsAsRasterImage;
00379   bool TextAsPath;
00380   float PointSizeFactor;
00381   float LineWidthFactor;
00382 
00383   vtkNew<vtkImageData> PixelData;
00384 
00385 private:
00386   vtkGL2PSExporter(const vtkGL2PSExporter&); // Not implemented
00387   void operator=(const vtkGL2PSExporter&); // Not implemented
00388 };
00389 
00390 inline const char *vtkGL2PSExporter::GetSortAsString(void)
00391 {
00392   if ( this->Sort == NO_SORT )
00393     {
00394     return "Off";
00395     }
00396   else if ( this->Sort == SIMPLE_SORT )
00397     {
00398     return "Simple";
00399     }
00400   else
00401     {
00402     return "BSP";
00403     }
00404 }
00405 
00406 inline const char *vtkGL2PSExporter::GetFileFormatAsString(void)
00407 {
00408   if ( this->FileFormat == PS_FILE )
00409     {
00410     return "PS";
00411     }
00412   else if ( this->FileFormat == EPS_FILE )
00413     {
00414     return "EPS";
00415     }
00416   else if ( this->FileFormat == PDF_FILE )
00417     {
00418     return "PDF";
00419     }
00420   else if ( this->FileFormat == TEX_FILE )
00421     {
00422     return "TeX";
00423     }
00424   else
00425     {
00426     return "SVG";
00427     }
00428 }
00429 
00430 #endif