QGIS API Documentation  2.15.0-Master (5f66276)
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 
30 class ANALYSIS_EXPORT QgsTransectSample
31 {
32  public:
33 
35  {
37  StrataUnits //units are the same as stratum layer
38  };
39 
40  QgsTransectSample( QgsVectorLayer* strataLayer, const QString& strataIdAttribute, const QString& minDistanceAttribute, const QString& nPointsAttribute,
41  DistanceUnits minDistUnits, QgsVectorLayer* baselineLayer, bool shareBaseline,
42  const QString& baselineStrataId, const QString& outputPointLayer, const QString& outputLineLayer, const QString& usedBaselineLayer, double minTransectLength = 0.0,
43  double baselineBufferDistance = -1.0, double baselineSimplificationTolerance = -1.0 );
44 
45  int createSample( QProgressDialog* pd );
46 
47  private:
48  QgsTransectSample(); //default constructor forbidden
49 
50  QgsGeometry* findBaselineGeometry( const QVariant& strataId );
51 
53  static bool otherTransectWithinDistance( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, const QMap< QgsFeatureId, QgsGeometry* >&
54  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( QgsGeometry& g1, QgsGeometry& g2, double& dist, QgsPoint& pt1, QgsPoint& pt2 );
87  static QgsGeometry* closestMultilineElement( const QgsPoint& pt, QgsGeometry* multiLine );
93  QgsGeometry* clipBufferLine( const QgsGeometry* stratumGeom, QgsGeometry* clippedBaseline, double tolerance );
94 
96  double bufferDistance( double minDistanceFromAttribute ) const;
97 };
98 
99 #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:117
General purpose distance and area calculator.
Represents a vector layer which manages a vector based data sets.