QGIS API Documentation  2.17.0-Master (0497e4a)
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( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, const QMap< QgsFeatureId, QgsGeometry* >&
55  lineFeatureMap, QgsDistanceArea& da );
56 
57  QgsVectorLayer* mStrataLayer;
58  QString mStrataIdAttribute;
59  QString mMinDistanceAttribute;
60  QString mNPointsAttribute;
61 
62  QgsVectorLayer* mBaselineLayer;
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( QgsGeometry& g1, QgsGeometry& g2, double& dist, QgsPoint& pt1, QgsPoint& pt2 );
88  static QgsGeometry* closestMultilineElement( const QgsPoint& pt, QgsGeometry* multiLine );
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: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.