OTB  9.0.0
Orfeo Toolbox
otbVectorData.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbVectorData_h
22 #define otbVectorData_h
23 
24 #include "itkTreeContainer.h"
25 #include "itkDataObject.h"
26 #include "otbDataNode.h"
27 
28 namespace otb
29 {
57 template <class TPrecision = double, unsigned int VDimension = 2, class TValuePrecision = double>
58 class VectorData : public itk::DataObject
59 {
60 public:
62  typedef VectorData Self;
63  typedef itk::DataObject Superclass;
64  typedef itk::SmartPointer<Self> Pointer;
65  typedef itk::SmartPointer<const Self> ConstPointer;
66 
68  itkNewMacro(Self);
69  itkTypeMacro(VectorData, DataObject);
70  itkStaticConstMacro(Dimension, unsigned int, VDimension);
72 
74  typedef TPrecision PrecisionType;
75  typedef TValuePrecision ValuePrecisionType;
76  // define VDimension Dimension;
79  typedef itk::TreeContainer<DataNodePointerType> DataTreeType;
80  typedef typename DataTreeType::Pointer DataTreePointerType;
81 
83  typedef typename DataNodeType::LineType LineType;
85 
86  typedef itk::Vector<double, 2> SpacingType;
87  typedef itk::Point<double, 2> OriginType;
88 
90  itkGetConstObjectMacro(DataTree, DataTreeType);
91 
92  virtual void SetProjectionRef(const std::string& projectionRef);
93  virtual std::string GetProjectionRef() const;
94 
98  itkSetMacro(Origin, OriginType);
99  virtual void SetOrigin(const double origin[2]);
100  virtual void SetOrigin(const float origin[2]);
102 
103  itkGetConstReferenceMacro(Origin, OriginType);
104 
108  virtual void SetSpacing(const SpacingType& spacing);
109  virtual void SetSpacing(const double spacing[2]);
110  virtual void SetSpacing(const float spacing[2]);
112 
113  itkGetConstReferenceMacro(Spacing, SpacingType);
114 
116  virtual bool Clear();
117 
119  virtual int Size() const;
120 
121  void TransformPointToPhysicalPoint(const PointType& point, PointType& physicalPoint) const
122  {
123  physicalPoint[0] = point[0] * m_Spacing[0] + m_Origin[0];
124  physicalPoint[1] = point[1] * m_Spacing[1] + m_Origin[1];
125  }
126 
134  void Graft(const itk::DataObject* data) override;
135 
136 protected:
138  VectorData();
139 
141  ~VectorData() override
142  {
143  }
144 
146  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
147 
148 private:
149  VectorData(const Self&) = delete;
150  void operator=(const Self&) = delete;
151 
154 
157 };
158 } // end namespace otb
159 
160 #ifndef OTB_MANUAL_INSTANTIATION
161 #include "otbVectorData.hxx"
162 #endif
163 
164 #endif
otb::DataNode::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbDataNode.h:79
otb::VectorData::m_Spacing
SpacingType m_Spacing
Definition: otbVectorData.h:155
otb::VectorData::Dimension
static const unsigned int Dimension
Definition: otbVectorData.h:70
otb::VectorData::DataTreePointerType
DataTreeType::Pointer DataTreePointerType
Definition: otbVectorData.h:80
otb::DataNode::PointType
itk::Point< PrecisionType, VDimension > PointType
Definition: otbDataNode.h:93
otb::VectorData::PrecisionType
TPrecision PrecisionType
Definition: otbVectorData.h:74
otb::VectorData::operator=
void operator=(const Self &)=delete
otb::VectorData::ValuePrecisionType
TValuePrecision ValuePrecisionType
Definition: otbVectorData.h:75
otb::VectorData::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorData.h:64
otb::VectorData::SpacingType
itk::Vector< double, 2 > SpacingType
Definition: otbVectorData.h:86
otb::VectorData
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:58
otb::DataNode
This class represents a node of data in a vector data hierarchy.
Definition: otbDataNode.h:73
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::VectorData::itkGetObjectMacro
itkGetObjectMacro(DataTree, DataTreeType)
otb::VectorData::GetProjectionRef
virtual std::string GetProjectionRef() const
Definition: otbVectorData.hxx:52
otb::VectorData::Size
virtual int Size() const
Definition: otbVectorData.hxx:112
otb::VectorData::LineType
DataNodeType::LineType LineType
Definition: otbVectorData.h:83
otb::VectorData::DataTreeType
itk::TreeContainer< DataNodePointerType > DataTreeType
Definition: otbVectorData.h:79
otb::VectorData::PolygonType
DataNodeType::PolygonType PolygonType
Definition: otbVectorData.h:84
otb::VectorData::PointType
DataNodeType::PointType PointType
Definition: otbVectorData.h:82
otb::VectorData::Self
VectorData Self
Definition: otbVectorData.h:62
otb::VectorData::OriginType
itk::Point< double, 2 > OriginType
Definition: otbVectorData.h:87
otb::VectorData::m_Origin
OriginType m_Origin
Definition: otbVectorData.h:156
otb::VectorData::VectorData
VectorData()
Definition: otbVectorData.hxx:32
otb::VectorData::TransformPointToPhysicalPoint
void TransformPointToPhysicalPoint(const PointType &point, PointType &physicalPoint) const
Definition: otbVectorData.h:121
otb::VectorData::SetOrigin
virtual void SetOrigin(OriginType _arg)
otb::PolyLineParametricPathWithValue
This class implement a PolyLineParametricPath for which a value can be set. The value is stored in th...
Definition: otbPolyLineParametricPathWithValue.h:50
otb::VectorData::m_DataTree
DataTreePointerType m_DataTree
Definition: otbVectorData.h:153
otbDataNode.h
otbVectorData.hxx
otb::VectorData::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbVectorData.hxx:118
otb::VectorData::DataNodePointerType
DataNodeType::Pointer DataNodePointerType
Definition: otbVectorData.h:78
otb::VectorData::Graft
void Graft(const itk::DataObject *data) override
Definition: otbVectorData.hxx:141
otb::VectorData::DataNodeType
otb::DataNode< TPrecision, VDimension, TValuePrecision > DataNodeType
Definition: otbVectorData.h:77
otb::VectorData::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbVectorData.h:65
otb::Polygon
This class represent a 2D polygon.
Definition: otbPolygon.h:44
otb::VectorData::SetProjectionRef
virtual void SetProjectionRef(const std::string &projectionRef)
Definition: otbVectorData.hxx:43
otb::VectorData::Clear
virtual bool Clear()
Definition: otbVectorData.hxx:106
otb::VectorData::Superclass
itk::DataObject Superclass
Definition: otbVectorData.h:63
otb::VectorData::~VectorData
~VectorData() override
Definition: otbVectorData.h:141
otb::VectorData::SetSpacing
virtual void SetSpacing(const SpacingType &spacing)
Definition: otbVectorData.hxx:63