OTB  6.7.0
Orfeo Toolbox
otbVectorDataExtractROI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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"
29 
30 namespace otb
31 {
32 
54 template <class TVectorData>
55 class ITK_EXPORT VectorDataExtractROI :
56  public VectorDataToVectorDataFilter<TVectorData, TVectorData>
57 {
58 public:
64 
66  itkNewMacro(Self);
67 
70 
72  typedef TVectorData VectorDataType;
73  typedef typename VectorDataType::DataNodeType DataNodeType;
74  typedef typename DataNodeType::Pointer DataNodePointerType;
75  typedef typename VectorDataType::DataTreeType DataTreeType;
76  typedef typename DataNodeType::PolygonPointerType PolygonPointerType;
77  typedef typename DataNodeType::PolygonType PolygonType;
78  typedef typename DataNodeType::LineType LineType;
79  typedef typename DataNodeType::LinePointerType LinePointerType;
81 
83  typedef typename PolygonType::VertexType VertexType;
84  typedef typename PolygonType::VertexListType VertexListType;
85  typedef typename PolygonType::VertexListPointer VertexListPointer;
86 
89  typedef typename RegionType::IndexType IndexType;
90  typedef typename RegionType::SizeType SizeType;
91 
93 
95  typedef typename VectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType;
96  typedef typename InternalTreeNodeType::ChildrenListType ChildrenListType;
97 
99  void SetRegion(const RegionType& region)
100  {
101  m_ROI = region;
102  }
103 
105  {return m_ROI; }
106 
107 protected:
109  ~VectorDataExtractROI() override {}
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(InternalTreeNodeType * source, InternalTreeNodeType * 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
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.
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:189
void SetRegion(const RegionType &region)