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 
85  vtkGetObjectMacro(LookupTable, vtkLookupTable);
87 
93 
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
114 
118 
120 
121  // Internal helpers
122  ostream* OpenFile();
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
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
Convert vtkPolyData to Geo JSON format.
void SetLookupTable(vtkLookupTable *lut)
Controls the lookup table to use when ValueMode is set to map colors;.
void CloseFile(ostream *)
Internals * WriterHelper
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
virtual void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void WriteData() override
static vtkGeoJSONWriter * New()
~vtkGeoJSONWriter() override
void WriteScalar(vtkDataArray *da, vtkIdType ptId)
void ConditionalComma(vtkIdType, vtkIdType)
vtkStdString GetOutputStdString()
When WriteToOutputString is on, this method returns a copy of the output string in a vtkStdString.
unsigned char * GetBinaryOutputString()
virtual int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkLookupTable * LookupTable
ostream * OpenFile()
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
abstract class to write data to file(s)
Definition: vtkWriter.h:46
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
int vtkIdType
Definition: vtkType.h:338