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 =========================================================================*/
50 #ifndef vtkPLYWriter_h
51 #define vtkPLYWriter_h
52 
53 #include "vtkIOPLYModule.h" // For export macro
54 #include "vtkSmartPointer.h" // For protected ivars
55 #include "vtkWriter.h"
56 
57 #include <string> // For string parameter
58 
60 class vtkPolyData;
61 class vtkScalarsToColors;
62 class vtkStringArray;
64 
65 #define VTK_LITTLE_ENDIAN 0
66 #define VTK_BIG_ENDIAN 1
67 
68 #define VTK_COLOR_MODE_DEFAULT 0
69 #define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
70 #define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
71 #define VTK_COLOR_MODE_UNIFORM_COLOR 3
72 #define VTK_COLOR_MODE_OFF 4
73 
74 #define VTK_TEXTURECOORDS_UV 0
75 #define VTK_TEXTURECOORDS_TEXTUREUV 1
76 
77 class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
78 {
79 public:
80  static vtkPLYWriter* New();
81  vtkTypeMacro(vtkPLYWriter, vtkWriter);
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
85 
89  vtkSetClampMacro(DataByteOrder, int, VTK_LITTLE_ENDIAN, VTK_BIG_ENDIAN);
90  vtkGetMacro(DataByteOrder, int);
91  void SetDataByteOrderToBigEndian() { this->SetDataByteOrder(VTK_BIG_ENDIAN); }
92  void SetDataByteOrderToLittleEndian() { this->SetDataByteOrder(VTK_LITTLE_ENDIAN); }
94 
96 
104  vtkSetMacro(WriteToOutputString, bool);
105  vtkGetMacro(WriteToOutputString, bool);
106  vtkBooleanMacro(WriteToOutputString, bool);
107  const std::string& GetOutputString() const { return this->OutputString; }
109 
111 
128  vtkSetMacro(ColorMode, int);
129  vtkGetMacro(ColorMode, int);
130  void SetColorModeToDefault() { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
133  void SetColorModeToUniformColor() // both cells and points are colored
134  {
135  this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);
136  }
137  void SetColorModeToOff() // No color information is written
138  {
139  this->SetColorMode(VTK_COLOR_MODE_OFF);
140  }
142 
144 
148  vtkSetMacro(EnableAlpha, bool);
149  vtkGetMacro(EnableAlpha, bool);
150  vtkBooleanMacro(EnableAlpha, bool);
152 
154 
157  vtkSetStringMacro(ArrayName);
158  vtkGetStringMacro(ArrayName);
160 
162 
165  vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
166  vtkGetMacro(Component, int);
168 
170 
175  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
177 
179 
185  vtkSetVector3Macro(Color, unsigned char);
186  vtkGetVector3Macro(Color, unsigned char);
188 
190 
193  vtkSetMacro(Alpha, unsigned char);
194  vtkGetMacro(Alpha, unsigned char);
196 
198 
204 
206 
212 
214 
217  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
218  vtkGetMacro(FileType, int);
219  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
220  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
222 
224 
228  vtkSetClampMacro(TextureCoordinatesName, int, VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
229  vtkGetMacro(TextureCoordinatesName, int);
230  void SetTextureCoordinatesNameToUV() { this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV); }
232  {
233  this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);
234  }
236 
240  void AddComment(const std::string& comment);
241 
242 protected:
244  ~vtkPLYWriter() override;
245 
246  void WriteData() override;
249  const float* GetNormals(vtkIdType num, vtkDataSetAttributes* dsa);
250 
252  char* ArrayName;
256  unsigned char Color[3];
257 
259  unsigned char Alpha;
260 
261  char* FileName;
262 
263  int FileType;
265 
267 
268  // Whether this object is writing to a string or a file.
269  // Default is 0: write to file.
271 
272  // The output string.
274 
276 
277 private:
278  vtkPLYWriter(const vtkPLYWriter&) = delete;
279  void operator=(const vtkPLYWriter&) = delete;
280 };
281 
282 #endif
represent and manipulate attribute data in a dataset
a simple class to control print indentation
Definition: vtkIndent.h:49
Store vtkAlgorithm input/output information.
write Stanford PLY file format
Definition: vtkPLYWriter.h:78
char * FileName
Definition: vtkPLYWriter.h:261
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:92
vtkSetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
const std::string & GetOutputString() const
Enable writing to an OutputString instead of the default, a file.
Definition: vtkPLYWriter.h:107
void SetColorModeToUniformCellColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:131
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:219
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:133
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:220
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:91
vtkGetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
void AddComment(const std::string &comment)
Add a comment in the header part.
char * ArrayName
Definition: vtkPLYWriter.h:252
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkScalarsToColors * LookupTable
Definition: vtkPLYWriter.h:255
unsigned char Alpha
Definition: vtkPLYWriter.h:259
std::string OutputString
Definition: vtkPLYWriter.h:273
vtkSmartPointer< vtkUnsignedCharArray > GetColors(vtkIdType num, vtkDataSetAttributes *dsa)
~vtkPLYWriter() override
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:230
void SetColorModeToDefault()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:130
void SetColorModeToUniformPointColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:132
static vtkPLYWriter * New()
bool WriteToOutputString
Definition: vtkPLYWriter.h:270
void WriteData() override
vtkPolyData * GetInput(int port)
Get the input to this writer.
const float * GetNormals(vtkIdType num, vtkDataSetAttributes *dsa)
int TextureCoordinatesName
Definition: vtkPLYWriter.h:264
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:231
vtkSmartPointer< vtkStringArray > HeaderComments
Definition: vtkPLYWriter.h:266
vtkPolyData * GetInput()
Get the input to this writer.
void SetColorModeToOff()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:137
const float * GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes *dsa)
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
Superclass for mapping scalar values to colors.
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of unsigned char
abstract class to write data to file(s)
Definition: vtkWriter.h:46
@ Color
Definition: vtkX3D.h:52
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ string
Definition: vtkX3D.h:496
#define VTK_LITTLE_ENDIAN
Definition: vtkPLYWriter.h:65
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkPLYWriter.h:68
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:72
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
Definition: vtkPLYWriter.h:70
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:74
#define VTK_COLOR_MODE_UNIFORM_COLOR
Definition: vtkPLYWriter.h:71
#define VTK_BIG_ENDIAN
Definition: vtkPLYWriter.h:66
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:69
#define VTK_TEXTURECOORDS_TEXTUREUV
Definition: vtkPLYWriter.h:75
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