VTK  9.0.1
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:
44  static vtkSingleVTPExporter* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
53  vtkSetStringMacro(FilePrefix);
54  vtkGetStringMacro(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(const char*);
61 
62 protected:
64  ~vtkSingleVTPExporter() override;
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.
86  vtkPolyData* FixTextureCoordinates(vtkPolyData*);
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
vtkSingleVTPExporter::actorData
Definition: vtkSingleVTPExporter.h:68
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkExporter::WriteData
virtual void WriteData()=0
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:65
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkExporter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSingleVTPExporter::FilePrefix
char * FilePrefix
Definition: vtkSingleVTPExporter.h:81
vtkExporter
abstract class to write a scene to a file
Definition: vtkExporter.h:47
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkExporter.h
vtkSingleVTPExporter
export a scene into a single vtp file and png texture
Definition: vtkSingleVTPExporter.h:41