Ejemplo n.º 1
0
    def initAlgorithm(self, config=None):
        self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
                                                              self.tr('Input point layer'), [QgsProcessing.TypeVectorPoint]))
        self.addParameter(QgsProcessingParameterField(self.ORDER_FIELD,
                                                      self.tr('Order field'), parentLayerParameterName=self.INPUT))
        self.addParameter(QgsProcessingParameterField(self.GROUP_FIELD,
                                                      self.tr('Group field'), parentLayerParameterName=self.INPUT, optional=True))
        self.addParameter(QgsProcessingParameterString(self.DATE_FORMAT,
                                                       self.tr('Date format (if order field is DateTime)'), optional=True))

        self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Paths'), QgsProcessing.TypeVectorLine))
        output_dir_param = QgsProcessingParameterFolderDestination(self.OUTPUT_TEXT_DIR, self.tr('Directory for text output'), optional=True)
        output_dir_param.setCreateByDefault(False)
        self.addParameter(output_dir_param)
Ejemplo n.º 2
0
Archivo: retile.py Proyecto: a17r/QGIS
    def initAlgorithm(self, config=None):
        self.methods = ((self.tr('Nearest neighbour'), 'near'),
                        (self.tr('Bilinear'), 'bilinear'),
                        (self.tr('Cubic'), 'cubic'),
                        (self.tr('Cubic spline'), 'cubicspline'),
                        (self.tr('Lanczos windowed sinc'), 'lanczos'),)

        self.addParameter(QgsProcessingParameterMultipleLayers(self.INPUT,
                                                               self.tr('Input files'),
                                                               QgsProcessing.TypeRaster))
        self.addParameter(QgsProcessingParameterNumber(self.TILE_SIZE_X,
                                                       self.tr('Tile width'),
                                                       type=QgsProcessingParameterNumber.Integer,
                                                       minValue=0,
                                                       defaultValue=256))
        self.addParameter(QgsProcessingParameterNumber(self.TILE_SIZE_Y,
                                                       self.tr('Tile height'),
                                                       type=QgsProcessingParameterNumber.Integer,
                                                       minValue=0,
                                                       defaultValue=256))
        self.addParameter(QgsProcessingParameterNumber(self.OVERLAP,
                                                       self.tr('Overlap in pixels between consecutive tiles'),
                                                       type=QgsProcessingParameterNumber.Integer,
                                                       minValue=0,
                                                       defaultValue=0))
        self.addParameter(QgsProcessingParameterNumber(self.LEVELS,
                                                       self.tr('Number of pyramids levels to build'),
                                                       type=QgsProcessingParameterNumber.Integer,
                                                       minValue=0,
                                                       defaultValue=1))

        params = []
        params.append(QgsProcessingParameterCrs(self.SOURCE_CRS,
                                                self.tr('Source coordinate reference system'),
                                                optional=True))
        params.append(QgsProcessingParameterEnum(self.RESAMPLING,
                                                 self.tr('Resampling method'),
                                                 options=[i[0] for i in self.methods],
                                                 allowMultiple=False,
                                                 defaultValue=0))
        params.append(QgsProcessingParameterString(self.DELIMITER,
                                                   self.tr('Column delimiter used in the CSV file'),
                                                   defaultValue=';',
                                                   optional=True))

        options_param = QgsProcessingParameterString(self.OPTIONS,
                                                     self.tr('Additional creation parameters'),
                                                     defaultValue='',
                                                     optional=True)
        options_param.setMetadata({
            'widget_wrapper': {
                'class': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}})
        params.append(options_param)

        params.append(QgsProcessingParameterEnum(self.DATA_TYPE,
                                                 self.tr('Output data type'),
                                                 self.TYPES,
                                                 allowMultiple=False,
                                                 defaultValue=5))

        params.append(QgsProcessingParameterBoolean(self.ONLY_PYRAMIDS,
                                                    self.tr('Build only the pyramids'),
                                                    defaultValue=False))
        params.append(QgsProcessingParameterBoolean(self.DIR_FOR_ROW,
                                                    self.tr('Use separate directory for each tiles row'),
                                                    defaultValue=False))

        for param in params:
            param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
            self.addParameter(param)

        self.addParameter(QgsProcessingParameterFolderDestination(self.OUTPUT,
                                                                  self.tr('Output directory')))

        output_csv_param = QgsProcessingParameterFileDestination(self.OUTPUT_CSV,
                                                                 self.tr('CSV file containing the tile(s) georeferencing information'),
                                                                 'CSV files (*.csv)',
                                                                 optional=True)
        output_csv_param.setCreateByDefault(False)
        self.addParameter(output_csv_param)
