Commit 9c427f01 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

bugFix issue #47

parent 9e1a712b
package org.vadere.gui.components.model; package org.vadere.gui.components.model;
import java.awt.Point;
import java.util.Collection; import java.util.Collection;
import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import org.vadere.state.scenario.Agent; import org.vadere.state.scenario.Agent;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.math.InterpolationUtil;
import org.vadere.util.potential.CellGrid;
public abstract class SimulationModel<T extends DefaultSimulationConfig> extends DefaultModel { public abstract class SimulationModel<T extends DefaultSimulationConfig> extends DefaultModel {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile", "type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "out.txt", "filename" : "postvis.trajectories",
"processors" : [ 1 ] "processors" : [ 1 ]
} ], } ],
"processors" : [ { "processors" : [ {
......
...@@ -78,16 +78,19 @@ public abstract class OutputFile<K extends DataKey<K>> { ...@@ -78,16 +78,19 @@ public abstract class OutputFile<K extends DataKey<K>> {
} }
public void write() { public void write() {
try (PrintWriter out = new PrintWriter(new FileWriter(absoluteFileName))) { // if there is something to write i.e. absoluteFileName != null
printHeader(out); if(!isEmpty()) {
try (PrintWriter out = new PrintWriter(new FileWriter(absoluteFileName))) {
this.dataProcessors.stream().flatMap(p -> p.getKeys().stream()) printHeader(out);
.distinct().sorted()
.forEach(key -> printRow(out, key)); this.dataProcessors.stream().flatMap(p -> p.getKeys().stream())
.distinct().sorted()
out.flush(); .forEach(key -> printRow(out, key));
} catch (IOException ex) {
throw new UncheckedIOException(ex); out.flush();
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
} }
} }
......
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