Index
subsurfaceio.graphics
SVG soil-pattern graphics composed from tiles.
Look up a graphic and render it:
from subsurfaceio.graphics import graphic_registry
svg = graphic_registry.graphics['ASPHALT'].generate_svg()
Classes:
| Name | Description |
|---|---|
Graphic |
Named soil-pattern graphic composed of tiled SVG fragments. |
Graphics |
Catalog of named |
SVGDefinitions |
Accumulated SVG |
TileConfiguration |
How one tile is placed inside a graphic (span, borders, scale). |
Attributes:
| Name | Type | Description |
|---|---|---|
graphic_registry |
Graphics
|
|
graphic_registry
module-attribute
Graphic
pydantic-model
Bases: BaseModel
Named soil-pattern graphic composed of tiled SVG fragments.
Config:
frozen:True
Fields:
-
name(str) -
description(str | None) -
category(str) -
tiles_configuration(tuple[TileConfiguration, ...])
svg_definitions
property
Cached SVG definitions accumulated while rendering tiles.
generate_svg
generate_svg(
solid_fill_color: str = "#000",
include_definitions: bool = True,
svg_width: float | None = None,
svg_height: float | None = None,
) -> str
Render the graphic to an SVG string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solid_fill_color
|
str
|
CSS color used for SOLID tiles. |
'#000'
|
include_definitions
|
bool
|
Whether to embed |
True
|
svg_width
|
float | None
|
Actual pixel width; used to resolve 'Expand Horizontal' tiles. |
None
|
svg_height
|
float | None
|
Actual pixel height; used to resolve 'Expand Vertical' tiles. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Full SVG document fragment for this graphic. |
Graphics
pydantic-model
SVGDefinitions
pydantic-model
Bases: BaseModel
Accumulated SVG <defs> fragments for a graphic.
Fields:
-
definitions(dict[str, str])
TileConfiguration
pydantic-model
Bases: BaseModel
How one tile is placed inside a graphic (span, borders, scale).
Config:
frozen:True
Fields:
-
tile_symbol(str | None) -
from_pct(float) -
to_pct(float) -
vertical_borders(Literal['Left', 'Right', 'Both'] | None) -
scale(float | None)