Commit 04ddcb92 authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Remove parameter targetIds from PotentialFieldTarget (non-compiling state)

parent 21c602f4
......@@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map;
import org.vadere.simulator.models.potential.fields.PotentialFieldTarget;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -33,11 +32,11 @@ public class CentroidGroup implements Group {
this.id = id;
this.size = size;
this.potentialFieldTarget = potentialFieldTarget;
members = new ArrayList<Pedestrian>();
members = new ArrayList<>();
this.lastVision = new HashMap<Pedestrian, Map<Pedestrian, VPoint>>();
this.lostMembers = new LinkedList<Pedestrian>();
this.noVisionOfLeaderCount = new HashMap<Pedestrian, Integer>();
this.lastVision = new HashMap<>();
this.lostMembers = new LinkedList<>();
this.noVisionOfLeaderCount = new HashMap<>();
}
@Override
......@@ -199,10 +198,8 @@ public class CentroidGroup implements Group {
double result;
VPoint pedLocation = ped.getPosition();
double pedDistance = potentialFieldTarget.getTargetPotential(
ped.getTargets(), pedLocation, ped);
double centroidDistance = potentialFieldTarget.getTargetPotential(
ped.getTargets(), getCentroidOthers(ped), ped);
double pedDistance = potentialFieldTarget.getTargetPotential(pedLocation, ped);
double centroidDistance = potentialFieldTarget.getTargetPotential(getCentroidOthers(ped), ped);
result = centroidDistance - pedDistance;
......@@ -216,12 +213,10 @@ public class CentroidGroup implements Group {
public Pedestrian getLeader(Pedestrian ped) {
Pedestrian result = members.get(0);
double smallestDistance = potentialFieldTarget.getTargetPotential(
ped.getTargets(), result.getPosition(), ped);
double smallestDistance = potentialFieldTarget.getTargetPotential(result.getPosition(), ped);
for (Pedestrian p : members) {
double pedDistance = potentialFieldTarget.getTargetPotential(
ped.getTargets(), p.getPosition(), p);
double pedDistance = potentialFieldTarget.getTargetPotential(p.getPosition(), p);
if (pedDistance < smallestDistance) {
result = p;
smallestDistance = pedDistance;
......
......@@ -221,7 +221,7 @@ public class PedestrianOSM extends Pedestrian {
public double getPotential(VPoint newPos) {
double targetPotential = potentialFieldTarget.getTargetPotential(getTargets(), newPos, this);
double targetPotential = potentialFieldTarget.getTargetPotential(newPos, this);
double pedestrianPotential = potentialFieldPedestrian
.getAgentPotential(newPos, this, relevantPedestrians);
......@@ -239,7 +239,7 @@ public class PedestrianOSM extends Pedestrian {
// Getters...
public double getTargetPotential(VPoint pos) {
return potentialFieldTarget.getTargetPotential(getTargets(), pos, this);
return potentialFieldTarget.getTargetPotential(pos, this);
}
public PotentialFieldTarget getPotentialFieldTarget() {
......@@ -247,8 +247,7 @@ public class PedestrianOSM extends Pedestrian {
}
public Vector2D getTargetGradient(VPoint pos) {
return potentialFieldTarget.getTargetPotentialGradient(getTargets(),
pos, this);
return potentialFieldTarget.getTargetPotentialGradient(pos, this);
}
public Vector2D getObstacleGradient(VPoint pos) {
......
......@@ -50,7 +50,7 @@ public abstract class AbstractPotentialFieldTarget implements IPotentialTargetGr
*
*/
@Override
public double getTargetPotential(final List<Integer> targetIds, final VPoint pos, final Agent ped) {
public double getTargetPotential(final VPoint pos, final Agent ped) {
CellGrid potentialField;
Topography floor = topography;
......@@ -107,7 +107,7 @@ public abstract class AbstractPotentialFieldTarget implements IPotentialTargetGr
incY = 0;
}
List<Point> points = new LinkedList<Point>();
List<Point> points = new LinkedList<>();
points.add(gridPoint);
points.add(new Point(gridPoint.x + incX, gridPoint.y));
points.add(new Point(gridPoint.x + incX, gridPoint.y + incY));
......@@ -222,7 +222,7 @@ public abstract class AbstractPotentialFieldTarget implements IPotentialTargetGr
*/
@Override
public HashMap<Integer, CellGrid> getCellGrids() {
HashMap<Integer, CellGrid> map = new HashMap<Integer, CellGrid>();
HashMap<Integer, CellGrid> map = new HashMap<>();
for (Map.Entry<Integer, PotentialFieldAndInitializer> entry2 : targetPotentialFields
......
......@@ -8,7 +8,6 @@ import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesFloorField;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.util.geometry.Vector2D;
......@@ -59,7 +58,7 @@ public class PotentialFieldMultiTargetGrid<T extends Agent> extends AbstractPote
}
@Override
public Vector2D getTargetPotentialGradient(List<Integer> targetIds, VPoint pos, Agent ped) {
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
throw new UnsupportedOperationException("method not jet implemented.");
}
......
......@@ -50,7 +50,7 @@ public class PotentialFieldSingleTargetGrid extends AbstractPotentialFieldTarget
}
@Override
public Vector2D getTargetPotentialGradient(List<Integer> targetIds, VPoint pos, Agent ped) {
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
throw new UnsupportedOperationException("method not jet implemented.");
}
......
package org.vadere.simulator.models.potential.fields;
import java.util.List;
import org.vadere.simulator.control.ActiveCallback;
import org.vadere.simulator.models.Model;
import org.vadere.state.scenario.Agent;
......@@ -10,9 +9,7 @@ import org.vadere.util.geometry.shapes.VPoint;
public interface PotentialFieldTarget extends ActiveCallback, Model {
boolean needsUpdate();
double getTargetPotential(List<Integer> targetIds,
final VPoint pos, final Agent ped);
double getTargetPotential(final VPoint pos, final Agent ped);
Vector2D getTargetPotentialGradient(final List<Integer> targetIds,
final VPoint pos, final Agent ped);
Vector2D getTargetPotentialGradient(final VPoint pos, final Agent ped);
}
......@@ -53,8 +53,7 @@ public class PotentialFieldTargetGrid<T extends Agent> extends AbstractPotential
@Override
public Vector2D getTargetPotentialGradient(List<Integer> targetIds,
VPoint pos, Agent ped) {
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
throw new UnsupportedOperationException("gradient not yet implemented");
}
......
......@@ -44,8 +44,7 @@ public class PotentialFieldTargetRingExperiment implements IPotentialTargetGrid
* Afterwards, rate "pos" and check if it lies in the same direction as tangent vector.
*/
@Override
public double getTargetPotential(List<Integer> targetIds, VPoint pos,
Agent ped) {
public double getTargetPotential(VPoint pos, Agent ped) {
Vector2D pedestrian = new Vector2D(ped.getPosition());
Vector2D center = new Vector2D(attributes.getCenter());
......@@ -69,8 +68,7 @@ public class PotentialFieldTargetRingExperiment implements IPotentialTargetGrid
}
@Override
public Vector2D getTargetPotentialGradient(List<Integer> targetIds,
VPoint pos, Agent ped) {
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
Vector2D pedestrian = new Vector2D(ped.getPosition());
Vector2D center = new Vector2D(attributes.getCenter());
......
......@@ -126,7 +126,7 @@ public class PotentialFieldTargetQueuingGrid implements IPotentialTargetGrid, Dy
}
@Override
public double getTargetPotential(final List<Integer> targetIds, final VPoint pos, final Agent pedArgument) {
public double getTargetPotential(final VPoint pos, final Agent pedArgument) {
if (Pedestrian.class.isAssignableFrom(pedArgument.getClass()))
throw new IllegalArgumentException("Target grid can only handle type Pedestrian");
Pedestrian ped = (Pedestrian) pedArgument;
......@@ -134,14 +134,14 @@ public class PotentialFieldTargetQueuingGrid implements IPotentialTargetGrid, Dy
if (pedestrianAttitudeMap.containsKey(ped) && queues.stream().anyMatch(queue -> queue.isQueued(ped))) {
switch (pedestrianAttitudeMap.get(ped)) {
case COMPETITIVE:
return competitiveField.getTargetPotential(targetIds, pos, ped);
return competitiveField.getTargetPotential(pos, ped);
case GENTLE:
return gentleField.getTargetPotential(targetIds, pos, ped);
return gentleField.getTargetPotential(pos, ped);
default:
throw new IllegalArgumentException(ped + " is not contained in the attitude map.");
}
} else if (queues.stream().noneMatch(queue -> queue.isQueued(ped))) {
return competitiveField.getTargetPotential(targetIds, pos, ped);
return competitiveField.getTargetPotential(pos, ped);
} else {
logger.warn("ped is neither queued nor not-queued.");
return 0;
......@@ -149,7 +149,7 @@ public class PotentialFieldTargetQueuingGrid implements IPotentialTargetGrid, Dy
}
@Override
public Vector2D getTargetPotentialGradient(final List<Integer> targetIds, final VPoint pos, final Agent ped) {
public Vector2D getTargetPotentialGradient(final VPoint pos, final Agent ped) {
throw new UnsupportedOperationException("method not implemented jet.");
}
......
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