OTB  7.2.0
Orfeo Toolbox
otbVectorDataExtractROI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 "otbDEMHandler.h"
27 #include "itkMacro.h"
28 #include "itkPreOrderTreeIterator.h"
29 
30 namespace otb
31 {
32 
54 template <class TVectorData>
55 class ITK_EXPORT VectorDataExtractROI : public VectorDataToVectorDataFilter<TVectorData, TVectorData>
56 {
57 public:
61  typedef itk::SmartPointer<Self> Pointer;
62  typedef itk::SmartPointer<const Self> ConstPointer;
63 
65  itkNewMacro(Self);
66 
69 
71  typedef TVectorData VectorDataType;
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;
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 itk::PreOrderTreeIterator<typename VectorDataType::DataTreeType> InputTreeIteratorType;
94  typedef typename VectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType;
95  typedef typename InternalTreeNodeType::ChildrenListType ChildrenListType;
96 
98  void SetRegion(const RegionType& region)
99  {
100  m_ROI = region;
101  }
102 
103  const RegionType& GetRegion()
104  {
105  return m_ROI;
106  }
107 
108 protected:
111  {
112  }
113  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
114 
116  virtual void CompareInputAndRegionProjection();
117 
119  virtual void ProjectRegionToInputVectorProjection();
120 
122  virtual RegionType ComputeVertexListBoundingRegion(typename VertexListType::ConstPointer vertexlist);
123 
125  virtual VertexType PointToContinuousIndex(ProjPointType point);
126 
128  void GenerateData(void) override;
129 
131  virtual bool IsPolygonIntersectionNotNull(PolygonPointerType polygon);
132 
134  virtual bool IsLineIntersectionNotNull(LinePointerType line);
135 
136  virtual void ProcessNode(InternalTreeNodeType* source, InternalTreeNodeType* destination);
137  using Superclass::ProcessNode;
138 
139 private:
140  VectorDataExtractROI(const Self&) = delete;
141  void operator=(const Self&) = delete;
142 
143  int CounterClockWise(PointType firstPoint, PointType secondPoint, PointType thirdPoint);
144  bool IsSegmentIntersectSegment(LinePointerType segmentLineAB, LinePointerType segmentLineCD);
145 
147  RegionType m_ROI;
148  RegionType m_GeoROI;
149 
150  unsigned int m_Kept;
151 };
152 
153 } // end namespace otb
154 
155 #ifndef OTB_MANUAL_INSTANTIATION
157 #endif
158 
159 #endif
RegionType::IndexType IndexType
PolygonType::VertexListPointer VertexListPointer
DataNodeType::PolygonPointerType PolygonPointerType
InternalTreeNodeType::ChildrenListType ChildrenListType
VectorDataType::DataTreeType DataTreeType
DataNodeType::PointType PointType
VectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType
DataNodeType::PolygonType PolygonType
PolygonType::VertexType VertexType
itk::Point< typename VertexType::CoordRepType, IndexType::IndexDimension > ProjPointType
otb::RemoteSensingRegion< typename VertexType::CoordRepType > RegionType
DataNodeType::Pointer DataNodePointerType
VectorDataType::DataNodeType DataNodeType
itk::PreOrderTreeIterator< typename VectorDataType::DataTreeType > InputTreeIteratorType
Extract a subset of a Vector Data based on location.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
PolygonType::VertexListType VertexListType
itk::SmartPointer< const Self > ConstPointer
Base class for filters that take an VectorData as input and produce an VectorData as output...
DataNodeType::LinePointerType LinePointerType
DataNodeType::LineType LineType
VectorDataToVectorDataFilter< TVectorData, TVectorData > Superclass
itk::SmartPointer< Self > Pointer
VectorImageType::PointType PointType
Definition: mvdTypes.h:183
void SetRegion(const RegionType &region)