VTK  9.2.6
vtkPLYWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPLYWriter.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 =========================================================================*/
41 #ifndef vtkPLYWriter_h
42 #define vtkPLYWriter_h
43 
44 #include "vtkIOPLYModule.h" // For export macro
45 #include "vtkSmartPointer.h" // For protected ivars
46 #include "vtkWriter.h"
47 
48 #include <string> // For string parameter
49 
51 class vtkPolyData;
52 class vtkScalarsToColors;
53 class vtkStringArray;
55 
56 #define VTK_LITTLE_ENDIAN 0
57 #define VTK_BIG_ENDIAN 1
58 
59 #define VTK_COLOR_MODE_DEFAULT 0
60 #define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
61 #define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
62 #define VTK_COLOR_MODE_UNIFORM_COLOR 3
63 #define VTK_COLOR_MODE_OFF 4
64 
65 #define VTK_TEXTURECOORDS_UV 0
66 #define VTK_TEXTURECOORDS_TEXTUREUV 1
67 
68 class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
69 {
70 public:
71  static vtkPLYWriter* New();
72  vtkTypeMacro(vtkPLYWriter, vtkWriter);
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
80  vtkSetClampMacro(DataByteOrder, int, VTK_LITTLE_ENDIAN, VTK_BIG_ENDIAN);
81  vtkGetMacro(DataByteOrder, int);
82  void SetDataByteOrderToBigEndian() { this->SetDataByteOrder(VTK_BIG_ENDIAN); }
83  void SetDataByteOrderToLittleEndian() { this->SetDataByteOrder(VTK_LITTLE_ENDIAN); }
85 
87 
95  vtkSetMacro(WriteToOutputString, bool);
96  vtkGetMacro(WriteToOutputString, bool);
97  vtkBooleanMacro(WriteToOutputString, bool);
98  const std::string& GetOutputString() const { return this->OutputString; }
100 
102 
119  vtkSetMacro(ColorMode, int);
120  vtkGetMacro(ColorMode, int);
121  void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
124  void SetColorModeToUniformColor() // both cells and points are colored
125  {
126  this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);
127  }
128  void SetColorModeToOff() // No color information is written
129  {
130  this->SetColorMode(VTK_COLOR_MODE_OFF);
131  }
133 
135 
139  vtkSetMacro(EnableAlpha, bool);
140  vtkGetMacro(EnableAlpha, bool);
141  vtkBooleanMacro(EnableAlpha, bool);
143 
145 
148  vtkSetStringMacro(ArrayName);
149  vtkGetStringMacro(ArrayName);
151 
153 
156  vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
157  vtkGetMacro(Component, int);
159 
161 
165  virtual void SetLookupTable(vtkScalarsToColors*);
166  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
168 
170 
176  vtkSetVector3Macro(Color, unsigned char);
177  vtkGetVector3Macro(Color, unsigned char);
179 
181 
184  vtkSetMacro(Alpha, unsigned char);
185  vtkGetMacro(Alpha, unsigned char);
187 
189 
193  vtkPolyData* GetInput(int port);
195 
197 
200  vtkSetFilePathMacro(FileName);
201  vtkGetFilePathMacro(FileName);
203 
205 
208  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
209  vtkGetMacro(FileType, int);
210  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
211  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
213 
215 
219  vtkSetClampMacro(TextureCoordinatesName, int, VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
220  vtkGetMacro(TextureCoordinatesName, int);
221  void SetTextureCoordinatesNameToUV() { this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV); }
223  {
224  this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);
225  }
227 
231  void AddComment(const std::string& comment);
232 
233 protected:
234  vtkPLYWriter();
235  ~vtkPLYWriter() override;
236 
237  void WriteData() override;
239  const float* GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes* dsa);
240  const float* GetNormals(vtkIdType num, vtkDataSetAttributes* dsa);
241 
243  char* ArrayName;
247  unsigned char Color[3];
248 
250  unsigned char Alpha;
251 
252  char* FileName;
253 
254  int FileType;
256 
258 
259  // Whether this object is writing to a string or a file.
260  // Default is 0: write to file.
262 
263  // The output string.
265 
266  int FillInputPortInformation(int port, vtkInformation* info) override;
267 
268 private:
269  vtkPLYWriter(const vtkPLYWriter&) = delete;
270  void operator=(const vtkPLYWriter&) = delete;
271 };
272 
273 #endif
vtkScalarsToColors * LookupTable
Definition: vtkPLYWriter.h:246
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:63
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:222
Store vtkAlgorithm input/output information.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:211
#define VTK_INT_MAX
Definition: vtkType.h:155
void SetDataByteOrderToBigEndian()
If the file type is binary, then the user can specify which byte order to use (little versus big endi...
Definition: vtkPLYWriter.h:82
write Stanford PLY file format
Definition: vtkPLYWriter.h:68
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
#define VTK_ASCII
Definition: vtkWriter.h:42
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
Definition: vtkPLYWriter.h:61
std::string OutputString
Definition: vtkPLYWriter.h:264
int TextureCoordinatesName
Definition: vtkPLYWriter.h:255
vtkSmartPointer< vtkStringArray > HeaderComments
Definition: vtkPLYWriter.h:257
Superclass for mapping scalar values to colors.
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:221
abstract class to write data to file(s)
Definition: vtkWriter.h:45
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const std::string & GetOutputString() const
Enable writing to an OutputString instead of the default, a file.
Definition: vtkPLYWriter.h:98
#define VTK_BIG_ENDIAN
Definition: vtkPLYWriter.h:57
unsigned char Alpha
Definition: vtkPLYWriter.h:250
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDataObject * GetInput()
void SetColorModeToOff()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:128
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:210
#define VTK_BINARY
Definition: vtkWriter.h:43
#define VTK_COLOR_MODE_UNIFORM_COLOR
Definition: vtkPLYWriter.h:62
represent and manipulate attribute data in a dataset
void SetColorModeToUniformPointColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:123
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:65
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
bool WriteToOutputString
Definition: vtkPLYWriter.h:261
dynamic, self-adjusting array of unsigned char
#define VTK_LITTLE_ENDIAN
Definition: vtkPLYWriter.h:56
void SetColorModeToUniformCellColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:122
char * FileName
Definition: vtkPLYWriter.h:252
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkPLYWriter.h:59
void SetDataByteOrderToLittleEndian()
If the file type is binary, then the user can specify which byte order to use (little versus big endi...
Definition: vtkPLYWriter.h:83
#define VTK_TEXTURECOORDS_TEXTUREUV
Definition: vtkPLYWriter.h:66
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:124
static vtkAlgorithm * New()
virtual void WriteData()=0
void SetColorModeToDefault()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:121
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:60
char * ArrayName
Definition: vtkPLYWriter.h:243