QGIS API Documentation  2.99.0-Master (37c43df)
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 
22 class QgsDistanceArea;
23 class QgsGeometry;
24 class QgsSpatialIndex;
25 class QgsVectorLayer;
26 class QgsPoint;
27 class QProgressDialog;
28 
31 class ANALYSIS_EXPORT QgsTransectSample
32 {
33  public:
34 
36  {
38  StrataUnits //units are the same as stratum layer
39  };
40 
41  QgsTransectSample( QgsVectorLayer* strataLayer, const QString& strataIdAttribute, const QString& minDistanceAttribute, const QString& nPointsAttribute,
42  DistanceUnits minDistUnits, QgsVectorLayer* baselineLayer, bool shareBaseline,
43  const QString& baselineStrataId, const QString& outputPointLayer, const QString& outputLineLayer, const QString& usedBaselineLayer, double minTransectLength = 0.0,
44  double baselineBufferDistance = -1.0, double baselineSimplificationTolerance = -1.0 );
45 
46  int createSample( QProgressDialog* pd );
47 
48  private:
49  QgsTransectSample(); //default constructor forbidden
50 
51  QgsGeometry findBaselineGeometry( const QVariant& strataId );
52 
54  static bool otherTransectWithinDistance( const QgsGeometry& geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, const QMap<QgsFeatureId, QgsGeometry>& lineFeatureMap, QgsDistanceArea& da );
55 
56  QgsVectorLayer* mStrataLayer;
57  QString mStrataIdAttribute;
58  QString mMinDistanceAttribute;
59  QString mNPointsAttribute;
60 
61  QgsVectorLayer* mBaselineLayer;
62  bool mShareBaseline;
63  QString mBaselineStrataId;
64 
65  QString mOutputPointLayer;
66  QString mOutputLineLayer;
67  QString mUsedBaselineLayer;
68 
69  DistanceUnits mMinDistanceUnits;
70 
71  double mMinTransectLength;
72 
74  double mBaselineBufferDistance;
76  double mBaselineSimplificationTolerance;
77 
85  static bool closestSegmentPoints( const QgsGeometry& g1, const QgsGeometry& g2, double& dist, QgsPoint& pt1, QgsPoint& pt2 );
87  static QgsGeometry closestMultilineElement( const QgsPoint& pt, const QgsGeometry& multiLine );
88 
94  QgsGeometry* clipBufferLine( const QgsGeometry& stratumGeom, QgsGeometry* clippedBaseline, double tolerance );
95 
97  double bufferDistance( double minDistanceFromAttribute ) const;
98 };
99 
100 #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:78
A class to represent a point.
Definition: qgspoint.h:111
General purpose distance and area calculator.
Represents a vector layer which manages a vector based data sets.