The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 8962a443 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Merge branch 'group_models' into develop

# Conflicts:
#	VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java
parents 9cad2a18 b1c53536
Pipeline #61709 passed with stage
in 51 seconds
...@@ -23,10 +23,12 @@ VadereSimulator/resources/current_commit_hash.txt ...@@ -23,10 +23,12 @@ VadereSimulator/resources/current_commit_hash.txt
#model test output #model test output
VadereModelTests/TestOSM/output/* VadereModelTests/TestOSM/output/*
VadereModelTests/TestOSM_Group/output/*
VadereModelTests/TestSFM/output/* VadereModelTests/TestSFM/output/*
VadereModelTests/TestGNM/output/* VadereModelTests/TestGNM/output/*
VadereModelTests/TestOVM/output/* VadereModelTests/TestOVM/output/*
VadereModelTests/TestOSM/processed output/* VadereModelTests/TestOSM/processed output/*
VadereModelTests/TestOSM_Group/processed output/*
VadereModelTests/TestSFM/processed output/* VadereModelTests/TestSFM/processed output/*
VadereModelTests/TestGNM/processed output/* VadereModelTests/TestGNM/processed output/*
VadereModelTests/TestOVM/processed output/* VadereModelTests/TestOVM/processed output/*
......
...@@ -217,6 +217,7 @@ PostVis.chbShowObstacles.text=Show Obstacles ...@@ -217,6 +217,7 @@ PostVis.chbShowObstacles.text=Show Obstacles
PostVis.chbShowTargets.text=Show Targets PostVis.chbShowTargets.text=Show Targets
PostVis.chbShowSources.text=Show Sources PostVis.chbShowSources.text=Show Sources
PostVis.chbShowStairs.text=Show Stairs PostVis.chbShowStairs.text=Show Stairs
PostVis.btnSnapshot.tooltip=Snapshot
PostVis.btnPNGSnapshot.tooltip=PNG Snapshot PostVis.btnPNGSnapshot.tooltip=PNG Snapshot
PostVis.btnSVGSnapshot.tooltip=SVG Snapshot PostVis.btnSVGSnapshot.tooltip=SVG Snapshot
PostVis.btnTikZSnapshot.tooltip=TikZ Snapshot PostVis.btnTikZSnapshot.tooltip=TikZ Snapshot
...@@ -255,6 +256,7 @@ SettingsDialog.menuOpenFloorFieldFile.title=Add Floor Field File... ...@@ -255,6 +256,7 @@ SettingsDialog.menuOpenFloorFieldFile.title=Add Floor Field File...
View.btnDrawVoronoiDiagram.tooltip=Draw and display a Voronoi Diagram View.btnDrawVoronoiDiagram.tooltip=Draw and display a Voronoi Diagram
View.chbLogo.text=Show the Vadere logo View.chbLogo.text=Show the Vadere logo
View.btnShowWalkingDirection.tooltip=Show the walking direction of all pedestrians View.btnShowWalkingDirection.tooltip=Show the walking direction of all pedestrians
View.btnShowGroupInformation.tooltip=Draw pedestrians within one group with same shape and color
View.btnShowPedestrian.tooltip=Show Pedestrians View.btnShowPedestrian.tooltip=Show Pedestrians
View.btnShowPotentialfield.tooltip=Show Potential Field (only possible after adding potential field file) View.btnShowPotentialfield.tooltip=Show Potential Field (only possible after adding potential field file)
View.btnShowTrajectories.tooltip=Show Trajectories View.btnShowTrajectories.tooltip=Show Trajectories
......
...@@ -217,9 +217,10 @@ PostVis.chbShowObstacles.text=Hindernisse anzeigen ...@@ -217,9 +217,10 @@ PostVis.chbShowObstacles.text=Hindernisse anzeigen
PostVis.chbShowTargets.text=Ziele anzeigen PostVis.chbShowTargets.text=Ziele anzeigen
PostVis.chbShowSources.text=Quellen anzeigen PostVis.chbShowSources.text=Quellen anzeigen
PostVis.chbShowStairs.text=Treppen anzeigen PostVis.chbShowStairs.text=Treppen anzeigen
PostVis.btnSnapshot.tooltip=Snapshot
PostVis.btnPNGSnapshot.tooltip=PNG-Snapshot PostVis.btnPNGSnapshot.tooltip=PNG-Snapshot
PostVis.btnSVGSnapshot.tooltip=SVG-Snapshot PostVis.btnSVGSnapshot.tooltip=SVG-Snapshot
PostVis.btnTikZSnapshot.tooltip=TikZ Snapshot PostVis.btnTikZSnapshot.tooltip=TikZ-Snapshot
PostVis.menuFile.title=Datei PostVis.menuFile.title=Datei
PostVis.menuSettings.title=Einstellungen PostVis.menuSettings.title=Einstellungen
PostVis.menuRecentFiles.title=K\u00FCrzlich verwendete Dateien PostVis.menuRecentFiles.title=K\u00FCrzlich verwendete Dateien
...@@ -255,6 +256,7 @@ SettingsDialog.menuOpenFloorFieldFile.title=Floor Field-Datei hinzuf\u00fcgen... ...@@ -255,6 +256,7 @@ SettingsDialog.menuOpenFloorFieldFile.title=Floor Field-Datei hinzuf\u00fcgen...
View.btnDrawVoronoiDiagram.tooltip=Voronoi-Diagramm zeichnen und anzeigen View.btnDrawVoronoiDiagram.tooltip=Voronoi-Diagramm zeichnen und anzeigen
View.chbLogo.text=VADERE-Logo anzeigen View.chbLogo.text=VADERE-Logo anzeigen
View.btnShowWalkingDirection.tooltip=Gehrichtung aller Fu\u00dfg\u00e4nger anzeigen View.btnShowWalkingDirection.tooltip=Gehrichtung aller Fu\u00dfg\u00e4nger anzeigen
View.btnShowGroupInformation.tooltip=Zeichne Fu\u00dfg\u00e4nger einer Gruppe mit denn selben Formen und Farben
View.btnShowPedestrian.tooltip=Fu\u00dfg\u00e4nger anzeigen View.btnShowPedestrian.tooltip=Fu\u00dfg\u00e4nger anzeigen
View.btnShowPotentialfield.tooltip=Potenzialfeld anzeigen (nur m\u00f6glich, nachdem eine Datei f\u00fcr das Potenzialfeld hinzugef\u00fcgt wurde) View.btnShowPotentialfield.tooltip=Potenzialfeld anzeigen (nur m\u00f6glich, nachdem eine Datei f\u00fcr das Potenzialfeld hinzugef\u00fcgt wurde)
View.btnShowTrajectories.tooltip=Trajektorien anzeigen View.btnShowTrajectories.tooltip=Trajektorien anzeigen
......
...@@ -22,6 +22,7 @@ public class DefaultSimulationConfig extends DefaultConfig { ...@@ -22,6 +22,7 @@ public class DefaultSimulationConfig extends DefaultConfig {
private boolean showTrajectories = false; private boolean showTrajectories = false;
private boolean showGrid = false; private boolean showGrid = false;
private boolean showDensity = false; private boolean showDensity = false;
private boolean showGroups = false;
protected final Color pedestrianDefaultColor = Color.BLUE; protected final Color pedestrianDefaultColor = Color.BLUE;
public DefaultSimulationConfig() { public DefaultSimulationConfig() {
...@@ -37,6 +38,15 @@ public class DefaultSimulationConfig extends DefaultConfig { ...@@ -37,6 +38,15 @@ public class DefaultSimulationConfig extends DefaultConfig {
this.showPedestrians = config.showPedestrians; this.showPedestrians = config.showPedestrians;
this.showLogo = config.showLogo; this.showLogo = config.showLogo;
this.showStairs = config.showStairs; this.showStairs = config.showStairs;
this.showGroups = config.showGroups;
}
public boolean isShowGroups() {
return showGroups;
}
public void setShowGroups(boolean showGroups) {
this.showGroups = showGroups;
} }
public boolean isShowLogo() { public boolean isShowLogo() {
......
...@@ -106,8 +106,7 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen ...@@ -106,8 +106,7 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
} }
@Override @Override
public void removeUpdate(DocumentEvent e) public void removeUpdate(DocumentEvent e) {
{
updateModel(); updateModel();
} }
...@@ -186,8 +185,8 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen ...@@ -186,8 +185,8 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
} else if (scenarioElement instanceof Pedestrian) { } else if (scenarioElement instanceof Pedestrian) {
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement)); this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement));
} else { } else {
this.txtrTextfiletextarea.setText(StateJsonConverter this.txtrTextfiletextarea.setText(StateJsonConverter
.serializeObject(scenarioElement.getAttributes())); .serializeObject(scenarioElement.getAttributes()));
} }
} }
} }
......
...@@ -16,6 +16,7 @@ import org.vadere.gui.components.model.SimulationModel; ...@@ -16,6 +16,7 @@ import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.CLGaussianCalculator; import org.vadere.gui.components.utils.CLGaussianCalculator;
import org.vadere.gui.components.utils.ColorHelper; import org.vadere.gui.components.utils.ColorHelper;
import org.vadere.gui.components.utils.Resources; import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.renderer.agent.AgentRender;
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.geometry.shapes.VTriangle; import org.vadere.util.geometry.shapes.VTriangle;
...@@ -35,12 +36,14 @@ public abstract class SimulationRenderer extends DefaultRenderer { ...@@ -35,12 +36,14 @@ public abstract class SimulationRenderer extends DefaultRenderer {
private ColorHelper colorHelper; private ColorHelper colorHelper;
private Color lastDensityColor = null; private Color lastDensityColor = null;
private int topographyId; private int topographyId;
private AgentRender agentRender;
public SimulationRenderer(final SimulationModel model) { public SimulationRenderer(final SimulationModel model) {
super(model); super(model);
this.model = model; this.model = model;
this.topographyId = -1; this.topographyId = -1;
this.colorHelper = new ColorHelper(40); this.colorHelper = new ColorHelper(40);
this.agentRender = new AgentRender(model);
} }
@Override @Override
...@@ -205,4 +208,12 @@ public abstract class SimulationRenderer extends DefaultRenderer { ...@@ -205,4 +208,12 @@ public abstract class SimulationRenderer extends DefaultRenderer {
private float getGridLineWidth() { private float getGridLineWidth() {
return (float) (0.5 / model.getScaleFactor()); return (float) (0.5 / model.getScaleFactor());
} }
public AgentRender getAgentRender() {
return agentRender;
}
public void setAgentRender(AgentRender agentRender) {
this.agentRender = agentRender;
}
} }
\ No newline at end of file
...@@ -36,7 +36,8 @@ public class OnlineVisualization implements PassiveCallback { ...@@ -36,7 +36,8 @@ public class OnlineVisualization implements PassiveCallback {
private OnlineVisualisationWindow onlineVisualisationPanel; private OnlineVisualisationWindow onlineVisualisationPanel;
private OnlineVisualizationModel model; private OnlineVisualizationModel model;
private Topography scenario; private Topography scenario;
private @Nullable IPotentialFieldTarget potentialFieldTarget; private @Nullable
IPotentialFieldTarget potentialFieldTarget;
private boolean enableVisualization; private boolean enableVisualization;
public OnlineVisualization(boolean enableVisualization) { public OnlineVisualization(boolean enableVisualization) {
......
...@@ -12,6 +12,7 @@ import org.vadere.gui.postvisualization.utils.SVGGenerator; ...@@ -12,6 +12,7 @@ import org.vadere.gui.postvisualization.utils.SVGGenerator;
import org.vadere.gui.postvisualization.utils.TikzGenerator; import org.vadere.gui.postvisualization.utils.TikzGenerator;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -25,7 +26,7 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang ...@@ -25,7 +26,7 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang
private final SimulationModel<? extends DefaultSimulationConfig> model; private final SimulationModel<? extends DefaultSimulationConfig> model;
public ActionGenerateTikz(final String name, final Icon icon, final SimulationRenderer renderer, public ActionGenerateTikz(final String name, final Icon icon, final SimulationRenderer renderer,
final SimulationModel<? extends DefaultSimulationConfig> model) { final SimulationModel<? extends DefaultSimulationConfig> model) {
super(name, icon); super(name, icon);
this.tikzGenerator = new TikzGenerator(renderer, model); this.tikzGenerator = new TikzGenerator(renderer, model);
this.model = model; this.model = model;
...@@ -55,5 +56,6 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang ...@@ -55,5 +56,6 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang
} }
@Override @Override
public void update(SimulationRenderer renderer) {} public void update(SimulationRenderer renderer) {
}
} }
package org.vadere.gui.onlinevisualization.control;
import org.vadere.gui.postvisualization.control.ActionVisualization;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.List;
import javax.swing.*;
public class ActionOnlineVisMenu extends AbstractAction {
private final List<Action> actions;
private JPopupMenu menu;
private Component parent;
public ActionOnlineVisMenu(final String name, Icon icon, final List<Action> actions) {
super(name, icon);
this.actions = actions;
}
public void setParent(Component parent) {
this.parent = parent;
}
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (menu == null) {
menu = new JPopupMenu();
for (Action action : actions) {
menu.add(action);
}
}
menu.show(parent, 0, parent.getHeight());
}
});
}
}
...@@ -3,8 +3,6 @@ package org.vadere.gui.onlinevisualization.view; ...@@ -3,8 +3,6 @@ package org.vadere.gui.onlinevisualization.view;
import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.FormLayout;
import javax.swing.*;
import org.vadere.gui.components.control.IViewportChangeListener; import org.vadere.gui.components.control.IViewportChangeListener;
import org.vadere.gui.components.control.JViewportChangeListener; import org.vadere.gui.components.control.JViewportChangeListener;
import org.vadere.gui.components.control.PanelResizeListener; import org.vadere.gui.components.control.PanelResizeListener;
...@@ -18,14 +16,18 @@ import org.vadere.gui.components.view.SimulationInfoPanel; ...@@ -18,14 +16,18 @@ import org.vadere.gui.components.view.SimulationInfoPanel;
import org.vadere.gui.onlinevisualization.control.ActionGeneratePNG; import org.vadere.gui.onlinevisualization.control.ActionGeneratePNG;
import org.vadere.gui.onlinevisualization.control.ActionGenerateSVG; import org.vadere.gui.onlinevisualization.control.ActionGenerateSVG;
import org.vadere.gui.onlinevisualization.control.ActionGenerateTikz; import org.vadere.gui.onlinevisualization.control.ActionGenerateTikz;
import org.vadere.gui.onlinevisualization.control.ActionOnlineVisMenu;
import org.vadere.gui.onlinevisualization.control.ActionShowPotentialField; import org.vadere.gui.onlinevisualization.control.ActionShowPotentialField;
import org.vadere.gui.onlinevisualization.model.OnlineVisualizationModel; import org.vadere.gui.onlinevisualization.model.OnlineVisualizationModel;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import javax.swing.*;
public class OnlineVisualisationWindow extends JPanel implements Observer { public class OnlineVisualisationWindow extends JPanel implements Observer {
private static final long serialVersionUID = 3522170593760789565L; private static final long serialVersionUID = 3522170593760789565L;
...@@ -102,6 +104,15 @@ public class OnlineVisualisationWindow extends JPanel implements Observer { ...@@ -102,6 +104,15 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
} }
}; };
AbstractAction showGroupInformationAction = new AbstractAction("showGroupInformationAction",
resources.getIcon("group.png", iconWidth, iconHeight)) {
@Override
public void actionPerformed(ActionEvent e) {
model.config.setShowGroups(!model.config.isShowGroups());
model.notifyObservers();
}
};
AbstractAction paintGridAction = new AbstractAction("paintGridAction", AbstractAction paintGridAction = new AbstractAction("paintGridAction",
resources.getIcon("grid.png", iconWidth, iconHeight)) { resources.getIcon("grid.png", iconWidth, iconHeight)) {
...@@ -139,20 +150,20 @@ public class OnlineVisualisationWindow extends JPanel implements Observer { ...@@ -139,20 +150,20 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
}; };
ActionGeneratePNG generatePNG = new ActionGeneratePNG( ActionGeneratePNG generatePNG = new ActionGeneratePNG(
"generatePNG", Messages.getString("PostVis.btnPNGSnapshot.tooltip"),
resources.getIcon("camera_png.png", iconWidth, iconHeight), resources.getIcon("camera_png.png", iconWidth, iconHeight),
new OnlinevisualizationRenderer(model), new OnlinevisualizationRenderer(model),
model); model);
ActionGenerateSVG generateSVG = new ActionGenerateSVG( ActionGenerateSVG generateSVG = new ActionGenerateSVG(
"generateSVG", Messages.getString("PostVis.btnSVGSnapshot.tooltip"),
resources.getIcon("camera_svg.png", iconWidth, iconHeight), resources.getIcon("camera_svg.png", iconWidth, iconHeight),
new OnlinevisualizationRenderer(model), new OnlinevisualizationRenderer(model),
model); model);
ActionGenerateTikz generateTikz = new ActionGenerateTikz( ActionGenerateTikz generateTikz = new ActionGenerateTikz(
"generateTikz", Messages.getString("PostVis.btnTikZSnapshot.tooltip"),
resources.getIcon("camera_tikz.png", iconWidth, iconHeight), resources.getIcon("camera_tikz.png", iconWidth, iconHeight),
new OnlinevisualizationRenderer(model), new OnlinevisualizationRenderer(model),
model); model);
...@@ -174,6 +185,8 @@ public class OnlineVisualisationWindow extends JPanel implements Observer { ...@@ -174,6 +185,8 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
Messages.getString("View.btnShowTrajectories.tooltip")); Messages.getString("View.btnShowTrajectories.tooltip"));
SwingUtils.addActionToToolbar(toolbar, paintArrowAction, SwingUtils.addActionToToolbar(toolbar, paintArrowAction,
Messages.getString("View.btnShowWalkingDirection.tooltip")); Messages.getString("View.btnShowWalkingDirection.tooltip"));
SwingUtils.addActionToToolbar(toolbar, showGroupInformationAction,
Messages.getString("View.btnShowGroupInformation.tooltip"));
toolbar.addSeparator(); toolbar.addSeparator();
...@@ -182,9 +195,18 @@ public class OnlineVisualisationWindow extends JPanel implements Observer { ...@@ -182,9 +195,18 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
toolbar.addSeparator(); toolbar.addSeparator();
SwingUtils.addActionToToolbar(toolbar, generatePNG, Messages.getString("PostVis.btnPNGSnapshot.tooltip")); ArrayList<Action> imgOptions = new ArrayList<>();
SwingUtils.addActionToToolbar(toolbar, generateSVG, Messages.getString("PostVis.btnSVGSnapshot.tooltip")); imgOptions.add(generatePNG);
SwingUtils.addActionToToolbar(toolbar, generateTikz, Messages.getString("PostVis.btnTikzSnapshot.tooltip")); imgOptions.add(generateSVG);
imgOptions.add(generateTikz);
ActionOnlineVisMenu imgDialog = new ActionOnlineVisMenu(
"camera_menu",
resources.getIcon("camera.png", iconWidth, iconHeight), imgOptions);
JButton imgMenuBtn =
SwingUtils.addActionToToolbar(toolbar, imgDialog, "PostVis.btnSnapshot.tooltip");
imgDialog.setParent(imgMenuBtn);
SwingUtils.addActionToToolbar(toolbar, showPotentialField, Messages.getString("OnlineVis.btnShowPotentialfield.tooltip")); SwingUtils.addActionToToolbar(toolbar, showPotentialField, Messages.getString("OnlineVis.btnShowPotentialfield.tooltip"));
add(toolbar, cc.xyw(2, 2, 3)); add(toolbar, cc.xyw(2, 2, 3));
...@@ -192,6 +214,9 @@ public class OnlineVisualisationWindow extends JPanel implements Observer { ...@@ -192,6 +214,9 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
scrollPane.setPreferredSize(new Dimension(1, windowHeight)); scrollPane.setPreferredSize(new Dimension(1, windowHeight));
add(jsonPanel, cc.xy(4, 4)); add(jsonPanel, cc.xy(4, 4));
add(infoPanel, cc.xyw(2, 6, 3)); add(infoPanel, cc.xyw(2, 6, 3));
repaint();
revalidate();
} }
@Override @Override
......
...@@ -8,6 +8,7 @@ import java.util.Map; ...@@ -8,6 +8,7 @@ import java.util.Map;
import org.vadere.gui.components.view.DefaultRenderer; import org.vadere.gui.components.view.DefaultRenderer;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.model.OnlineVisualizationModel; import org.vadere.gui.onlinevisualization.model.OnlineVisualizationModel;
import org.vadere.gui.renderer.agent.AgentRender;
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;
...@@ -55,10 +56,11 @@ public class OnlinevisualizationRenderer extends SimulationRenderer { ...@@ -55,10 +56,11 @@ public class OnlinevisualizationRenderer extends SimulationRenderer {
} }
private void renderPedestrians(final Graphics2D g) { private void renderPedestrians(final Graphics2D g) {
AgentRender agentRender = getAgentRender();
g.setColor(model.config.getPedestrianDefaultColor()); g.setColor(model.config.getPedestrianDefaultColor());
for (Agent ped : model.getAgents()) { for (Agent ped : model.getAgents()) {
VPoint position = ped.getPosition(); VPoint position = ped.getPosition();
g.fill(ped.getShape()); agentRender.render(ped, g);
if (!pedestrianPositions.containsKey(ped.getId())) { if (!pedestrianPositions.containsKey(ped.getId())) {
pedestrianPositions.put(ped.getId(), new LinkedList()); pedestrianPositions.put(ped.getId(), new LinkedList());
......
...@@ -8,6 +8,7 @@ import org.vadere.gui.postvisualization.utils.TikzGenerator; ...@@ -8,6 +8,7 @@ import org.vadere.gui.postvisualization.utils.TikzGenerator;
import org.vadere.gui.postvisualization.view.PostvisualizationRenderer; import org.vadere.gui.postvisualization.view.PostvisualizationRenderer;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
......
package org.vadere.gui.postvisualization.control;
import org.vadere.gui.postvisualization.model.PostvisualizationModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.List;
import javax.swing.*;
public class ActionVisualizationMenu extends ActionVisualization {
private final List<Action> actions;
private JPopupMenu menu;
private Component parent;
private final ActionVisualization action;
public ActionVisualizationMenu(String name, Icon icon, PostvisualizationModel model,
final ActionVisualization action,
final List<Action> actions) {
super(name, icon, model);
this.action = action;
this.actions = actions;
}
public ActionVisualizationMenu(String name, PostvisualizationModel model,
final ActionVisualization action,
final List<Action> actions) {
super(name, model);
this.action = action;
this.actions = actions;
}
public void setParent(Component parent) {
this.parent = parent;
}
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (menu == null) {
menu = new JPopupMenu();
for (Action action : actions) {
menu.add(action);
}
}
menu.show(parent, 0, parent.getHeight());
}
});
// action.actionPerformed(e);
}
}
...@@ -2,6 +2,7 @@ package org.vadere.gui.postvisualization.utils; ...@@ -2,6 +2,7 @@ package org.vadere.gui.postvisualization.utils;
import org.apache.log4j.LogManager; import org.apache.log4j.LogManager;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.components.model.DefaultSimulationConfig; import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel; import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.view.SimulationRenderer; import org.vadere.gui.components.view.SimulationRenderer;
...@@ -22,16 +23,14 @@ import static java.awt.geom.PathIterator.*; ...@@ -22,16 +23,14 @@ import static java.awt.geom.PathIterator.*;
* @see PathIterator This PathSeparator must be converted into its TikZ * @see PathIterator This PathSeparator must be converted into its TikZ
* representation.