QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
32  QgsVectorLayer* mInputLayer;
34  QString mOutputLayer;
36  QString mNumberOfPointsAttribute;
38  QString mMinDistanceAttribute;
39  QgsFeatureId mNCreatedPoints; //helper to find free ids
40 };
41 
42 #endif // QGSPOINTSAMPLE_H
static unsigned index
Definition: mersenne-twister.cpp:36
A convenience class for writing vector files to disk.
Definition: qgsvectorfilewriter.h:42
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
Creates random points in polygons / multipolygons.
Definition: qgspointsample.h:15
A class to represent a point geometry.
Definition: qgspoint.h:63
Definition: qgsspatialindex.h:44
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:470