Commit aed6fe63 authored by Julian Zobel's avatar Julian Zobel 🦄
Browse files

Square AP generator with radius, radius in AP constructor

parent c31d45dd
...@@ -64,6 +64,11 @@ public class AttractionPoint extends BasicAttractionPoint { ...@@ -64,6 +64,11 @@ public class AttractionPoint extends BasicAttractionPoint {
} }
} }
public AttractionPoint(String name, PositionVector posVec, double radius) {
this(name, posVec);
this.radius = radius;
}
public AttractionPoint(String name, PositionVector posVec, double weight, double radius, long pauseTimeMin, long pauseTimeMax) { public AttractionPoint(String name, PositionVector posVec, double weight, double radius, long pauseTimeMin, long pauseTimeMax) {
this(name, posVec); this(name, posVec);
......
...@@ -21,24 +21,24 @@ ...@@ -21,24 +21,24 @@
package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction; package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import de.tud.kom.p2psim.impl.topology.util.PositionVector; import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor; import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
/** /**
* Attraction Generator, providing 4 equidistant attraction points, i.e., in a square * Attraction Generator, providing 4 equidistant attraction points, i.e., in a square.
* *
* @author Julian Zobel * @author Julian Zobel
* @version 1.0, Nov 2018 * @version 1.0, Nov 2018
*/ */
public class EquidistantSquareAttractionGenerator extends AbstractAttractionProvider { public class EquidistantSquareAttractionGenerator extends AbstractAttractionProvider {
private PositionVector worldDimension;
private double squareSize; private double squareSize;
private double radius;
@XMLConfigurableConstructor({ "squareSize" }) @XMLConfigurableConstructor({ "squareSize", "radius" })
public EquidistantSquareAttractionGenerator(double squareSize) { public EquidistantSquareAttractionGenerator(double squareSize, double radius) {
this.squareSize = squareSize; this.squareSize = squareSize;
this.radius = radius;
createAttractionPoints(); createAttractionPoints();
} }
...@@ -56,16 +56,16 @@ public class EquidistantSquareAttractionGenerator extends AbstractAttractionProv ...@@ -56,16 +56,16 @@ public class EquidistantSquareAttractionGenerator extends AbstractAttractionProv
double y = worldDimension.getY() / 2; double y = worldDimension.getY() / 2;
PositionVector p1 = new PositionVector(x - squareSize, y - squareSize); PositionVector p1 = new PositionVector(x - squareSize, y - squareSize);
this.addAttractionPoint(new AttractionPoint("AP1", p1)); this.addAttractionPoint(new AttractionPoint("AP1", p1, radius));
PositionVector p2 = new PositionVector(x - squareSize, y + squareSize); PositionVector p2 = new PositionVector(x - squareSize, y + squareSize);
this.addAttractionPoint(new AttractionPoint("AP2", p2)); this.addAttractionPoint(new AttractionPoint("AP2", p2, radius));
PositionVector p3 = new PositionVector(x + squareSize, y - squareSize); PositionVector p3 = new PositionVector(x + squareSize, y - squareSize);
this.addAttractionPoint(new AttractionPoint("AP3", p3)); this.addAttractionPoint(new AttractionPoint("AP3", p3, radius));
PositionVector p4 = new PositionVector(x + squareSize, y + squareSize); PositionVector p4 = new PositionVector(x + squareSize, y + squareSize);
this.addAttractionPoint(new AttractionPoint("AP4", p4)); this.addAttractionPoint(new AttractionPoint("AP4", p4, radius));
} }
......
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