QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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, QString nPointsAttribute, QString minDistAttribute = QString() );
19  ~QgsPointSample();
20 
23  int createRandomPoints( QProgressDialog* pd );
24 
25  private:
26 
27  QgsPointSample(); //default constructor is forbidden
28  void addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, int nPoints, double minDistance );
29  bool checkMinDistance( QgsPoint& pt, QgsSpatialIndex& index, double minDistance, QMap< QgsFeatureId, QgsPoint >& pointMap );
30 
34  QString mOutputLayer;
39  QgsFeatureId mNCreatedPoints; //helper to find free ids
40 };
41 
42 #endif // QGSPOINTSAMPLE_H