21 #ifndef otbVectorData_h
22 #define otbVectorData_h
24 #include "itkDataObject.h"
26 #include <boost/graph/graph_as_tree.hpp>
27 #include <boost/graph/adjacency_list.hpp>
28 #include <boost/graph/copy.hpp>
60 template <
class TPrecision =
double,
unsigned int VDimension = 2,
class TValuePrecision =
double>
73 itkStaticConstMacro(
Dimension,
unsigned int, VDimension);
87 using DataTreeType = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, DataNodePointerType >;
88 using TreeNodeType =
typename boost::graph_traits< DataTreeType >::vertex_descriptor;
89 using TreeEdgeType =
typename boost::graph_traits< DataTreeType >::edge_descriptor;
91 using VertexIterator =
typename boost::graph_traits<DataTreeType>::vertex_iterator;
136 void Graft(
const itk::DataObject* data)
override;
155 boost::add_edge(rootvertex,nodevertex,
m_DataTree);
161 std::vector<DataNodePointerType> childrenslist;
163 boost::tie(it, it_end) = boost::vertices(
m_DataTree);
165 for (;it!=it_end;it++)
169 typename boost::graph_traits<DataTreeType>::adjacency_iterator eit, eend;
170 std::tie(eit, eend) = boost::adjacent_vertices(*it,
m_DataTree);
171 for(;eit != eend;eit++)
178 return childrenslist;
184 boost::tie(it, it_end) = boost::vertices(
m_DataTree);
186 return std::make_pair(it,it_end);
204 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
208 typename boost::graph_traits<DataTreeType>::vertex_iterator it,it_end;
209 boost::tie(it, it_end) = boost::vertices(
m_DataTree);
210 for (;it!=it_end;it++)
223 boost::copy_graph(inputVD.
m_DataTree,this->m_DataTree);
231 this->
m_root->Reset(rootNode);
239 boost::copy_graph(inputVD->
m_DataTree,this->m_DataTree);
250 #ifndef OTB_MANUAL_INSTANTIATION
This class represents a node of data in a vector data hierarchy.
Polygon< ValuePrecisionType > PolygonType
otb::PolyLineParametricPathWithValue< ValuePrecisionType, VDimension > LineType
itk::SmartPointer< Self > Pointer
itk::Point< PrecisionType, VDimension > PointType
This class represents a hierarchy of vector data.
void CopyDataTree(const Self *inputVD)
typename boost::graph_traits< DataTreeType >::vertex_iterator VertexIterator
void Reset(const Self &inputVD)
static const unsigned int Dimension
void Add(DataNodePointerType nodeToAdd, DataNodePointerType rootForNode)
void SetProjectionRef(const std::string &projectionRef)
std::pair< VertexIterator, VertexIterator > GetIteratorPair() const
itk::SmartPointer< Self > Pointer
itk::Vector< double, 2 > SpacingType
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, DataNodePointerType > DataTreeType
VectorData(const Self &)=delete
DataNodePointerType m_root
void ResetRoot(const DataNodeType &rootNode)
std::string GetProjectionRef() const
itk::DataObject Superclass
std::vector< DataNodePointerType > ChildrenListType
typename DataNodeType::Pointer DataNodePointerType
itk::SmartPointer< const Self > ConstPointer
void Graft(const itk::DataObject *data) override
typename boost::graph_traits< DataTreeType >::edge_descriptor TreeEdgeType
typename boost::graph_traits< DataTreeType >::vertex_descriptor TreeNodeType
TValuePrecision ValuePrecisionType
void SetSpacing(const SpacingType &spacing)
typename DataNodeType::PointType PointType
std::vector< DataNodePointerType > GetChildrenList(DataNodePointerType parentNode) const
void TransformPointToPhysicalPoint(const PointType &point, PointType &physicalPoint) const
virtual void SetOrigin(OriginType _arg)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
typename DataNodeType::LineType LineType
void SetRoot(DataNodePointerType rootNode)
TreeNodeType ConvertToTreeNodeType(DataNodePointerType datanode)
typename DataNodeType::PolygonType PolygonType
DataNodePointerType Get(VertexIterator dataIt) const
itk::Point< double, 2 > OriginType
DataNodePointerType GetRoot() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.