VTK  9.0.1
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 =========================================================================*/
23 #ifndef vtkGeoJSONWriter_h
24 #define vtkGeoJSONWriter_h
25 
26 #include "vtkIOGeoJSONModule.h" // For export macro
27 #include "vtkWriter.h"
28 
29 class vtkLookupTable;
30 
31 class VTKIOGEOJSON_EXPORT vtkGeoJSONWriter : public vtkWriter
32 {
33 public:
34  static vtkGeoJSONWriter* New();
35  virtual void PrintSelf(ostream& os, vtkIndent indent) override;
36  vtkTypeMacro(vtkGeoJSONWriter, vtkWriter);
37 
39 
42  vtkSetStringMacro(FileName);
43  vtkGetStringMacro(FileName);
45 
47 
50  vtkSetMacro(WriteToOutputString, bool);
51  vtkGetMacro(WriteToOutputString, bool);
52  vtkBooleanMacro(WriteToOutputString, bool);
54 
56 
61  vtkGetMacro(OutputStringLength, int);
62  vtkGetStringMacro(OutputString);
63  unsigned char* GetBinaryOutputString()
64  {
65  return reinterpret_cast<unsigned char*>(this->OutputString);
66  }
68 
70 
76  vtkSetMacro(ScalarFormat, int);
77  vtkGetMacro(ScalarFormat, int);
79 
81 
84  void SetLookupTable(vtkLookupTable* lut);
85  vtkGetObjectMacro(LookupTable, vtkLookupTable);
87 
92  vtkStdString GetOutputStdString();
93 
99  char* RegisterAndGetOutputString();
100 
101 protected:
103  ~vtkGeoJSONWriter() override;
104 
105  // Only accepts vtkPolyData
106  virtual int FillInputPortInformation(int port, vtkInformation* info) override;
107 
108  // Implementation of Write()
109  void WriteData() override;
110 
111  // Helper for Write that writes attributes out
112  void WriteScalar(vtkDataArray* da, vtkIdType ptId);
114 
118 
120 
121  // Internal helpers
122  ostream* OpenFile();
123  void ConditionalComma(vtkIdType, vtkIdType);
124  void CloseFile(ostream*);
125  class Internals;
126  Internals* WriterHelper;
127  char* FileName;
128 
129 private:
130  vtkGeoJSONWriter(const vtkGeoJSONWriter&) = delete;
131  void operator=(const vtkGeoJSONWriter&) = delete;
132 };
133 
134 #endif // vtkGeoJSONWriter_h
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkWriter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGeoJSONWriter::WriteToOutputString
bool WriteToOutputString
Definition: vtkGeoJSONWriter.h:115
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkGeoJSONWriter
Convert vtkPolyData to Geo JSON format.
Definition: vtkGeoJSONWriter.h:31
vtkWriter::WriteData
virtual void WriteData()=0
vtkGeoJSONWriter::GetBinaryOutputString
unsigned char * GetBinaryOutputString()
Definition: vtkGeoJSONWriter.h:63
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWriter
abstract class to write data to file(s)
Definition: vtkWriter.h:45
vtkGeoJSONWriter::OutputString
char * OutputString
Definition: vtkGeoJSONWriter.h:116
vtkGeoJSONWriter::OutputStringLength
int OutputStringLength
Definition: vtkGeoJSONWriter.h:117
vtkGeoJSONWriter::WriterHelper
Internals * WriterHelper
Definition: vtkGeoJSONWriter.h:125
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:68
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkWriter.h
vtkGeoJSONWriter::LookupTable
vtkLookupTable * LookupTable
Definition: vtkGeoJSONWriter.h:113
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkGeoJSONWriter::ScalarFormat
int ScalarFormat
Definition: vtkGeoJSONWriter.h:119
vtkGeoJSONWriter::FileName
char * FileName
Definition: vtkGeoJSONWriter.h:127