OTB  6.7.0
Orfeo Toolbox
otbVectorDataToRandomLineGenerator.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 otbVectorDataToRandomLineGenerator_h
22 #define otbVectorDataToRandomLineGenerator_h
23 
24 #include "otbVectorDataSource.h"
25 #include "otbVectorData.h"
28 #include <string>
29 
30 namespace otb
31 {
48 template <class TVectorData>
50  public VectorDataSource<TVectorData>
51 {
52 public:
58 
61 
63  itkNewMacro(Self);
64 
65  typedef TVectorData VectorDataType;
66  typedef typename VectorDataType::Pointer VectorDataPointerType;
67  typedef typename VectorDataType::DataNodeType DataNodeType;
68  typedef typename DataNodeType::PolygonType::RegionType RegionType;
70  typedef typename DataNodeType::LineType LineType;
71  typedef typename DataNodeType::LineType::VertexType VertexType;
72  typedef typename std::vector<PointType> PointVectorType;
73 
75 
77 
79  using Superclass::SetInput;
80  void SetInput(const VectorDataType *);
81  const VectorDataType * GetInput() const;
83 
84  itkGetConstMacro(NumberOfOutputLine, unsigned int);
85  itkSetMacro(NumberOfOutputLine, unsigned int);
86 
87  itkGetConstMacro(MinLineSize, unsigned int);
88  itkSetMacro(MinLineSize, unsigned int);
89 
90  itkGetConstMacro(MaxLineSize, unsigned int);
91  itkSetMacro(MaxLineSize, unsigned int);
92 
94  void SetSeed(unsigned int seed)
95  {
96  m_RandomGenerator->SetSeed(seed);
97  m_RandomSizeGenerator->SetSeed(seed);
98  }
100 
101 protected:
104  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
105 
107  void GenerateData(void) override;
108 
109  PointVectorType RandomPointsGenerator(DataNodeType * node);
110 
111 private:
112  VectorDataToRandomLineGenerator(const Self &) = delete;
113  void operator =(const Self&) = delete;
114 
115  std::string GetNextID()
116  {
117  std::ostringstream oss;
118  oss << m_CurrentID++;
119  return oss.str();
120  }
121 
124 
125  unsigned int m_NumberOfOutputLine;
126  unsigned int m_MinLineSize;
127  unsigned int m_MaxLineSize;
128  unsigned int m_CurrentID;
129 };
130 
131 } // end namespace otb
132 
133 #ifndef OTB_MANUAL_INSTANTIATION
135 #endif
136 
137 #endif
Filter hierarchy for generating VectorData.
Produces a VectorData Containing Random Lines.
DataNodeType::PolygonType::RegionType RegionType
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
itk::PreOrderTreeIterator< typename VectorDataType::DataTreeType > TreeIteratorType
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType