QGIS API Documentation  2.99.0-Master (9f5e33a)
qgstransectsample.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstransectsample.h
3  ---------------------
4  begin : July 2013
5  copyright : (C) 2013 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSTRANSECTSAMPLE_H
16 #define QGSTRANSECTSAMPLE_H
17 
18 #include "qgsfeature.h"
19 #include <QMap>
20 #include <QString>
21 #include "qgis_analysis.h"
22 
23 class QgsDistanceArea;
24 class QgsGeometry;
25 class QgsSpatialIndex;
26 class QgsVectorLayer;
27 class QgsPointXY;
28 class QProgressDialog;
29 
32 class ANALYSIS_EXPORT QgsTransectSample
33 {
34  public:
35 
37  {
39  StrataUnits //units are the same as stratum layer
40  };
41 
42  QgsTransectSample( QgsVectorLayer *strataLayer, const QString &strataIdAttribute, const QString &minDistanceAttribute, const QString &nPointsAttribute,
43  DistanceUnits minDistUnits, QgsVectorLayer *baselineLayer, bool shareBaseline,
44  const QString &baselineStrataId, const QString &outputPointLayer, const QString &outputLineLayer, const QString &usedBaselineLayer, double minTransectLength = 0.0,
45  double baselineBufferDistance = -1.0, double baselineSimplificationTolerance = -1.0 );
46 
47  int createSample( QProgressDialog *pd );
48 
49  private:
50  QgsTransectSample(); //default constructor forbidden
51 
52  QgsGeometry findBaselineGeometry( const QVariant &strataId );
53 
55  static bool otherTransectWithinDistance( const QgsGeometry &geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex &sIndex, const QMap<QgsFeatureId, QgsGeometry> &lineFeatureMap, QgsDistanceArea &da );
56 
57  QgsVectorLayer *mStrataLayer = nullptr;
58  QString mStrataIdAttribute;
59  QString mMinDistanceAttribute;
60  QString mNPointsAttribute;
61 
62  QgsVectorLayer *mBaselineLayer = nullptr;
63  bool mShareBaseline;
64  QString mBaselineStrataId;
65 
66  QString mOutputPointLayer;
67  QString mOutputLineLayer;
68  QString mUsedBaselineLayer;
69 
70  DistanceUnits mMinDistanceUnits;
71 
72  double mMinTransectLength;
73 
75  double mBaselineBufferDistance;
77  double mBaselineSimplificationTolerance;
78 
86  static bool closestSegmentPoints( const QgsGeometry &g1, const QgsGeometry &g2, double &dist, QgsPointXY &pt1, QgsPointXY &pt2 );
88  static QgsGeometry closestMultilineElement( const QgsPointXY &pt, const QgsGeometry &multiLine );
89 
95  QgsGeometry *clipBufferLine( const QgsGeometry &stratumGeom, QgsGeometry *clippedBaseline, double tolerance );
96 
98  double bufferDistance( double minDistanceFromAttribute ) const;
99 };
100 
101 #endif // QGSTRANSECTSAMPLE_H
A class for the creation of transect sample lines based on a set of strata polygons and baselines...
A class to represent a 2D point.
Definition: qgspointxy.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:96
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
Represents a vector layer which manages a vector based data sets.