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 
33 class VTKIOGEOJSON_EXPORT vtkGeoJSONWriter : public vtkWriter
34 {
35 public:
36  static vtkGeoJSONWriter* New();
37  virtual void PrintSelf( ostream& os, vtkIndent indent );
38  vtkTypeMacro(vtkGeoJSONWriter,vtkWriter);
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(vtkDataArray *da, vtkIdType ptId);
102 
106 
108 
109  // Internal helpers
110  ostream *OpenFile();
111  void ConditionalComma(vtkIdType, vtkIdType);
112  void CloseFile(ostream *);
113  class Internals;
114  Internals *WriterHelper;
115  char* FileName;
116 
117 private:
118  vtkGeoJSONWriter(const vtkGeoJSONWriter&); // Not implemented.
119  void operator=(const vtkGeoJSONWriter&); // Not implemented.
120 };
121 
122 #endif // vtkGeoJSONWriter_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
int vtkIdType
Definition: vtkType.h:275
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:54
virtual int FillInputPortInformation(int port, vtkInformation *info)
Internals * WriterHelper
static vtkAlgorithm * New()
virtual void WriteData()=0
Convert vtkPolyData to Geo JSON format.
vtkLookupTable * LookupTable
void PrintSelf(ostream &os, vtkIndent indent)
unsigned char * GetBinaryOutputString()