Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Code
Common
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
"
22
#include "
otbPolyLineParametricPathWithValue.h
"
23
#include "
otbPolygon.h
"
24
#include "
otbObjectList.h
"
25
#include "
otbVectorDataKeywordlist.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,
43
FEATURE_POINT
= 3,
44
FEATURE_LINE
= 4,
45
FEATURE_POLYGON
= 5,
46
FEATURE_MULTIPOINT
= 6,
47
FEATURE_MULTILINE
= 7,
48
FEATURE_MULTIPOLYGON
= 8,
49
FEATURE_COLLECTION
= 9
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
;
77
typedef
itk::Object
Superclass
;
78
typedef
itk::SmartPointer<Self>
Pointer
;
79
typedef
itk::SmartPointer<const Self>
ConstPointer
;
80
82
itkNewMacro(
Self
);
83
itkTypeMacro(
DataNode
,
Object
);
84
86
typedef
TPrecision
PrecisionType
;
87
typedef
TValuePrecision
ValuePrecisionType
;
88
itkStaticConstMacro(
Dimension
,
unsigned
int
, VDimension);
89
91
typedef
itk::Point<PrecisionType, VDimension>
PointType
;
92
typedef
otb::PolyLineParametricPathWithValue<ValuePrecisionType, VDimension>
LineType
;
93
typedef
typename
LineType::Pointer
LinePointerType
;
94
typedef
typename
LineType::ConstPointer
LineConstPointerType
;
95
typedef
Polygon<ValuePrecisionType>
PolygonType
;
96
typedef
typename
PolygonType::VertexListType
VertexListType
;
97
typedef
typename
VertexListType::ConstPointer
VertexListConstPointerType
;
98
typedef
typename
PolygonType::Pointer
PolygonPointerType
;
99
typedef
typename
PolygonType::ConstPointer
PolygonConstPointerType
;
100
typedef
ObjectList<PolygonType>
PolygonListType
;
101
typedef
typename
PolygonListType::Pointer
PolygonListPointerType
;
102
typedef
typename
PolygonListType::ConstPointer
PolygonListConstPointerType
;
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
;
136
PolygonPointerType
GetPolygonExteriorRing
()
const
;
141
PolygonListPointerType
GetPolygonInteriorRings
()
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
EuclideanDistance
(
const
DataNode
* node);
267
268
double
EuclideanDistance
(
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
;
303
PointType
point
;
304
LinePointerType
line
;
305
PolygonPointerType
exteriorRing
;
306
PolygonListPointerType
interiorRings
;
307
}
DataType
;
308
310
NodeType
m_NodeType
;
311
313
std::string
m_NodeId
;
314
316
DataType
m_Data
;
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 Sun Feb 3 2013 00:19:58 for
Orfeo Toolbox
with
doxygen 1.8.1.1