Commit 0d3494e7 authored by Julian Zobel's avatar Julian Zobel
Browse files

x and y for fixed ap

parent d251b7dc
......@@ -25,6 +25,7 @@ import de.tud.kom.p2psim.api.topology.Topology;
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.Binder;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint;
import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
/**
* Implementation of the interface {@link AttractionGenerator}.
......@@ -39,11 +40,19 @@ public class TwoPointFixedAttractionGenerator implements IAttractionGenerator {
private PositionVector worldDimension;
public TwoPointFixedAttractionGenerator() {
private double x1, x2, y1, y2;
@XMLConfigurableConstructor({ "x1", "y1", "x2", "y2"})
public TwoPointFixedAttractionGenerator(double x1, double y1, double x2, double y2) {
this.worldDimension = Binder.getComponentOrNull(Topology.class)
.getWorldDimensions();
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
createAttractionPoints();
}
......@@ -56,16 +65,16 @@ public class TwoPointFixedAttractionGenerator implements IAttractionGenerator {
}
private void createAttractionPoints() {
double x = worldDimension.getX();
double y = worldDimension.getY();
PositionVector p1 = new PositionVector(0 + 0.1 * x, y/2);
PositionVector p1 = new PositionVector(x1, y1);
AttractionPoint ap1 = new AttractionPointImpl("AP1", p1);
ap1.setRadius(100);
attractionPoints.add(ap1);
PositionVector p2 = new PositionVector(0.9 * x, y/2);
PositionVector p2 = new PositionVector(x2, y2);
AttractionPoint ap2 = new AttractionPointImpl("AP2", p2);
ap2.setRadius(100);
attractionPoints.add(ap2);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment