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 =========================================================================*/
35 #ifndef vtkPLYWriter_h
36 #define vtkPLYWriter_h
37 
38 #include "vtkIOPLYModule.h" // For export macro
39 #include "vtkSmartPointer.h" // For protected ivars
40 #include "vtkWriter.h"
41 
42 #include <string> // For string parameter
43 
45 class vtkPolyData;
46 class vtkScalarsToColors;
47 class vtkStringArray;
48 
49 #define VTK_LITTLE_ENDIAN 0
50 #define VTK_BIG_ENDIAN 1
51 
52 #define VTK_COLOR_MODE_DEFAULT 0
53 #define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
54 #define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
55 #define VTK_COLOR_MODE_UNIFORM_COLOR 3
56 #define VTK_COLOR_MODE_OFF 4
57 
58 #define VTK_TEXTURECOORDS_UV 0
59 #define VTK_TEXTURECOORDS_TEXTUREUV 1
60 
61 class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
62 {
63 public:
64  static vtkPLYWriter *New();
65  vtkTypeMacro(vtkPLYWriter,vtkWriter);
66  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
67 
69 
73  vtkSetClampMacro(DataByteOrder,int,VTK_LITTLE_ENDIAN,VTK_BIG_ENDIAN);
74  vtkGetMacro(DataByteOrder,int);
76  {this->SetDataByteOrder(VTK_BIG_ENDIAN);}
78  {this->SetDataByteOrder(VTK_LITTLE_ENDIAN);}
80 
82 
99  vtkSetMacro(ColorMode,int);
100  vtkGetMacro(ColorMode,int);
102  {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);}
104  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_CELL_COLOR);}
106  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_POINT_COLOR);}
107  void SetColorModeToUniformColor() //both cells and points are colored
108  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);}
109  void SetColorModeToOff() //No color information is written
110  {this->SetColorMode(VTK_COLOR_MODE_OFF);}
112 
114 
117  vtkSetStringMacro(ArrayName);
118  vtkGetStringMacro(ArrayName);
120 
122 
125  vtkSetClampMacro(Component,int,0,VTK_INT_MAX);
126  vtkGetMacro(Component,int);
128 
130 
134  virtual void SetLookupTable(vtkScalarsToColors*);
135  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
137 
139 
145  vtkSetVector3Macro(Color,unsigned char);
146  vtkGetVector3Macro(Color,unsigned char);
148 
150 
154  vtkPolyData* GetInput(int port);
156 
158 
161  vtkSetStringMacro(FileName);
162  vtkGetStringMacro(FileName);
164 
166 
169  vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
170  vtkGetMacro(FileType,int);
171  void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
172  void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
174 
176 
180  vtkSetClampMacro(TextureCoordinatesName,int,VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
181  vtkGetMacro(TextureCoordinatesName,int);
183  {this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV);}
185  {this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);}
187 
191  void AddComment(const std::string &comment);
192 
193 protected:
194  vtkPLYWriter();
195  ~vtkPLYWriter() VTK_OVERRIDE;
196 
197  void WriteData() VTK_OVERRIDE;
198  unsigned char *GetColors(vtkIdType num, vtkDataSetAttributes *dsa);
199  const float *GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes *dsa);
200 
201  int DataByteOrder;
202  char *ArrayName;
203  int Component;
204  int ColorMode;
205  vtkScalarsToColors *LookupTable;
206  unsigned char Color[3];
207 
208  char* FileName;
209 
210  int FileType;
211  int TextureCoordinatesName;
212 
214 
215  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
216 
217 private:
218  vtkPLYWriter(const vtkPLYWriter&) VTK_DELETE_FUNCTION;
219  void operator=(const vtkPLYWriter&) VTK_DELETE_FUNCTION;
220 };
221 
222 #endif
223 
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:56
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:184
Store vtkAlgorithm input/output information.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:172
#define VTK_INT_MAX
Definition: vtkType.h:157
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:75
write Stanford PLY file format
Definition: vtkPLYWriter.h:61
a vtkAbstractArray subclass for strings
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_ASCII
Definition: vtkWriter.h:39
#define VTK_COLOR_MODE_UNIFORM_POINT_COLOR
Definition: vtkPLYWriter.h:54
Superclass for mapping scalar values to colors.
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:182
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:50
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkDataObject * GetInput()
void SetColorModeToOff()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:109
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:171
#define VTK_BINARY
Definition: vtkWriter.h:40
#define VTK_COLOR_MODE_UNIFORM_COLOR
Definition: vtkPLYWriter.h:55
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
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:105
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:58
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_LITTLE_ENDIAN
Definition: vtkPLYWriter.h:49
void SetColorModeToUniformCellColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:103
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkPLYWriter.h:52
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:77
#define VTK_TEXTURECOORDS_TEXTUREUV
Definition: vtkPLYWriter.h:59
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:107
static vtkAlgorithm * New()
void SetColorModeToDefault()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:101
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:53