Пример #1
0
    def initAlgorithm(self, config=None):
        self.METHODS = [self.tr('Linear'),
                        self.tr('Clough-Toucher (cubic)')
                        ]

        self.addParameter(ParameterInterpolationData(self.INTERPOLATION_DATA,
                                                     self.tr('Input layer(s)')))
        self.addParameter(QgsProcessingParameterEnum(self.METHOD,
                                                     self.tr('Interpolation method'),
                                                     options=self.METHODS,
                                                     defaultValue=0))
        self.addParameter(QgsProcessingParameterNumber(self.COLUMNS,
                                                       self.tr('Number of columns'),
                                                       minValue=0, maxValue=10000000, defaultValue=300))
        self.addParameter(QgsProcessingParameterNumber(self.ROWS,
                                                       self.tr('Number of rows'),
                                                       minValue=0, maxValue=10000000, defaultValue=300))
        self.addParameter(QgsProcessingParameterNumber(self.CELLSIZE_X,
                                                       self.tr('Cell size X'), type=QgsProcessingParameterNumber.Double,
                                                       minValue=0.0, maxValue=999999.000000, defaultValue=0.0))
        self.addParameter(QgsProcessingParameterNumber(self.CELLSIZE_Y,
                                                       self.tr('Cell size Y'), type=QgsProcessingParameterNumber.Double,
                                                       minValue=0.0, maxValue=999999.000000, defaultValue=0.0))
        self.addParameter(QgsProcessingParameterExtent(self.EXTENT,
                                                       self.tr('Extent'),
                                                       optional=False))
        self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT,
                                                                  self.tr('Interpolated')))

        triangulation_file_param = QgsProcessingParameterFileDestination(self.TRIANGULATION_FILE,
                                                                         self.tr('Triangulation'),
                                                                         self.tr('SHP files (*.shp)'),
                                                                         optional=True)
        triangulation_file_param.setCreateByDefault(False)
        self.addParameter(triangulation_file_param)
Пример #2
0
    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 options'),
            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)
Пример #3
0
    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 options'),
                                                     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)