Open Shadow992 opened 6 years ago
Ok finally I am quite sure what to save in backend and how. We should aim for a JSON file with the following structure:
{
"nodes":
{
[
{
"id": "id of node",
"label [optional]": "text of node",
"style [optional]": "style/class of node",
"shape [optional]": "shape of node; neccessary for frontend",
"mathml [optional]": "mathml if needed/wanted",
"previewhtml [optional]": "HTML to show in node as preview",
"url [optional]": "URL of node",
"x [optional]": "x position of node",
"y [optional]": "y position of node"
},
...
]
},
"edges":
{
[
{
"id": "id of edge",
"from": "Node to start edge from (source node)",
"to": "Node to connect edge from (target node)",
"label [optional]": "text of edge",
"style [optional]": "style/class of edge",
"weight [optional]": "Weight of edge",
"url [optional]": "URL of edge"
},
...
]
},
"cluster [optional]":
{
[
{
"id": "id of cluster",
"nodeIds": ["id of node 1", "id of node 2", ...],
"nodePositions": [{"x": "old x position of node 1 before clustering","y": "old y position of node 1 before clustering"}, ...],
"label [optional]": "text for cluster",
"type [optional]": "Type of cluster: lock nodes to region or create one new cluster node",
"x [optional]": "x position of cluster",
"y [optional]": "y position of cluster"
},
...
]
}
}
This structure is very similar to the current structure, which the backend delivers. Therefore it should be easy to extend the backend and frontend to produce/save/read this structure.
@Jazzpirate What do you think? Is this a good structure to start with?
We also want to save the layouted graph in backend. However this needs some MMT work. But at first TGView has to implement https://github.com/UniFormal/TGView/issues/38 to get an overview of dependencies and problems.