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=========================================================================*/
67#ifndef vtkPLYWriter_h
68#define vtkPLYWriter_h
69
70#include "vtkIOPLYModule.h" // For export macro
71#include "vtkSmartPointer.h" // For protected ivars
72#include "vtkWriter.h"
73
74#include <string> // For string parameter
75
77class vtkPolyData;
79class vtkStringArray;
81
82#define VTK_LITTLE_ENDIAN 0
83#define VTK_BIG_ENDIAN 1
84
85#define VTK_COLOR_MODE_DEFAULT 0
86#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
87#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
88#define VTK_COLOR_MODE_UNIFORM_COLOR 3
89#define VTK_COLOR_MODE_OFF 4
90
91#define VTK_TEXTURECOORDS_UV 0
92#define VTK_TEXTURECOORDS_TEXTUREUV 1
93
94class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
95{
96public:
97 static vtkPLYWriter* New();
98 vtkTypeMacro(vtkPLYWriter, vtkWriter);
99 void PrintSelf(ostream& os, vtkIndent indent) override;
100
102
106 vtkSetClampMacro(DataByteOrder, int, VTK_LITTLE_ENDIAN, VTK_BIG_ENDIAN);
107 vtkGetMacro(DataByteOrder, int);
108 void SetDataByteOrderToBigEndian() { this->SetDataByteOrder(VTK_BIG_ENDIAN); }
109 void SetDataByteOrderToLittleEndian() { this->SetDataByteOrder(VTK_LITTLE_ENDIAN); }
111
113
121 vtkSetMacro(WriteToOutputString, bool);
122 vtkGetMacro(WriteToOutputString, bool);
123 vtkBooleanMacro(WriteToOutputString, bool);
124 const std::string& GetOutputString() const { return this->OutputString; }
126
128
145 vtkSetMacro(ColorMode, int);
146 vtkGetMacro(ColorMode, int);
147 void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
150 void SetColorModeToUniformColor() // both cells and points are colored
151 {
152 this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);
153 }
154 void SetColorModeToOff() // No color information is written
155 {
156 this->SetColorMode(VTK_COLOR_MODE_OFF);
157 }
159
161
165 vtkSetMacro(EnableAlpha, bool);
166 vtkGetMacro(EnableAlpha, bool);
167 vtkBooleanMacro(EnableAlpha, bool);
169
171
174 vtkSetStringMacro(ArrayName);
175 vtkGetStringMacro(ArrayName);
177
179
182 vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
183 vtkGetMacro(Component, int);
185
187
192 vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
194
196
202 vtkSetVector3Macro(Color, unsigned char);
203 vtkGetVector3Macro(Color, unsigned char);
205
207
210 vtkSetMacro(Alpha, unsigned char);
211 vtkGetMacro(Alpha, unsigned char);
213
215
221
223
229
231
234 vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
235 vtkGetMacro(FileType, int);
236 void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
237 void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
239
241
245 vtkSetClampMacro(TextureCoordinatesName, int, VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
246 vtkGetMacro(TextureCoordinatesName, int);
247 void SetTextureCoordinatesNameToUV() { this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV); }
249 {
250 this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);
251 }
253
257 void AddComment(const std::string& comment);
258
259protected:
261 ~vtkPLYWriter() override;
262
263 void WriteData() override;
266
272 unsigned char Color[3];
273
275 unsigned char Alpha;
276
277 char* FileName;
278
281
283
284 // Whether this object is writing to a string or a file.
285 // Default is 0: write to file.
287
288 // The output string.
289 std::string OutputString;
290
291 int FillInputPortInformation(int port, vtkInformation* info) override;
292
293private:
294 vtkPLYWriter(const vtkPLYWriter&) = delete;
295 void operator=(const vtkPLYWriter&) = delete;
296};
297
298#endif
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
write Stanford PLY file format
Definition: vtkPLYWriter.h:95
char * FileName
Definition: vtkPLYWriter.h:277
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:109
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.
Definition: vtkPLYWriter.h:148
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:236
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:150
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.
Definition: vtkPLYWriter.h:237
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:108
const std::string & GetOutputString() const
Enable writing to an OutputString instead of the default, a file.
Definition: vtkPLYWriter.h:124
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.
char * ArrayName
Definition: vtkPLYWriter.h:268
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
Definition: vtkPLYWriter.h:271
unsigned char Alpha
Definition: vtkPLYWriter.h:275
std::string OutputString
Definition: vtkPLYWriter.h:289
~vtkPLYWriter() override
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:247
void SetColorModeToDefault()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:147
void SetColorModeToUniformPointColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:149
bool WriteToOutputString
Definition: vtkPLYWriter.h:286
void WriteData() override
int TextureCoordinatesName
Definition: vtkPLYWriter.h:280
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.
Definition: vtkPLYWriter.h:248
vtkSmartPointer< vtkStringArray > HeaderComments
Definition: vtkPLYWriter.h:282
void SetColorModeToOff()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:154
vtkSmartPointer< vtkUnsignedCharArray > GetColors(vtkIdType num, vtkDataSetAttributes *dsa)
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
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:46
#define VTK_LITTLE_ENDIAN
Definition: vtkPLYWriter.h:82
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:89
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
Definition: vtkPLYWriter.h:87
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:91
#define VTK_COLOR_MODE_UNIFORM_COLOR
Definition: vtkPLYWriter.h:88
#define VTK_BIG_ENDIAN
Definition: vtkPLYWriter.h:83
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:86
#define VTK_TEXTURECOORDS_TEXTUREUV
Definition: vtkPLYWriter.h:92
#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:43
#define VTK_ASCII
Definition: vtkWriter.h:42