VTK  9.1.0
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 =========================================================================*/
30 #ifndef vtkSingleVTPExporter_h
31 #define vtkSingleVTPExporter_h
32 
33 #include "vtkExporter.h"
34 #include "vtkIOExportModule.h" // For export macro
35 #include <vector> // for method args
36 
37 class vtkActor;
38 class vtkPolyData;
39 class vtkTexture;
40 
41 class VTKIOEXPORT_EXPORT vtkSingleVTPExporter : public vtkExporter
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
53  vtkSetFilePathMacro(FilePrefix);
54  vtkGetFilePathMacro(FilePrefix);
56 
57  // computes the file prefix from a filename by removing
58  // the .vtp extension if present. Useful for APIs that
59  // are filename centric.
60  void SetFileName(VTK_FILEPATH const char*);
61 
62 protected:
65 
66  void WriteData() override;
67 
68  class actorData
69  {
70  public:
71  vtkActor* Actor = nullptr;
72  vtkTexture* Texture = nullptr;
73  int ImagePosition[2];
74  double URange[2];
75  double VRange[2];
76  bool HaveRepeatingTexture = false;
77  };
78  int TextureSize[2];
79  void WriteTexture(std::vector<actorData>& actors);
80  void WriteVTP(std::vector<actorData>& actors);
81  char* FilePrefix;
82 
83  // handle repeating textures by subdividing triangles
84  // so that they do not span mode than 0.0-1.5 of texture
85  // range.
87 
88  // recursive method that handles one triangle
89  void ProcessTriangle(const vtkIdType* pts, vtkPolyData* out);
90 
91 private:
93  void operator=(const vtkSingleVTPExporter&) = delete;
94 };
95 
96 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
abstract class to write a scene to a file
Definition: vtkExporter.h:48
a simple class to control print indentation
Definition: vtkIndent.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
export a scene into a single vtp file and png texture
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void WriteTexture(std::vector< actorData > &actors)
void SetFileName(VTK_FILEPATH const char *)
static vtkSingleVTPExporter * New()
~vtkSingleVTPExporter() override
void WriteData() override
vtkSetFilePathMacro(FilePrefix)
Specify the prefix of the files to write out.
void ProcessTriangle(const vtkIdType *pts, vtkPolyData *out)
vtkGetFilePathMacro(FilePrefix)
Specify the prefix of the files to write out.
void WriteVTP(std::vector< actorData > &actors)
vtkPolyData * FixTextureCoordinates(vtkPolyData *)
handles properties associated with a texture map
Definition: vtkTexture.h:66
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH