OTB  9.0.0
Orfeo Toolbox
otbGeometriesProjectionFilter.hxx
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 
21 #ifndef otbGeometriesProjectionFilter_hxx
22 #define otbGeometriesProjectionFilter_hxx
23 
24 /*===========================================================================*/
25 /*===============================[ Includes ]================================*/
26 /*===========================================================================*/
28 
29 
30 /*===========================================================================*/
31 /*====================[ ReprojectTransformationFunctor ]=====================*/
32 /*===========================================================================*/
33 
34 template <typename TGeometry>
36 {
37  boost::interprocess::unique_ptr<TGeometry, ogr::internal::GeometryDeleter> out(in ? static_cast<TGeometry*>(in->clone())
38  : nullptr); // OGR clone doesn't use covariant return ...
39  if (out)
41  ogr::UniqueGeometryPtr res(out.release());
42  return res;
43 }
44 
45 template <typename TGeometry>
47 {
48  if (inout)
49  m_Reprojector.do_transform(*inout);
50 }
51 
53 {
54  m_Transform = transform;
55 }
56 
57 
58 /*===========================================================================*/
59 /*======================[ GeometriesProjectionFilter ]=======================*/
60 /*===========================================================================*/
61 
62 inline void otb::GeometriesProjectionFilter::SetInputSpacing(ImageReference::SpacingType const& spacing)
63 {
64  m_InputImageReference.SetSpacing(spacing);
65 }
66 
67 inline void otb::GeometriesProjectionFilter::SetOutputSpacing(ImageReference::SpacingType const& spacing)
68 {
69  m_OutputImageReference.SetSpacing(spacing);
70 }
71 
72 inline void otb::GeometriesProjectionFilter::SetInputOrigin(ImageReference::OriginType const& origin)
73 {
74  m_InputImageReference.SetOrigin(origin);
75 }
76 
77 inline void otb::GeometriesProjectionFilter::SetOutputOrigin(ImageReference::OriginType const& origin)
78 {
79  m_OutputImageReference.SetOrigin(origin);
80 }
81 
82 #endif
otb::GeometriesProjectionFilter::SetInputSpacing
void SetInputSpacing(ImageReference::SpacingType const &spacing)
Definition: otbGeometriesProjectionFilter.hxx:62
otb::GeometriesProjectionFilter::SetOutputOrigin
void SetOutputOrigin(ImageReference::OriginType const &origin)
Definition: otbGeometriesProjectionFilter.hxx:77
otb::internal::ReprojectTransformationFunctor::InPlace::operator()
void operator()(TGeometry *inout) const
Definition: otbGeometriesProjectionFilter.hxx:46
otbGeometriesProjectionFilter.h
otb::ogr::UniqueGeometryPtr
boost::interprocess::unique_ptr< OGRGeometry, internal::GeometryDeleter > UniqueGeometryPtr
Definition: otbOGRGeometryWrapper.h:109
otb::GeometriesProjectionFilter::SetInputOrigin
void SetInputOrigin(ImageReference::OriginType const &origin)
Definition: otbGeometriesProjectionFilter.hxx:72
otb::internal::ReprojectTransformationFunctor::SetOnePointTransformation
void SetOnePointTransformation(InternalTransformPointerType transform)
Definition: otbGeometriesProjectionFilter.hxx:52
otb::internal::ReprojectTransformationFunctor::InternalTransformPointerType
InternalTransformType::Pointer InternalTransformPointerType
Definition: otbGeometriesProjectionFilter.h:92
otb::internal::ReprojectTransformationFunctor::ByCopy::operator()
ogr::UniqueGeometryPtr operator()(TGeometry const *in) const
otb::internal::ReprojectTransformationFunctor::do_transform
void do_transform(OGRPoint &g) const
otb::GeometriesProjectionFilter::SetOutputSpacing
void SetOutputSpacing(ImageReference::SpacingType const &spacing)
Definition: otbGeometriesProjectionFilter.hxx:67
otb::internal::ReprojectTransformationFunctor::m_Transform
InternalTransformPointerType m_Transform
Definition: otbGeometriesProjectionFilter.h:139
otb::internal::ReprojectTransformationFunctor::ByCopy::m_Reprojector
ReprojectTransformationFunctor const & m_Reprojector
Definition: otbGeometriesProjectionFilter.h:68