Ejemplo n.º 3
0
    def initAlgorithm(self, config=None):
        self.addParameter(ParameterGroup(self.GROUP, description='Grupo'))

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.FOLDER_OUTPUT, self.tr('Pasta destino treino')))
    def initAlgorithm(self, config):

        #super(MappiaPublisherAlgorithm, self).initAlgorithm()
        """
        Here we define the inputs and output of the algorithm, along
        with some other properties.
        """

        options = OptionsCfg.read()

        #self.addParameter(
        #    QgsProcessingParameterEnum(
        #        self.OPERATION,
        #        self.tr('Operation Type'),
        #        options=[self.tr(curOption) for curOption in OperationType.getOptions()],
        #        defaultValue=9
        #    )
        #)

        #TODO Implement layer attribute later.
        # self.addParameter(
        #     QgsProcessingParameterString(
        #         self.LAYER_ATTRIBUTE,
        #         self.tr('Layer style name (Change to different style names only if interested in publishing multiple (layers or attributes) of the same file.)'),
        #         optional=False,
        #         defaultValue=options['attrName']
        #     )
        # )

        self.addParameter(
            QgsProcessingParameterString(
                self.GITHUB_REPOSITORY,
                self.tr('Repository name (or map group name)'),
                optional=False,
                defaultValue=options['gh_repository']))

        # We add the input vector features source. It can have any kind of
        # geometry.
        layerParam = QgsProcessingParameterMultipleLayers(
            self.LAYERS,
            self.tr('Maps to display online'),
            QgsProcessing.TypeMapLayer,
            defaultValue=[
                layer.dataProvider().dataSourceUri(False)
                for layer in iface.mapCanvas().layers()
            ])
        layerParam.setMinimumNumberInputs(1)
        self.addParameter(layerParam)

        maxZoomParameter = QgsProcessingParameterNumber(
            self.ZOOM_MAX,
            self.tr('Map max Zoom level [1 ~ 13] (lower is faster)'),
            minValue=1,
            maxValue=13,
            defaultValue=options["zoom_max"])
        maxZoomParameter.setFlags(
            maxZoomParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(maxZoomParameter)

        gitExeParameter = QgsProcessingParameterString(
            self.GIT_EXECUTABLE,
            self.tr('Git client executable path.'),
            optional=True,
            defaultValue=self.getGitDefault(options))
        gitExeParameter.setFlags(
            gitExeParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(gitExeParameter)

        ghUserParameter = QgsProcessingParameterString(
            self.GITHUB_USER,
            self.tr('Github USERNAME (Credentials for https://github.com)'),
            optional=True,
            defaultValue=options['gh_user'])
        ghUserParameter.setFlags(
            ghUserParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(ghUserParameter)

        ghPassParameter = QgsProcessingParameterString(
            self.GITHUB_PASS,
            self.tr('Github Access Token'),
            optional=True,
            defaultValue=options['gh_pass'])
        ghPassParameter.setFlags(
            ghPassParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(ghPassParameter)

        outputDirParameter = QgsProcessingParameterFolderDestination(
            self.OUTPUT_DIRECTORY,
            self.tr('Output directory'),
            optional=True,
            defaultValue=options["folder"])
        outputDirParameter.setFlags(
            outputDirParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(outputDirParameter)
Ejemplo n.º 5
0
    def initAlgorithm(self, config):

        # Base contenant la table
        db_param = QgsProcessingParameterString(
            self.DATABASE, tr("Connexion à la base de données"))
        db_param.setMetadata({
            "widget_wrapper": {
                "class":
                "processing.gui.wrappers_postgis.ConnectionWidgetWrapper"
            }
        })
        db_param.tooltip_3liz = 'Nom de la connexion dans QGIS pour se connecter à la base de données'
        self.addParameter(db_param)

        # Schema contenant la table
        schema_param = QgsProcessingParameterString(self.SCHEMA, tr("Schéma"),
                                                    "veloroutes", False, False)
        schema_param.setMetadata({
            "widget_wrapper": {
                "class": "processing.gui.wrappers_postgis.SchemaWidgetWrapper",
                "connection_param": self.DATABASE
            }
        })
        schema_param.tooltip_3liz = 'Nom du schéma pour chercher les couches dans la base de données'
        self.addParameter(schema_param)

        # Table à exporter
        table_param = QgsProcessingParameterEnum(
            self.TABLE,
            tr("Donnée à exporter"),
            options=self.EXPORTABLES,
            defaultValue="",
        )
        table_param.tooltip_3liz = 'Nom de la table à exporter'
        self.addParameter(table_param)

        # Nom du département pour le fichier d'export
        depparam = QgsProcessingParameterString(
            self.DPT, tr("Département au format XXX"), '066', optional=False)
        depparam.tooltip_3liz = 'Pour le département de l\'Ain, mettre 001'
        self.addParameter(depparam)

        # Chemin du dossier de destination
        outparam = QgsProcessingParameterFolderDestination(
            self.PROJECTS_FOLDER, description=tr("Chemin de destination"))
        outparam.tooltip_3liz = 'Chemin de destination pour enregistrer les exports Shapefile'
        self.addParameter(outparam)

        param = QgsProcessingParameterBoolean(
            self.CHARGER,
            tr("Charger le fichier d'export dans le projet"),
            defaultValue=False,
            optional=False,
        )
        param.tooltip_3liz = 'Si le traitement doit charger la couche Shapefile dans le projet'
        self.addParameter(param)

        output = QgsProcessingOutputVectorLayer(self.OUTPUT,
                                                tr("Couches de sortie"))
        output.tooltip_3liz = 'Les couches de l\'export'
        self.addOutput(output)
Ejemplo n.º 6
0
 def initAlgorithm(self, config=None):
     self.addParameter(
         QgsProcessingParameterFolderDestination(
             self.OUTPUT_DATA_FOLDER, 'Folder to store converted data in'))
    def initAlgorithm(self, config=None):
        """
        Here we define the inputs and output of the algorithm, along
        with some other properties.
        """

        # We add the input vector features source. It can have any kind of
        # geometry.
        #self.addParameter(
        #    QgsProcessingParameterFeatureSource(
        #        self.INPUT,
        #        self.tr('Input'),
        #        [QgsProcessing.TypeVectorAnyGeometry]
        #    )
        #)
        
        #self.addParameter(
        #    QgsProcessingParameterString(
        #        self.IN_DATE_MIN,
        #        self.tr('Date minimale'))
        #    )
            
        #self.addParameter(
        #    QgsProcessingParameterString(
        #        self.IN_DATE_MAX,
        #        self.tr('Date maximale'))
        #    )
        
        datDeb = QgsProcessingParameterString(self.IN_DATE_MIN, 'Date minimale')
        datDeb.setMetadata({
            'widget_wrapper': {
                'class': DateWidget}})

        self.addParameter(datDeb)
        
        datFin = QgsProcessingParameterString(self.IN_DATE_MAX, 'Date maximale')
        datFin.setMetadata({
            'widget_wrapper': {
                'class': DateWidget}})

        self.addParameter(datFin)
        
        self.addParameter(
            QgsProcessingParameterExtent(
                self.IN_EXTENT,
                'Emprise du projet', 
                defaultValue=None))
        
        self.addParameter(
            QgsProcessingParameterEnum(
                self.IN_LEVEL,
                tr('Niveau de traitement'),
                options=[tr('LEVEL2A'), tr('LEVEL3A')],
                defaultValue=0,
                optional=False)
        )

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.OUTPUT,
                self.tr('Images S2')
            )
        )
        
        # We add a feature sink in which to store our processed features (this
        # usually takes the form of a newly created vector layer when the
        # algorithm is run in QGIS).
        
        #self.addParameter(
        #    QgsProcessingParameterFeatureSink(
        #        self.OUTPUT,
        #        self.tr('Output layer')
        #    )
        #)
        
        params = []
        params.append(QgsProcessingParameterString(self.IN_ID,
                                                   self.tr('Utilisateur'),
                                                   optional=False))
        params.append(QgsProcessingParameterString(self.IN_PW,
                                                   self.tr('Mot de passe'),
                                                   optional=False))
                                                   
                                                   
        params.append(QgsProcessingParameterBoolean(self.IN_SAVE_PW,
                                                    description="garder en mémoire",
                                                    optional=True,
                                                    defaultValue=False))
                                                   
        for p in params:
            p.setFlags(p.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
            self.addParameter(p)
Ejemplo n.º 8
0
    def initAlgorithm(self, config=None):
        self.modes = ((self.tr("Keep both when possible"),
                       "keepall"), (self.tr("Remove source"), "rmvsrc"),
                      (self.tr("Remove ground"),
                       "rmvgnd"), (self.tr("Remove both"), "rmvall"))

        self.addParameter(
            QgsProcessingParameterRasterLayer(
                self.RESISTANCE_MAP, self.tr("Raster resistance map")))
        self.addParameter(
            QgsProcessingParameterBoolean(
                self.IS_CONDUCTANCES,
                self.tr("Data represent conductances instead of resistances"),
                False))
        self.addParameter(
            QgsProcessingParameterRasterLayer(self.CURRENT_SOURCE,
                                              self.tr("Current source")))
        self.addParameter(
            QgsProcessingParameterRasterLayer(self.GROUND_POINT,
                                              self.tr("Ground point")))
        self.addParameter(
            QgsProcessingParameterBoolean(
                self.GP_CONDUCTANCES,
                self.
                tr("Data represent conductances instead of resistances to ground"
                   ), False))
        self.addParameter(
            QgsProcessingParameterEnum(
                self.MODE,
                self.tr("When a source and ground are at the same node"),
                options=[i[0] for i in self.modes],
                allowMultiple=False,
                defaultValue=0))
        self.addParameter(
            QgsProcessingParameterBoolean(
                self.UNIT_CURRENTS,
                self.tr("Use unit currents (i = 1) for all current sources"),
                False))
        self.addParameter(
            QgsProcessingParameterBoolean(
                self.DIRECT_CONNECTIONS,
                self.
                tr("Use direct connections to ground (R = 0) for all ground points"
                   ), False))
        self.addParameter(
            QgsProcessingParameterBoolean(self.WRITE_CURRENT_MAP,
                                          self.tr("Create current map"), True))
        self.addParameter(
            QgsProcessingParameterBoolean(self.WRITE_VOLTAGE_MAP,
                                          self.tr("Create voltage map"), True))
        self.addParameter(
            QgsProcessingParameterRasterLayer(self.MASK,
                                              self.tr("Mask raster"),
                                              optional=True))
        self.addParameter(
            QgsProcessingParameterRasterLayer(self.SHORT_CIRCUIT,
                                              self.tr("Short-circuit region"),
                                              optional=True))
        self.addParameter(
            QgsProcessingParameterString(self.BASENAME,
                                         self.tr("Output basename"),
                                         "csoutput"))

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.DIRECTORY, self.tr("Output directory")))
    def initAlgorithm(self, config):
        print('initAlgorithm()')

        #super(MappiaPublisherAlgorithm, self).initAlgorithm()
        """
        Here we define the inputs and output of the algorithm, along
        with some other properties.
        """

        options = OptionsCfg.read()

        self.last_update_date = options[OptionsCfg.UPDATE_CHECK]

        #self.addParameter(
        #    QgsProcessingParameterEnum(
        #        self.OPERATION,
        #        self.tr('Operation Type'),
        #        options=[self.tr(curOption) for curOption in OperationType.getOptions()],
        #        defaultValue=9
        #    )
        #)

        #TODO Implement layer attribute later.
        # self.addParameter(
        #     QgsProcessingParameterString(
        #         self.LAYER_ATTRIBUTE,
        #         self.tr('Layer style name (Change to different style names only if interested in publishing multiple (layers or attributes) of the same file.)'),
        #         optional=False,
        #         defaultValue=options['attrName']
        #     )
        # )

        self.addParameter(
            QgsProcessingParameterString(
                self.GITHUB_REPOSITORY,
                self.tr('* Repository name (or map group name)'),
                optional=False,
                defaultValue=options['gh_repository']))

        # We add the input vector features source. It can have any kind of
        # geometry.
        layerParam = QgsProcessingParameterMultipleLayers(
            self.LAYERS, self.tr('* Maps to display online'),
            QgsProcessing.TypeMapLayer
            #, defaultValue=[layer.id() for layer in iface.mapCanvas().layers()]#[layer.dataProvider().dataSourceUri(False) for layer in iface.mapCanvas().layers()]
        )
        layerParam.setMinimumNumberInputs(1)
        self.addParameter(layerParam)
        self.m_layerParam = layerParam

        maxZoomParameter = QgsProcessingParameterNumber(
            self.ZOOM_MAX,
            self.tr('Map max Zoom level [1 ~ 13] (lower is faster)'),
            minValue=1,
            maxValue=13,
            defaultValue=options["zoom_max"])
        maxZoomParameter.setFlags(
            maxZoomParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(maxZoomParameter)

        includeSourceDownload = QgsProcessingParameterBoolean(
            self.INCLUDE_DOWNLOAD,
            self.tr(
                'Upload maps for further download (2GB limit per unique map)'),
            defaultValue=options['include_dl'])
        includeSourceDownload.setFlags(
            includeSourceDownload.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(includeSourceDownload)

        gitExeParameter = QgsProcessingParameterString(
            self.GIT_EXECUTABLE,
            self.tr('Git client executable path.'),
            optional=True,
            defaultValue=UTILS.getGitDefault(options['git_exe']))
        gitExeParameter.setFlags(
            gitExeParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(gitExeParameter)

        ghUserParameter = QgsProcessingParameterString(
            self.GITHUB_USER,
            self.tr('Github USERNAME (Credentials for https://github.com)'),
            optional=True,
            defaultValue=options['gh_user'])
        ghUserParameter.setFlags(
            ghUserParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(ghUserParameter)

        # ghPassParameter = QgsProcessingParameterString(
        #     self.GITHUB_PASS,
        #     self.tr('Github Access Token *'),
        #     optional=True,
        #     defaultValue=options['gh_pass']
        # )
        # ghPassParameter.setFlags(ghPassParameter.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
        # self.addParameter(ghPassParameter)

        askUserConfirmation = QgsProcessingParameterBoolean(
            self.ASK_USER,
            self.tr('Ask user confirmation before each step.'),
            defaultValue=options['ask_user'])
        askUserConfirmation.setFlags(
            askUserConfirmation.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(askUserConfirmation)

        outputDirParameter = QgsProcessingParameterFolderDestination(
            self.OUTPUT_DIRECTORY,
            self.tr('Output directory'),
            optional=True,
            defaultValue=options["folder"] or None)
        outputDirParameter.setFlags(
            outputDirParameter.flags()
            | QgsProcessingParameterDefinition.FlagAdvanced)
        self.addParameter(outputDirParameter)
Ejemplo n.º 10
0
 def addParametersTemporaryDirectoryGUI(self):
     self.addParameter(
         QgsProcessingParameterFolderDestination(
             LAStoolsAlgorithm.TEMPORARY_DIRECTORY,
             "temporary directory (must be empty!!!)", None, False))
Ejemplo n.º 11
0
 def addParametersOutputDirectoryGUI(self):
     self.addParameter(
         QgsProcessingParameterFolderDestination(
             LAStoolsAlgorithm.OUTPUT_DIRECTORY, "output directory", None,
             True))
Ejemplo n.º 12
0
    def initAlgorithm(self, config=None):

        # The name that the user will see in the toolbox

        self.addParameter(
            QgsProcessingParameterRasterLayer(self.INPUT_RASTER,
                                              self.tr('Input raster')))

        # Train algorithm

        self.addParameter(
            QgsProcessingParameterEnum(self.TRAIN, "Select algorithm to train",
                                       self.TRAIN_ALGORITHMS, 0))

        # ROI
        # VECTOR
        self.addParameter(
            QgsProcessingParameterVectorLayer(
                self.INPUT_LAYER,
                'Input layer',
            ))
        # TABLE / COLUMN
        self.addParameter(
            QgsProcessingParameterField(
                self.INPUT_COLUMN,
                'Field (column must have classification number (e.g. \'1\' forest, \'2\' water...))',
                parentLayerParameterName=self.INPUT_LAYER,
                optional=False))  # save model

        # DISTANCE
        self.addParameter(
            QgsProcessingParameterNumber(
                self.DISTANCE,
                self.tr('Distance in pixels'),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                maxValue=99999,
                defaultValue=100))

        # MAX ITER
        self.addParameter(
            QgsProcessingParameterNumber(
                self.MAXITER,
                self.
                tr('Maximum iteration (default : 0 e.g. class with min effective)'
                   ),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                maxValue=99999,
                defaultValue=0))
        #
        self.addParameter(
            QgsProcessingParameterString(
                self.PARAMGRID,
                self.tr('Parameters for the hyperparameters of the algorithm'),
                optional=True))
        # SAVE AS
        # SAVE MODEL
        self.addParameter(
            QgsProcessingParameterFileDestination(
                self.OUTPUT_MODEL,
                self.tr("Output model (to use for classifying)")))
        """
        # SAVE CONFUSION MATRIX
        self.addParameter(
        QgsProcessingParameterFileDestination(
            self.OUTPUT_MATRIX,
            self.tr("Output confusion matrix"),
            fileFilter='csv'))#,
            #ext='csv'))
        """
        # SAVE DIR
        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.SAVEDIR,
                self.tr("Directory to save every confusion matrix")))
Ejemplo n.º 13
0
    def accept(self):
        description = self.nameTextBox.text()
        if description.strip() == '':
            QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                self.tr('Invalid parameter name'))
            return
        if self.param is None:
            validChars = \
                'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
            safeName = ''.join(c for c in description if c in validChars)
            name = safeName.lower()
            i = 2
            while self.alg.parameterDefinition(name):
                name = safeName.lower() + str(i)
                i += 1
        else:
            name = self.param.name()

        # Destination parameter
        if (isinstance(self.param, QgsProcessingParameterFeatureSink)):
            self.param = QgsProcessingParameterFeatureSink(
                name=name,
                description=self.param.description(),
                type=self.param.dataType(),
                defaultValue=self.defaultWidget.value())
        elif (isinstance(self.param, QgsProcessingParameterFileDestination)):
            self.param = QgsProcessingParameterFileDestination(
                name=name,
                description=self.param.description(),
                fileFilter=self.param.fileFilter(),
                defaultValue=self.defaultWidget.value())
        elif (isinstance(self.param, QgsProcessingParameterFolderDestination)):
            self.param = QgsProcessingParameterFolderDestination(
                name=name,
                description=self.param.description(),
                defaultValue=self.defaultWidget.value())
        elif (isinstance(self.param, QgsProcessingParameterRasterDestination)):
            self.param = QgsProcessingParameterRasterDestination(
                name=name,
                description=self.param.description(),
                defaultValue=self.defaultWidget.value())
        elif (isinstance(self.param, QgsProcessingParameterVectorDestination)):
            self.param = QgsProcessingParameterVectorDestination(
                name=name,
                description=self.param.description(),
                type=self.param.dataType(),
                defaultValue=self.defaultWidget.value())

        else:
            if self.paramType:
                typeId = self.paramType
            else:
                typeId = self.param.type()

            paramTypeDef = QgsApplication.instance().processingRegistry(
            ).parameterType(typeId)
            if not paramTypeDef:
                msg = self.tr(
                    'The parameter `{}` is not registered, are you missing a required plugin?'
                    .format(typeId))
                raise UndefinedParameterException(msg)
            self.param = paramTypeDef.create(name)
            self.param.setDescription(description)
            self.param.setMetadata(paramTypeDef.metadata())

        if not self.requiredCheck.isChecked():
            self.param.setFlags(
                self.param.flags()
                | QgsProcessingParameterDefinition.FlagOptional)
        else:
            self.param.setFlags(
                self.param.flags()
                & ~QgsProcessingParameterDefinition.FlagOptional)

        if self.advancedCheck.isChecked():
            self.param.setFlags(
                self.param.flags()
                | QgsProcessingParameterDefinition.FlagAdvanced)
        else:
            self.param.setFlags(
                self.param.flags()
                & ~QgsProcessingParameterDefinition.FlagAdvanced)

        settings = QgsSettings()
        settings.setValue(
            "/Processing/modelParametersDefinitionDialogGeometry",
            self.saveGeometry())

        QDialog.accept(self)
Ejemplo n.º 14
0
    def initAlgorithm(self, config):

        label = tr("Connexion à la base de données")
        tooltip = 'Nom de la connexion dans QGIS pour se connecter à la base de données'
        if Qgis.QGIS_VERSION_INT >= 31400:
            param = QgsProcessingParameterProviderConnection(
                self.DATABASE,
                label,
                "postgres",
                optional=False,
            )
        else:
            param = QgsProcessingParameterString(self.DATABASE, label)
            param.setMetadata(
                {
                    "widget_wrapper": {
                        "class": "processing.gui.wrappers_postgis.ConnectionWidgetWrapper"
                    }
                }
            )
        if Qgis.QGIS_VERSION_INT >= 31600:
            param.setHelp(tooltip)
        else:
            param.tooltip_3liz = tooltip
        self.addParameter(param)

        # Schema de destination
        label = tr("Schéma")
        tooltip = 'Nom du schéma où importer les données'
        default = 'veloroutes'
        if Qgis.QGIS_VERSION_INT >= 31400:
            param = QgsProcessingParameterDatabaseSchema(
                self.SCHEMA,
                label,
                self.DATABASE,
                defaultValue=default,
                optional=False,
            )
        else:
            param = QgsProcessingParameterString(self.SCHEMA, label, default, False, True)
            param.setMetadata(
                {
                    "widget_wrapper": {
                        "class": "processing.gui.wrappers_postgis.SchemaWidgetWrapper",
                        "connection_param": self.DATABASE,
                    }
                }
            )
        if Qgis.QGIS_VERSION_INT >= 31600:
            param.setHelp(tooltip)
        else:
            param.tooltip_3liz = tooltip
        self.addParameter(param)

        # Table à exporter
        table_param = QgsProcessingParameterEnum(
            self.TABLE,
            tr("Donnée à exporter"),
            options=self.EXPORTABLES,
            defaultValue="",
        )
        table_param.tooltip_3liz = 'Nom de la table à exporter'
        self.addParameter(table_param)

        # Nom du département pour le fichier d'export
        depparam = QgsProcessingParameterString(
            self.DPT,
            tr("Département au format XXX"),
            '066',
            optional=False
        )
        depparam.tooltip_3liz = 'Pour le département de l\'Ain, mettre 001'
        self.addParameter(depparam)

        # Chemin du dossier de destination
        outparam = QgsProcessingParameterFolderDestination(
            self.PROJECTS_FOLDER,
            description=tr("Chemin de destination")
        )
        outparam.tooltip_3liz = 'Chemin de destination pour enregistrer les exports Shapefile'
        self.addParameter(outparam)

        param = QgsProcessingParameterBoolean(
            self.CHARGER,
            tr("Charger le fichier d'export dans le projet"),
            defaultValue=False,
            optional=False,
        )
        param.tooltip_3liz = 'Si le traitement doit charger la couche Shapefile dans le projet'
        self.addParameter(param)

        output = QgsProcessingOutputVectorLayer(self.OUTPUT, tr("Couches de sortie"))
        output.tooltip_3liz = 'Les couches de l\'export'
        self.addOutput(output)
Ejemplo n.º 15
0
    def initAlgorithm(self, config=None):
        self.profiles = ((self.tr('Mercator'), 'mercator'),
                         (self.tr('Geodetic'), 'geodetic'),
                         (self.tr('Raster'), 'raster'))

        self.methods = ((self.tr('Average'), 'average'),
                        (self.tr('Nearest neighbour'), 'near'),
                        (self.tr('Bilinear'), 'bilinear'),
                        (self.tr('Cubic'), 'cubic'),
                        (self.tr('Cubic spline'), 'cubicspline'),
                        (self.tr('Lanczos windowed sinc'), 'lanczos'),
                        (self.tr('Antialias'), 'antialias'))

        self.viewers = ((self.tr('All'), 'all'),
                        (self.tr('GoogleMaps'), 'google'),
                        (self.tr('OpenLayers'), 'openlayers'),
                        (self.tr('Leaflet'), 'leaflet'),
                        (self.tr('None'), 'none'))

        self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
        self.addParameter(QgsProcessingParameterEnum(self.PROFILE,
                                                     self.tr('Tile cutting profile'),
                                                     options=[i[0] for i in self.profiles],
                                                     allowMultiple=False,
                                                     defaultValue=0))
        self.addParameter(QgsProcessingParameterString(self.ZOOM,
                                                       self.tr('Zoom levels to render'),
                                                       defaultValue='',
                                                       optional=True))
        self.addParameter(QgsProcessingParameterEnum(self.VIEWER,
                                                     self.tr('Web viewer to generate'),
                                                     options=[i[0] for i in self.viewers],
                                                     allowMultiple=False,
                                                     defaultValue=0))
        self.addParameter(QgsProcessingParameterString(self.TITLE,
                                                       self.tr('Title of the map'),
                                                       optional=True))
        self.addParameter(QgsProcessingParameterString(self.COPYRIGHT,
                                                       self.tr('Copyright of the map'),
                                                       optional=True))

        params = []
        params.append(QgsProcessingParameterEnum(self.RESAMPLING,
                                                 self.tr('Resampling method'),
                                                 options=[i[0] for i in self.methods],
                                                 allowMultiple=False,
                                                 defaultValue=0))
        params.append(QgsProcessingParameterCrs(self.SOURCE_CRS,
                                                self.tr('The spatial reference system used for the source input data'),
                                                optional=True))
        params.append(QgsProcessingParameterNumber(self.NODATA,
                                                   self.tr('Transparency value to assign to the input data'),
                                                   type=QgsProcessingParameterNumber.Double,
                                                   defaultValue=0,
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.URL,
                                                   self.tr('URL address where the generated tiles are going to be published'),
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.GOOGLE_KEY,
                                                   self.tr('Google Maps API key (http://code.google.com/apis/maps/signup.html)'),
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.BING_KEY,
                                                   self.tr('Bing Maps API key (https://www.bingmapsportal.com/)'),
                                                   optional=True))
        params.append(QgsProcessingParameterBoolean(self.RESUME,
                                                    self.tr('Generate only missing files'),
                                                    defaultValue=False))
        params.append(QgsProcessingParameterBoolean(self.KML,
                                                    self.tr('Generate KML for Google Earth'),
                                                    defaultValue=False))
        params.append(QgsProcessingParameterBoolean(self.NO_KML,
                                                    self.tr('Avoid automatic generation of KML files for EPSG:4326'),
                                                    defaultValue=False))
        for param in params:
            param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
            self.addParameter(param)

        self.addParameter(QgsProcessingParameterFolderDestination(self.OUTPUT,
                                                                  self.tr('Output directory')))
Ejemplo n.º 16
0
    def accept(self):
        description = self.nameTextBox.text()
        if description.strip() == '':
            QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                self.tr('Invalid parameter name'))
            return
        if self.param is None:
            validChars = \
                'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
            safeName = ''.join(c for c in description if c in validChars)
            name = safeName.lower()
            i = 2
            while self.alg.parameterDefinition(name):
                name = safeName.lower() + str(i)
                i += 1
        else:
            name = self.param.name()
        if (self.paramType == parameters.PARAMETER_BOOLEAN or
                isinstance(self.param, QgsProcessingParameterBoolean)):
            self.param = QgsProcessingParameterBoolean(name, description, self.state.isChecked())
        elif (self.paramType == parameters.PARAMETER_TABLE_FIELD or
              isinstance(self.param, QgsProcessingParameterField)):
            if self.parentCombo.currentIndex() < 0:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return
            parent = self.parentCombo.currentData()
            datatype = self.datatypeCombo.currentData()
            default = self.defaultTextBox.text()
            if not default:
                default = None
            self.param = QgsProcessingParameterField(name, description, defaultValue=default,
                                                     parentLayerParameterName=parent, type=datatype,
                                                     allowMultiple=self.multipleCheck.isChecked())
        elif (self.paramType == parameters.PARAMETER_BAND or
              isinstance(self.param, QgsProcessingParameterBand)):
            if self.parentCombo.currentIndex() < 0:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return
            parent = self.parentCombo.currentData()
            self.param = QgsProcessingParameterBand(name, description, None, parent)
        elif (self.paramType == parameters.PARAMETER_LAYOUTITEM or
              isinstance(self.param, QgsProcessingParameterLayoutItem)):
            if self.parentCombo.currentIndex() < 0:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return
            parent = self.parentCombo.currentData()
            self.param = QgsProcessingParameterLayoutItem(name, description, None, parent)
        elif (self.paramType == parameters.PARAMETER_MAP_LAYER or
              isinstance(self.param, QgsProcessingParameterMapLayer)):
            self.param = QgsProcessingParameterMapLayer(
                name, description)
        elif (self.paramType == parameters.PARAMETER_RASTER or
              isinstance(self.param, QgsProcessingParameterRasterLayer)):
            self.param = QgsProcessingParameterRasterLayer(
                name, description)
        elif (self.paramType == parameters.PARAMETER_TABLE or
              isinstance(self.param, QgsProcessingParameterVectorLayer)):
            self.param = QgsProcessingParameterVectorLayer(
                name, description,
                [self.shapetypeCombo.currentData()])
        elif (self.paramType == parameters.PARAMETER_VECTOR or
              isinstance(self.param, QgsProcessingParameterFeatureSource)):
            self.param = QgsProcessingParameterFeatureSource(
                name, description,
                [self.shapetypeCombo.currentData()])
        elif (self.paramType == parameters.PARAMETER_MULTIPLE or
              isinstance(self.param, QgsProcessingParameterMultipleLayers)):
            self.param = QgsProcessingParameterMultipleLayers(
                name, description,
                self.datatypeCombo.currentData())
        elif (self.paramType == parameters.PARAMETER_DISTANCE or
              isinstance(self.param, QgsProcessingParameterDistance)):
            self.param = QgsProcessingParameterDistance(name, description,
                                                        self.defaultTextBox.text())
            try:
                vmin = self.minTextBox.text().strip()
                if not vmin == '':
                    self.param.setMinimum(float(vmin))
                vmax = self.maxTextBox.text().strip()
                if not vmax == '':
                    self.param.setMaximum(float(vmax))
            except:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return

            if self.parentCombo.currentIndex() < 0:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return
            parent = self.parentCombo.currentData()
            if parent:
                self.param.setParentParameterName(parent)
        elif (self.paramType == parameters.PARAMETER_SCALE or
              isinstance(self.param, QgsProcessingParameterScale)):
            self.param = QgsProcessingParameterScale(name, description,
                                                     self.defaultTextBox.text())
        elif (self.paramType == parameters.PARAMETER_NUMBER or
              isinstance(self.param, QgsProcessingParameterNumber)):

            type = self.type_combo.currentData()
            self.param = QgsProcessingParameterNumber(name, description, type,
                                                      self.defaultTextBox.text())
            try:
                vmin = self.minTextBox.text().strip()
                if not vmin == '':
                    self.param.setMinimum(float(vmin))
                vmax = self.maxTextBox.text().strip()
                if not vmax == '':
                    self.param.setMaximum(float(vmax))
            except:
                QMessageBox.warning(self, self.tr('Unable to define parameter'),
                                    self.tr('Wrong or missing parameter values'))
                return
        elif (self.paramType == parameters.PARAMETER_EXPRESSION or
              isinstance(self.param, QgsProcessingParameterExpression)):
            parent = self.parentCombo.currentData()
            self.param = QgsProcessingParameterExpression(name, description,
                                                          str(self.defaultEdit.expression()),
                                                          parent)
        elif (self.paramType == parameters.PARAMETER_STRING or
              isinstance(self.param, QgsProcessingParameterString)):
            self.param = QgsProcessingParameterString(name, description,
                                                      str(self.defaultTextBox.text()))
        elif (self.paramType == parameters.PARAMETER_EXTENT or
              isinstance(self.param, QgsProcessingParameterExtent)):
            self.param = QgsProcessingParameterExtent(name, description)
        elif (self.paramType == parameters.PARAMETER_FILE or
              isinstance(self.param, QgsProcessingParameterFile)):
            isFolder = self.fileFolderCombo.currentIndex() == 1
            self.param = QgsProcessingParameterFile(name, description,
                                                    QgsProcessingParameterFile.Folder if isFolder else QgsProcessingParameterFile.File)
        elif (self.paramType == parameters.PARAMETER_POINT or
              isinstance(self.param, QgsProcessingParameterPoint)):
            self.param = QgsProcessingParameterPoint(name, description,
                                                     str(self.defaultTextBox.text()))
        elif (self.paramType == parameters.PARAMETER_CRS or
              isinstance(self.param, QgsProcessingParameterCrs)):
            self.param = QgsProcessingParameterCrs(name, description, self.selector.crs().authid())
        elif (self.paramType == parameters.PARAMETER_ENUM or
                isinstance(self.param, QgsProcessingParameterEnum)):
            self.param = QgsProcessingParameterEnum(name, description, self.widget.options(), self.widget.allowMultiple(), self.widget.defaultOptions())
        elif (self.paramType == parameters.PARAMETER_MATRIX or
                isinstance(self.param, QgsProcessingParameterMatrix)):
            self.param = QgsProcessingParameterMatrix(name, description, hasFixedNumberRows=self.widget.fixedRows(), headers=self.widget.headers(), defaultValue=self.widget.value())

        # Destination parameter
        elif (isinstance(self.param, QgsProcessingParameterFeatureSink)):
            self.param = QgsProcessingParameterFeatureSink(
                name=name,
                description=self.param.description(),
                type=self.param.dataType(),
                defaultValue=self.defaultWidget.getValue())
        elif (isinstance(self.param, QgsProcessingParameterFileDestination)):
            self.param = QgsProcessingParameterFileDestination(
                name=name,
                description=self.param.description(),
                fileFilter=self.param.fileFilter(),
                defaultValue=self.defaultWidget.getValue())
        elif (isinstance(self.param, QgsProcessingParameterFolderDestination)):
            self.param = QgsProcessingParameterFolderDestination(
                name=name,
                description=self.param.description(),
                defaultValue=self.defaultWidget.getValue())
        elif (isinstance(self.param, QgsProcessingParameterRasterDestination)):
            self.param = QgsProcessingParameterRasterDestination(
                name=name,
                description=self.param.description(),
                defaultValue=self.defaultWidget.getValue())
        elif (isinstance(self.param, QgsProcessingParameterVectorDestination)):
            self.param = QgsProcessingParameterVectorDestination(
                name=name,
                description=self.param.description(),
                type=self.param.dataType(),
                defaultValue=self.defaultWidget.getValue())

        else:
            if self.paramType:
                typeId = self.paramType
            else:
                typeId = self.param.type()

            paramTypeDef = QgsApplication.instance().processingRegistry().parameterType(typeId)
            if not paramTypeDef:
                msg = self.tr('The parameter `{}` is not registered, are you missing a required plugin?'.format(typeId))
                raise UndefinedParameterException(msg)
            self.param = paramTypeDef.create(name)
            self.param.setDescription(description)
            self.param.setMetadata(paramTypeDef.metadata())

        if not self.requiredCheck.isChecked():
            self.param.setFlags(self.param.flags() | QgsProcessingParameterDefinition.FlagOptional)
        else:
            self.param.setFlags(self.param.flags() & ~QgsProcessingParameterDefinition.FlagOptional)

        settings = QgsSettings()
        settings.setValue("/Processing/modelParametersDefinitionDialogGeometry", self.saveGeometry())

        QDialog.accept(self)
Ejemplo n.º 17
0
    def initAlgorithm(self, config, label=True):
        if DEBUG_MODE:
            logMessage("initAlgorithm(): {}".format(self.__class__.__name__),
                       False)

        qgis_iface = qgis.utils.plugins["Qgis2threejs"].iface
        self.settings.loadSettingsFromFile()
        self.settings.setMapSettings(qgis_iface.mapCanvas().mapSettings())

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.OUTPUT, self.tr("Output Directory")))

        self.addParameter(
            QgsProcessingParameterVectorLayer(
                self.INPUT, self.tr("Coverage Layer"),
                [QgsProcessing.TypeVectorAnyGeometry]))

        self.addParameter(
            QgsProcessingParameterField(self.TITLE_FIELD,
                                        self.tr("Title Field"), None,
                                        self.INPUT,
                                        QgsProcessingParameterField.Any))

        self.addParameter(
            QgsProcessingParameterBoolean(self.CF_FILTER,
                                          self.tr("Current Feature Filter")))

        enum = ["Fit to Geometry", "Fixed Scale (based on map canvas)"]
        self.addAdvancedParameter(
            QgsProcessingParameterEnum(self.SCALE,
                                       self.tr("Scale Mode"),
                                       enum,
                                       defaultValue=enum[0]))

        self.addAdvancedParameter(
            QgsProcessingParameterNumber(self.BUFFER,
                                         self.tr("Buffer (%)"),
                                         defaultValue=10))

        self.addAdvancedParameter(
            QgsProcessingParameterNumber(self.TEX_WIDTH,
                                         self.tr("Texture base width (px)"),
                                         defaultValue=1024))

        self.addAdvancedParameter(
            QgsProcessingParameterNumber(
                self.TEX_HEIGHT,
                self.
                tr('Texture base height (px)\n'
                   '    Leave this zero to respect aspect ratio of buffered geometry bounding box (in "Fit to Geometry" scale mode)\n'
                   '    or map canvas (in "Fixed scale" scale mode).'),
                defaultValue=0
                # ,optional=True
            ))

        if label:
            self.addAdvancedParameter(
                QgsProcessingParameterExpression(
                    self.HEADER, self.tr("Header Label"),
                    "'{}'".format(self.settings.headerLabel().replace(
                        "'", "''")), self.INPUT))

            self.addAdvancedParameter(
                QgsProcessingParameterExpression(
                    self.FOOTER, self.tr("Footer Label"),
                    "'{}'".format(self.settings.footerLabel().replace(
                        "'", "''")), self.INPUT))

        self.addAdvancedParameter(
            QgsProcessingParameterFile(
                self.SETTINGS,
                self.tr('Export Settings File (.qto3settings)'),
                extension="qto3settings",
                optional=True))
Ejemplo n.º 18
0
def create_output_from_token(name: str, description: str, token: str):  # pylint: disable=too-many-branches
    """
    Creates an output (or destination parameter) definition from a token string
    """
    no_prompt = False
    if 'noprompt' in token:
        no_prompt = True
        token = token.replace(' noprompt', '')

    output_type = token.lower().strip()

    out = None
    if output_type.startswith('vector'):
        vector_type = QgsProcessing.TypeVectorAnyGeometry
        if output_type == 'vector point':
            vector_type = QgsProcessing.TypeVectorPoint
        elif output_type == 'vector line':
            vector_type = QgsProcessing.TypeVectorLine
        elif output_type == 'vector polygon':
            vector_type = QgsProcessing.TypeVectorPolygon
        if no_prompt:
            out = QgsProcessingOutputVectorLayer(name, description, vector_type)
        else:
            out = QgsProcessingParameterVectorDestination(name, description, type=vector_type)
    elif output_type.startswith('table'):
        if no_prompt:
            out = QgsProcessingOutputVectorLayer(name, description, QgsProcessing.TypeVector)
        else:
            out = QgsProcessingParameterVectorDestination(name, description, type=QgsProcessing.TypeVector)
    elif output_type == 'multilayers':
        # out = QgsProcessingOutputMultipleLayers(name, description)
        #            elif token.lower().strip() == 'vector point':
        #                out = OutputVector(datatype=[dataobjects.TYPE_VECTOR_POINT])
        #            elif token.lower().strip() == 'vector line':
        #                out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_LINE])
        #            elif token.lower().strip() == 'vector polygon':
        #                out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_POLYGON])
        #            elif token.lower().strip().startswith('table'):
        #                out = OutputTable()
        #            elif token.lower().strip().startswith('file'):
        #                out = OutputFile()
        #                ext = token.strip()[len('file') + 1:]
        #                if ext:
        #                    out.ext = ext
        #            elif token.lower().strip().startswith('extent'):
        #                out = OutputExtent()
        pass
    elif not no_prompt:
        if output_type.startswith('raster'):
            out = QgsProcessingParameterRasterDestination(name, description)
        elif output_type.startswith('folder'):
            out = QgsProcessingParameterFolderDestination(name, description)
        elif output_type.startswith('html'):
            out = QgsProcessingParameterFileDestination(name, description, 'HTML Files (*.html)')
        elif output_type.startswith('file'):
            ext = token.strip()[len('file') + 1:]
            if ext:
                out = QgsProcessingParameterFileDestination(name, description, '%s Files (*.%s)' % (ext.upper(), ext))
            else:
                out = QgsProcessingParameterFileDestination(name, description)
    if not out and output_type in OUTPUT_FACTORY:
        return OUTPUT_FACTORY[output_type](name, description)
    if not out and output_type.startswith('file'):
        return OUTPUT_FACTORY['file'](name, description)

    return out
Ejemplo n.º 19
0
    def initAlgorithm(self, config: Dict[str, Any]) -> None:

        # Описываем входные параметры

        self.addParameter(
            QgsProcessingParameterFeatureSource(
                name=self.SAMPLES,
                description='Input layer',
                types=[QgsProcessing.TypeVectorAnyGeometry]))

        self.addParameter(
            QgsProcessingParameterRasterLayer(name=self.MOSAIC,
                                              description='Rater mosaic layer',
                                              optional=True))

        self.addParameter(
            QgsProcessingParameterCrs(name=self.CRS,
                                      description='CRS',
                                      defaultValue=options.get(self.CRS,
                                                               None)))

        self.addParameter(
            QgsProcessingParameterNumber(
                name=self.HORRESOLUTION,
                description='Horizontal resolution',
                type=QgsProcessingParameterNumber.Double,
                defaultValue=options.get(self.HORRESOLUTION, None)))

        self.addParameter(
            QgsProcessingParameterNumber(
                name=self.VERTRESOLUTION,
                description='Vertical resolution',
                type=QgsProcessingParameterNumber.Double,
                defaultValue=options.get(self.VERTRESOLUTION, None)))

        self.addParameter(
            QgsProcessingParameterNumber(
                name=self.WIDTH,
                description='Width (pixel)',
                type=QgsProcessingParameterNumber.Integer,
                defaultValue=options.get(self.WIDTH, None)))

        self.addParameter(
            QgsProcessingParameterNumber(
                name=self.HEIGHT,
                description='Height (pixel)',
                type=QgsProcessingParameterNumber.Integer,
                defaultValue=options.get(self.HEIGHT, None)))

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                name=self.FOLDER,
                description='Output folder for mosail tiles',
                defaultValue=options.get(self.FOLDER, None),
                optional=True))

        self.addParameter(
            QgsProcessingParameterBoolean(
                name=self.SAVEONESAMPLE,
                description='Save one sample as raster',
                defaultValue=options.get(self.SAVEONESAMPLE, None),
                optional=False))

        self.addParameter(
            QgsProcessingParameterFeatureSink(name=self.INTERSECTION,
                                              description='Samples per tiles',
                                              createByDefault=True,
                                              supportsAppend=True,
                                              defaultValue='TEMPORARY_OUTPUT'))

        self.addParameter(
            QgsProcessingParameterFeatureSink(name=self.GRID,
                                              description='Grid layer',
                                              createByDefault=True,
                                              supportsAppend=True,
                                              defaultValue='TEMPORARY_OUTPUT'))

        self.addParameter(
            QgsProcessingParameterFeatureSink(name=self.RLE,
                                              description='RLE',
                                              createByDefault=True,
                                              supportsAppend=True,
                                              defaultValue='TEMPORARY_OUTPUT'))