Orfeo Toolbox  4.0
otbDataNode.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbDataNode_h
19 #define __otbDataNode_h
20 
21 #include "itkPoint.h"
23 #include "otbPolygon.h"
24 #include "otbObjectList.h"
26 
27 #include <iostream>
28 
29 #include "ogrsf_frmts.h"
30 
31 namespace otb
32 {
37 typedef
38 enum
39  {
40  ROOT = 0,
41  DOCUMENT = 1,
42  FOLDER = 2,
50  } NodeType;
51 
70 template <class TPrecision = double, unsigned VDimension = 2, class TValuePrecision = double>
71 class DataNode
72  : public itk::Object
73 {
74 public:
76  typedef DataNode Self;
80 
82  itkNewMacro(Self);
83  itkTypeMacro(DataNode, Object);
84 
86  typedef TPrecision PrecisionType;
87  typedef TValuePrecision ValuePrecisionType;
88  itkStaticConstMacro(Dimension, unsigned int, VDimension);
89 
97  typedef typename VertexListType::ConstPointer VertexListConstPointerType;
103 
105 // typedef std::map<std::string, std::string> FieldMapType;
106 // typedef std::pair<std::string, std::string> FieldType;
107 
109  itkGetConstMacro(NodeType, NodeType);
110  itkGetStringMacro(NodeId);
111  itkSetStringMacro(NodeId);
112 
117  void SetNodeType(NodeType type);
121  std::string GetNodeTypeAsString() const;
126  PointType GetPoint() const;
131  LinePointerType GetLine() const;
146  void SetPoint(PointType point);
151  void SetLine(LineType* line);
156  void SetPolygonExteriorRing(PolygonType* polygon);
157 
162  void SetPolygonInteriorRings(PolygonListType* polygonList);
163 
167  bool IsDocument() const;
171  bool IsRoot() const;
175  bool IsFolder() const;
179  bool IsPointFeature() const;
183  bool IsLineFeature() const;
187  bool IsPolygonFeature() const;
191  bool IsMultiPointFeature() const;
195  bool IsMultiLineFeature() const;
199  bool IsMultiPolygonFeature() const;
203  bool IsCollectionFeature() const;
209  void SetFieldAsString(const std::string& key, const std::string& value);
215  std::string GetFieldAsString(const std::string& key) const;
216 
222  void SetFieldAsInt(const std::string& key, int value);
228  int GetFieldAsInt(const std::string& key) const;
229 
235  void SetFieldAsDouble(const std::string& key, double value);
241  double GetFieldAsDouble(const std::string& key) const;
242 
243  // /**
244  // * Remove the field associated with the given key, if possible.
245  // * \param key The name of the field.
246  // */
247  // void RemoveField(const std::string& key);
252  bool HasField(const std::string& key) const;
253 
258  void CopyFieldList(const DataNode * dataNode);
259 
263  std::vector<std::string> GetFieldList() const;
264 
266  double EuclideanDistanceMetric(const DataNode* node);
267 
268  double EuclideanDistanceMetric(const PointType point);
269 
273  bool Intersects(const DataNode* node);
274 
278  bool Within(const DataNode* node);
279 
283 // void ClearFields();
284 
285 protected:
287  DataNode();
289  virtual ~DataNode() {}
291  void PrintSelf(std::ostream& os, itk::Indent indent) const;
292 
293  OGRGeometry* ConvertDataNodeToOGRGeometry(const DataNode* dataNode);
294 
295 private:
296  DataNode(const Self&); //purposely not implemented
297  void operator =(const Self&); //purposely not implemented
298 
300  typedef struct
301  {
302  bool valid;
307  } DataType;
308 
311 
313  std::string m_NodeId;
314 
317 
319 // FieldMapType m_FieldMap;
320 };
321 } // end namespace
322 
323 #ifndef OTB_MANUAL_INSTANTIATION
324 #include "otbDataNode.txx"
325 #endif
326 
327 #endif

Generated at Sat Mar 8 2014 15:53:15 for Orfeo Toolbox with doxygen 1.8.3.1