VTK  9.7.0
vtkPLYWriter.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
28
29#ifndef vtkPLYWriter_h
30#define vtkPLYWriter_h
31
32#include "vtkIOPLYModule.h" // For export macro
33#include "vtkSmartPointer.h" // For protected ivars
34#include "vtkWriter.h"
35
36#include <string> // For string parameter
37
38VTK_ABI_NAMESPACE_BEGIN
40class vtkPolyData;
42class vtkStringArray;
44
45#define VTK_LITTLE_ENDIAN 0
46#define VTK_BIG_ENDIAN 1
47
48#define VTK_COLOR_MODE_DEFAULT 0
49#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
50#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
51#define VTK_COLOR_MODE_UNIFORM_COLOR 3
52#define VTK_COLOR_MODE_OFF 4
53
54#define VTK_TEXTURECOORDS_UV 0
55#define VTK_TEXTURECOORDS_TEXTUREUV 1
56#define VTK_TEXTURECOORDS_ST 2
57
58class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
59{
60public:
61 static vtkPLYWriter* New();
62 vtkTypeMacro(vtkPLYWriter, vtkWriter);
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
71 vtkGetMacro(DataByteOrder, int);
75
77
85 vtkSetMacro(WriteToOutputString, bool);
86 vtkGetMacro(WriteToOutputString, bool);
87 vtkBooleanMacro(WriteToOutputString, bool);
88 const std::string& GetOutputString() const { return this->OutputString; }
90
92
96 vtkSetMacro(WriteObjectInformation, bool);
97 vtkGetMacro(WriteObjectInformation, bool);
98 vtkBooleanMacro(WriteObjectInformation, bool);
100
102
119 vtkSetMacro(ColorMode, int);
120 vtkGetMacro(ColorMode, int);
124 void SetColorModeToUniformColor() // both cells and points are colored
125 {
127 }
128 void SetColorModeToOff() // No color information is written
129 {
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
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
195
197
203
205
208 vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
209 vtkGetMacro(FileType, int);
213
215
222 vtkGetMacro(TextureCoordinatesName, int);
225 {
227 }
230
234 void AddComment(const std::string& comment);
235
236protected:
238 ~vtkPLYWriter() override;
239
240 bool WriteDataAndReturn() override;
244
250 unsigned char Color[3];
251
253 unsigned char Alpha;
254
255 char* FileName;
256
259
261
262 // Whether this object is writing to a string or a file.
263 // Default is 0: write to file.
265
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
278VTK_ABI_NAMESPACE_END
279#endif
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
virtual void SetColorMode(int)
These methods enable the user to control how to add color into the PLY output file.
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
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.
virtual void SetDataByteOrder(int)
If the file type is binary, then the user can specify which byte order to use (little versus big endi...
bool WriteDataAndReturn() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetTextureCoordinatesNameToST()
Choose the name used for the texture coordinates.
vtkScalarsToColors * LookupTable
unsigned char Alpha
std::string OutputString
virtual void SetFileType(int)
Specify file type (ASCII or BINARY) for vtk data file.
unsigned char Color[3]
~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.
const float * GetNormals(vtkIdType num, vtkDataSetAttributes *dsa)
bool WriteToOutputString
int TextureCoordinatesName
static vtkPLYWriter * New()
virtual void SetLookupTable(vtkScalarsToColors *)
A lookup table can be specified in order to convert data arrays to RGBA colors.
bool WriteObjectInformation
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
vtkSmartPointer< vtkStringArray > HeaderComments
virtual void SetTextureCoordinatesName(int)
Choose the name used for the texture coordinates.
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:72
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
#define VTK_LITTLE_ENDIAN
#define VTK_COLOR_MODE_DEFAULT
#define VTK_COLOR_MODE_OFF
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
#define VTK_TEXTURECOORDS_ST
#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
int vtkIdType
Definition vtkType.h:363
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_BINARY
Definition vtkWriter.h:33
#define VTK_ASCII
Definition vtkWriter.h:32