Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 6276a892 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Integrated new scenario element "AbsorbingArea" into "SimulationRenderer" and "SettingsDialog".

parent 6308a0f2
......@@ -229,6 +229,7 @@ SettingsDialog.chbHideVoronoiDiagram.text=Hide VoronoiDiagram
SettingsDialog.chbShowObstacles.text=Show Obstacles
SettingsDialog.chbShowTargets.text=Show Targets
SettingsDialog.chbShowSources.text=Show Sources
SettingsDialog.chbShowAbsorbingAreas.text=Show Absorbing Areas
SettingsDialog.chbShowStairs.text=Show Stairs
ProjectView.btnSnapshot.tooltip=Snapshot
ProjectView.btnPNGSnapshot.tooltip=PNG Snapshot
......@@ -269,6 +270,7 @@ SettingsDialog.lblPedTrajColor.text=Pedestrians & Trajectories
SettingsDialog.lblCellWidth.text=Cell Width
SettingsDialog.btnClose.text=Close
SettingsDialog.lblDensityColor.text=Density
SettingsDialog.lblAbsorbingAreaColor.text=Absorbing Area
SettingsDialog.lblStair.text=Stair
SettingsDialog.lblPedestrianNoTarget.text=Without Target (-1)
ProjectView.menuOpenFloorFieldFile.title=Add Floor Field File...
......
......@@ -225,6 +225,7 @@ SettingsDialog.chbHideVoronoiDiagram.text=Voronoi-Diagramm nicht anzeigen
SettingsDialog.chbShowObstacles.text=Hindernisse anzeigen
SettingsDialog.chbShowTargets.text=Ziele anzeigen
SettingsDialog.chbShowSources.text=Quellen anzeigen
SettingsDialog.chbShowAbsorbingAreas.text=Absorbierende Bereiche anzeigen
SettingsDialog.chbShowStairs.text=Treppen anzeigen
ProjectView.btnSnapshot.tooltip=Snapshot
ProjectView.btnPNGSnapshot.tooltip=PNG-Snapshot
......@@ -265,6 +266,7 @@ SettingsDialog.lblPedTrajColor.text=Fu\u00dfg\u00e4nger & Trajektorien
SettingsDialog.lblCellWidth.text=Zellbreite
SettingsDialog.btnClose.text=Schlie\u00dfen
SettingsDialog.lblDensityColor.text=Dichte
SettingsDialog.lblAbsorbingAreaColor.text=Absorbierender Bereich
SettingsDialog.lblStair.text=Treppe
SettingsDialog.lblPedestrianNoTarget.text=Ohne Ziel (-1)
SettingsDialog.menuOpenFloorFieldFile.title=Floor Field-Datei hinzuf\u00fcgen...
......
package org.vadere.gui.components.control.simulation;
import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel;
import javax.swing.*;
import java.awt.*;
public class ActionSetAbsorbingAreaColor extends ActionSetColor {
public ActionSetAbsorbingAreaColor(String name, SimulationModel<? extends DefaultSimulationConfig> model, JPanel coloredPanel) {
super(name, model, coloredPanel);
}
@Override
protected void saveColor(Color color) {
model.config.setAbsorbingAreaColor(color);
}
}
......@@ -6,6 +6,7 @@ public class DefaultConfig {
private Color obstacleColor = new Color(0.7f,0.7f,0.7f);
private Color sourceColor = new Color(0.3333333333333333f, 0.6588235294117647f, 0.40784313725490196f);
private Color targetColor = new Color(0.8666666666666667f, 0.51764705882352946f, 0.32156862745098042f);
private Color absorbingAreaColor = new Color(0.76863f,0.30588f, 0.32157f);
private Color densityColor = Color.RED;
private Color stairColor = new Color(0.5058823529411764f, 0.4470588235294118f, 0.6980392156862745f);
private Color pedestrianColor = new Color(0.2980392156862745f, 0.4470588235294118f, 0.7901960784313725f);
......@@ -16,6 +17,7 @@ public class DefaultConfig {
public DefaultConfig(final DefaultConfig config) {
this.sourceColor = config.sourceColor;
this.targetColor = config.targetColor;
this.absorbingAreaColor = config.absorbingAreaColor;
this.densityColor = config.densityColor;
this.obstacleColor = config.obstacleColor;
this.stairColor = config.stairColor;
......@@ -62,6 +64,15 @@ public class DefaultConfig {
setChanged();
}
public Color getAbsorbingAreaColor() {
return absorbingAreaColor;
}
public void setAbsorbingAreaColor(final Color absorbingAreaColor) {
this.absorbingAreaColor = absorbingAreaColor;
setChanged();
}
public void setDensityColor(final Color densityColor) {
this.densityColor = densityColor;
setChanged();
......
......@@ -103,7 +103,7 @@ public abstract class DefaultModel<T extends DefaultConfig> extends Observable i
c = getConfig().getTargetColor();
break;
case ABSORBING_AREA:
c = Color.RED;
c = getConfig().getAbsorbingAreaColor();
break;
default:
c = Color.RED;
......
......@@ -20,6 +20,7 @@ public class DefaultSimulationConfig extends DefaultConfig {
private boolean useRandomPedestrianColors = false;
private boolean showPedestrianIds = false;
private boolean showTargets = true;
private boolean showAbsorbingAreas = true;
private boolean showSources = true;
private boolean showObstacles = true;
private boolean showStairs = true;
......@@ -112,6 +113,10 @@ public class DefaultSimulationConfig extends DefaultConfig {
return showTargets;
}
public boolean isShowAbsorbingAreas() {
return showAbsorbingAreas;
}
public void setShowTargetPotentielFieldMesh(final boolean showTargetPotentielFieldMesh) {
this.showTargetPotentielFieldMesh = showTargetPotentielFieldMesh;
setChanged();
......@@ -135,6 +140,11 @@ public class DefaultSimulationConfig extends DefaultConfig {
setChanged();
}
public void setShowAbsorbingAreas(boolean showAbsorbingAreas) {
this.showAbsorbingAreas = showAbsorbingAreas;
setChanged();
}
public boolean isShowObstacles() {
return showObstacles;
}
......
......@@ -3,14 +3,7 @@ package org.vadere.gui.components.view;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import org.vadere.gui.components.control.simulation.ActionSetDensityColor;
import org.vadere.gui.components.control.simulation.ActionSetObstacleColor;
import org.vadere.gui.components.control.simulation.ActionSetPedestrianColor;
import org.vadere.gui.components.control.simulation.ActionSetPedestrianWithoutTargetColor;
import org.vadere.gui.components.control.simulation.ActionSetSnapshotDirectory;
import org.vadere.gui.components.control.simulation.ActionSetSourceColor;
import org.vadere.gui.components.control.simulation.ActionSetStairsColor;
import org.vadere.gui.components.control.simulation.ActionSetTargetColor;
import org.vadere.gui.components.control.simulation.*;
import org.vadere.gui.components.model.DefaultSimulationConfig;
import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.utils.Messages;
......@@ -113,6 +106,7 @@ public class SettingsDialog extends JDialog {
JCheckBox chShowObstacles = new JCheckBox((Messages.getString("SettingsDialog.chbShowObstacles.text")));
JCheckBox chShowTargets = new JCheckBox((Messages.getString("SettingsDialog.chbShowTargets.text")));
JCheckBox chShowSources = new JCheckBox((Messages.getString("SettingsDialog.chbShowSources.text")));
JCheckBox chShowAbsorbingAreas = new JCheckBox((Messages.getString("SettingsDialog.chbShowAbsorbingAreas.text")));
JCheckBox chShowStairs = new JCheckBox((Messages.getString("SettingsDialog.chbShowStairs.text")));
JCheckBox chShowPedIds = new JCheckBox((Messages.getString("SettingsDialog.chbShowPedestrianIds.text")));
......@@ -147,6 +141,12 @@ public class SettingsDialog extends JDialog {
model.notifyObservers();
});
chShowAbsorbingAreas.setSelected(model.config.isShowAbsorbingAreas());
chShowAbsorbingAreas.addItemListener(e -> {
model.config.setShowAbsorbingAreas(!model.config.isShowAbsorbingAreas());
model.notifyObservers();
});
chShowStairs.setSelected(model.config.isShowSources());
chShowStairs.addItemListener(e -> {
model.config.setShowStairs(!model.config.isShowStairs());
......@@ -177,6 +177,7 @@ public class SettingsDialog extends JDialog {
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblSource.text") + ":"), cc.xy(2, 6));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblStair.text") + ":"), cc.xy(2, 8));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblDensityColor.text") + ":"), cc.xy(2, 10));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblAbsorbingAreaColor.text") + ":"), cc.xy(2, 12));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblPedestrianNoTarget.text") + ":"),
cc.xy(2, 18));
......@@ -220,6 +221,14 @@ public class SettingsDialog extends JDialog {
colorLayeredPane.add(pDensityColor, cc.xy(4, 10));
colorLayeredPane.add(bDensityColor, cc.xy(6, 10));
final JButton bAbsorbingAreaColor = new JButton(Messages.getString("SettingsDialog.btnEditColor.text"));
final JPanel pAbsorbingAreaColor = new JPanel();
pAbsorbingAreaColor.setBackground(model.config.getAbsorbingAreaColor());
pAbsorbingAreaColor.setPreferredSize(new Dimension(130, 20));
bAbsorbingAreaColor.addActionListener(new ActionSetAbsorbingAreaColor("Set Absorbing Area Color", model, pAbsorbingAreaColor));
colorLayeredPane.add(pAbsorbingAreaColor, cc.xy(4, 12));
colorLayeredPane.add(bAbsorbingAreaColor, cc.xy(6, 12));
colorLayeredPane.add(new JSeparator(), cc.xyw(1, 12, 9));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblPedTrajColor.text") + ":"),
cc.xyw(2, 14, 5));
......@@ -253,7 +262,8 @@ public class SettingsDialog extends JDialog {
additionalLayeredPane.add(chShowTargets, cc.xyw(2, 6, 5));
additionalLayeredPane.add(chShowSources, cc.xyw(2, 8, 5));
additionalLayeredPane.add(chShowStairs, cc.xyw(2, 10, 5));
additionalLayeredPane.add(chShowPedIds, cc.xyw(2, 12, 5));
additionalLayeredPane.add(chShowAbsorbingAreas, cc.xyw(2, 12, 5));
additionalLayeredPane.add(chShowPedIds, cc.xyw(2, 14, 5));
additionalLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblSnapshotDir.text") + ":"),
cc.xy(2, 14));
......
......@@ -87,6 +87,10 @@ public abstract class SimulationRenderer extends DefaultRenderer {
renderScenarioElement(model.getTopography().getTargets(), graphics, model.config.getTargetColor());
}
if (model.config.isShowAbsorbingAreas()) {
renderScenarioElement(model.getTopography().getAbsorbingAreas(), graphics, model.config.getAbsorbingAreaColor());
}
if (model.config.isShowSources()) {
renderScenarioElement(model.getTopography().getSources(), graphics, model.config.getSourceColor());
}
......
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