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 =========================================================================*/
27 #ifndef vtkSingleVTPExporter_h
28 #define vtkSingleVTPExporter_h
29 
30 #include "vtkIOExportModule.h" // For export macro
31 #include "vtkExporter.h"
32 #include <vector> // for method args
33 
34 class vtkActor;
35 class vtkPolyData;
36 class vtkTexture;
37 
38 class VTKIOEXPORT_EXPORT vtkSingleVTPExporter : public vtkExporter
39 {
40 public:
41  static vtkSingleVTPExporter *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
50  vtkSetStringMacro(FilePrefix);
51  vtkGetStringMacro(FilePrefix);
53 
54  // computes the file prefix from a filename by removing
55  // the .vtp extension if present. Useful for APIs that
56  // are filename centric.
57  void SetFileName(const char *);
58 
59 protected:
61  ~vtkSingleVTPExporter() override;
62 
63  void WriteData() override;
64 
65  class actorData
66  {
67  public:
68  vtkActor *Actor = nullptr;
69  vtkTexture *Texture = nullptr;
70  int ImagePosition[2];
71  double URange[2];
72  double VRange[2];
73  bool HaveRepeatingTexture = false;
74  };
75  int TextureSize[2];
76  void WriteTexture(std::vector<actorData> &actors);
77  void WriteVTP(std::vector<actorData> &actors);
78  char *FilePrefix;
79 
80  // handle repeating textures by subdividing triangles
81  // so that they do not span mode than 0.0-1.5 of texture
82  // range.
83  vtkPolyData *FixTextureCoordinates(vtkPolyData *);
84 
85  // recursive method that handles one triangle
86  void ProcessTriangle(vtkIdType *pts, vtkPolyData *out);
87 
88 private:
90  void operator=(const vtkSingleVTPExporter&) = delete;
91 };
92 
93 #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:45
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:79
a simple class to control print indentation
Definition: vtkIndent.h:33
handles properties associated with a texture map
Definition: vtkTexture.h:65
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...