VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGeoJSONWriter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00025 #ifndef vtkGeoJSONWriter_h 00026 #define vtkGeoJSONWriter_h 00027 00028 #include "vtkIOGeoJSONModule.h" // For export macro 00029 #include "vtkWriter.h" 00030 00031 class vtkLookupTable; 00032 00033 class VTKIOGEOJSON_EXPORT vtkGeoJSONWriter : public vtkWriter 00034 { 00035 public: 00036 static vtkGeoJSONWriter* New(); 00037 virtual void PrintSelf( ostream& os, vtkIndent indent ); 00038 vtkTypeMacro(vtkGeoJSONWriter,vtkWriter); 00039 00041 00042 vtkSetStringMacro(FileName); 00043 vtkGetStringMacro(FileName); 00045 00047 00048 vtkSetMacro(WriteToOutputString,bool); 00049 vtkGetMacro(WriteToOutputString,bool); 00050 vtkBooleanMacro(WriteToOutputString,bool); 00052 00054 00057 vtkGetMacro(OutputStringLength, int); 00058 vtkGetStringMacro(OutputString); 00059 unsigned char *GetBinaryOutputString() 00060 { 00061 return reinterpret_cast<unsigned char *>(this->OutputString); 00062 } 00064 00066 00070 vtkSetMacro(ScalarFormat,int); 00071 vtkGetMacro(ScalarFormat,int); 00073 00075 00076 void SetLookupTable(vtkLookupTable *lut); 00077 vtkGetObjectMacro(LookupTable, vtkLookupTable); 00079 00082 vtkStdString GetOutputStdString(); 00083 00087 char *RegisterAndGetOutputString(); 00088 00089 protected: 00090 vtkGeoJSONWriter(); 00091 virtual ~vtkGeoJSONWriter(); 00092 00093 // Only accepts vtkPolyData 00094 virtual int FillInputPortInformation(int port, vtkInformation *info); 00095 00096 // Implementation of Write() 00097 void WriteData(); 00098 00099 // Helper for Write that writes attributes out 00100 void WriteScalar(vtkDataArray *da, vtkIdType ptId); 00101 vtkLookupTable *LookupTable; 00102 00103 bool WriteToOutputString; 00104 char *OutputString; 00105 int OutputStringLength; 00106 00107 int ScalarFormat; 00108 00109 // Internal helpers 00110 ostream *OpenFile(); 00111 void ConditionalComma(vtkIdType, vtkIdType); 00112 void CloseFile(ostream *); 00113 class Internals; 00114 Internals *WriterHelper; 00115 char* FileName; 00116 00117 private: 00118 vtkGeoJSONWriter(const vtkGeoJSONWriter&); // Not implemented. 00119 void operator=(const vtkGeoJSONWriter&); // Not implemented. 00120 }; 00121 00122 #endif // vtkGeoJSONWriter_h