# sec_interp.core.validation.field_validator module

sec_interp.core.validation.field_validator.validate_numeric_input(value: str, min_val: float | None = None, max_val: float | None = None, field_name: str = 'Value', allow_empty: bool = False) → Tuple[bool, str, float | None]

  Validate a numeric input string from a text field.

  Parameters:

    - value – The string value to validate.

    - min_val – Optional minimum value allowed.

    - max_val – Optional maximum value allowed.

    - field_name – Name of the field for error messages.

    - allow_empty – Whether to allow an empty string.

  Returns:

    (is_valid, error_message, float_value)

      - is_valid (bool): True if validation passed.

      - error_message (str): Error details if validation failed.

      - float_value (float | None): The parsed numeric value if valid.

  Return type:

    tuple

sec_interp.core.validation.field_validator.validate_integer_input(value: str, min_val: int | None = None, max_val: int | None = None, field_name: str = 'Value', allow_empty: bool = False) → Tuple[bool, str, int | None]

  Validate an integer input string from a text field.

  Parameters:

    - value – The string value to validate.

    - min_val – Optional minimum value allowed.

    - max_val – Optional maximum value allowed.

    - field_name – Name of the field for error messages.

    - allow_empty – Whether to allow an empty string.

  Returns:

    (is_valid, error_message, int_value)

      - is_valid (bool): True if validation passed.

      - error_message (str): Error details if validation failed.

      - int_value (int | None): The parsed integer value if valid.

  Return type:

    tuple

sec_interp.core.validation.field_validator.validate_angle_range(value: float, field_name: str, min_angle: float = 0.0, max_angle: float = 360.0) → Tuple[bool, str]

  Validate that an angle value is within the expected range.

  Parameters:

    - value – The angle value to validate.

    - field_name – Name of the field for error messages.

    - min_angle – Minimum allowed angle (default 0.0).

    - max_angle – Maximum allowed angle (default 360.0).

  Returns:

    (is_valid, error_message)

      - is_valid (bool): True if validation passed.

      - error_message (str): Error details if validation failed.

  Return type:

    tuple

sec_interp.core.validation.field_validator.validate_field_exists(layer: qgis.core.QgsVectorLayer, field_name: str | None) → Tuple[bool, str]

  Validate that a specific field exists in a vector layer.

  Parameters:

    - layer – The QGIS vector layer to check.

    - field_name – The name of the field to search for.

  Returns:

    (is_valid, error_message)

      - is_valid (bool): True if validation passed.

      - error_message (str): Error details if validation failed.

  Return type:

    tuple

sec_interp.core.validation.field_validator.validate_field_type(layer: qgis.core.QgsVectorLayer, field_name: str, expected_types: List[qgis.PyQt.QtCore.QVariant.Type]) → Tuple[bool, str]

  Validate that a field in a layer has one of the expected data types.

  Parameters:

    - layer – The QGIS vector layer containing the field.

    - field_name – The name of the field to check.

    - expected_types – List of allowed QVariant.Type values.

  Returns:

    (is_valid, error_message)

      - is_valid (bool): True if validation passed.

      - error_message (str): Error details if validation failed.

  Return type:

    tuple