Skip to content

Implement a template format where a specific list of structures can be specified with corresponding relative locations #76

Description

@GregSal

Create a custom_diagram_layout dataclass in the diagram_layout module with the following structure:

{
    "template_name": "Template Name",
    "template_description": "Template Description",
    "template_version": "1.0",
    "template_author": "Author Name",
    "template_date": "2024-06-01",
    "template_layout": {
        "Structure ID 1": {
            "x": 0,
            "y": 0
        },
        "Structure ID 2": {
            "x": 1,
            "y": 0
        },
        ...
    }
}

Then create functions in the module to load the templates from a Jason file,
validate the templates and make them accessible via the existing
get_layout_template function. As part of this, create a public function to add new templates
to the existing templates referenced by the get_layout_template function. The function to add new templates should accept a template definition as a dictionary in the above format and add it to the existing templates.

Finally, in the Custom Diagram Layout The diagram rendering function will use the existing render_template_diagram
function to render the diagram based on the loaded template.

A Custom Diagram Layout Template is defined by a data structure that specifies
the Structure and its relative location on the diagram. The templates are
"Custom" because their definition can be stored in a Jason file and loaded into
the program. This allows for the creation of new templates without having to
modify the code.

The definition is in the following format:

In the initial implementation only an exactly matching "Structure ID" will be
accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions