VTK  9.2.6
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 "vtkExporter.h"
40 #include "vtkIOExportModule.h" // For export macro
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:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  vtkSetFilePathMacro(FilePrefix);
60  vtkGetFilePathMacro(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(VTK_FILEPATH const char*);
67 
68 protected:
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.
93 
94  // recursive method that handles one triangle
95  void ProcessTriangle(const vtkIdType* pts, vtkPolyData* out);
96 
97 private:
99  void operator=(const vtkSingleVTPExporter&) = delete;
100 };
101 
102 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
abstract class to write a scene to a file
Definition: vtkExporter.h:48
a simple class to control print indentation
Definition: vtkIndent.h:119
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
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:178
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH