QGIS API Documentation  2.15.0-Master (94d88e6)
qgspointsample.h
Go to the documentation of this file.
1 #ifndef QGSPOINTSAMPLE_H
2 #define QGSPOINTSAMPLE_H
3 
4 #include "qgsfeature.h"
5 #include <QString>
6 
7 class QgsFeature;
8 class QgsPoint;
9 class QgsSpatialIndex;
11 class QgsVectorLayer;
12 class QProgressDialog;
13 
15 class ANALYSIS_EXPORT QgsPointSample
16 {
17  public:
18  QgsPointSample( QgsVectorLayer* inputLayer, const QString& outputLayer, const QString& nPointsAttribute, const QString& minDistAttribute = QString() );
19 
22  int createRandomPoints( QProgressDialog* pd );
23 
24  private:
25 
26  QgsPointSample(); //default constructor is forbidden
27  void addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, int nPoints, double minDistance );
28  bool checkMinDistance( QgsPoint& pt, QgsSpatialIndex& index, double minDistance, QMap< QgsFeatureId, QgsPoint >& pointMap );
29 
31  QgsVectorLayer* mInputLayer;
33  QString mOutputLayer;
35  QString mNumberOfPointsAttribute;
37  QString mMinDistanceAttribute;
38  QgsFeatureId mNCreatedPoints; //helper to find free ids
39 };
40 
41 #endif // QGSPOINTSAMPLE_H
static unsigned index
A convenience class for writing vector files to disk.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:187
Creates random points in polygons / multipolygons.
A class to represent a point.
Definition: qgspoint.h:117
qint64 QgsFeatureId
Definition: qgsfeature.h:31
Represents a vector layer which manages a vector based data sets.