Commit 679a6f50 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Bugfix OSM-Route Visualization (do not alter simulation settings)

parent 941fd777
......@@ -71,6 +71,14 @@ public abstract class AbstractLocalMovementStrategy implements
public static void setCalculationOfRouteSegments(boolean setting) {
calculateRouteSegments = setting;
}
/**
* For the visualization: programmatically check route segment
* calculation.
*/
public static boolean isCalculatingRouteSegments() {
return calculateRouteSegments;
}
/**
* If you intend to use the {@link RouteSensor} and operate on a per-segment
......
......@@ -21,11 +21,13 @@
package de.tud.kom.p2psim.impl.topology.movement.modularosm;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.geom.Point2D;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -71,6 +73,8 @@ public class ModularMovementModelViz extends JComponent
protected boolean showNodePositions = true;
protected boolean showTrajectories = false;
protected boolean setupCalculatesTrajectories = false;
private JMenu menu;
......@@ -131,19 +135,24 @@ public class ModularMovementModelViz extends JComponent
}
private JCheckBoxMenuItem createCheckboxTrajectories() {
setupCalculatesTrajectories = AbstractLocalMovementStrategy.isCalculatingRouteSegments();
final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(
"show node trajectories", showTrajectories);
checkBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
showTrajectories = checkBox.isSelected();
AbstractLocalMovementStrategy
.setCalculationOfRouteSegments(showTrajectories);
if (!setupCalculatesTrajectories) {
AbstractLocalMovementStrategy
.setCalculationOfRouteSegments(showTrajectories);
}
VisualizationInjector.invalidate();
}
});
AbstractLocalMovementStrategy
.setCalculationOfRouteSegments(showTrajectories);
if (!setupCalculatesTrajectories) {
AbstractLocalMovementStrategy
.setCalculationOfRouteSegments(showTrajectories);
}
return checkBox;
}
......@@ -216,6 +225,7 @@ public class ModularMovementModelViz extends JComponent
continue;
}
g2.setColor(Color.MAGENTA);
g2.setStroke(new BasicStroke(3.0f));
g2.drawLine(
VisualizationInjector
.scaleValue(lastLoc.getLongitude()),
......
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