QGIS API Documentation  2.4.0-Chugiak
 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
static unsigned index
QgsVectorLayer * mInputLayer
Layer id of input polygon/multipolygon layer.
QString mMinDistanceAttribute
Attribute containing minimum distance between sample points (or -1 if no min.
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:113
Creates random points in polygons / multipolygons.
A class to represent a point geometry.
Definition: qgspoint.h:63
QgsFeatureId mNCreatedPoints
QString mOutputLayer
Output path of result layer.
qint64 QgsFeatureId
Definition: qgsfeature.h:30
Represents a vector layer which manages a vector based data sets.
QString mNumberOfPointsAttribute
Attribute containing number of points per feature.