VTK  9.3.20240328
vtkSingleVTPExporter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkSingleVTPExporter_h
25 #define vtkSingleVTPExporter_h
26 
27 #include "vtkExporter.h"
28 #include "vtkIOExportModule.h" // For export macro
29 #include <vector> // for method args
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkActor;
33 class vtkPolyData;
34 class vtkTexture;
35 
36 class VTKIOEXPORT_EXPORT vtkSingleVTPExporter : public vtkExporter
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
48  vtkSetFilePathMacro(FilePrefix);
49  vtkGetFilePathMacro(FilePrefix);
51 
52  // computes the file prefix from a filename by removing
53  // the .vtp extension if present. Useful for APIs that
54  // are filename centric.
55  void SetFileName(VTK_FILEPATH const char*);
56 
57 protected:
60 
61  void WriteData() override;
62 
63  class actorData
64  {
65  public:
66  vtkActor* Actor = nullptr;
67  vtkTexture* Texture = nullptr;
68  int ImagePosition[2];
69  double URange[2];
70  double VRange[2];
71  bool HaveRepeatingTexture = false;
72  };
73  int TextureSize[2];
74  void WriteTexture(std::vector<actorData>& actors);
75  void WriteVTP(std::vector<actorData>& actors);
76  char* FilePrefix;
77 
78  // handle repeating textures by subdividing triangles
79  // so that they do not span mode than 0.0-1.5 of texture
80  // range.
82 
83  // recursive method that handles one triangle
84  void ProcessTriangle(const vtkIdType* pts, vtkPolyData* out);
85 
86 private:
88  void operator=(const vtkSingleVTPExporter&) = delete;
89 };
90 
91 VTK_ABI_NAMESPACE_END
92 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
abstract class to write a scene to a file
Definition: vtkExporter.h:37
a simple class to control print indentation
Definition: vtkIndent.h:108
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
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:167
int vtkIdType
Definition: vtkType.h:315
#define VTK_FILEPATH