OTB  9.0.0
Orfeo Toolbox
otbCoordinateTransformation.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 #ifndef otbCoordinateTransformation_h
21 #define otbCoordinateTransformation_h
22 
23 #include "otbSpatialReference.h"
24 
25 #include "OTBGdalAdaptersExport.h"
26 
27 #include <memory>
28 #include <tuple>
29 
30 #if defined(_MSC_VER)
31 #pragma warning(disable : 4251)
32 // Disable following warning :
33 // warning C4251: 'otb::CoordinateTransformation::m_Transform':
34 // class 'std::unique_ptr<OGRCoordinateTransformation,std::default_delete<_Ty>>'
35 // needs to have dll-interface to be used by clients of class
36 // 'otb::CoordinateTransformation'
37 // As long as otb::CoordinateTransformation::m_Transform is private no need to
38 // export this type.
39 #endif
40 
41 class OGRCoordinateTransformation;
42 
43 namespace otb
44 {
45 // Destructor of OGRCoordinateTransformation
46 namespace internal
47 {
48 struct OTBGdalAdapters_EXPORT OGRCoordinateTransformationDeleter
49 {
50 public:
51  void operator()(OGRCoordinateTransformation* del) const;
52 };
53 }
54 
55 // Forward declaration needed for the operators declared bellow.
57 
59 OTBGdalAdapters_EXPORT bool operator==(const CoordinateTransformation& ct1, const CoordinateTransformation& ct2) noexcept;
60 
62 OTBGdalAdapters_EXPORT bool operator!=(const CoordinateTransformation& ct1, const CoordinateTransformation& ct2) noexcept;
63 
77 class OTBGdalAdapters_EXPORT CoordinateTransformation
78 {
79  OTBGdalAdapters_EXPORT friend bool operator==(const CoordinateTransformation& ct1, const CoordinateTransformation& ct2) noexcept;
80  OTBGdalAdapters_EXPORT friend bool operator!=(const CoordinateTransformation& ct1, const CoordinateTransformation& ct2) noexcept;
81 
82 public:
83  typedef std::unique_ptr<OGRCoordinateTransformation, internal::OGRCoordinateTransformationDeleter> CoordinateTransformationPtr;
92  CoordinateTransformation(const SpatialReference& source, const SpatialReference& destination);
93 
96 
98  CoordinateTransformation& operator=(const CoordinateTransformation& other) noexcept;
99 
101  SpatialReference GetSourceSpatialReference() const;
102 
104  SpatialReference GetTargetSpatialReference() const;
105 
112  std::tuple<double, double, double> Transform(const std::tuple<double, double, double>& in) const;
113 
120  std::tuple<double, double> Transform(const std::tuple<double, double>& in) const;
121 
122 
123 private:
124  // unique ptr to the internal OGRCoordinateTransformation
126 };
127 
129 OTBGdalAdapters_EXPORT std::ostream& operator<<(std::ostream& o, const CoordinateTransformation& i);
130 }
131 
132 #endif
otb::CoordinateTransformation
This class is a wrapper around OGRCoordinateTransformation.
Definition: otbCoordinateTransformation.h:77
otb::CoordinateTransformation::m_Transform
CoordinateTransformationPtr m_Transform
Definition: otbCoordinateTransformation.h:125
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SpatialReference
This class is a wrapper around OGRSpatialReference.
Definition: otbSpatialReference.h:79
otbSpatialReference.h
otb::operator==
constexpr bool operator==(extents< StaticExtentsL... > const &lhs, extents< StaticExtentsR... > const &rhs)
Definition: otbExtents.h:150
otb::Transform
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:39
otb::CoordinateTransformation::CoordinateTransformationPtr
std::unique_ptr< OGRCoordinateTransformation, internal::OGRCoordinateTransformationDeleter > CoordinateTransformationPtr
Definition: otbCoordinateTransformation.h:83
otb::internal::OGRCoordinateTransformationDeleter
Definition: otbCoordinateTransformation.h:48
otb::operator!=
constexpr bool operator!=(extents< StaticExtentsL... > const &lhs, extents< StaticExtentsR... > const &rhs)
Definition: otbExtents.h:164
otb::operator<<
OTBCommon_EXPORT std::ostream & operator<<(std::ostream &os, const otb::StringToHTML &str)