OTB  10.0.0
Orfeo Toolbox
otbOGRLayerStreamStitchingFilter.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 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:
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
This filter fusion the geometries in a layer (OGRLayer) along streaming lines. It is a in-line filter...
OGRLayerStreamStitchingFilter(const Self &)=delete
void operator=(const Self &)=delete
Geometric object with descriptive fields.
Layer of geometric objects.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.