Commit 11d5609e authored by hm-schuhba1's avatar hm-schuhba1

remove double move in UpdateSchemeEventDriven which produces duplicated...

remove double move in UpdateSchemeEventDriven which produces duplicated pedestrians in LinkedCellGrid.
parent c0be573d
......@@ -98,6 +98,12 @@ public class VadereConsole {
.dest("output-dir") // set name in namespace
.type(String.class)
.help("Supply different output directory path to use.");
scenarioRun.addArgument("--override-timestep-setting")
.dest("override-timestep-setting")
.required(false)
.setDefault(false)
.action(Arguments.storeTrue())
.help("This will ignore the TimestampSetting in the scenario file.");
scenarioRun.addArgument("--scenario-file", "-f")
.required(true)
......
......@@ -42,6 +42,7 @@ public class ScenarioRunSubCommand implements SubCommandRunner {
@Override
public void run(Namespace ns, ArgumentParser parser) {
Path outputDir = Paths.get(ns.getString("output-dir"));
boolean overrideTimeStepSetting = ns.getBoolean("override-timestep-setting");
String scenarioCheckerSwitch = ns.getString("scenario-checker");
if (!outputDir.toFile().exists()){
if ( ! outputDir.toFile().mkdirs() ) {
......@@ -64,7 +65,7 @@ public class ScenarioRunSubCommand implements SubCommandRunner {
try {
Scenario scenario = ScenarioFactory.createScenarioWithScenarioFilePath(scenarioFile);
if (checkScenario(scenario, scenarioCheckerSwitch)){
new ScenarioRun(scenario, outputDir.toFile().toString() , null).run();
new ScenarioRun(scenario, outputDir.toFile().toString() , overrideTimeStepSetting, null).run();
} else {
System.exit(-1);
}
......
......@@ -249,7 +249,7 @@ public class PedestrianOSM extends Pedestrian {
public void refreshRelevantPedestrians() {
VCircle reachableArea = new VCircle(getPosition(), getStepSize());
relevantPedestrians = potentialFieldPedestrian.getRelevantAgents(reachableArea, this, getTopography());
setRelevantPedestrians(potentialFieldPedestrian.getRelevantAgents(reachableArea, this, getTopography()));
}
......
......@@ -54,7 +54,6 @@ public class UpdateSchemeEventDriven implements UpdateSchemeOSM {
makeStep(topography, pedestrian, pedestrian.getDurationNextStep());
pedestrian.setTimeOfNextStep(pedestrian.getTimeOfNextStep() + pedestrian.getDurationNextStep());
topography.moveElement(pedestrian, oldPosition);
}
@Override
......
......@@ -66,8 +66,8 @@ public class PotentialFieldPedestrianOSM implements PotentialFieldAgent {
@Override
public Collection<Pedestrian> getRelevantAgents(VCircle relevantArea,
Agent pedestrian, Topography scenario) {
return scenario.getSpatialMap(Pedestrian.class)
Agent pedestrian, Topography topography) {
return topography.getSpatialMap(Pedestrian.class)
.getObjects(relevantArea.getCenter(),
attributes.getPedestrianRecognitionDistance());
}
......
......@@ -58,7 +58,7 @@ public class ScenarioRun implements Runnable {
}
public ScenarioRun(final Scenario scenario, final String outputDir, final RunnableFinishedListener scenarioFinishedListener) {
this(scenario, IOUtils.OUTPUT_DIR, false, scenarioFinishedListener);
this(scenario, outputDir, false, scenarioFinishedListener);
}
// if overwriteTimestampSetting is true do note use timestamp in output directory
......
......@@ -61,6 +61,8 @@ public class DynamicElementContainer<T extends DynamicElement> {
this.elementMap.put(element.getId(), element);
this.cellsElements.addObject(element);
assert (elementMap.size() == cellsElements.size());
for (DynamicElementAddListener<T> listener : addListener) {
listener.elementAdded(element);
}
......@@ -69,6 +71,7 @@ public class DynamicElementContainer<T extends DynamicElement> {
public synchronized void moveElement(T element, VPoint oldPosition) {
this.cellsElements.moveObject(element, oldPosition);
assert (elementMap.size() == cellsElements.size());
for (DynamicElementMoveListener<T> listener : moveListener) {
listener.elementMove(element);
}
......@@ -78,6 +81,7 @@ public class DynamicElementContainer<T extends DynamicElement> {
this.elementMap.remove(element.getId());
this.cellsElements.removeObject(element);
assert (elementMap.size() == cellsElements.size());
for (DynamicElementRemoveListener<T> listener : removeListener) {
listener.elementRemoved(element);
}
......
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