Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the new diagram layout data structure #1527

Closed
gcoutable opened this issue Dec 14, 2022 · 1 comment · Fixed by #1832
Closed

Add the new diagram layout data structure #1527

gcoutable opened this issue Dec 14, 2022 · 1 comment · Fixed by #1832

Comments

@gcoutable
Copy link
Contributor

gcoutable commented Dec 14, 2022

Remove:

  • Position#UNDEFINED
  • Node#position
  • Node#size
  • Edge#routingPoints
  • Edge#sourceAnchorRelativePosition
  • Edge#targetAnchorRelativePosition
  • Label#position
  • Label#size
  • Label#alignment
  • NodeDescription#childrenLayoutStrategyProvider should be childrenLayoutStrategy (should not be dynamic)
  • Node#childrenLayoutStrategy (can be computed from description)

Add:

public record DiagramLayoutData (
  Map<String, NodeLayoutData> nodeLayoutData,
  Map<String, EdgeLayoutData> edgeLayoutData
  Map<String, LabelLayoutData> labelLayoutData
) {}

public record NodeLayoutData (
  Position position,
  Size size,
) {}

public record EdgeLayoutData (
  Ratio sourceAnchorRelativePosition,
  Ratio targetAnchorRelativePosition,
  List<Position> routingPoints
) {}

public record LabelLayoutData (
  Position position,
  Size size,
  Position alignment
) {}
@sbegaudeau
Copy link
Member

This does not imply any change on the frontend side since we could introduce things like this:

public class NodeSizeDataFetcher {
  public Size get(DataFetcherEnvironment environment) {
    var diagramData = environment.getLocalContext().get("diagramData");
    var nodeId = ((Node) environment.getSource).getId();
    return diagramData.getLayoutData()nodeLayoutData.get(nodeId).size;
  }
}

As a result, we could probably move Size and Position from sirius-components-diagrams to sirius-components-layout-api and remove all the related code from the various components. This would give us a good opportunity to get rid of Position#UNDEFINED and Size#UNDEFINED

@sbegaudeau sbegaudeau self-assigned this Mar 1, 2023
@sbegaudeau sbegaudeau added this to the 2023.4.0 milestone Mar 1, 2023
@sbegaudeau sbegaudeau changed the title Remove layout data from diagram data structure Add the new diagram layout data structure Mar 1, 2023
sbegaudeau added a commit that referenced this issue Mar 1, 2023
Bug: #1527
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
sbegaudeau added a commit that referenced this issue Mar 1, 2023
Bug: #1527
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
sbegaudeau added a commit that referenced this issue Mar 6, 2023
Bug: #1527
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
@sbegaudeau sbegaudeau linked a pull request Mar 6, 2023 that will close this issue
39 tasks
pcdavid pushed a commit that referenced this issue Mar 6, 2023
Bug: #1527
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
pcdavid pushed a commit that referenced this issue Mar 6, 2023
Bug: #1527
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
pcdavid added a commit that referenced this issue Mar 29, 2023
The new API is only used for diagrams whose name ends with
`__EXPERIMENTAL` for now, and the provided implementation does nothing
for the moment.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
pcdavid added a commit that referenced this issue Mar 29, 2023
Get the oldPosition from the new layout data for __EXPERIMENTAL
diagrams.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
pcdavid added a commit that referenced this issue Mar 30, 2023
The new API is only used for diagrams whose name ends with
`__EXPERIMENTAL` for now, and the provided implementation does nothing
for the moment.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
pcdavid added a commit that referenced this issue Mar 30, 2023
Get the oldPosition from the new layout data for __EXPERIMENTAL
diagrams.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
pcdavid added a commit that referenced this issue Apr 26, 2023
The new API is only used for diagrams whose name ends with
`__EXPERIMENTAL` for now, and the provided implementation does nothing
for the moment.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
pcdavid added a commit that referenced this issue Apr 26, 2023
Get the oldPosition from the new layout data for __EXPERIMENTAL
diagrams.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
gcoutable pushed a commit that referenced this issue May 15, 2023
The new API is only used for diagrams whose name ends with
`__EXPERIMENTAL` for now, and the provided implementation does nothing
for the moment.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
gcoutable pushed a commit that referenced this issue May 15, 2023
Get the oldPosition from the new layout data for __EXPERIMENTAL
diagrams.

Bug: #1527
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants