OTB  9.0.0
Orfeo Toolbox
otbOGRLayerStreamStitchingFilter.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 otbOGRLayerStreamStitchingFilter_h
22 #define otbOGRLayerStreamStitchingFilter_h
23 
25 #include "otbMacro.h"
26 
27 #include "itkProgressReporter.h"
28 
29 #include <algorithm>
30 
31 namespace otb
32 {
33 
54 template <class TInputImage>
55 class ITK_EXPORT OGRLayerStreamStitchingFilter : public itk::ProcessObject
56 {
57 public:
60  typedef itk::ProcessObject Superclass;
61  typedef itk::SmartPointer<Self> Pointer;
62  typedef itk::SmartPointer<const Self> ConstPointer;
63 
65  typedef TInputImage InputImageType;
66  typedef typename InputImageType::PixelType InputPixelType;
67  typedef typename InputImageType::IndexType InputIndexType;
68  typedef typename InputImageType::SizeType SizeType;
69  typedef typename InputImageType::RegionType RegionType;
70  typedef typename InputImageType::SpacingType SpacingType;
71  typedef typename InputImageType::PointType OriginType;
72  typedef typename InputImageType::IndexType IndexType;
73 
76 
78  using Superclass::SetInput;
79  virtual void SetInput(const InputImageType* input);
80 
82  virtual const InputImageType* GetInput(void);
83 
85  itkNewMacro(Self);
86 
88  itkTypeMacro(OGRLayerStreamStitchingFilter, ProcessObject);
89 
91  void SetOGRLayer(const OGRLayerType& ogrLayer);
92 
94  const OGRLayerType& GetOGRLayer(void) const;
95 
100  itkSetMacro(StreamSize, SizeType);
101 
103  itkGetMacro(StreamSize, SizeType);
104 
106  void GenerateData() override;
107 
108 protected:
111  {
112  }
113 
115  {
116  unsigned int indStream1;
117  unsigned int indStream2;
118  double overlap;
119  };
121  {
122  FeatureStruct(OGRFeatureDefn& defn) : feat(defn), fusioned(false)
123  {
124  }
126  bool fusioned;
127  };
129  {
131  {
132  return (f1.overlap > f2.overlap);
133  }
134  } SortFeature;
135 
139  void ProcessStreamingLine(bool line, itk::ProgressReporter& progress);
140 
146  double GetLengthOGRGeometryCollection(OGRGeometryCollection* intersection);
147 
148 private:
149  OGRLayerStreamStitchingFilter(const Self&) = delete;
150  void operator=(const Self&) = delete;
151 
152  SizeType m_StreamSize{0,0};
153  unsigned int m_Radius;
155 };
156 
157 
158 } // end namespace otb
159 
160 #ifndef OTB_MANUAL_INSTANTIATION
162 #endif
163 
164 #endif
otb::OGRLayerStreamStitchingFilter::InputImageType
TInputImage InputImageType
Definition: otbOGRLayerStreamStitchingFilter.h:65
otb::OGRLayerStreamStitchingFilter::FeatureStruct::feat
OGRFeatureType feat
Definition: otbOGRLayerStreamStitchingFilter.h:125
otb::OGRLayerStreamStitchingFilter::FusionStruct
Definition: otbOGRLayerStreamStitchingFilter.h:114
otbOGRLayerStreamStitchingFilter.hxx
otb::OGRLayerStreamStitchingFilter::InputPixelType
InputImageType::PixelType InputPixelType
Definition: otbOGRLayerStreamStitchingFilter.h:66
otb::OGRLayerStreamStitchingFilter::FeatureStruct::fusioned
bool fusioned
Definition: otbOGRLayerStreamStitchingFilter.h:126
otb::OGRLayerStreamStitchingFilter::FusionStruct::indStream2
unsigned int indStream2
Definition: otbOGRLayerStreamStitchingFilter.h:117
otb::OGRLayerStreamStitchingFilter::OGRFeatureType
ogr::Feature OGRFeatureType
Definition: otbOGRLayerStreamStitchingFilter.h:75
otb::OGRLayerStreamStitchingFilter::OriginType
InputImageType::PointType OriginType
Definition: otbOGRLayerStreamStitchingFilter.h:71
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::OGRLayerStreamStitchingFilter::FeatureStruct::FeatureStruct
FeatureStruct(OGRFeatureDefn &defn)
Definition: otbOGRLayerStreamStitchingFilter.h:122
otb::OGRLayerStreamStitchingFilter::IndexType
InputImageType::IndexType IndexType
Definition: otbOGRLayerStreamStitchingFilter.h:72
otbMacro.h
otb::OGRLayerStreamStitchingFilter::FusionStruct::overlap
double overlap
Definition: otbOGRLayerStreamStitchingFilter.h:118
otb::OGRLayerStreamStitchingFilter::RegionType
InputImageType::RegionType RegionType
Definition: otbOGRLayerStreamStitchingFilter.h:69
otb::OGRLayerStreamStitchingFilter::OGRLayerType
ogr::Layer OGRLayerType
Definition: otbOGRLayerStreamStitchingFilter.h:74
otb::OGRLayerStreamStitchingFilter::FusionStruct::indStream1
unsigned int indStream1
Definition: otbOGRLayerStreamStitchingFilter.h:116
otb::OGRLayerStreamStitchingFilter::SpacingType
InputImageType::SpacingType SpacingType
Definition: otbOGRLayerStreamStitchingFilter.h:70
otb::OGRLayerStreamStitchingFilter::SortFeatureStruct::operator()
bool operator()(FusionStruct f1, FusionStruct f2)
Definition: otbOGRLayerStreamStitchingFilter.h:130
otb::OGRLayerStreamStitchingFilter::Superclass
itk::ProcessObject Superclass
Definition: otbOGRLayerStreamStitchingFilter.h:60
otb::OGRLayerStreamStitchingFilter
This filter fusion the geometries in a layer (OGRLayer) along streaming lines. It is a in-line filter...
Definition: otbOGRLayerStreamStitchingFilter.h:55
otb::OGRLayerStreamStitchingFilter::m_Radius
unsigned int m_Radius
Definition: otbOGRLayerStreamStitchingFilter.h:153
otb::OGRLayerStreamStitchingFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbOGRLayerStreamStitchingFilter.h:62
otb::OGRLayerStreamStitchingFilter::InputIndexType
InputImageType::IndexType InputIndexType
Definition: otbOGRLayerStreamStitchingFilter.h:67
otb::OGRLayerStreamStitchingFilter::SortFeatureStruct
Definition: otbOGRLayerStreamStitchingFilter.h:128
otb::ogr::Feature
Geometric object with descriptive fields.
Definition: otbOGRFeatureWrapper.h:63
otb::OGRLayerStreamStitchingFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbOGRLayerStreamStitchingFilter.h:61
otb::OGRLayerStreamStitchingFilter::SizeType
InputImageType::SizeType SizeType
Definition: otbOGRLayerStreamStitchingFilter.h:68
otb::OGRLayerStreamStitchingFilter::m_OGRLayer
OGRLayerType m_OGRLayer
Definition: otbOGRLayerStreamStitchingFilter.h:154
otb::ogr::Layer
Layer of geometric objects.
Definition: otbOGRLayerWrapper.h:80
otb::OGRLayerStreamStitchingFilter::FeatureStruct
Definition: otbOGRLayerStreamStitchingFilter.h:120
otbOGRDataSourceWrapper.h
otb::OGRLayerStreamStitchingFilter::Self
OGRLayerStreamStitchingFilter Self
Definition: otbOGRLayerStreamStitchingFilter.h:59
otb::OGRLayerStreamStitchingFilter::~OGRLayerStreamStitchingFilter
~OGRLayerStreamStitchingFilter() override
Definition: otbOGRLayerStreamStitchingFilter.h:110