Commit ef457470 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck Committed by Daniel Lehmberg
Browse files

call fireChangeViewportEvent from awt Event Thread

parent b564e158
package org.vadere.gui.onlinevisualization.model;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collection;
......@@ -140,8 +141,12 @@ public class OnlineVisualizationModel extends SimulationModel<DefaultSimulationC
if (topography == null) {
topography = observationAreaSnapshot.scenario;
fireChangeViewportEvent(new Rectangle2D.Double(topography.getBounds().x, topography.getBounds().y,
topography.getBounds().width, topography.getBounds().height));
// recalculate GUI (fireChangeViewportEvent will synchronize on model which is also
// needed by some awt event. Therefore do this in EDT (Event Dispatching Thread)
EventQueue.invokeLater(() -> {
fireChangeViewportEvent(new Rectangle2D.Double(topography.getBounds().x, topography.getBounds().y,
topography.getBounds().width, topography.getBounds().height));
});
} else {
topography = observationAreaSnapshot.scenario;
}
......
......@@ -247,9 +247,9 @@ public class Simulation {
}
preLoop();
logger.info("preLoop finished.");
while (isRunSimulation) {
synchronized (this) {
while (isPaused) {
try {
......
Supports Markdown
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