Skip to content

Commit

Permalink
[feature][processing] Random points in polygons C++ algorithm
Browse files Browse the repository at this point in the history
Offers the same functionality as the Random points inside polygons
algorithm, and in addition it includes (possible to opt-out) the attributes
from the containing polygon and the ability to specify a seed for the random
number generator.

Could replace the Python algorithm Random points inside polygons, but
this C++ implementation only supports "Points count" ("number of points
for each feature") directly, while "Points density" is supported by allowing the
point count to be data defined (using the polygon area to calculate the
number of points).
  • Loading branch information
havatv authored Jul 1, 2020
1 parent 0ea4fe0 commit 2a786ae
Show file tree
Hide file tree
Showing 20 changed files with 1,680 additions and 10 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<file>themes/default/algorithms/mAlgorithmPolygonToLine.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomExponentialRaster.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomGammaRaster.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomPointsInPolygons.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomPointsOnLines.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomPointsWithinPolygon.svg</file>
<file>themes/default/algorithms/mAlgorithmRandomPointsWithinExtent.svg</file>
Expand Down
123 changes: 123 additions & 0 deletions images/themes/default/algorithms/mAlgorithmRandomPointsInPolygons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions python/plugins/processing/gui/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
'qgis:randomselectionwithinsubsets': researchToolsMenu,
'native:randompointsinextent': researchToolsMenu,
'qgis:randompointsinlayerbounds': researchToolsMenu,
'native:randompointsinpolygons': researchToolsMenu,
'qgis:randompointsinsidepolygons': researchToolsMenu,
'qgis:randompointsonlines': researchToolsMenu,

This comment has been minimized.

Copy link
@agiudiceandrea

agiudiceandrea Jul 18, 2020

Contributor

See #37872

This comment has been minimized.

Copy link
@havatv

havatv Jul 18, 2020

Author Contributor

Thanks.

'qgis:regularpoints': researchToolsMenu,
'native:selectbylocation': researchToolsMenu,
'native:polygonfromlayerextent': researchToolsMenu})
Expand Down
Loading

0 comments on commit 2a786ae

Please sign in to comment.