QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsPointSample Class Reference

Creates random points in polygons / multipolygons. More...

#include <qgspointsample.h>

Collaboration diagram for QgsPointSample:
Collaboration graph
[legend]

Public Member Functions

 QgsPointSample (QgsVectorLayer *inputLayer, const QString &outputLayer, QString nPointsAttribute, QString minDistAttribute=QString())
 ~QgsPointSample ()
int createRandomPoints (QProgressDialog *pd)
 Starts calculation of random points.

Private Member Functions

 QgsPointSample ()
void addSamplePoints (QgsFeature &inputFeature, QgsVectorFileWriter &writer, int nPoints, double minDistance)
bool checkMinDistance (QgsPoint &pt, QgsSpatialIndex &index, double minDistance, QMap< QgsFeatureId, QgsPoint > &pointMap)

Private Attributes

QgsVectorLayermInputLayer
 Layer id of input polygon/multipolygon layer.
QString mOutputLayer
 Output path of result layer.
QString mNumberOfPointsAttribute
 Attribute containing number of points per feature.
QString mMinDistanceAttribute
 Attribute containing minimum distance between sample points (or -1 if no min.
QgsFeatureId mNCreatedPoints

Detailed Description

Creates random points in polygons / multipolygons.

Definition at line 15 of file qgspointsample.h.

Constructor & Destructor Documentation

QgsPointSample::QgsPointSample ( QgsVectorLayer inputLayer,
const QString &  outputLayer,
QString  nPointsAttribute,
QString  minDistAttribute = QString() 
)

Definition at line 10 of file qgspointsample.cpp.

QgsPointSample::~QgsPointSample ( )

Definition at line 19 of file qgspointsample.cpp.

QgsPointSample::QgsPointSample ( )
private

Definition at line 15 of file qgspointsample.cpp.

Member Function Documentation

void QgsPointSample::addSamplePoints ( QgsFeature inputFeature,
QgsVectorFileWriter writer,
int  nPoints,
double  minDistance 
)
private
bool QgsPointSample::checkMinDistance ( QgsPoint pt,
QgsSpatialIndex index,
double  minDistance,
QMap< QgsFeatureId, QgsPoint > &  pointMap 
)
private

Definition at line 134 of file qgspointsample.cpp.

References QgsSpatialIndex::nearestNeighbor(), and QgsPoint::sqrDist().

Referenced by addSamplePoints().

int QgsPointSample::createRandomPoints ( QProgressDialog *  pd)

Member Data Documentation

QgsVectorLayer* QgsPointSample::mInputLayer
private

Layer id of input polygon/multipolygon layer.

Definition at line 32 of file qgspointsample.h.

Referenced by createRandomPoints().

QString QgsPointSample::mMinDistanceAttribute
private

Attribute containing minimum distance between sample points (or -1 if no min.

distance constraint)

Definition at line 38 of file qgspointsample.h.

Referenced by createRandomPoints().

QgsFeatureId QgsPointSample::mNCreatedPoints
private

Definition at line 39 of file qgspointsample.h.

Referenced by addSamplePoints(), and createRandomPoints().

QString QgsPointSample::mNumberOfPointsAttribute
private

Attribute containing number of points per feature.

Definition at line 36 of file qgspointsample.h.

Referenced by createRandomPoints().

QString QgsPointSample::mOutputLayer
private

Output path of result layer.

Definition at line 34 of file qgspointsample.h.

Referenced by createRandomPoints().


The documentation for this class was generated from the following files: