Skip to content

Commit

Permalink
Replace Vertical and Horizontal ZoneLayout by MatrixZoneLayout
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas ADAM <[email protected]>
  • Loading branch information
tadam50 committed Jan 16, 2024
1 parent 0e1a50f commit f82cc44
Show file tree
Hide file tree
Showing 12 changed files with 1,260 additions and 1,463 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package com.powsybl.sld.layout;

import com.powsybl.sld.model.graphs.ZoneGraph;
import com.powsybl.sld.model.graphs.*;

/**
* @author Thomas Adam {@literal <tadam at silicom.fr>}
Expand All @@ -16,6 +16,6 @@ public class HorizontalZoneLayoutFactory implements ZoneLayoutFactory {

@Override
public Layout create(ZoneGraph graph, SubstationLayoutFactory sLayoutFactory, VoltageLevelLayoutFactory vLayoutFactory) {
return new HorizontalZoneLayout(graph, sLayoutFactory, vLayoutFactory);
return new MatrixZoneLayoutFactory().create(graph, sLayoutFactory, vLayoutFactory);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/
package com.powsybl.sld.layout;

import com.powsybl.sld.model.graphs.ZoneGraph;
import com.powsybl.sld.model.graphs.*;

import java.util.*;

/**
* @author Thomas Adam {@literal <tadam at silicom.fr>}
Expand All @@ -16,6 +18,11 @@ public class VerticalZoneLayoutFactory implements ZoneLayoutFactory {

@Override
public Layout create(ZoneGraph graph, SubstationLayoutFactory sLayoutFactory, VoltageLevelLayoutFactory vLayoutFactory) {
return new VerticalZoneLayout(graph, sLayoutFactory, vLayoutFactory);
List<String> substations = graph.getSubstations().stream().map(SubstationGraph::getId).toList();
String[][] matrix = new String[substations.size()][1];
for (int row = 0; row < substations.size(); row++) {
matrix[row][0] = substations.get(row);
}
return new MatrixZoneLayout(graph, matrix, sLayoutFactory, vLayoutFactory);
}
}
Loading

0 comments on commit f82cc44

Please sign in to comment.