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 =========================================================================*/
38 #ifndef vtkPLYWriter_h
39 #define vtkPLYWriter_h
40 
41 #include "vtkIOPLYModule.h" // For export macro
42 #include "vtkSmartPointer.h" // For protected ivars
43 #include "vtkWriter.h"
44 
45 #include <string> // For string parameter
46 
48 class vtkPolyData;
49 class vtkScalarsToColors;
50 class vtkStringArray;
51 
52 #define VTK_LITTLE_ENDIAN 0
53 #define VTK_BIG_ENDIAN 1
54 
55 #define VTK_COLOR_MODE_DEFAULT 0
56 #define VTK_COLOR_MODE_UNIFORM_CELL_COLOR 1
57 #define VTK_COLOR_MODE_UNIFORM_POINT_COLOR 2
58 #define VTK_COLOR_MODE_UNIFORM_COLOR 3
59 #define VTK_COLOR_MODE_OFF 4
60 
61 #define VTK_TEXTURECOORDS_UV 0
62 #define VTK_TEXTURECOORDS_TEXTUREUV 1
63 
64 class VTKIOPLY_EXPORT vtkPLYWriter : public vtkWriter
65 {
66 public:
67  static vtkPLYWriter *New();
68  vtkTypeMacro(vtkPLYWriter,vtkWriter);
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
72 
76  vtkSetClampMacro(DataByteOrder,int,VTK_LITTLE_ENDIAN,VTK_BIG_ENDIAN);
77  vtkGetMacro(DataByteOrder,int);
79  {this->SetDataByteOrder(VTK_BIG_ENDIAN);}
81  {this->SetDataByteOrder(VTK_LITTLE_ENDIAN);}
83 
85 
102  vtkSetMacro(ColorMode,int);
103  vtkGetMacro(ColorMode,int);
105  {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);}
107  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_CELL_COLOR);}
109  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_POINT_COLOR);}
110  void SetColorModeToUniformColor() //both cells and points are colored
111  {this->SetColorMode(VTK_COLOR_MODE_UNIFORM_COLOR);}
112  void SetColorModeToOff() //No color information is written
113  {this->SetColorMode(VTK_COLOR_MODE_OFF);}
115 
117 
120  vtkSetStringMacro(ArrayName);
121  vtkGetStringMacro(ArrayName);
123 
125 
128  vtkSetClampMacro(Component,int,0,VTK_INT_MAX);
129  vtkGetMacro(Component,int);
131 
133 
137  virtual void SetLookupTable(vtkScalarsToColors*);
138  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
140 
142 
148  vtkSetVector3Macro(Color,unsigned char);
149  vtkGetVector3Macro(Color,unsigned char);
151 
153 
157  vtkPolyData* GetInput(int port);
159 
161 
164  vtkSetStringMacro(FileName);
165  vtkGetStringMacro(FileName);
167 
169 
172  vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
173  vtkGetMacro(FileType,int);
174  void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
175  void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
177 
179 
183  vtkSetClampMacro(TextureCoordinatesName,int,VTK_TEXTURECOORDS_UV, VTK_TEXTURECOORDS_TEXTUREUV);
184  vtkGetMacro(TextureCoordinatesName,int);
186  {this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_UV);}
188  {this->SetTextureCoordinatesName(VTK_TEXTURECOORDS_TEXTUREUV);}
190 
194  void AddComment(const std::string &comment);
195 
196 protected:
197  vtkPLYWriter();
198  ~vtkPLYWriter();
199 
200  void WriteData();
201  unsigned char *GetColors(vtkIdType num, vtkDataSetAttributes *dsa);
202  const float *GetTextureCoordinates(vtkIdType num, vtkDataSetAttributes *dsa);
203 
205  char *ArrayName;
209  unsigned char Color[3];
210 
211  char* FileName;
212 
213  int FileType;
215 
217 
219 
220 private:
221  vtkPLYWriter(const vtkPLYWriter&) VTK_DELETE_FUNCTION;
222  void operator=(const vtkPLYWriter&) VTK_DELETE_FUNCTION;
223 };
224 
225 #endif
226 
vtkScalarsToColors * LookupTable
Definition: vtkPLYWriter.h:208
#define VTK_COLOR_MODE_OFF
Definition: vtkPLYWriter.h:59
void SetTextureCoordinatesNameToTextureUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:187
Store vtkAlgorithm input/output information.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:175
#define VTK_INT_MAX
Definition: vtkType.h:153
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:78
write Stanford PLY file format
Definition: vtkPLYWriter.h:64
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:287
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:57
int TextureCoordinatesName
Definition: vtkPLYWriter.h:214
vtkSmartPointer< vtkStringArray > HeaderComments
Definition: vtkPLYWriter.h:216
Superclass for mapping scalar values to colors.
void SetTextureCoordinatesNameToUV()
Choose the name used for the texture coordinates.
Definition: vtkPLYWriter.h:185
abstract class to write data to file(s)
Definition: vtkWriter.h:42
#define VTK_BIG_ENDIAN
Definition: vtkPLYWriter.h:53
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:112
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkPLYWriter.h:174
#define VTK_BINARY
Definition: vtkWriter.h:40
#define VTK_COLOR_MODE_UNIFORM_COLOR
Definition: vtkPLYWriter.h:58
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:108
#define VTK_TEXTURECOORDS_UV
Definition: vtkPLYWriter.h:61
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_LITTLE_ENDIAN
Definition: vtkPLYWriter.h:52
void SetColorModeToUniformCellColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:106
char * FileName
Definition: vtkPLYWriter.h:211
#define VTK_COLOR_MODE_DEFAULT
Definition: vtkPLYWriter.h:55
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:80
#define VTK_TEXTURECOORDS_TEXTUREUV
Definition: vtkPLYWriter.h:62
void SetColorModeToUniformColor()
These methods enable the user to control how to add color into the PLY output file.
Definition: vtkPLYWriter.h:110
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:104
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
#define VTK_COLOR_MODE_UNIFORM_CELL_COLOR
Definition: vtkPLYWriter.h:56
char * ArrayName
Definition: vtkPLYWriter.h:205