Skip to content

Commit a14c4b5

Browse files
Remove Atlas2 RepulsionFromFixedNodes parameter
Signed-off-by: Nathan Dissoubray <nathan.dissoubray@rte-france.com>
1 parent 81a3a9f commit a14c4b5

3 files changed

Lines changed: 2 additions & 25 deletions

File tree

diagram-util/src/main/java/com/powsybl/diagram/util/layout/algorithms/Atlas2ForceLayoutAlgorithm.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public class Atlas2ForceLayoutAlgorithm<V, E> implements LayoutAlgorithm<V, E> {
6565
public Atlas2ForceLayoutAlgorithm(Atlas2Parameters layoutParameters) {
6666
this.forces.add(new RepulsionForceDegreeBasedLinear<>(
6767
layoutParameters.getRepulsionIntensity(),
68-
layoutParameters.isRepulsionFromFixedPointsEnabled()));
68+
true
69+
));
6970
this.forces.add(new EdgeAttractionForceLinear<>(layoutParameters.getEdgeAttractionIntensity()));
7071
if (layoutParameters.isAttractToCenterEnabled()) {
7172
// Atlas2 talks about both a unit gravity force and a linear gravity force

diagram-util/src/main/java/com/powsybl/diagram/util/layout/algorithms/parameters/Atlas2Parameters.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public final class Atlas2Parameters {
1919
private static final double DEFAULT_MAX_SPEED_FACTOR = 10;
2020
private static final double DEFAULT_SWING_TOLERANCE = 1;
2121
private static final double DEFAULT_MAX_GLOBAL_SPEED_INCREASE_RATIO = 1.5;
22-
private static final boolean DEFAULT_REPULSION_FROM_FIXED_POINTS_ENABLED = true;
2322
private static final boolean DEFAULT_ATTRACT_TO_CENTER_ENABLED = true;
2423

2524
private final int maxSteps;
@@ -30,7 +29,6 @@ public final class Atlas2Parameters {
3029
private final double maxSpeedFactor;
3130
private final double swingTolerance;
3231
private final double maxGlobalSpeedIncreaseRatio;
33-
private final boolean repulsionFromFixedPointsEnabled;
3432
private final boolean attractToCenterEnabled;
3533

3634
private Atlas2Parameters(
@@ -42,7 +40,6 @@ private Atlas2Parameters(
4240
double maxSpeedFactor,
4341
double swingTolerance,
4442
double maxGlobalSpeedIncreaseRatio,
45-
boolean repulsionFromFixedPointsEnabled,
4643
boolean attractToCenterEnabled
4744
) {
4845
this.maxSteps = maxSteps;
@@ -53,7 +50,6 @@ private Atlas2Parameters(
5350
this.maxSpeedFactor = maxSpeedFactor;
5451
this.swingTolerance = swingTolerance;
5552
this.maxGlobalSpeedIncreaseRatio = maxGlobalSpeedIncreaseRatio;
56-
this.repulsionFromFixedPointsEnabled = repulsionFromFixedPointsEnabled;
5753
this.attractToCenterEnabled = attractToCenterEnabled;
5854
}
5955

@@ -66,7 +62,6 @@ public static class Builder {
6662
private double maxSpeedFactor = DEFAULT_MAX_SPEED_FACTOR;
6763
private double swingTolerance = DEFAULT_SWING_TOLERANCE;
6864
private double maxGlobalSpeedIncreaseRatio = DEFAULT_MAX_GLOBAL_SPEED_INCREASE_RATIO;
69-
private boolean repulsionFromFixedPointsEnabled = DEFAULT_REPULSION_FROM_FIXED_POINTS_ENABLED;
7065
private boolean attractToCenterEnabled = DEFAULT_ATTRACT_TO_CENTER_ENABLED;
7166

7267
/**
@@ -164,17 +159,6 @@ public Builder withMaxGlobalSpeedIncreaseRatio(double maxGlobalSpeedIncreaseRati
164159
return this;
165160
}
166161

167-
/**
168-
* If set to true, other points will get a repulsion effect from unmovable points (fixed points),
169-
* default is {@value DEFAULT_REPULSION_FROM_FIXED_POINTS_ENABLED}
170-
* @param repulsionFromFixedPointsEnabled whether you want to activate repulsion from fixed points or not
171-
* @return the instance of this Builder with the `repulsionFromFixedPointsEnabled` changed
172-
*/
173-
public Builder withRepulsionFromFixedPointsEnabled(boolean repulsionFromFixedPointsEnabled) {
174-
this.repulsionFromFixedPointsEnabled = repulsionFromFixedPointsEnabled;
175-
return this;
176-
}
177-
178162
/**
179163
* Activate or deactivate the force that attracts points to the center of the graph. It is used to prevent non-connected points
180164
* from drifting away, default is {@value DEFAULT_ATTRACT_TO_CENTER_ENABLED}
@@ -196,7 +180,6 @@ public Atlas2Parameters build() {
196180
maxSpeedFactor,
197181
swingTolerance,
198182
maxGlobalSpeedIncreaseRatio,
199-
repulsionFromFixedPointsEnabled,
200183
attractToCenterEnabled
201184
);
202185
}
@@ -234,10 +217,6 @@ public double getMaxGlobalSpeedIncreaseRatio() {
234217
return maxGlobalSpeedIncreaseRatio;
235218
}
236219

237-
public boolean isRepulsionFromFixedPointsEnabled() {
238-
return repulsionFromFixedPointsEnabled;
239-
}
240-
241220
public boolean isAttractToCenterEnabled() {
242221
return attractToCenterEnabled;
243222
}

diagram-util/src/test/java/com/powsybl/diagram/util/layout/algorithms/parameters/Atlas2ParametersTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Atlas2ParametersTest {
2424
double maxSpeedFactor = 12.45;
2525
double swingTolerance = 0.8;
2626
double maxGlobalSpeedIncreaseRatio = 1.69;
27-
boolean repulsionFromFixedPointsEnabled = false;
2827
boolean attractToCenterEnabled = false;
2928

3029
@Test
@@ -38,7 +37,6 @@ void checkBuilder() {
3837
.withMaxSpeedFactor(maxSpeedFactor)
3938
.withSwingTolerance(swingTolerance)
4039
.withMaxGlobalSpeedIncreaseRatio(maxGlobalSpeedIncreaseRatio)
41-
.withRepulsionFromFixedPointsEnabled(repulsionFromFixedPointsEnabled)
4240
.withAttractToCenterEnabled(attractToCenterEnabled)
4341
.build();
4442

@@ -50,7 +48,6 @@ void checkBuilder() {
5048
assertEquals(maxSpeedFactor, parameters.getMaxSpeedFactor());
5149
assertEquals(swingTolerance, parameters.getSwingTolerance());
5250
assertEquals(maxGlobalSpeedIncreaseRatio, parameters.getMaxGlobalSpeedIncreaseRatio());
53-
assertEquals(repulsionFromFixedPointsEnabled, parameters.isRepulsionFromFixedPointsEnabled());
5451
assertEquals(attractToCenterEnabled, parameters.isAttractToCenterEnabled());
5552
}
5653
}

0 commit comments

Comments
 (0)