OTB  7.2.0
Orfeo Toolbox
otbRectangle.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 otbRectangle_h
22 #define otbRectangle_h
23 
24 #include "itkImageRegion.h"
25 
26 #include "itkVectorContainer.h"
27 
28 namespace otb
29 {
38 template <class TValue = double>
39 class ITK_EXPORT Rectangle : public itk::Object
40 {
41 public:
43  typedef Rectangle Self;
44  typedef itk::Object Superclass;
45  typedef itk::SmartPointer<Self> Pointer;
46  typedef itk::SmartPointer<const Self> ConstPointer;
47 
48  typedef TValue ValueType;
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(Rectangle, itk::Object);
55 
57  typedef itk::ContinuousIndex<ValueType, 2> ContinuousIndexType;
58  typedef ContinuousIndexType VertexType;
59  typedef itk::VectorContainer<unsigned, VertexType> VertexListType;
60  typedef typename VertexListType::Pointer VertexListPointerType;
61  typedef typename VertexListType::ConstIterator VertexListConstIteratorType;
62 
63  /* typedef typename Superclass::VertexType VertexType; */
64  /* typedef typename Superclass::VertexListType VertexListType; */
65  /* typedef typename VertexListType::Pointer VertexListPointerType; */
66  /* typedef typename Superclass::ContinuousIndexType ContinuousIndexType; */
67  /* typedef typename Superclass::VertexListConstIteratorType VertexListConstIteratorType; */
68 
69  typedef itk::ImageRegion<2> RegionType;
70 
76  itkGetMacro(Width, ValueType);
77  itkSetMacro(Width, ValueType);
78 
79  itkSetMacro(Orientation, ValueType);
80  itkGetMacro(Orientation, ValueType);
81 
87  bool IsInside(VertexType point) const;
88 
89  virtual void AddVertex(const ContinuousIndexType& vertex);
90 
92  virtual RegionType GetBoundingRegion() const;
93 
94 protected:
97  {
98  m_VertexList = VertexListType::New();
99  };
101 
103  ~Rectangle() override
104  {
105  }
106 
108  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
109 
111  virtual double ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const;
112 
115 private:
116  Rectangle(const Self&) = delete;
117  void operator=(const Self&) = delete;
118 
119  ValueType m_Orientation;
120  ValueType m_Width;
121 
122  VertexListPointerType m_VertexList;
123 };
124 } // End namespace otb
125 
126 #ifndef OTB_MANUAL_INSTANTIATION
127 #include "otbRectangle.hxx"
128 #endif
129 #endif
itk::SmartPointer< const Self > ConstPointer
Definition: otbRectangle.h:46
VertexListPointerType m_VertexList
Definition: otbRectangle.h:122
VertexListType::Pointer VertexListPointerType
Definition: otbRectangle.h:60
ValueType m_Orientation
Definition: otbRectangle.h:119
ValueType m_Width
Definition: otbRectangle.h:120
itk::ImageRegion< 2 > RegionType
Definition: otbRectangle.h:69
This class represent a Rectangle.
Definition: otbRectangle.h:39
itk::Object Superclass
Definition: otbRectangle.h:44
~Rectangle() override
Definition: otbRectangle.h:103
itk::ContinuousIndex< ValueType, 2 > ContinuousIndexType
Definition: otbRectangle.h:54
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
VertexListType::ConstIterator VertexListConstIteratorType
Definition: otbRectangle.h:61
Rectangle Self
Definition: otbRectangle.h:43
ContinuousIndexType VertexType
Definition: otbRectangle.h:58
TValue ValueType
Definition: otbRectangle.h:48
itk::SmartPointer< Self > Pointer
Definition: otbRectangle.h:45
itk::VectorContainer< unsigned, VertexType > VertexListType
Definition: otbRectangle.h:59