def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) fieldsParam = QgsProcessingParameterFile( name=self.MAP_CSV, description=self.tr('CSV Map'), optional=True) fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeCsvTxtFileWidgetWrapper', 'fileExtensions': ['csv','txt'] } }) self.addParameter(fieldsParam) fieldsParam = QgsProcessingParameterString( name= self.CHANGES, description=self.tr('Values to search and replace'), defaultValue='') #fieldsParam.setIsDynamic(True) #fieldsParam.setDynamicLayerParameterName('MAP_CSV') #m_param.setDynamicPropertyDefinition(QgsPropertyDefinition(self.M_VALUE, self.tr("M Value"), QgsPropertyDefinition.Double)) fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMappingTableWidgetWrapper', 'parentWidgetConfig': { 'paramName': self.MAP_CSV, 'refreshMethod': 'refreshMappingCombobox'} } }) self.addParameter(fieldsParam) self.addParameter(QgsProcessingParameterNumber( name=self.NODATA_VALUE, description=self.tr('Nodata value'), defaultValue=-1)) # === OUTPUT PARAMETERS === fieldsParam = ChloeASCParameterFileDestination( name=self.OUTPUT_ASC, description=self.tr('Output Raster ascii')) self.addParameter(fieldsParam, createOutput=True) self.addParameter(QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) ascFilterParam = QgsProcessingParameterRasterLayer( name=self.ASCII_FILTER, description=self.tr('Ascii Grid Filter')) ascFilterParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(ascFilterParam) fieldsParam = QgsProcessingParameterString( name=self.FILTER_VALUES, description=self.tr('Filter value(s)'), defaultValue='') fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeValuesWidgetWrapper' } }) self.addParameter(fieldsParam) # === OUTPUT PARAMETERS === fieldsParam = ChloeASCParameterFileDestination( name=self.OUTPUT_ASC, description=self.tr('Output Raster ascii')) self.addParameter(fieldsParam, createOutput=True) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) metricsParam = QgsProcessingParameterString( name=self.METRICS, description=self.tr('Select metrics')) metricsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMultipleMetricsSelectorWidgetWrapper', 'dictValues': self.types_of_metrics, 'initialValue': 'value metrics', 'rasterLayerParamName': self.INPUT_LAYER_ASC, 'parentWidgetConfig': { 'paramName': self.INPUT_LAYER_ASC, 'refreshMethod': 'refreshMetrics' } } }) self.addParameter(metricsParam) # === OUTPUT PARAMETERS === self.addParameter( ChloeCSVParameterFileDestination( name=self.OUTPUT_CSV, description=self.tr('Output csv'))) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) # ANALYZE TYPE analyzeTypeParam = QgsProcessingParameterEnum( name=self.ANALYZE_TYPE, description=self.tr('Analyze type'), options=self.types_of_analyze) analyzeTypeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.DISTANCE_FUNCTION, 'enableValue': 1 }] } }) self.addParameter(analyzeTypeParam) # DISTANCE FUNCTION self.addParameter(QgsProcessingParameterString( name=self.DISTANCE_FUNCTION, description=self.tr('Distance function'), optional=True)) # WINDOW SHAPE windowShapeParam = QgsProcessingParameterEnum( name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options=self.types_of_shape) windowShapeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.FRICTION_FILE, 'enableValue': 2 }] } }) self.addParameter(windowShapeParam) # FRICTION FILE self.addParameter(QgsProcessingParameterFile( name=self.FRICTION_FILE, description=self.tr('Friction file'), optional=True)) # WINDOW SIZE windowSizeParam = QgsProcessingParameterString( name=self.WINDOW_SIZES, description=self.tr('Windows sizes (pixels)')) # [constraint V2.0: "select only one"] windowSizeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeIntListWidgetWrapper', 'initialValue': 3, 'minValue' : 3, 'maxValue' : 100001, 'oddNum' : True } }) self.addParameter(windowSizeParam) # POINT PIXEL pointPixelParam = QgsProcessingParameterEnum( name=self.PIXELS_POINTS_SELECT, description=self.tr('Pixels/points selection'), options=self.types_of_pixel_point_select) pointPixelParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.PIXELS_FILE, 'enableValue': 0 }, { 'paramName': self.POINTS_FILE, 'enableValue': 1 }] } }) self.addParameter(pointPixelParam) # PIXEL FILE self.addParameter(QgsProcessingParameterFile( name=self.PIXELS_FILE, description=self.tr('Pixels file'), optional=True)) # POINT FILE self.addParameter(QgsProcessingParameterFile( name=self.POINTS_FILE, description=self.tr('Points file'), optional=True)) # MAXIMUM RATE MISSING VALUE self.addParameter(QgsProcessingParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of missing values'), minValue=0, maxValue=100, defaultValue=100)) metricsParam = QgsProcessingParameterString( name=self.METRICS, description=self.tr('Select metrics')) metricsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMultipleMetricsSelectorWidgetWrapper', 'dictValues': self.types_of_metrics, 'initialValue': 'value metrics', 'rasterLayerParamName': self.INPUT_LAYER_ASC, 'parentWidgetConfig': { 'paramName': self.INPUT_LAYER_ASC, 'refreshMethod': 'refreshMetrics'} } }) self.addParameter(metricsParam) # === OUTPUT PARAMETERS === self.addParameter(ChloeParameterFolderDestination( name=self.OUTPUT_DIR, description=self.tr('Output directory'))) self.addParameter(QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) # ANALYZE TYPE analyzeTypeParam = QgsProcessingParameterEnum( name=self.ANALYZE_TYPE, description=self.tr('Analyze type'), options=self.types_of_analyze) analyzeTypeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.DISTANCE_FUNCTION, 'enableValue': 1 }] } }) self.addParameter(analyzeTypeParam) # DISTANCE FUNCTION self.addParameter(QgsProcessingParameterString( name=self.DISTANCE_FUNCTION, description=self.tr('Distance function'), optional=True)) windowShapeParam = QgsProcessingParameterEnum( name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options=self.types_of_shape) windowShapeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.FRICTION_FILE, 'enableValue': 2 }] } }) self.addParameter(windowShapeParam) self.addParameter(QgsProcessingParameterFile( name=self.FRICTION_FILE, description=self.tr('Friction file'), optional=True)) windowSizeParam = QgsProcessingParameterString( name=self.WINDOW_SIZES, description=self.tr('Windows sizes (pixels)')) # [constraint V2.0: "select only one"] windowSizeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeIntListWidgetWrapper', 'initialValue': 3, 'minValue' : 3, 'maxValue' : 100001, 'oddNum' : True } }) self.addParameter(windowSizeParam) self.addParameter(QgsProcessingParameterNumber( name=self.DELTA_DISPLACEMENT, description=self.tr('Delta displacement (pixels)'), defaultValue=1, minValue=1)) self.addParameter(QgsProcessingParameterBoolean( name=self.INTERPOLATE_VALUES_BOOL, description=self.tr('Interpolate Values'), defaultValue=False)) fieldsParam = QgsProcessingParameterString( name=self.FILTER, description=self.tr('Filters - Analyse only'), defaultValue='', optional=True) fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeValuesWidgetWrapper' } }) self.addParameter(fieldsParam) fieldsParam = QgsProcessingParameterString( name=self.UNFILTER, description=self.tr('Filters - Do not analyse'), defaultValue='', optional=True) fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeValuesWidgetWrapper' } }) self.addParameter(fieldsParam) self.addParameter(QgsProcessingParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of missing values'), minValue=0, maxValue=100, defaultValue=100)) metricsParam = QgsProcessingParameterString( name=self.METRICS, description=self.tr('Select metrics')) metricsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMultipleMetricsSelectorWidgetWrapper', 'dictValues': self.types_of_metrics, 'initialValue': 'value metrics', 'rasterLayerParamName': self.INPUT_LAYER_ASC, 'parentWidgetConfig': { 'paramName': self.INPUT_LAYER_ASC, 'refreshMethod': 'refreshMetrics'} } }) self.addParameter(metricsParam) # === OUTPUT PARAMETERS === self.addParameter(ChloeParameterFolderDestination( name=self.OUTPUT_DIR, description=self.tr('Output directory'))) self.addParameter(QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === #Asc inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) # Value ranges fieldsParam = QgsProcessingParameterString( name=self.VALUES_RANGES, description=self.tr('Values'), defaultValue='') fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeValuesWidgetWrapper' } }) self.addParameter(fieldsParam) # Distance type distanceTypeParam = QgsProcessingParameterEnum( name=self.DISTANCE_TYPE, description=self.tr('Distance type'), options=self.types_of_distance) distanceTypeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.DISTANCE_FRICTION, 'enableValue': 1 }] } }) self.addParameter(distanceTypeParam) # Friction file self.addParameter( QgsProcessingParameterFile(name=self.DISTANCE_FRICTION, description=self.tr('Friction file'), optional=True)) # Max distance self.addParameter( QgsProcessingParameterNumber( name=self.DISTANCE_MAX, description=self.tr('Maximum distance (in meters)'), type=QgsProcessingParameterNumber.Double, defaultValue=None, minValue=1, optional=True)) # === OUTPUT PARAMETERS === fieldsParam = ChloeASCParameterFileDestination( name=self.OUTPUT_ASC, description=self.tr('Output Raster ascii')) self.addParameter(fieldsParam, createOutput=True) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) fieldsParam = QgsProcessingParameterString( name=self.CLUSTER, description=self.tr('Clusters from value(s)'), defaultValue='') fieldsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeValuesWidgetWrapper' } }) self.addParameter(fieldsParam) clusterTypeParam = QgsProcessingParameterEnum(self.CLUSTER_TYPE, self.tr('Cluster type'), self.types_of_cluster) self.addParameter(clusterTypeParam) clusterTypeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMultiEnumUpdateStateWidgetWrapper', 'dependantWidgetConfig': [{ 'paramName': self.CLUSTER_DISTANCE, 'enableValue': '2,3' }] } }) self.addParameter( QgsProcessingParameterNumber( name=self.CLUSTER_MIN_AREA, description=self.tr('Minimal area (Ha)'), defaultValue=0, minValue=0)) self.addParameter( QgsProcessingParameterNumber( name=self.CLUSTER_DISTANCE, description=self. tr('Distance in meters (only for euclidean and functional distance)' ), optional=True, minValue=0)) self.addParameter( QgsProcessingParameterFile(name=self.CLUSTER_FRICTION, description=self.tr('Friction file'), optional=True)) # === OUTPUT PARAMETERS === self.addParameter( ChloeCSVParameterFileDestination( name=self.OUTPUT_CSV, description=self.tr('Output csv (*.csv)'))) fieldsParam = ChloeASCParameterFileDestination( name=self.OUTPUT_ASC, description=self.tr('Output Raster ascii')) self.addParameter(fieldsParam, createOutput=True) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) self.addParameter( QgsProcessingParameterNumber( name=self.GRID_SIZES, description=self.tr('Grid size (pixels)'), defaultValue=2, minValue=1)) metricsParam = QgsProcessingParameterString( name=self.METRICS, description=self.tr('Select metrics')) metricsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeDoubleComboboxWidgetWrapper', 'dictValues': self.types_of_metrics, 'initialValue': 'value metrics', 'rasterLayerParamName': self.INPUT_LAYER_ASC, 'parentWidgetConfig': { 'paramName': self.INPUT_LAYER_ASC, 'refreshMethod': 'refreshMappingCombobox' } } }) self.addParameter(metricsParam) self.addParameter( QgsProcessingParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, defaultValue=100)) # self.addParameter(QgsProcessingParameterString( # name=self.COMMENT, # description=self.tr('Comment')) # ) # === OUTPUT PARAMETERS === self.addParameter( ChloeCSVParameterFileDestination(name=self.OUTPUT_CSV, description=self.tr('Output csv'), addToMapDefaultState=False)) fieldsParam = ChloeASCParameterFileDestination( name=self.OUTPUT_ASC, description=self.tr('Output Raster ascii')) self.addParameter(fieldsParam, createOutput=True) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))
def initAlgorithm(self, config=None): # === INPUT PARAMETERS === # === INPUT PARAMETERS === inputAscParam = QgsProcessingParameterRasterLayer( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc')) inputAscParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeAscRasterWidgetWrapper' } }) self.addParameter(inputAscParam) gridSizeParam = QgsProcessingParameterString( name=self.GRID_SIZES, description=self.tr( 'Grid sizes (pixels)')) # [constraint V2.0: "select only one"] gridSizeParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeIntListWidgetWrapper', 'initialValue': 2, 'maxValue': 100001, 'minValue': 1, 'oddNum': None } }) self.addParameter(gridSizeParam) metricsParam = QgsProcessingParameterString( name=self.METRICS, description=self.tr('Select metrics')) metricsParam.setMetadata({ 'widget_wrapper': { 'class': 'Chloe.chloe_algorithm_dialog.ChloeMultipleMetricsSelectorWidgetWrapper', 'dictValues': self.types_of_metrics, 'initialValue': 'value metrics', 'rasterLayerParamName': self.INPUT_LAYER_ASC, 'parentWidgetConfig': { 'paramName': self.INPUT_LAYER_ASC, 'refreshMethod': 'refreshMetrics' } } }) self.addParameter(metricsParam) self.addParameter( QgsProcessingParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, defaultValue=100)) # === OUTPUT PARAMETERS === self.addParameter( ChloeParameterFolderDestination( name=self.OUTPUT_DIR, description=self.tr('Output directory'))) self.addParameter( QgsProcessingParameterFileDestination( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), fileFilter='Properties (*.properties)'))