VTK
vtkGeoJSONWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGeoJSONWriter.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 =========================================================================*/
25 #ifndef __vtkGeoJSONWriter_h
26 #define __vtkGeoJSONWriter_h
27 
28 #include <vtkIOGeoJSONModule.h> // For export macro
29 #include <vtkWriter.h>
30 
31 class vtkLookupTable;
32 
34 {
35 public:
36  static vtkGeoJSONWriter* New();
37  virtual void PrintSelf( ostream& os, vtkIndent indent );
39 
41 
42  vtkSetStringMacro(FileName);
43  vtkGetStringMacro(FileName);
45 
47 
48  vtkSetMacro(WriteToOutputString,bool);
49  vtkGetMacro(WriteToOutputString,bool);
50  vtkBooleanMacro(WriteToOutputString,bool);
52 
54 
57  vtkGetMacro(OutputStringLength, int);
58  vtkGetStringMacro(OutputString);
59  unsigned char *GetBinaryOutputString()
60  {
61  return reinterpret_cast<unsigned char *>(this->OutputString);
62  }
64 
66 
70  vtkSetMacro(ScalarFormat,int);
71  vtkGetMacro(ScalarFormat,int);
73 
75 
76  void SetLookupTable(vtkLookupTable *lut);
77  vtkGetObjectMacro(LookupTable, vtkLookupTable);
79 
82  vtkStdString GetOutputStdString();
83 
87  char *RegisterAndGetOutputString();
88 
89 protected:
91  virtual ~vtkGeoJSONWriter();
92 
93  // Only accepts vtkPolyData
95 
96  // Implementation of Write()
97  void WriteData();
98 
99  // Helper for Write that writes attributes out
100  void WriteScalar(ostream *fp, vtkDataArray *da, vtkIdType ptId);
102 
106 
108 
109  // Internal helpers
110  ostream *OpenFile();
111  void ConditionalComma(ostream *, vtkIdType, vtkIdType);
112  void CloseFile(ostream *);
113 
114  char* FileName;
115 
116 private:
117  vtkGeoJSONWriter(const vtkGeoJSONWriter&); // Not implemented.
118  void operator=(const vtkGeoJSONWriter&); // Not implemented.
119 };
120 
121 #endif // __vtkGeoJSONWriter_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
Store vtkAlgorithm input/output information.
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
map scalar values into colors via a lookup table
int vtkIdType
Definition: vtkType.h:268
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
#define VTKIOGEOJSON_EXPORT
abstract class to write data to file(s)
Definition: vtkWriter.h:44
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
virtual int FillInputPortInformation(int port, vtkInformation *info)
static vtkAlgorithm * New()
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
virtual void WriteData()=0
Convert vtkPolyData to Geo JSON format.
vtkLookupTable * LookupTable
void PrintSelf(ostream &os, vtkIndent indent)
unsigned char * GetBinaryOutputString()
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69