OTB  9.0.0
Orfeo Toolbox
otbGeometriesSet.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 
21 #ifndef otbGeometriesSet_h
22 #define otbGeometriesSet_h
23 
24 #include <boost/variant.hpp>
25 // #include "otbOGRLayerWrapper.h"
27 #include "otbImageReference.h"
28 
29 namespace otb
30 {
38 class OTBGdalAdapters_EXPORT GeometriesSet : public itk::DataObject
39 {
40 public:
41 
45  typedef itk::DataObject Superclass;
46  typedef itk::SmartPointer<Self> Pointer;
47  typedef itk::SmartPointer<const Self> ConstPointer;
49 
52 
54  itkTypeMacro(GeometriesSet, itk::DataObject);
56 
59 
61  itkNewMacro(Self);
62 
64  static Pointer New(ogr::DataSource::Pointer datasource);
66  static Pointer New(ogr::Layer layer);
68 
71  void Set(ogr::DataSource::Pointer datasource);
72  void Set(ogr::Layer layer);
74 
75 
79  template <typename Visitor>
80  typename Visitor::result_type
81 
96  apply(Visitor const& visitor)
97  {
98  return boost::apply_visitor(visitor, m_GeometriesSet);
99  }
100 
104  template <typename Visitor>
105  typename Visitor::result_type apply(Visitor const& visitor) const
106  {
107  return boost::apply_visitor(visitor, m_GeometriesSet);
108  }
109 
116  template <typename Visitor>
117  typename Visitor::result_type apply(Visitor const& visitor, Self& visitable)
118  {
119  return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet);
120  }
121 
125  template <typename Visitor>
126  typename Visitor::result_type apply(Visitor const& visitor, Self /*const*/& visitable) const
127  {
128  return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet);
129  }
131 
132 
133 
136  bool IsSet() const;
137 
141 
143  void SetImageReference(ImageReference const& imageReference)
144  {
145  m_ImageReference = imageReference;
146  }
147 
150  {
151  return m_ImageReference;
152  }
154 
155 protected:
164  GeometriesSet();
165 
168 
170  GeometriesSet(ogr::Layer layer);
171 
173  ~GeometriesSet() override;
174 
176  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
177 
178 private:
179  typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType;
182 };
183 
184 } // end namespace otb
185 
186 #ifndef OTB_MANUAL_INSTANTIATION
187 // #include "otbGeometriesSet.hxx"
188 #endif
189 
190 #endif // otbGeometriesSet_h
otb::GeometriesSet::apply
Visitor::result_type apply(Visitor const &visitor, Self &visitable) const
Definition: otbGeometriesSet.h:126
otb::GeometriesSet::apply
Visitor::result_type apply(Visitor const &visitor)
Definition: otbGeometriesSet.h:96
otb::GeometriesSet::apply
Visitor::result_type apply(Visitor const &visitor) const
Definition: otbGeometriesSet.h:105
otbImageReference.h
otb::GeometriesSet::AnyGeometriesSetType
boost::variant< ogr::DataSource::Pointer, ogr::Layer > AnyGeometriesSetType
Definition: otbGeometriesSet.h:179
otb::GeometriesSet::m_ImageReference
ImageReference m_ImageReference
Definition: otbGeometriesSet.h:181
otb::GeometriesSet
Common ITK type to manipulate any set of geometries: a otb::ogr::DataSource, or a otb::ogr::Layer.
Definition: otbGeometriesSet.h:38
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GeometriesSet::Self
GeometriesSet Self
Definition: otbGeometriesSet.h:44
otb::ogr::ImageReference< double >
otb::GeometriesSet::GetImageReference
ImageReference const & GetImageReference() const
Definition: otbGeometriesSet.h:149
otb::GeometriesSet::apply
Visitor::result_type apply(Visitor const &visitor, Self &visitable)
Definition: otbGeometriesSet.h:117
otb::GeometriesSet::m_GeometriesSet
AnyGeometriesSetType m_GeometriesSet
Definition: otbGeometriesSet.h:180
otb::ogr::DataSource::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbOGRDataSourceWrapper.h:90
otb::GeometriesSet::SetImageReference
void SetImageReference(ImageReference const &imageReference)
Definition: otbGeometriesSet.h:143
otb::GeometriesSet::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGeometriesSet.h:46
otb::ogr::Layer
Layer of geometric objects.
Definition: otbOGRLayerWrapper.h:80
otb::GeometriesSet::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGeometriesSet.h:47
otb::GeometriesSet::ImageReference
ogr::ImageReference< double > ImageReference
Definition: otbGeometriesSet.h:140
otbOGRDataSourceWrapper.h
otb::GeometriesSet::Superclass
itk::DataObject Superclass
Definition: otbGeometriesSet.h:45