Commit f2ef599f authored by Julian Zobel's avatar Julian Zobel
Browse files

Allow node placement in modular movement model

parent 930bb6e9
......@@ -125,6 +125,8 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
protected Random rand = Randoms.getRandom(ModularMovementModel.class);
protected boolean placeNodesAtAP = false;
public ModularMovementModel() {
this.worldDimensions = Binder.getComponentOrNull(Topology.class)
.getWorldDimensions();
......@@ -132,6 +134,10 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
// scheduling initalization!
Event.scheduleImmediately(this, null, EVENT_INIT);
}
public void setPlaceNodes(boolean placeNodes) {
this.placeNodesAtAP = placeNodes;
}
/**
* This Method will be not called from the Components. So we call this
......@@ -173,6 +179,14 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
// strategy
for (SimLocationActuator ms : moveableHosts) {
attractionAssigment.addComponent(ms);
if(placeNodesAtAP) {
IAttractionPoint assignment = attractionAssigment.getAssignment(ms);
double apRadius = (assignment.hasRadius() ? Math.max(assignment.getRadius(), 25.0) : 25.0);
ms.updateCurrentLocation(this.addGaussianOffsetToPosition(new PositionVector(assignment), apRadius / 3));
attractionAssigment.updateTargetAttractionPoint(ms, assignment);
}
}
setTimeBetweenMoveOperations(timeBetweenMoveOperation);
......
......@@ -61,11 +61,7 @@ public class SocialGroupMovementModel extends ModularMovementModel {
private Set<SimLocationActuator> singleHosts = new LinkedHashSet<SimLocationActuator>();
private int numberOfSingleHosts;
private boolean placeNodesAtAP = false;
public void setPlaceNodes(boolean placeNodes) {
this.placeNodesAtAP = placeNodes;
}
@Override
public void initialize() {
......
......@@ -152,7 +152,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
delay = Time.MINUTE;
}
System.out.println(Time.getFormattedTime(delay) );
// System.out.println(Time.getFormattedTime(delay) );
Event.scheduleWithDelay(delay, new EventHandler() {
@Override
......
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