Пример #1
0
    def initAlgorithm(self, config=None):
        self.addParameter(QgsProcessingParameterMapLayer(self.INPUT, self.tr('Input layer')))

        round_to_parameter = QgsProcessingParameterDistance(self.ROUND_TO,
                                                            self.tr('Round values to'),
                                                            parentParameterName=self.INPUT,
                                                            minValue=0,
                                                            defaultValue=0)
        round_to_parameter.setFlags(round_to_parameter.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(round_to_parameter)

        self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Extent'), type=QgsProcessing.TypeVectorPolygon))
Пример #2
0
    def initAlgorithm(self, config):
        self.addParameter(
            QgsProcessingParameterFeatureSource(
                self.POINTS_INPUT, self.tr("Points Input"),
                [QgsProcessing.TypeVectorPoint]))

        # have to use QgsProcessingParameterFile to account for rasters too large to load in qgis
        self.addParameter(
            QgsProcessingParameterFile(self.RASTER_INPUT,
                                       self.tr("Raster File Input")))

        param = QgsProcessingParameterDistance(
            self.GRAB_RADIUS_INPUT,
            self.tr("Grab Radius"),
            parentParameterName=self.POINTS_INPUT,
            optional=True)
        param.setFlags(param.flags()
                       | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(param)

        param = QgsProcessingParameterNumber(
            self.GRAB_AREA_DISTANCE_WEIGHT_INPUT,
            self.tr("Grab Area Distance Weight"),
            type=QgsProcessingParameterNumber.Double,
            optional=True)
        param.setFlags(param.flags()
                       | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(param)

        param = QgsProcessingParameterFile(self.GRAB_FUNCTION_INPUT,
                                           self.tr("Grab Function"),
                                           optional=True)
        param.setFlags(param.flags()
                       | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(param)

        self.addParameter(
            QgsProcessingParameterFeatureSink(
                self.POINTS_WITH_VALUES_OUTPUT,
                self.tr("Points with Grabbed Values")))