OTB  6.7.0
Orfeo Toolbox
otbVectorData.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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>
59  : public itk::DataObject
60 {
61 public:
63  typedef VectorData Self;
67 
69  itkNewMacro(Self);
70  itkTypeMacro(VectorData, DataObject);
71  itkStaticConstMacro(Dimension, unsigned int, VDimension);
73 
75  typedef TPrecision PrecisionType;
76  typedef TValuePrecision ValuePrecisionType;
77  //define VDimension Dimension;
82 
84  typedef typename DataNodeType::LineType LineType;
86 
89 
91  itkGetConstObjectMacro(DataTree, DataTreeType);
92 
93  virtual void SetProjectionRef(const std::string& projectionRef);
94  virtual std::string GetProjectionRef() const;
95 
99  itkSetMacro(Origin, OriginType);
100  virtual void SetOrigin(const double origin[2]);
101  virtual void SetOrigin(const float origin[2]);
103 
104  itkGetConstReferenceMacro(Origin, OriginType);
105 
109  virtual void SetSpacing(const SpacingType& spacing);
110  virtual void SetSpacing(const double spacing[2]);
111  virtual void SetSpacing(const float spacing[2]);
113 
114  itkGetConstReferenceMacro(Spacing, SpacingType);
115 
117  virtual bool Clear();
118 
120  virtual int Size() const;
121 
122  void TransformPointToPhysicalPoint(const PointType& point, PointType& physicalPoint) const
123  {
124  physicalPoint[0] = point[0] * m_Spacing[0] + m_Origin[0];
125  physicalPoint[1] = point[1] * m_Spacing[1] + m_Origin[1];
126  }
127 
135  void Graft(const itk::DataObject *data) override;
136 
137 protected:
139  VectorData();
140 
142  ~VectorData() override {}
143 
145  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
146 
147 private:
148  VectorData(const Self&) = delete;
149  void operator =(const Self&) = delete;
150 
153 
156 };
157 } // end namespace otb
158 
159 #ifndef OTB_MANUAL_INSTANTIATION
160 #include "otbVectorData.txx"
161 #endif
162 
163 #endif
DataTreeType::Pointer DataTreePointerType
Definition: otbVectorData.h:81
virtual void SetProjectionRef(const std::string &projectionRef)
itkGetObjectMacro(DataTree, DataTreeType)
virtual bool Clear()
itk::DataObject Superclass
Definition: otbVectorData.h:64
void Graft(const itk::DataObject *data) override
This class implement a PolyLineParametricPath for which a value can be set. The value is stored in th...
TValuePrecision ValuePrecisionType
Definition: otbVectorData.h:76
DataNodeType::PointType PointType
Definition: otbVectorData.h:83
VectorData Self
Definition: otbVectorData.h:63
virtual void SetOrigin(OriginType _arg)
itk::Vector< double, 2 > SpacingType
Definition: otbVectorData.h:87
OriginType m_Origin
This class represents a node of data in a vector data hierarchy.
Definition: otbDataNode.h:75
itk::SmartPointer< Self > Pointer
Definition: otbVectorData.h:65
This class represent a 2D polygon.
Definition: otbPolygon.h:44
itk::SmartPointer< const Self > ConstPointer
Definition: otbVectorData.h:66
DataNodeType::Pointer DataNodePointerType
Definition: otbVectorData.h:79
otb::DataNode< TPrecision, VDimension, TValuePrecision > DataNodeType
Definition: otbVectorData.h:78
virtual int Size() const
SpacingType m_Spacing
~VectorData() override
DataTreePointerType m_DataTree
itk::TreeContainer< DataNodePointerType > DataTreeType
Definition: otbVectorData.h:80
static const unsigned int Dimension
Definition: otbVectorData.h:71
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:58
virtual void SetSpacing(const SpacingType &spacing)
virtual std::string GetProjectionRef() const
itk::Point< double, 2 > OriginType
Definition: otbVectorData.h:88
TPrecision PrecisionType
Definition: otbVectorData.h:75
void operator=(const Self &)=delete
void TransformPointToPhysicalPoint(const PointType &point, PointType &physicalPoint) const
DataNodeType::PolygonType PolygonType
Definition: otbVectorData.h:85
DataNodeType::LineType LineType
Definition: otbVectorData.h:84
void PrintSelf(std::ostream &os, itk::Indent indent) const override