VTK  9.1.0
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=========================================================================*/
47#ifndef vtkPLYWriter_h
48#define vtkPLYWriter_h
49
50#include "vtkIOPLYModule.h" // For export macro
51#include "vtkSmartPointer.h" // For protected ivars
52#include "vtkWriter.h"
53
54#include <string> // For string parameter
55
57class vtkPolyData;
59class vtkStringArray;
61
62#define VTK_LITTLE_ENDIAN 0
63#define VTK_BIG_ENDIAN 1
64
65#define VTK_COLOR_MODE_DEFAULT 0
66#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
67#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
68#define VTK_COLOR_MODE_UNIFORM_COLOR 3
69#define VTK_COLOR_MODE_OFF 4
70
71#define VTK_TEXTURECOORDS_UV 0
72#define VTK_TEXTURECOORDS_TEXTUREUV 1
73
74class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
75{
76public:
77 static vtkPLYWriter* New();
78 vtkTypeMacro(vtkPLYWriter, vtkWriter);
79 void PrintSelf(ostream& os, vtkIndent indent) override;
80
82
86 vtkSetClampMacro(DataByteOrder, int, VTK_LITTLE_ENDIAN, VTK_BIG_ENDIAN);
87 vtkGetMacro(DataByteOrder, int);
88 void SetDataByteOrderToBigEndian() { this->SetDataByteOrder(VTK_BIG_ENDIAN); }
89 void SetDataByteOrderToLittleEndian() { this->SetDataByteOrder(VTK_LITTLE_ENDIAN); }
91
93
101 vtkSetMacro(WriteToOutputString, bool);
102 vtkGetMacro(WriteToOutputString, bool);
103 vtkBooleanMacro(WriteToOutputString, bool);
104 const std::string& GetOutputString() const { return this->OutputString; }
106
108
125 vtkSetMacro(ColorMode, int);
126 vtkGetMacro(ColorMode, int);
127 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
130 void SetColorModeToUniformColor() // both cells and points are colored
131 {
132 this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);
133 }
134 void SetColorModeToOff() // No color information is written
135 {
136 this->SetColorMode(VTK_COLOR_MODE_OFF);
137 }
139
141
145 vtkSetMacro(EnableAlpha, bool);
146 vtkGetMacro(EnableAlpha, bool);
147 vtkBooleanMacro(EnableAlpha, bool);
149
151
154 vtkSetStringMacro(ArrayName);
155 vtkGetStringMacro(ArrayName);
157
159
162 vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
163 vtkGetMacro(Component, int);
165
167
172 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
174
176
182 vtkSetVector3Macro(Color, unsigned char);
183 vtkGetVector3Macro(Color, unsigned char);
185
187
190 vtkSetMacro(Alpha, unsigned char);
191 vtkGetMacro(Alpha, unsigned char);
193
195
201
203
209
211
214 vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
215 vtkGetMacro(FileType, int);
216 void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
217 void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
219
221
225 vtkSetClampMacro(TextureCoordinatesName, int, VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
226 vtkGetMacro(TextureCoordinatesName, int);
227 void SetTextureCoordinatesNameToUV() { this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV); }
229 {
230 this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);
231 }
233
237 void AddComment(const std::string& comment);
238
239protected:
241 ~vtkPLYWriter() override;
242
243 void WriteData() override;
246
252 unsigned char Color[3];
253
255 unsigned char Alpha;
256
257 char* FileName;
258
261
263
264 // Whether this object is writing to a string or a file.
265 // Default is 0: write to file.
267
268 // The output string.
269 std::string OutputString;
270
271 int FillInputPortInformation(int port, vtkInformation* info) override;
272
273private:
274 vtkPLYWriter(const vtkPLYWriter&) = delete;
275 void operator=(const vtkPLYWriter&) = delete;
276};
277
278#endif
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition vtkIndent.h:43
Store vtkAlgorithm input/output information.
write Stanford PLY file format
void SetDataByteOrderToLittleEndian()
If the file type is binary, then the user can specify which byte order to use (little versus big endi...
vtkSetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
void SetColorModeToUniformCellColor()
These methods enable the user to control how to add color into the PLY output file.
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
void SetDataByteOrderToBigEndian()
If the file type is binary, then the user can specify which byte order to use (little versus big endi...
const std::string & GetOutputString() const
Enable writing to an OutputString instead of the default, a file.
vtkGetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
vtkPolyData * GetInput(int port)
Get the input to this writer.
void AddComment(const std::string &comment)
Add a comment in the header part.
const float * GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes *dsa)
vtkPolyData * GetInput()
Get the input to this writer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkScalarsToColors * LookupTable
unsigned char Alpha
std::string OutputString
~vtkPLYWriter() override
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
void SetColorModeToDefault()
These methods enable the user to control how to add color into the PLY output file.
void SetColorModeToUniformPointColor()
These methods enable the user to control how to add color into the PLY output file.
bool WriteToOutputString
void WriteData() override
int TextureCoordinatesName
static vtkPLYWriter * New()
virtual void SetLookupTable(vtkScalarsToColors *)
A lookup table can be specified in order to convert data arrays to RGBA colors.
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
vtkSmartPointer< vtkStringArray > HeaderComments
void SetColorModeToOff()
These methods enable the user to control how to add color into the PLY output file.
vtkSmartPointer< vtkUnsignedCharArray > GetColors(vtkIdType num, vtkDataSetAttributes *dsa)
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:95
Superclass for mapping scalar values to colors.
Hold a reference to a vtkObjectBase instance.
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of unsigned char
abstract class to write data to file(s)
Definition vtkWriter.h:43
#define VTK_LITTLE_ENDIAN
#define VTK_COLOR_MODE_OFF
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
#define VTK_TEXTURECOORDS_UV
#define VTK_COLOR_MODE_UNIFORM_COLOR
#define VTK_BIG_ENDIAN
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
#define VTK_TEXTURECOORDS_TEXTUREUV
#define VTK_COLOR_MODE_DEFAULT
int vtkIdType
Definition vtkType.h:332
#define VTK_INT_MAX
Definition vtkType.h:155
#define VTK_BINARY
Definition vtkWriter.h:40
#define VTK_ASCII
Definition vtkWriter.h:39