Index
subsurfaceio.tiles
Reusable SVG tiles used by soil-pattern graphics.
Look up a tile and emit its <pattern> or <symbol> definition:
from subsurfaceio.tiles import tile_registry
svg = tile_registry.tiles['gint_CIRC05'].generate_definition_svg()
Classes:
| Name | Description |
|---|---|
Tile |
Reusable SVG pattern or symbol used inside a graphic. |
Tiles |
Catalog of named |
Attributes:
| Name | Type | Description |
|---|---|---|
tile_registry |
Tiles
|
|
Tile
pydantic-model
Bases: BaseModel
Reusable SVG pattern or symbol used inside a graphic.
Config:
frozen:True
Fields:
-
name(str) -
description(str | None) -
width(float) -
height(float) -
mapping(Literal['Repeat', 'Expand to fit', 'Repeat Horizontal/Expand Vertical', 'Expand Horizontal/Repeat Vertical', 'Maintain Proportions', 'Maintain Size', 'Maintain Size - Expand Borders'])
mapping
pydantic-field
mapping: Literal[
"Repeat",
"Expand to fit",
"Repeat Horizontal/Expand Vertical",
"Expand Horizontal/Repeat Vertical",
"Maintain Proportions",
"Maintain Size",
"Maintain Size - Expand Borders",
] = "Repeat"
definition_id
Stable SVG id for this tile, including size when the mapping is dynamic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float | None
|
Rendered width used in expand-horizontal ids. |
None
|
height
|
float | None
|
Rendered height used in expand-vertical ids. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Element id string. |
generate_definition_svg
cached
generate_definition_svg(
width_for_expand_horizontal: float | None = None,
height_for_expand_vertical: float | None = None,
) -> str
Return the SVG <pattern> or <symbol> definition for this tile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width_for_expand_horizontal
|
float | None
|
Rendered pixel width; required when mapping is 'Expand Horizontal/Repeat Vertical'. |
None
|
height_for_expand_vertical
|
float | None
|
Rendered pixel height; required when mapping is 'Repeat Horizontal/Expand Vertical'. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
For mappings not yet supported. |
ValueError
|
When a required dimension is missing. |
Returns:
| Type | Description |
|---|---|
str
|
SVG |