OTB  10.0.0
Orfeo Toolbox
otbVectorDataExtractROI.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 otbVectorDataExtractROI_h
22 #define otbVectorDataExtractROI_h
23 
25 #include "otbRemoteSensingRegion.h"
26 #include "itkMacro.h"
27 
28 namespace otb
29 {
30 
52 template <class TVectorData>
53 class ITK_EXPORT VectorDataExtractROI : public VectorDataToVectorDataFilter<TVectorData, TVectorData>
54 {
55 public:
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  itkNewMacro(Self);
64 
67 
69  typedef TVectorData VectorDataType;
70  typedef typename VectorDataType::ConstPointer VectorDataConstPointerType;
71  typedef typename VectorDataType::Pointer VectorDataPointerType;
72  typedef typename VectorDataType::DataNodeType DataNodeType;
73  typedef typename DataNodeType::Pointer DataNodePointerType;
74  typedef typename VectorDataType::DataTreeType DataTreeType;
75  typedef typename DataNodeType::PolygonPointerType PolygonPointerType;
76  typedef typename DataNodeType::PolygonType PolygonType;
77  typedef typename DataNodeType::LineType LineType;
78  typedef typename DataNodeType::LinePointerType LinePointerType;
79  typedef typename DataNodeType::PointType PointType;
80 
82  typedef typename PolygonType::VertexType VertexType;
83  typedef typename PolygonType::VertexListType VertexListType;
84  typedef typename PolygonType::VertexListPointer VertexListPointer;
85 
88  typedef typename RegionType::IndexType IndexType;
89  typedef typename RegionType::SizeType SizeType;
90 
91  typedef itk::Point<typename VertexType::CoordRepType, IndexType::IndexDimension> ProjPointType;
92 
93  typedef typename VectorDataType::ChildrenListType ChildrenListType;
94 
96  void SetRegion(const RegionType& region)
97  {
98  m_ROI = region;
99  }
100 
102  {
103  return m_ROI;
104  }
105 
106 protected:
108  ~VectorDataExtractROI() override = default;
109 
110  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
111 
113  virtual void CompareInputAndRegionProjection();
114 
116  virtual void ProjectRegionToInputVectorProjection();
117 
119  virtual RegionType ComputeVertexListBoundingRegion(typename VertexListType::ConstPointer vertexlist);
120 
122  virtual VertexType PointToContinuousIndex(ProjPointType point);
123 
125  void GenerateData(void) override;
126 
128  virtual bool IsPolygonIntersectionNotNull(PolygonPointerType polygon);
129 
131  virtual bool IsLineIntersectionNotNull(LinePointerType line);
132 
133  virtual void ProcessNode(VectorDataConstPointerType inputVdata, DataNodePointerType source, VectorDataPointerType outputVdata, DataNodePointerType destination);
134  using Superclass::ProcessNode;
135 
136 private:
137  VectorDataExtractROI(const Self&) = delete;
138  void operator=(const Self&) = delete;
139 
140  int CounterClockWise(PointType firstPoint, PointType secondPoint, PointType thirdPoint);
141  bool IsSegmentIntersectSegment(LinePointerType segmentLineAB, LinePointerType segmentLineCD);
142 
146 
147  unsigned int m_Kept;
148 };
149 
150 } // end namespace otb
151 
152 #ifndef OTB_MANUAL_INSTANTIATION
154 #endif
155 
156 #endif
Extract a subset of a Vector Data based on location.
otb::RemoteSensingRegion< typename VertexType::CoordRepType > RegionType
void operator=(const Self &)=delete
PolygonType::VertexListPointer VertexListPointer
DataNodeType::Pointer DataNodePointerType
DataNodeType::LinePointerType LinePointerType
itk::Point< typename VertexType::CoordRepType, IndexType::IndexDimension > ProjPointType
DataNodeType::LineType LineType
VectorDataType::ConstPointer VectorDataConstPointerType
DataNodeType::PointType PointType
~VectorDataExtractROI() override=default
VectorDataType::ChildrenListType ChildrenListType
itk::SmartPointer< Self > Pointer
VectorDataType::DataNodeType DataNodeType
PolygonType::VertexListType VertexListType
VectorDataExtractROI(const Self &)=delete
VectorDataType::DataTreeType DataTreeType
RegionType::IndexType IndexType
VectorDataToVectorDataFilter< TVectorData, TVectorData > Superclass
DataNodeType::PolygonPointerType PolygonPointerType
PolygonType::VertexType VertexType
VectorDataType::Pointer VectorDataPointerType
void SetRegion(const RegionType &region)
itk::SmartPointer< const Self > ConstPointer
DataNodeType::PolygonType PolygonType
Base class for filters that take an VectorData as input and produce an VectorData as output.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.