OTB  6.7.0
Orfeo Toolbox
otbGeocentricTransform.hxx
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 otbGeocentricTransform_hxx
22 #define otbGeocentricTransform_hxx
23 
24 #include "otbGeocentricTransform.h"
25 
26 namespace otb
27 {
28 
29 template<TransformDirection::TransformationDirection TDirectionOfMapping, class TScalarType,
30  unsigned int NInputDimensions, unsigned int NOutputDimensions>
32 ::GeocentricTransform() : Superclass(ParametersDimension)
33 {
34  m_Ellipsoid = EllipsoidAdapter::New();
35 }
36 
37 template<TransformDirection::TransformationDirection TDirectionOfMapping, class TScalarType,
38  unsigned int NInputDimensions, unsigned int NOutputDimensions>
41 {}
42 
43 template<TransformDirection::TransformationDirection TDirectionOfMapping, class TScalarType,
44  unsigned int NInputDimensions, unsigned int NOutputDimensions>
45 typename GeocentricTransform<TDirectionOfMapping, TScalarType,
46  NInputDimensions, NOutputDimensions>::OutputPointType
48 ::TransformPoint(const InputPointType& point) const
49 {
50  OutputPointType outputPoint;
51 
52  if (DirectionOfMapping == TransformDirection::INVERSE)
53  {
54  m_Ellipsoid->XYZToLonLatHeight(point[0], point[1], point[2],
55  outputPoint[0], outputPoint[1], outputPoint[2]);
56  }
57  if (DirectionOfMapping == TransformDirection::FORWARD)
58  {
59  m_Ellipsoid->LonLatHeightToXYZ(point[0], point[1], point[2],
60  outputPoint[0], outputPoint[1], outputPoint[2]);
61  }
62  //To be completed
63  return outputPoint;
64 }
65 
66 } // namespace otb
67 #endif
Convert coordinates from geocentric (X, Y, Z) to geographic (lon, lat, h)
OutputPointType TransformPoint(const InputPointType &point) const override
static Pointer New()