Skip to content
Permalink
Browse files

Port code in QgsPointSample to 2.18

  • Loading branch information
mhugent committed May 20, 2017
1 parent cde1d78 commit 9e4114311682a0684025246f1b0c4d92d895a50b
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/analysis/vector/qgspointsample.cpp
  2. +1 −1 src/analysis/vector/qgspointsample.h
@@ -85,13 +85,13 @@ int QgsPointSample::createRandomPoints( QProgressDialog* pd )
{
minDistance = fet.attribute( mMinDistanceAttribute ).toDouble();
}
addSamplePoints( fet, writer, nPoints, minDistance );
addSamplePoints( fet, writer, outputFields, nPoints, minDistance );
}

return 0;
}

void QgsPointSample::addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, int nPoints, double minDistance )
void QgsPointSample::addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, const QgsFields& outputFields, int nPoints, double minDistance )
{
if ( !inputFeature.constGeometry() )
return;
@@ -122,7 +122,7 @@ void QgsPointSample::addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWri
if ( ptGeom->within( geom ) && checkMinDistance( randPoint, sIndex, minDistance, pointMapForFeature ) )
{
//add feature to writer
QgsFeature f( mNCreatedPoints );
QgsFeature f( outputFields, mNCreatedPoints );
f.setAttribute( "id", mNCreatedPoints + 1 );
f.setAttribute( "station_id", points + 1 );
f.setAttribute( "stratum_id", inputFeature.id() );
@@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsPointSample
private:

QgsPointSample(); //default constructor is forbidden
void addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, int nPoints, double minDistance );
void addSamplePoints( QgsFeature& inputFeature, QgsVectorFileWriter& writer, const QgsFields& outputFields, int nPoints, double minDistance );
bool checkMinDistance( QgsPoint& pt, QgsSpatialIndex& index, double minDistance, QMap< QgsFeatureId, QgsPoint >& pointMap );

/** Layer id of input polygon/multipolygon layer*/

0 comments on commit 9e41143

Please sign in to comment.
You can’t perform that action at this time.