Reference¶
extend_objects(tree_dict, build_exceptions, imx_file, element)
¶
Extends IMX objects in a tree structure with additional properties and handles exceptions.
Info
This function iterates over objects of specific types within an IMX file and attempts to extend them using corresponding objects found in a tree dictionary. If the extension is successful, it merges the properties of the objects. If not, it logs appropriate warnings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tree_dict |
defaultdict[str, list[ImxObject]]
|
A dictionary containing lists of IMX objects indexed by their unique identifiers. |
required |
build_exceptions |
BuildExceptions
|
An object to collect exceptions that occur during the build process. |
required |
imx_file |
ImxFile
|
An object representing the IMX file to be processed. |
required |
element |
_Element | None
|
An optional XML element to narrow down the search scope within the IMX file. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
build_rail_connections(get_by_types, find, exceptions)
¶
Constructs rail connections by merging geometries of referenced track and passage objects.
Info
This function retrieves rail connection objects, fetches their referenced track and passage objects, merges their geometries, and assigns the resulting geometry to the rail connection. It handles exceptions when references are missing or invalid and logs these exceptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
get_by_types |
A callable to retrieve objects by their types. |
required | |
find |
Callable[[str], ImxObject | None]
|
A callable to find an object by its unique identifier. |
required |
exceptions |
BuildExceptions
|
An object to collect exceptions that occur during the build process. |
required |
add_children(tree_dict, find)
¶
Adds child objects to each IMX object in a tree dictionary.
Info
This function iterates over each IMX object in the provided tree dictionary, finds
its child elements by their unique identifiers (PUIC), and assigns these child objects
to the children
attribute of the parent IMX object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tree_dict |
defaultdict[str, list[ImxObject]]
|
A dictionary containing lists of IMX objects indexed by their unique identifiers. |
required |
find |
Callable[[str], ImxObject | None]
|
A callable to find an IMX object by its unique identifier (PUIC). |
required |