Pipeline
Core classes for executing the scene generation pipeline.
s2gos_generator.core.pipeline.SceneGenerationPipeline
SceneGenerationPipeline(config: SceneGenConfig)
Scene generation pipeline with automatic dependency resolution.
This pipeline automatically manages dependencies between scene generation steps, ensuring resources are processed in the correct order.
Initialize the scene generation pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SceneGenConfig
|
Scene generation configuration |
required |
Attributes
scene_name
property
scene_name: str
Get scene name from configuration.
Functions
get_resource_dependencies
get_resource_dependencies() -> Dict[str, List[str]]
Get the current resource dependency graph.
Returns:
| Type | Description |
|---|---|
Dict[str, List[str]]
|
Dictionary mapping resource IDs to their dependencies |
initialize
initialize()
Initialize the pipeline - call this before using the pipeline.
run
run() -> SceneDescription
Execute the complete scene generation pipeline.
Returns:
| Type | Description |
|---|---|
SceneDescription
|
SceneDescription instance with complete scene configuration |
visualize_dag
visualize_dag(
output_path: Optional[Path] = None, format: str = "png"
) -> Optional[Path]
Render the pipeline dependency graph to an image file using Graphviz.
Nodes are colour-coded by resource category (AOI, DEM, landcover,
mesh, texture, etc.) and shaped by type (ellipse for AOIs, diamond for
meshes, double-octagon for the final scene description). The output
file is written next to the scene output directory when output_path
is not supplied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Optional[Path]
|
Destination path for the rendered image (without
extension). Defaults to
|
None
|
format
|
str
|
Graphviz output format (e.g. |
'png'
|
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path to the rendered file, or |
Optional[Path]
|
installed or rendering fails. |
s2gos_generator.core.context.SceneResourceContext
SceneResourceContext(
config: SceneGenConfig,
combined_user_assets: List = None,
additional_material_libraries: List = None,
**kwargs,
)
Resource context for scene generation pipeline execution.
Initialize scene resource context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SceneGenConfig
|
Scene generation configuration |
required |
combined_user_assets
|
List
|
List combining config + XML assets |
None
|
additional_material_libraries
|
List
|
Extra material libraries from XML |
None
|
Attributes
coordinate_system
property
coordinate_system: CoordinateSystem
Get cached coordinate system for this scene.
Returns:
| Type | Description |
|---|---|
CoordinateSystem
|
CoordinateSystem instance for this scene's center location |
has_background
property
has_background: bool
Check if background processing is enabled.
has_buffer
property
has_buffer: bool
Check if buffer processing is enabled.
has_hamster
property
has_hamster: bool
Check if HAMSTER data integration is enabled.
user_assets
property
user_assets
Get combined user assets (config + XML assets).
Functions
s2gos_generator.core.assets.SceneAssets
dataclass
SceneAssets(
dem_file: Optional[UPath] = None,
landcover_file: Optional[UPath] = None,
mesh_file: Optional[UPath] = None,
selection_texture_file: Optional[UPath] = None,
preview_texture_file: Optional[UPath] = None,
config_file: Optional[UPath] = None,
scene_description_file: Optional[UPath] = None,
buffer_dem_file: Optional[UPath] = None,
buffer_landcover_file: Optional[UPath] = None,
buffer_mesh_file: Optional[UPath] = None,
buffer_selection_texture_file: Optional[UPath] = None,
buffer_preview_texture_file: Optional[UPath] = None,
background_landcover_file: Optional[UPath] = None,
background_selection_texture_file: Optional[
UPath
] = None,
background_preview_texture_file: Optional[UPath] = None,
)
Container for generated scene assets.
Functions
to_dict
to_dict() -> Dict
Convert assets to dictionary.
s2gos_generator.core.resource_registry.ResourceRegistry
ResourceRegistry()
Registry for managing resource definitions.
Functions
get_execution_order
get_execution_order() -> List[str]
Get resources in dependency order using topological sort with cycle detection.
get_resource
get_resource(id: str) -> Resource
Get a resource by ID.
get_resource_list
get_resource_list() -> List[Resource]
Get all registered resources.
register
register(id: str, dependencies: List[str], func: Callable)
Register a resource explicitly.
update_scene_dependencies
update_scene_dependencies()
Update scene_description dependencies based on currently registered resources.
s2gos_generator.core.resource_registry.DAGExecutor
DAGExecutor(registry: ResourceRegistry)
Executes resources in dependency order.
Functions
execute
execute(context: SceneResourceContext) -> Dict[str, Any]
Execute all resources in dependency order.