/usr/include/OTB-6.4/otbGeometriesSet.h is in libotb-dev 6.4.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | /*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbGeometriesSet_h
#define otbGeometriesSet_h
#include <boost/variant.hpp>
// #include "otbOGRLayerWrapper.h"
#include "otbOGRDataSourceWrapper.h"
#include "otbImageReference.h"
namespace otb
{
/**\ingroup gGeometry
* \class GeometriesSet
* \brief Common ITK type to manipulate any set of geometries: a \c otb::ogr::DataSource, or a \c otb::ogr::Layer.
* \since OTB v 3.14.0
*
* \ingroup OTBGdalAdapters
*/
class OTBGdalAdapters_EXPORT GeometriesSet : public itk::DataObject
{
public:
/**\name Standard ITK typedefs */
//@{
typedef GeometriesSet Self;
typedef itk::DataObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
//@}
/**\name Standard macros */
//@{
/** Run-time type information (and related methods). */
itkTypeMacro(GeometriesSet, itk::DataObject);
//@}
/**\name Factory functions */
//@{
/** ITK method for creation through the object factory. */
itkNewMacro(Self);
/// Direct builder from an existing \c otb::DataSource.
static Pointer New(ogr::DataSource::Pointer datasource);
/// Direct builder from an existing \c otb::Layer.
static Pointer New(ogr::Layer layer);
//@}
/**\name Geometries accessors */
//@{
void Set(ogr::DataSource::Pointer datasource);
void Set(ogr::Layer layer);
//@}
/**\name Application of a command to a geometries set, through a visitor
*/
//@{
template <typename Visitor>
typename Visitor::result_type
/**
* Unary visiting function to apply a visitor on any kind of geometies set.
*
* As a \c GeometriesSet contains either a \c otb::ogr::DataSource, or a \c
* otb::ogr::Layer, one needs to apply a function on either kind of data.
* This can be done thanks to a specialization of \c boost::static_visitor<>
* that has a const \c operator() that takes either one (or two in case of
* binary visitors) \c otb::DataSource or \c otb::Layer as parameter(s).
*
* \throw Whatever is thrown by the actual visitor.
* \tparam Visitor type of the visitor functor.
* \param[in] visitor Functor visitor that shal derive from \c
* boost::static_visitor.
*/
apply(Visitor const& visitor)
{
return boost::apply_visitor(visitor, m_GeometriesSet);
}
/**
* \copydoc apply(Visitor const& visitor)
*/
template <typename Visitor>
typename Visitor::result_type
apply(Visitor const& visitor) const
{
return boost::apply_visitor(visitor, m_GeometriesSet);
}
/**
* Binary visiting function to apply a visitor on any kind of geometies set.
* \copydetails apply(Visitor const& visitor)
* \param[in] visitable other geometries set to visit along side with the
* current geometries set instance.
*/
template <typename Visitor>
typename Visitor::result_type
apply(Visitor const& visitor, Self & visitable)
{
return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet);
}
/**
* \copydoc apply(Visitor const& visitor, Self& visitable)
*/
template <typename Visitor>
typename Visitor::result_type
apply(Visitor const& visitor, Self /*const*/& visitable) const
{
return boost::apply_visitor(visitor, m_GeometriesSet, visitable.m_GeometriesSet);
}
//@}
/** Does it contain a geometries set ?.
*/
bool IsSet() const;
/**\name Image reference (spacing + origin) */
//@{
typedef ogr::ImageReference<double> ImageReference;
/** \em ImageReference setter. */
void SetImageReference(ImageReference const& imageReference)
{ m_ImageReference = imageReference; }
/** \em ImageReference getter. */
ImageReference const& GetImageReference() const
{ return m_ImageReference; }
//@}
protected:
/** Default constructor.
* This actual geometries set is an in-memory \c otb::ogr::DataSource.
* It needs to be set to a set of geometries if you expect to serialize it or
* work on a \c otb::Layer.
*
* When using this construction path, you'll likelly need to \c Set() the
* actual geometries set.
*/
GeometriesSet();
/** Init constructor from a \c otb::DataSource. */
GeometriesSet(ogr::DataSource::Pointer datasource);
/** Init constructor from a \c otb::Layer. */
GeometriesSet(ogr::Layer layer);
/** Destructor. */
~GeometriesSet() ITK_OVERRIDE;
/** Prints self to stream. */
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
private:
typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType;
AnyGeometriesSetType m_GeometriesSet;
ImageReference m_ImageReference;
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
// #include "otbGeometriesSet.txx"
#endif
#endif // otbGeometriesSet_h
|