VTK
vtkSingleVTPExporter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSingleVTPExporter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkSingleVTPExporter_h
34 #define vtkSingleVTPExporter_h
35 
36 #include "vtkIOExportModule.h" // For export macro
37 #include "vtkExporter.h"
38 #include <vector> // for method args
39 
40 class vtkActor;
41 class vtkPolyData;
42 class vtkTexture;
43 
44 class VTKIOEXPORT_EXPORT vtkSingleVTPExporter : public vtkExporter
45 {
46 public:
47  static vtkSingleVTPExporter *New();
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
56  vtkSetStringMacro(FilePrefix);
57  vtkGetStringMacro(FilePrefix);
59 
60  // computes the file prefix from a filename by removing
61  // the .vtp extension if present. Useful for APIs that
62  // are filename centric.
63  void SetFileName(const char *);
64 
65 protected:
67  ~vtkSingleVTPExporter() override;
68 
69  void WriteData() override;
70 
71  class actorData
72  {
73  public:
74  vtkActor *Actor = nullptr;
75  vtkTexture *Texture = nullptr;
76  int ImagePosition[2];
77  double URange[2];
78  double VRange[2];
79  bool HaveRepeatingTexture = false;
80  };
81  int TextureSize[2];
82  void WriteTexture(std::vector<actorData> &actors);
83  void WriteVTP(std::vector<actorData> &actors);
84  char *FilePrefix;
85 
86  // handle repeating textures by subdividing triangles
87  // so that they do not span mode than 0.0-1.5 of texture
88  // range.
89  vtkPolyData *FixTextureCoordinates(vtkPolyData *);
90 
91  // recursive method that handles one triangle
92  void ProcessTriangle(vtkIdType *pts, vtkPolyData *out);
93 
94 private:
96  void operator=(const vtkSingleVTPExporter&) = delete;
97 };
98 
99 #endif
abstract class to write a scene to a file
Definition: vtkExporter.h:46
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual void WriteData()=0
int vtkIdType
Definition: vtkType.h:345
export a scene into a single vtp file and png texture
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
a simple class to control print indentation
Definition: vtkIndent.h:39
handles properties associated with a texture map
Definition: vtkTexture.h:71
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...