VTK
vtkGeoJSONFeature.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGeoJSONFeature.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 =========================================================================*/
22 #ifndef vtkGeoJSONFeature_h
23 #define vtkGeoJSONFeature_h
24 
25 // VTK Includes
26 #include "vtkIOGeoJSONModule.h" // For export macro
27 #include "vtkDataObject.h"
28 #include "vtk_jsoncpp.h" // For json parser
29 
30 class vtkPolyData;
31 
32 // Currently implemented geoJSON compatible Geometries
33 #define GeoJSON_POINT "Point"
34 #define GeoJSON_MULTI_POINT "MultiPoint"
35 #define GeoJSON_LINE_STRING "LineString"
36 #define GeoJSON_MULTI_LINE_STRING "MultiLineString"
37 #define GeoJSON_POLYGON "Polygon"
38 #define GeoJSON_MULTI_POLYGON "MultiPolygon"
39 #define GeoJSON_GEOMETRY_COLLECTION "GeometryCollection"
40 
41 class VTKIOGEOJSON_EXPORT vtkGeoJSONFeature : public vtkDataObject
42 {
43 public:
44  static vtkGeoJSONFeature *New();
45  virtual void PrintSelf(ostream &os, vtkIndent indent);
47 
49 
52  vtkSetMacro(OutlinePolygons, bool);
53  vtkGetMacro(OutlinePolygons, bool);
54  vtkBooleanMacro(OutlinePolygons, bool);
56 
59  void ExtractGeoJSONFeature(const Json::Value& root, vtkPolyData *outputData);
60 
61 protected:
64 
67  Json::Value featureRoot;
68 
70  char *FeatureId;
71 
75 
77 
78  void ExtractGeoJSONFeatureGeometry(const Json::Value& root,
79  vtkPolyData *outputData);
81 
83 
84  vtkPolyData *ExtractPoint(const Json::Value& coordinates,
85  vtkPolyData *outputData);
86  vtkPolyData *ExtractLineString(const Json::Value& coordinates,
87  vtkPolyData *outputData);
88  vtkPolyData *ExtractPolygon(const Json::Value& coordinates,
89  vtkPolyData *outputData);
91 
93 
95  vtkPolyData *ExtractMultiPoint(const Json::Value& coordinates,
96  vtkPolyData *outputData);
97  vtkPolyData *ExtractMultiLineString(const Json::Value& coordinates,
98  vtkPolyData *outputData);
99  vtkPolyData *ExtractMultiPolygon(const Json::Value& coordinates,
100  vtkPolyData *outputData);
102 
104 
106  bool IsPoint(const Json::Value& root);
107  bool IsMultiPoint(const Json::Value& root);
108  bool IsLineString(const Json::Value& root); //To Do.
109  bool IsMultiLineString(const Json::Value& root); //To Do.
110  bool IsPolygon(const Json::Value& root); //To Do.
111  bool IsMultiPolygon(const Json::Value& root); //To Do.
113 
115  bool CreatePoint(const Json::Value& coordinates, double point[3]);
116 
117  void InsertFeatureProperties(vtkPolyData *outputData);
118 
119 private:
120  vtkGeoJSONFeature(const vtkGeoJSONFeature&); //Not implemented
121  void operator=(const vtkGeoJSONFeature&); //Not implemented
122 };
123 
124 #endif // vtkGeoJSONFeature_h
static vtkDataObject * New()
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
Represents GeoJSON feature geometry & properties.
a simple class to control print indentation
Definition: vtkIndent.h:38
Json::Value featureRoot
void PrintSelf(ostream &os, vtkIndent indent)
general representation of visualization data
Definition: vtkDataObject.h:64