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 =========================================================================*/
36 #ifndef vtkSingleVTPExporter_h
37 #define vtkSingleVTPExporter_h
38 
39 #include "vtkIOExportModule.h" // For export macro
40 #include "vtkExporter.h"
41 #include <vector> // for method args
42 
43 class vtkActor;
44 class vtkPolyData;
45 class vtkTexture;
46 
47 class VTKIOEXPORT_EXPORT vtkSingleVTPExporter : public vtkExporter
48 {
49 public:
50  static vtkSingleVTPExporter *New();
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  vtkSetStringMacro(FilePrefix);
60  vtkGetStringMacro(FilePrefix);
62 
63  // computes the file prefix from a filename by removing
64  // the .vtp extension if present. Useful for APIs that
65  // are filename centric.
66  void SetFileName(const char *);
67 
68 protected:
70  ~vtkSingleVTPExporter() override;
71 
72  void WriteData() override;
73 
74  class actorData
75  {
76  public:
77  vtkActor *Actor = nullptr;
78  vtkTexture *Texture = nullptr;
79  int ImagePosition[2];
80  double URange[2];
81  double VRange[2];
82  bool HaveRepeatingTexture = false;
83  };
84  int TextureSize[2];
85  void WriteTexture(std::vector<actorData> &actors);
86  void WriteVTP(std::vector<actorData> &actors);
87  char *FilePrefix;
88 
89  // handle repeating textures by subdividing triangles
90  // so that they do not span mode than 0.0-1.5 of texture
91  // range.
92  vtkPolyData *FixTextureCoordinates(vtkPolyData *);
93 
94  // recursive method that handles one triangle
95  void ProcessTriangle(vtkIdType *pts, vtkPolyData *out);
96 
97 private:
99  void operator=(const vtkSingleVTPExporter&) = delete;
100 };
101 
102 #endif
abstract class to write a scene to a file
Definition: vtkExporter.h:47
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual void WriteData()=0
int vtkIdType
Definition: vtkType.h:347
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...