Commit 8b1d0310 authored by BZoennchen's avatar BZoennchen

issue#277 fix synchronization problem where the OnlineVis InofPanel is out of...

issue#277 fix synchronization problem where the OnlineVis InofPanel is out of sync with the OnlineVis model.
parent 624ce491
Pipeline #174785 failed with stages
in 85 minutes and 52 seconds
......@@ -109,7 +109,8 @@ public class OnlineVisualization implements PassiveCallback {
@Override
public void postUpdate(double simTimeInSec) {
pushDrawData(simTimeInSec);
this.model.notifyObservers();
model.popDrawData();
model.notifyObservers();
}
/**
......
......@@ -34,9 +34,7 @@ public class OnlinevisualizationRenderer extends SimulationRenderer {
@Override
public void render(final Graphics2D targetGraphics2D, int x, int y, int width, int height) {
synchronized (model.getDataSynchronizer()) {
if (model.popDrawData()) {
super.render(targetGraphics2D, x, y, width, height);
}
super.render(targetGraphics2D, x, y, width, height);
}
}
......@@ -44,9 +42,7 @@ public class OnlinevisualizationRenderer extends SimulationRenderer {
@Override
public void render(final Graphics2D targetGraphics2D, int width, int height) {
synchronized (model.getDataSynchronizer()) {
if (model.popDrawData()) {
super.render(targetGraphics2D, width, height);
}
super.render(targetGraphics2D, width, height);
}
}
......
......@@ -28,6 +28,7 @@ import org.vadere.util.geometry.shapes.VCircle;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.*;
import java.util.stream.Collectors;
public class PedestrianOSM extends Pedestrian {
......@@ -106,6 +107,30 @@ public class PedestrianOSM extends Pedestrian {
this.strides = new LinkedList<>();
}
private PedestrianOSM(@NotNull final PedestrianOSM other) {
super(other);
this.attributesOSM = other.attributesOSM;
this.topography = other.topography;
this.potentialFieldTarget = other.potentialFieldTarget;
this.potentialFieldObstacle = other.potentialFieldObstacle;
this.potentialFieldPedestrian = other.potentialFieldPedestrian;
this.combinedPotentialStrategy = other.combinedPotentialStrategy;
this.stepCircleOptimizer = other.stepCircleOptimizer;
this.speedAdjusters = new LinkedList<>(other.speedAdjusters);
this.stepSizeAdjusters = new LinkedList<>(other.stepSizeAdjusters);
this.relevantPedestrians = new ArrayList<>(other.relevantPedestrians);
this.timeOfNextStep = INVALID_NEXT_EVENT_TIME;
this.stepDeviation = other.stepDeviation;
this.stepLength = other.stepLength;
this.minStepLength = other.minStepLength;
this.lastPosition = other.lastPosition;
this.nextPosition = other.nextPosition;
this.strides = new LinkedList<>(other.strides);
this.random = other.random;
}
/*public void update(double timeStepInSec, double currentTimeInSec, CallMethod callMethod) {
double lastSimTimeInSec = currentTimeInSec - timeStepInSec;
......@@ -371,16 +396,7 @@ public class PedestrianOSM extends Pedestrian {
@Override
public PedestrianOSM clone() {
return new PedestrianOSM(attributesOSM,
getAttributes(),
topography,
random,
potentialFieldTarget,
potentialFieldObstacle,
potentialFieldPedestrian,
speedAdjusters,
stepCircleOptimizer
);
return new PedestrianOSM(this);
}
@Override
......
......@@ -68,13 +68,14 @@ public class Pedestrian extends Agent {
footstepHistory = new FootstepHistory(attributesAgent.getFootstepHistorySize());
}
private Pedestrian(Pedestrian other) {
protected Pedestrian(Pedestrian other) {
super(other);
idAsTarget = other.idAsTarget;
isChild = other.isChild;
isLikelyInjured = other.isLikelyInjured;
//TODO: @author Benedikt K. this is not a clone
psychology = new AttributesAgentPsychology();
psychology.setMostImportantStimulus(other.getMostImportantStimulus());
psychology.setSelfCategory(other.getSelfCategory());
......
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