sec_interp.core.validation.layer_validator module
- sec_interp.core.validation.layer_validator.validate_crs_compatibility(layers: list[qgis.core.QgsMapLayer]) tuple[bool, str][source]
Validate that a list of layers have compatible Coordinate Reference Systems.
If layers have different CRSs, it returns a warning message instead of an error.
- sec_interp.core.validation.layer_validator.validate_layer_exists(layer_name: str | None) tuple[bool, str, QgsMapLayer | None][source]
Validate that a layer with the given name exists in the current QGIS project.
- Parameters:
layer_name – The name of the layer to search for.
- Returns:
- (is_valid, error_message, layer)
is_valid: True if at least one matching layer was found.
error_message: Error details if no layer was found.
layer: The first matching layer instance if valid, else None.
- Return type:
tuple
- sec_interp.core.validation.layer_validator.validate_layer_geometry(layer: qgis.core.QgsVectorLayer, expected_type: qgis.core.QgsWkbTypes.GeometryType) tuple[bool, str][source]
Validate that a vector layer matches the expected QGIS geometry type.
- Parameters:
layer – The QGIS vector layer to check.
expected_type – The required QgsWkbTypes.GeometryType.
- Returns:
- (is_valid, error_message)
is_valid: True if the geometry type matches.
error_message: Detailed error if types mismatch.
- Return type:
tuple
- sec_interp.core.validation.layer_validator.validate_layer_has_features(layer: qgis.core.QgsVectorLayer) tuple[bool, str][source]
Validate that a vector layer contains at least one feature.
- Parameters:
layer – The QGIS vector layer to check.
- Returns:
- (is_valid, error_message)
is_valid: True if the layer has features.
error_message: Error details if the layer is empty.
- Return type:
tuple
- sec_interp.core.validation.layer_validator.validate_raster_band(layer: qgis.core.QgsRasterLayer, band_number: int) tuple[bool, str][source]
Validate that a specified band number exists in the given raster layer.
- Parameters:
layer – The QGIS raster layer to check.
band_number – The 1-based index of the raster band.
- Returns:
- (is_valid, error_message)
is_valid: True if the band exists.
error_message: Error message if the band is out of range.
- Return type:
tuple
- sec_interp.core.validation.layer_validator.validate_structural_requirements(layer: qgis.core.QgsVectorLayer, layer_name: str, dip_field: str | None, strike_field: str | None) tuple[bool, str][source]
Validate structural layer requirements (geometry and attribute fields).
- Parameters:
layer – The QGIS point layer containing structural data.
layer_name – Human-readable name of the layer.
dip_field – Name of the attribute field containing dip values.
strike_field – Name of the attribute field containing strike values.
- Returns:
- (is_valid, error_message)
is_valid: True if both geometry and fields are valid.
error_message: Detailed error if validation fails.
- Return type:
tuple