VTK  9.3.20240418
vtkGeoJSONWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkGeoJSONWriter_h
15 #define vtkGeoJSONWriter_h
16 
17 #include "vtkIOGeoJSONModule.h" // For export macro
18 #include "vtkWriter.h"
19 
20 VTK_ABI_NAMESPACE_BEGIN
21 class vtkLookupTable;
22 
23 class VTKIOGEOJSON_EXPORT vtkGeoJSONWriter : public vtkWriter
24 {
25 public:
26  static vtkGeoJSONWriter* New();
27  void PrintSelf(ostream& os, vtkIndent indent) override;
28  vtkTypeMacro(vtkGeoJSONWriter, vtkWriter);
29 
31 
37 
39 
42  vtkSetMacro(WriteToOutputString, bool);
43  vtkGetMacro(WriteToOutputString, bool);
44  vtkBooleanMacro(WriteToOutputString, bool);
46 
48 
53  vtkGetMacro(OutputStringLength, int);
54  vtkGetStringMacro(OutputString);
55  unsigned char* GetBinaryOutputString()
56  {
57  return reinterpret_cast<unsigned char*>(this->OutputString);
58  }
60 
62 
68  vtkSetMacro(ScalarFormat, int);
69  vtkGetMacro(ScalarFormat, int);
71 
73 
77  vtkGetObjectMacro(LookupTable, vtkLookupTable);
79 
85 
92 
93 protected:
95  ~vtkGeoJSONWriter() override;
96 
97  // Only accepts vtkPolyData
99 
100  // Implementation of Write()
101  void WriteData() override;
102 
103  // Helper for Write that writes attributes out
106 
110 
112 
113  // Internal helpers
114  ostream* OpenFile();
116  void CloseFile(ostream*);
117  class Internals;
118  Internals* WriterHelper;
119  char* FileName;
120 
121 private:
122  vtkGeoJSONWriter(const vtkGeoJSONWriter&) = delete;
123  void operator=(const vtkGeoJSONWriter&) = delete;
124 };
125 
126 VTK_ABI_NAMESPACE_END
127 #endif // vtkGeoJSONWriter_h
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
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
vtkGetFilePathMacro(FileName)
Accessor for name of the file that will be opened on WriteData.
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void WriteData() override
static vtkGeoJSONWriter * New()
vtkSetFilePathMacro(FileName)
Accessor for name of the file that will be opened on WriteData.
~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()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLookupTable * LookupTable
ostream * OpenFile()
a simple class to control print indentation
Definition: vtkIndent.h:108
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:78
abstract class to write data to file(s)
Definition: vtkWriter.h:35
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
int vtkIdType
Definition: vtkType.h:315