OTB  9.0.0
Orfeo Toolbox
otbVectorDataExtractROI.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 otbVectorDataExtractROI_h
22 #define otbVectorDataExtractROI_h
23 
25 #include "otbRemoteSensingRegion.h"
26 #include "itkMacro.h"
27 #include "itkPreOrderTreeIterator.h"
28 
29 namespace otb
30 {
31 
53 template <class TVectorData>
54 class ITK_EXPORT VectorDataExtractROI : public VectorDataToVectorDataFilter<TVectorData, TVectorData>
55 {
56 public:
60  typedef itk::SmartPointer<Self> Pointer;
61  typedef itk::SmartPointer<const Self> ConstPointer;
62 
64  itkNewMacro(Self);
65 
68 
70  typedef TVectorData VectorDataType;
71  typedef typename VectorDataType::DataNodeType DataNodeType;
72  typedef typename DataNodeType::Pointer DataNodePointerType;
73  typedef typename VectorDataType::DataTreeType DataTreeType;
74  typedef typename DataNodeType::PolygonPointerType PolygonPointerType;
75  typedef typename DataNodeType::PolygonType PolygonType;
76  typedef typename DataNodeType::LineType LineType;
77  typedef typename DataNodeType::LinePointerType LinePointerType;
78  typedef typename DataNodeType::PointType PointType;
79 
81  typedef typename PolygonType::VertexType VertexType;
82  typedef typename PolygonType::VertexListType VertexListType;
83  typedef typename PolygonType::VertexListPointer VertexListPointer;
84 
87  typedef typename RegionType::IndexType IndexType;
88  typedef typename RegionType::SizeType SizeType;
89 
90  typedef itk::Point<typename VertexType::CoordRepType, IndexType::IndexDimension> ProjPointType;
91 
92  typedef itk::PreOrderTreeIterator<typename VectorDataType::DataTreeType> InputTreeIteratorType;
93  typedef typename VectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType;
94  typedef typename InternalTreeNodeType::ChildrenListType ChildrenListType;
95 
97  void SetRegion(const RegionType& region)
98  {
99  m_ROI = region;
100  }
101 
103  {
104  return m_ROI;
105  }
106 
107 protected:
109  ~VectorDataExtractROI() override = default;
110 
111  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
112 
114  virtual void CompareInputAndRegionProjection();
115 
117  virtual void ProjectRegionToInputVectorProjection();
118 
120  virtual RegionType ComputeVertexListBoundingRegion(typename VertexListType::ConstPointer vertexlist);
121 
123  virtual VertexType PointToContinuousIndex(ProjPointType point);
124 
126  void GenerateData(void) override;
127 
129  virtual bool IsPolygonIntersectionNotNull(PolygonPointerType polygon);
130 
132  virtual bool IsLineIntersectionNotNull(LinePointerType line);
133 
134  virtual void ProcessNode(InternalTreeNodeType* source, InternalTreeNodeType* destination);
135  using Superclass::ProcessNode;
136 
137 private:
138  VectorDataExtractROI(const Self&) = delete;
139  void operator=(const Self&) = delete;
140 
141  int CounterClockWise(PointType firstPoint, PointType secondPoint, PointType thirdPoint);
142  bool IsSegmentIntersectSegment(LinePointerType segmentLineAB, LinePointerType segmentLineCD);
143 
147 
148  unsigned int m_Kept;
149 };
150 
151 } // end namespace otb
152 
153 #ifndef OTB_MANUAL_INSTANTIATION
155 #endif
156 
157 #endif
otb::VectorDataExtractROI::DataNodeType
VectorDataType::DataNodeType DataNodeType
Definition: otbVectorDataExtractROI.h:71
otbRemoteSensingRegion.h
otb::VectorDataExtractROI::VertexListPointer
PolygonType::VertexListPointer VertexListPointer
Definition: otbVectorDataExtractROI.h:83
otb::VectorDataExtractROI::Self
VectorDataExtractROI Self
Definition: otbVectorDataExtractROI.h:58
otb::VectorDataExtractROI::InputTreeIteratorType
itk::PreOrderTreeIterator< typename VectorDataType::DataTreeType > InputTreeIteratorType
Definition: otbVectorDataExtractROI.h:92
otb::VectorDataExtractROI::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbVectorDataExtractROI.h:61
otb::VectorDataExtractROI::SetRegion
void SetRegion(const RegionType &region)
Definition: otbVectorDataExtractROI.h:97
otb::VectorDataExtractROI::m_ROI
RegionType m_ROI
Definition: otbVectorDataExtractROI.h:145
otb::VectorDataExtractROI::VertexListType
PolygonType::VertexListType VertexListType
Definition: otbVectorDataExtractROI.h:82
otbVectorDataToVectorDataFilter.h
otb::VectorDataExtractROI::RegionType
otb::RemoteSensingRegion< typename VertexType::CoordRepType > RegionType
Definition: otbVectorDataExtractROI.h:86
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::VectorDataExtractROI::Superclass
VectorDataToVectorDataFilter< TVectorData, TVectorData > Superclass
Definition: otbVectorDataExtractROI.h:59
otb::VectorDataExtractROI::InternalTreeNodeType
VectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType
Definition: otbVectorDataExtractROI.h:93
otb::VectorDataExtractROI::PolygonType
DataNodeType::PolygonType PolygonType
Definition: otbVectorDataExtractROI.h:75
otb::VectorDataToVectorDataFilter
Base class for filters that take an VectorData as input and produce an VectorData as output.
Definition: otbVectorDataToVectorDataFilter.h:43
otb::VectorDataExtractROI::m_ProjectionNeeded
bool m_ProjectionNeeded
Definition: otbVectorDataExtractROI.h:144
otb::VectorDataExtractROI::VectorDataType
TVectorData VectorDataType
Definition: otbVectorDataExtractROI.h:67
otb::VectorDataExtractROI::ProjPointType
itk::Point< typename VertexType::CoordRepType, IndexType::IndexDimension > ProjPointType
Definition: otbVectorDataExtractROI.h:90
otb::VectorDataExtractROI::SizeType
RegionType::SizeType SizeType
Definition: otbVectorDataExtractROI.h:88
otb::VectorDataExtractROI::DataNodePointerType
DataNodeType::Pointer DataNodePointerType
Definition: otbVectorDataExtractROI.h:72
otb::RemoteSensingRegion< typename VertexType::CoordRepType >::SizeType
itk::ContinuousIndex< Type > SizeType
Definition: otbRemoteSensingRegion.h:79
otb::VectorDataExtractROI::LineType
DataNodeType::LineType LineType
Definition: otbVectorDataExtractROI.h:76
otb::VectorDataExtractROI::ChildrenListType
InternalTreeNodeType::ChildrenListType ChildrenListType
Definition: otbVectorDataExtractROI.h:94
otb::VectorDataExtractROI
Extract a subset of a Vector Data based on location.
Definition: otbVectorDataExtractROI.h:54
otb::RemoteSensingRegion< typename VertexType::CoordRepType >
otb::VectorDataExtractROI::GetRegion
const RegionType & GetRegion()
Definition: otbVectorDataExtractROI.h:102
otb::VectorDataExtractROI::IndexType
RegionType::IndexType IndexType
Definition: otbVectorDataExtractROI.h:87
otb::RemoteSensingRegion< typename VertexType::CoordRepType >::IndexType
itk::ContinuousIndex< Type > IndexType
Definition: otbRemoteSensingRegion.h:75
otb::VectorDataExtractROI::DataTreeType
VectorDataType::DataTreeType DataTreeType
Definition: otbVectorDataExtractROI.h:73
otb::VectorDataExtractROI::m_Kept
unsigned int m_Kept
Definition: otbVectorDataExtractROI.h:148
otb::VectorDataExtractROI::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorDataExtractROI.h:60
otb::VectorDataExtractROI::PolygonPointerType
DataNodeType::PolygonPointerType PolygonPointerType
Definition: otbVectorDataExtractROI.h:74
otb::VectorDataExtractROI::VertexType
PolygonType::VertexType VertexType
Definition: otbVectorDataExtractROI.h:81
otb::VectorDataExtractROI::LinePointerType
DataNodeType::LinePointerType LinePointerType
Definition: otbVectorDataExtractROI.h:77
otb::VectorDataExtractROI::m_GeoROI
RegionType m_GeoROI
Definition: otbVectorDataExtractROI.h:146
otb::VectorDataExtractROI::PointType
DataNodeType::PointType PointType
Definition: otbVectorDataExtractROI.h:78
otbVectorDataExtractROI.hxx