Skip to content

Commit 8bf7146

Browse files
Cleanup, remove some unneeded code / classes / TODO
Signed-off-by: NathanDissoubray <[email protected]>
1 parent d9e0b86 commit 8bf7146

5 files changed

Lines changed: 8 additions & 96 deletions

File tree

diagram-util/src/main/java/com/powsybl/diagram/util/forcelayout/ForceLayout.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public Vector2D getStablePosition(V vertex) {
130130
return algorithmRunner.getStablePosition(vertex);
131131
}
132132

133+
//TODO we could remove this since there are no use for it in the code, but its public so someone else might be using it.
133134
public Set<Spring> getSprings() {
134135
return springs;
135136
}

diagram-util/src/main/java/com/powsybl/diagram/util/forcelayout/geometry/Edge.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

diagram-util/src/main/java/com/powsybl/diagram/util/forcelayout/geometry/Point.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ public class Point {
2121
private static final double DEFAULT_MASS = 1.0;
2222

2323
private Vector2D position;
24-
//TODO remove this, it is not needed
25-
// or maybe it is to calculate the Barnes Hut Dynamic schedule ?
2624
private Vector2D velocity;
27-
//TODO remove this, forces are not kept at the point level anymore
2825
private Vector2D forces;
2926
private final double mass;
3027

diagram-util/src/main/java/com/powsybl/diagram/util/forcelayout/layouts/SpringyLayout.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ public static <V, E> SpringContainer<DefaultEdge> initializeSprings(ForceGraph<V
7171

7272
@Override
7373
public void calculateLayout(ForceGraph<V, E> forceGraph) {
74-
// it would be better if this was created with all the other forces but we need the graph to init the springs
75-
// TODO that could cause an issue if we launch the runner on multiple different graph, we would keep adding spring force
74+
// it would be better if this was created with all the other forces, but we need the graph to init the springs
7675
this.forces.add(new SpringForce<>(initializeSprings(forceGraph)));
7776

7877
// do the loop on the nodes and forces
@@ -93,6 +92,12 @@ public void calculateLayout(ForceGraph<V, E> forceGraph) {
9392
}
9493
}
9594
LOGGER.info("Calculating the layout took {} steps", i);
95+
try {
96+
this.forces.remove(2);
97+
} catch (Exception e) {
98+
LOGGER.error("Tried to remove the Spring force from the Graph but did not succeed", new Exception(e));
99+
}
100+
96101
}
97102

98103
private void updateVelocity(ForceGraph<V, E> forceGraph) {

diagram-util/src/test/java/com/powsybl/diagram/util/forcelayout/geometry/EdgeTest.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)