QGIS API Documentation  2.14.0-Essen
qgstransectsample.h
Go to the documentation of this file.
1 #ifndef QGSTRANSECTSAMPLE_H
2 #define QGSTRANSECTSAMPLE_H
3 
4 #include "qgsfeature.h"
5 #include <QMap>
6 #include <QString>
7 
8 class QgsDistanceArea;
9 class QgsGeometry;
10 class QgsSpatialIndex;
11 class QgsVectorLayer;
12 class QgsPoint;
13 class QProgressDialog;
14 
16 class ANALYSIS_EXPORT QgsTransectSample
17 {
18  public:
19 
21  {
23  StrataUnits //units are the same as stratum layer
24  };
25 
26  QgsTransectSample( QgsVectorLayer* strataLayer, const QString& strataIdAttribute, const QString& minDistanceAttribute, const QString& nPointsAttribute,
27  DistanceUnits minDistUnits, QgsVectorLayer* baselineLayer, bool shareBaseline,
28  const QString& baselineStrataId, const QString& outputPointLayer, const QString& outputLineLayer, const QString& usedBaselineLayer, double minTransectLength = 0.0,
29  double baselineBufferDistance = -1.0, double baselineSimplificationTolerance = -1.0 );
30 
31  int createSample( QProgressDialog* pd );
32 
33  private:
34  QgsTransectSample(); //default constructor forbidden
35 
36  QgsGeometry* findBaselineGeometry( const QVariant& strataId );
37 
39  static bool otherTransectWithinDistance( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, const QMap< QgsFeatureId, QgsGeometry* >&
40  lineFeatureMap, QgsDistanceArea& da );
41 
42  QgsVectorLayer* mStrataLayer;
43  QString mStrataIdAttribute;
44  QString mMinDistanceAttribute;
45  QString mNPointsAttribute;
46 
47  QgsVectorLayer* mBaselineLayer;
48  bool mShareBaseline;
49  QString mBaselineStrataId;
50 
51  QString mOutputPointLayer;
52  QString mOutputLineLayer;
53  QString mUsedBaselineLayer;
54 
55  DistanceUnits mMinDistanceUnits;
56 
57  double mMinTransectLength;
58 
60  double mBaselineBufferDistance;
62  double mBaselineSimplificationTolerance;
63 
71  static bool closestSegmentPoints( QgsGeometry& g1, QgsGeometry& g2, double& dist, QgsPoint& pt1, QgsPoint& pt2 );
73  static QgsGeometry* closestMultilineElement( const QgsPoint& pt, QgsGeometry* multiLine );
79  QgsGeometry* clipBufferLine( const QgsGeometry* stratumGeom, QgsGeometry* clippedBaseline, double tolerance );
80 
82  double bufferDistance( double minDistanceFromAttribute ) const;
83 };
84 
85 #endif // QGSTRANSECTSAMPLE_H
A class for the creation of transect sample lines based on a set of strata polygons and baselines...
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
A class to represent a point.
Definition: qgspoint.h:65
General purpose distance and area calculator.
Represents a vector layer which manages a vector based data sets.