OTB  10.0.0
Orfeo Toolbox
otbGeometriesSet.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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:
165 
168 
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
Common ITK type to manipulate any set of geometries: a otb::ogr::DataSource, or a otb::ogr::Layer.
ImageReference const & GetImageReference() const
ImageReference m_ImageReference
Visitor::result_type apply(Visitor const &visitor, Self &visitable)
GeometriesSet(ogr::Layer layer)
AnyGeometriesSetType m_GeometriesSet
itk::SmartPointer< const Self > ConstPointer
ogr::ImageReference< double > ImageReference
Visitor::result_type apply(Visitor const &visitor)
static Pointer New(ogr::DataSource::Pointer datasource)
Direct builder from an existing otb::DataSource.
GeometriesSet(ogr::DataSource::Pointer datasource)
static Pointer New(ogr::Layer layer)
Direct builder from an existing otb::Layer.
void SetImageReference(ImageReference const &imageReference)
GeometriesSet Self
bool IsSet() const
void Set(ogr::DataSource::Pointer datasource)
itk::DataObject Superclass
~GeometriesSet() override
itk::SmartPointer< Self > Pointer
Visitor::result_type apply(Visitor const &visitor, Self &visitable) const
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Visitor::result_type apply(Visitor const &visitor) const
boost::variant< ogr::DataSource::Pointer, ogr::Layer > AnyGeometriesSetType
void Set(ogr::Layer layer)
itk::SmartPointer< Self > Pointer
Layer of geometric objects.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.