VTK
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);
83  {this->SetDataByteOrder(VTK_BIG_ENDIAN);}
85  {this->SetDataByteOrder(VTK_LITTLE_ENDIAN);}
87 
89 
106  vtkSetMacro(ColorMode,int);
107  vtkGetMacro(ColorMode,int);
109  {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);}
111  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_CELL_COLOR);}
113  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_POINT_COLOR);}
114  void SetColorModeToUniformColor() //both cells and points are colored
115  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);}
116  void SetColorModeToOff() //No color information is written
117  {this->SetColorMode(VTK_COLOR_MODE_OFF);}
119 
121 
125  vtkSetMacro(EnableAlpha, bool);
126  vtkGetMacro(EnableAlpha, bool);
127  vtkBooleanMacro(EnableAlpha, bool);
129 
131 
134  vtkSetStringMacro(ArrayName);
135  vtkGetStringMacro(ArrayName);
137 
139 
142  vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
143  vtkGetMacro(Component, int);
145 
147 
151  virtual void SetLookupTable(vtkScalarsToColors*);
152  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
154 
156 
162  vtkSetVector3Macro(Color, unsigned char);
163  vtkGetVector3Macro(Color, unsigned char);
165 
167 
170  vtkSetMacro(Alpha, unsigned char);
171  vtkGetMacro(Alpha, unsigned char);
173 
175 
179  vtkPolyData* GetInput(int port);
181 
183 
186  vtkSetStringMacro(FileName);
187  vtkGetStringMacro(FileName);
189 
191 
194  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
195  vtkGetMacro(FileType, int);
196  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); };
197  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); };
199 
201 
205  vtkSetClampMacro(
206  TextureCoordinatesName, int, VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
207  vtkGetMacro(TextureCoordinatesName, int);
208  void SetTextureCoordinatesNameToUV() { this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV); }
210  {this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);}
212 
216  void AddComment(const std::string &comment);
217 
218 protected:
219  vtkPLYWriter();
220  ~vtkPLYWriter() override;
221 
222  void WriteData() override;
224  const float *GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes *dsa);
225 
227  char *ArrayName;
231  unsigned char Color[3];
232 
234  unsigned char Alpha;
235 
236  char* FileName;
237 
238  int FileType;
240 
242 
243  int FillInputPortInformation(int port, vtkInformation *info) override;
244 
245 private:
246  vtkPLYWriter(const vtkPLYWriter&) = delete;
247  void operator=(const vtkPLYWriter&) = delete;
248 };
249 
250 #endif
251 
vtkScalarsToColors * LookupTable
Definition: vtkPLYWriter.h:230
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:63
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:209
Store vtkAlgorithm input/output information.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:197
#define VTK_INT_MAX
Definition: vtkType.h:159
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:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
#define VTK_ASCII
Definition: vtkWriter.h:39
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
Definition: vtkPLYWriter.h:61
int TextureCoordinatesName
Definition: vtkPLYWriter.h:239
vtkSmartPointer< vtkStringArray > HeaderComments
Definition: vtkPLYWriter.h:241
Superclass for mapping scalar values to colors.
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:208
abstract class to write data to file(s)
Definition: vtkWriter.h:42
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_BIG_ENDIAN
Definition: vtkPLYWriter.h:57
unsigned char Alpha
Definition: vtkPLYWriter.h:234
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:116
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:196
#define VTK_BINARY
Definition: vtkWriter.h:40
#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:112
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:65
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
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:110
char * FileName
Definition: vtkPLYWriter.h:236
#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:84
#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:114
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:108
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:60
char * ArrayName
Definition: vtkPLYWriter.h:227