OTB  6.7.0
Orfeo Toolbox
otbGeographicalDistance.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbGeographicalDistance_h
22 #define otbGeographicalDistance_h
23 
24 #include "itkNumericTraits.h"
25 #include "itkDistanceMetric.h"
26 
27 namespace otb
28 {
49 template <class TVector>
50 class ITK_EXPORT GeographicalDistance :
51  public itk::Statistics::DistanceMetric<TVector>
52 {
53 public:
54 
60 
63 
65  itkNewMacro(Self);
66 
68  typedef TVector VectorType;
69 
72  double Evaluate(const VectorType & x) const override;
73 
74  /* Gets the distance between x and y points */
75  double Evaluate(const VectorType & x, const VectorType & y) const override;
76 
78  itkSetMacro(EarthRadius, double);
79 
81  itkGetMacro(EarthRadius, double);
82 
83 protected:
86 
88  ~GeographicalDistance() override{}
89 
91  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
92 
93 private:
94  GeographicalDistance(const Self &) = delete;
95  void operator =(const Self&) = delete;
96 
98  double m_EarthRadius;
99 };
100 
101 } // end namespace otb
102 
103 #ifndef OTB_MANUAL_INSTANTIATION
104 # include "otbGeographicalDistance.hxx"
105 #endif
106 
107 #endif
itk::Statistics::DistanceMetric< TVector > Superclass
itk::SmartPointer< const Self > ConstPointer
itk::SmartPointer< Self > Pointer
Compute the metric distance between two geographical points.