Skip to content
Permalink
Browse files

[processing] Use distance parameter for Points Along Geometry offsets

and Topological Coloring distance parameters

Fixes #19712

(cherry picked from commit 304033c)
  • Loading branch information
nyalldawson committed Aug 27, 2018
1 parent 3606306 commit 9ca0e9d023319a5456ab26c81ca1731620480739
@@ -80,10 +80,10 @@ def initAlgorithm(self, config=None):
self.tr('Input layer'), [QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorLine]))
self.addParameter(QgsProcessingParameterDistance(self.DISTANCE,
self.tr('Distance'), parentParameterName=self.INPUT, minValue=0.0, defaultValue=1.0))
self.addParameter(QgsProcessingParameterNumber(self.START_OFFSET,
self.tr('Start offset'), type=QgsProcessingParameterNumber.Double, minValue=0.0, defaultValue=0.0))
self.addParameter(QgsProcessingParameterNumber(self.END_OFFSET,
self.tr('End offset'), type=QgsProcessingParameterNumber.Double, minValue=0.0, defaultValue=0.0))
self.addParameter(QgsProcessingParameterDistance(self.START_OFFSET,
self.tr('Start offset'), parentParameterName=self.INPUT, minValue=0.0, defaultValue=0.0))
self.addParameter(QgsProcessingParameterDistance(self.END_OFFSET,
self.tr('End offset'), parentParameterName=self.INPUT, minValue=0.0, defaultValue=0.0))

self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Points'), QgsProcessing.TypeVectorPoint))

@@ -35,7 +35,6 @@
QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterDistance,
QgsProcessingParameterNumber,
QgsProcessingParameterBoolean,
QgsProcessingParameterFeatureSink)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
@@ -36,7 +36,6 @@
QgsProcessingException,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterNumber,
QgsProcessingParameterFeatureSink)

from qgis.PyQt.QtCore import QVariant
@@ -33,7 +33,6 @@
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterNumber,
QgsProcessingParameterEnum)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
@@ -40,6 +40,7 @@
QgsProcessing,
QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterDistance,
QgsProcessingParameterNumber,
QgsProcessingParameterEnum,
QgsProcessingParameterFeatureSink)
@@ -73,12 +74,15 @@ def __init__(self):
def initAlgorithm(self, config=None):

self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'), [QgsProcessing.TypeVectorPolygon]))
self.tr('Input layer'),
[QgsProcessing.TypeVectorPolygon]))
self.addParameter(QgsProcessingParameterNumber(self.MIN_COLORS,
self.tr('Minimum number of colors'), minValue=1, maxValue=1000, defaultValue=4))
self.addParameter(QgsProcessingParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance between features'), type=QgsProcessingParameterNumber.Double,
minValue=0.0, maxValue=999999999.0, defaultValue=0.0))
self.tr('Minimum number of colors'), minValue=1, maxValue=1000,
defaultValue=4))
self.addParameter(QgsProcessingParameterDistance(self.MIN_DISTANCE,
self.tr('Minimum distance between features'),
parentParameterName=self.INPUT, minValue=0.0,
maxValue=999999999.0, defaultValue=0.0))
balance_by = [self.tr('By feature count'),
self.tr('By assigned area'),
self.tr('By distance between colors')]
@@ -87,7 +91,8 @@ def initAlgorithm(self, config=None):
self.tr('Balance color assignment'),
options=balance_by, defaultValue=0))

self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Colored'), QgsProcessing.TypeVectorPolygon))
self.addParameter(
QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Colored'), QgsProcessing.TypeVectorPolygon))

def name(self):
return 'topologicalcoloring'

0 comments on commit 9ca0e9d

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