Commit 20bebdbd authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

Merge branch 'master' into...

Merge branch 'master' into 210-seed-test-fails-on-windows-worker-with-modulenotfounderror-no-module-named-vadere_analysis_tool
parents c9204916 5f66c434
Pipeline #93105 failed with stages
in 6 minutes and 34 seconds
......@@ -50,7 +50,7 @@ stages:
# runners do not support OpenCL.
script:
- mvn clean
- mvn -Dtest=!TestConvolution,!TestBitonicSort,!TestCLLinkedList,!TestCLOptimalStepsModel test
- mvn -Dtest=!TestConvolution,!TestBitonicSort,!TestCLLinkedList,!TestCLOptimalStepsModel,!TestLWJGL test
- python3 Tools/ContinuousIntegration/collect_line_and_branch_coverage.py
artifacts:
when: on_success
......
......@@ -6,6 +6,9 @@
### Added
- Added new scenario element `AbsorbingArea` to absorb agents immediately.
* The new scenario element can be selected in `TopographyCreator` via the "emergency exit" button.
* The new scenario element is also taken into account by `SettingsDialaog` and `TikzGenerator`.
- Configured 1-click-deployment in ".gitlab-ci.yml".
* In short: Vadere is packaged as a single ZIP file containing following build artifacts: README.md VadereModelTests/ VadereGui/target/vadere.jar VadereSimulator/target/vadere-console.jar
* Vadere is packaged for GNU/Linux and Microsoft Windows.
......
......@@ -13,7 +13,7 @@ research group at the [Munich University of Applied Sciences](https://www.hm.edu
[department for Computer Science and Mathematics](http://cs.hm.edu/).
However, we welcome contributions from external sources.
The Vadere framework includes a mesh generator for unstructured high-quality 2D meshes called **EikMesh** which is described [here](https://gitlab.lrz.de/vadere/vadere/wikis/eikmesh).
The Vadere framework includes a mesh generator for unstructured high-quality 2D meshes called **EikMesh** which is described [here](https://gitlab.lrz.de/vadere/vadere/wikis/eikmesh/Overview).
## Pipeline Status
......@@ -47,20 +47,22 @@ To execute the `.jar` files it is highly recommended to use Oracle Java 8.
* Java 8
* Maven 3.0
* Git
* OpenCL
* OpenCL (optional but recommended)
**Note:** Please, ensure that the Git executable can be found in the `PATH` variable of your operating system.
#### Install OpenCL
#### Install OpenCL (optional but recommended)
Vadere uses computer's video card to speed up some computations. Therefore, following OpenCL components must be installed:
Vadere uses computer's video card to speed up some computations. Therefore, following OpenCL components should be installed:
* the latest drivers for your OpenCL device(s)
* an OpenCL SDK
* the OpenCL Installable Client Driver loader also called ICD loader (Opencl.dll for Windows and libOpenCL.so for Linux)
* OpenCL Drivers for your device
Both should be offered by the vendor of your device. The device can be a CPU as well as a GPU (recommanded). For example if you have a NVIDIA GPU updating your drivers should be enough to install both components.
Vadere will search for the best device which is supported. On a desktop workstation this should be your video card (GPU). If there is no device Vadere will use a plain and slower Java-Implementation instead.
Please, use following instructions to set up the OpenCL components for your operating system:
* Windows: For further information using OpenCL on Windows [click here](https://streamcomputing.eu/blog/2015-03-16/how-to-install-opencl-on-windows/).
* Windows: For further information using OpenCL on Windows read the paragraph Running an OpenCL application [click here](https://streamcomputing.eu/blog/2015-03-16/how-to-install-opencl-on-windows/).
* OS X: OpenCL is pre-installed for OS X.
* Linux: Please refer to the installation manual of your Linux distribution.
* [Sources: OpenCL HowTo](https://wiki.tiker.net/OpenCLHowTo)
......
......@@ -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...
......@@ -306,6 +308,7 @@ TopographyCreator.btnTranslation.tooltip=Translate topography
TopographyCreator.btnElementTranslation.tooltip=Translate topography elements
TopographyCreator.btnInsertObstacle.tooltip=Obstacle
TopographyCreator.btnInsertTarget.tooltip=Target
TopographyCreator.btnInsertAbsorbingArea.tooltip=Absorbing Area
TopographyCreator.btnInsertSource.tooltip=Source
TopographyCreator.btnInsertStairs.tooltip=Stairs
TopographyCreator.btnErase.tooltip=Eraser
......@@ -314,7 +317,7 @@ TopographyCreator.btnSimplePolygon.label=Simple Polygon
TopographyCreator.btnCircle.label=Circle
TopographyCreator.btnRectangle.label=Rectangle
TopographyCreator.btnChecker.tooltip=Show Topography Checker Messages
TopographyCreator.btnMakro.tooltip=Generate not set IDs.
TopographyCreator.btnGenerateIds.tooltip=Generate missing Ids for sources, targets, ...
select_shape_tooltip=Select Shape
......
......@@ -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...
......@@ -298,6 +300,7 @@ TopographyCreator.btnCutTopography.tooltip=Szenario ausschneiden
TopographyCreator.btnInsertPedestrian.tooltip=Fu\u00dfg\u00e4nger
TopographyCreator.btnInsertObstacle.tooltip=Hindernis
TopographyCreator.btnInsertTarget.tooltip=Ziel
TopographyCreator.btnInsertAbsorbingArea.tooltip=Absorbierender Bereich
TopographyCreator.btnTopographyBound.tooltip=Topographie Grenze
TopographyCreator.btnTranslation.tooltip=Topographie verschieben
TopographyCreator.btnElementTranslation.tooltip=Elemente der Topography verschieben
......@@ -310,7 +313,7 @@ TopographyCreator.btnSimplePolygon.label=Einfaches Polygon
TopographyCreator.btnCircle.label=Kreis
TopographyCreator.btnRectangle.label=Rechteck
TopographyCreator.btnChecker.tooltip=Topography Linter Nachrichten
TopographyCreator.btnMakro.tooltip=Erzeuge nicht gesetzte IDs.
TopographyCreator.btnGenerateIds.tooltip=Erzeuge fehlende Ids f\u00fcr Quellen, Ziele, ...
# tab titles Topography creator / postvis
......
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();
......
......@@ -102,6 +102,9 @@ public abstract class DefaultModel<T extends DefaultConfig> extends Observable i
case TARGET:
c = getConfig().getTargetColor();
break;
case ABSORBING_AREA:
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;
......@@ -94,9 +87,9 @@ public class SettingsDialog extends JDialog {
// Layout definition for sub panels
FormLayout additionalLayout = new FormLayout("5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu", // col
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows
FormLayout colorLayout = new FormLayout("5dlu, pref, 2dlu, pref:grow, 2dlu, pref, 2dlu, pref, 5dlu", // col
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows
"5dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5dlu"); // rows
colorLayeredPane.setLayout(colorLayout);
additionalLayeredPane.setLayout(additionalLayout);
......@@ -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,8 +177,9 @@ 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));
cc.xy(2, 20));
final JButton bObstColor = new JButton(Messages.getString("SettingsDialog.btnEditColor.text"));
final JPanel pObstacleColor = new JPanel();
......@@ -220,12 +221,20 @@ public class SettingsDialog extends JDialog {
colorLayeredPane.add(pDensityColor, cc.xy(4, 10));
colorLayeredPane.add(bDensityColor, cc.xy(6, 10));
colorLayeredPane.add(new JSeparator(), cc.xyw(1, 12, 9));
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, 14, 9));
colorLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblPedTrajColor.text") + ":"),
cc.xyw(2, 14, 5));
colorLayeredPane.add(jComoboTargetIds, cc.xy(2, 16));
colorLayeredPane.add(pPedestrian, cc.xy(4, 16));
colorLayeredPane.add(bChange, cc.xy(6, 16));
cc.xyw(2, 16, 5));
colorLayeredPane.add(jComoboTargetIds, cc.xy(2, 18));
colorLayeredPane.add(pPedestrian, cc.xy(4, 18));
colorLayeredPane.add(bChange, cc.xy(6, 18));
final JButton bPedestrianNoTarget = new JButton(Messages.getString("SettingsDialog.btnEditColor.text"));
final JPanel pPedestrianNoTarget = new JPanel();
......@@ -234,8 +243,8 @@ public class SettingsDialog extends JDialog {
pPedestrianNoTarget.setPreferredSize(new Dimension(130, 20));
bPedestrianNoTarget.addActionListener(new ActionSetPedestrianWithoutTargetColor(
"Set Pedestrian without Target Color", model, pPedestrianNoTarget));
colorLayeredPane.add(pPedestrianNoTarget, cc.xy(4, 18));
colorLayeredPane.add(bPedestrianNoTarget, cc.xy(6, 18));
colorLayeredPane.add(pPedestrianNoTarget, cc.xy(4, 20));
colorLayeredPane.add(bPedestrianNoTarget, cc.xy(6, 20));
// 20 is free
......@@ -245,7 +254,7 @@ public class SettingsDialog extends JDialog {
model.config.setUseRandomPedestrianColors(!model.config.isUseRandomPedestrianColors());
model.notifyObservers();
});
colorLayeredPane.add(chRandomColors, cc.xyw(2, 22, 8));
colorLayeredPane.add(chRandomColors, cc.xyw(2, 24, 8));
additionalLayeredPane.add(chHideVoronoiDiagram, cc.xyw(2, 2, 5));
......@@ -253,19 +262,28 @@ 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));
JCheckBox chChowLogo = new JCheckBox(Messages.getString("SettingsDialog.chbLogo.text"));
chChowLogo.setSelected(model.config.isShowLogo());
chChowLogo.addItemListener(e -> {
model.config.setShowLogo(!model.config.isShowLogo());
model.notifyObservers();
});
additionalLayeredPane.add(chChowLogo, cc.xyw(2, 16, 5));
additionalLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblSnapshotDir.text") + ":"),
cc.xy(2, 14));
cc.xy(2, 18));
JTextField tSnapshotDir = new JTextField(
Preferences.userNodeForPackage(PostVisualisation.class).get("SettingsDialog.snapshotDirectory.path", "."));
tSnapshotDir.setEditable(false);
tSnapshotDir.setPreferredSize(new Dimension(130, 20));
additionalLayeredPane.add(tSnapshotDir, cc.xy(4, 14));
additionalLayeredPane.add(tSnapshotDir, cc.xy(4, 18));
final JButton bSnapshotDir = new JButton(Messages.getString("SettingsDialog.btnEditSnapshot.text"));
bSnapshotDir.addActionListener(new ActionSetSnapshotDirectory("Set Snapshot Directory", model, tSnapshotDir));
additionalLayeredPane.add(bSnapshotDir, cc.xy(6, 14));
additionalLayeredPane.add(bSnapshotDir, cc.xy(6, 18));
final JSpinner spinnerCellWidth = new JSpinner();
final SpinnerNumberModel sModelCellWidth = new SpinnerNumberModel(model.config.getGridWidth(),
......@@ -278,17 +296,8 @@ public class SettingsDialog extends JDialog {
});
additionalLayeredPane.add(new JLabel(Messages.getString("SettingsDialog.lblCellWidth.text") + ":"),
cc.xy(2, 16));
additionalLayeredPane.add(spinnerCellWidth, cc.xy(4, 16));
JCheckBox chChowLogo = new JCheckBox(Messages.getString("SettingsDialog.chbLogo.text"));
chChowLogo.setSelected(model.config.isShowLogo());
chChowLogo.addItemListener(e -> {
model.config.setShowLogo(!model.config.isShowLogo());
model.notifyObservers();
});
additionalLayeredPane.add(chChowLogo, cc.xyw(2, 18, 5));
cc.xy(2, 20));
additionalLayeredPane.add(spinnerCellWidth, cc.xy(4, 20));
mainPanel.add(getAdditionalOptionPanel(), cc.xy(2, 6));
......
......@@ -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());
}
......
......@@ -7,14 +7,7 @@ import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.components.view.DefaultRenderer;
import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.postvisualization.model.PostvisualizationModel;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.ScenarioElement;
import org.vadere.state.scenario.Source;
import org.vadere.state.scenario.Stairs;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.state.scenario.*;
import org.vadere.state.simulation.Step;
import org.vadere.state.simulation.Trajectory;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -125,6 +118,9 @@ public class TikzGenerator {
Color targetColor = model.getConfig().getTargetColor();
colorDefinitions += String.format(Locale.US, colorTextPattern, "TargetColor", targetColor.getRed(), targetColor.getGreen(), targetColor.getBlue());
Color absorbingAreaColor = model.getConfig().getAbsorbingAreaColor();
colorDefinitions += String.format(Locale.US, colorTextPattern, "AbsorbingAreaColor", absorbingAreaColor.getRed(), absorbingAreaColor.getGreen(), absorbingAreaColor.getBlue());
Color obstacleColor = model.getConfig().getObstacleColor();
colorDefinitions += String.format(Locale.US, colorTextPattern, "ObstacleColor", obstacleColor.getRed(), obstacleColor.getGreen(), obstacleColor.getBlue());
......@@ -197,6 +193,15 @@ public class TikzGenerator {
generatedCode += "% Targets (not enabled in config)\n";
}
if (config.isShowAbsorbingAreas()) {
generatedCode += "% Absorbing Areas\n";
for (AbsorbingArea absorbingArea : topography.getAbsorbingAreas()) {
generatedCode += String.format(Locale.US, "\\fill[AbsorbingAreaColor] %s;\n", generatePathForScenarioElement(absorbingArea));
}
} else {
generatedCode += "% Absorbing Areas (not enabled in config)\n";
}
if (config.isShowObstacles()) {
generatedCode += "% Obstacles\n";
for (Obstacle obstacle : topography.getObstacles()) {
......
......@@ -50,7 +50,7 @@ public class SettingsDialog extends org.vadere.gui.components.view.SettingsDialo
additionalLayeredPane.add(chCleanSnapshot, cc.xy(2, 6));
JCheckBox chShowEvacTimeColor = new JCheckBox(Messages.getString("PostVis.chShowEvacTimeColor.text"));
getColorLayeredPane().add(chShowEvacTimeColor, cc.xyw(2, 24, 8));
getColorLayeredPane().add(chShowEvacTimeColor, cc.xyw(2, 26, 8));
chShowEvacTimeColor.addItemListener(e -> {
model.config.setUseEvacuationTimeColor(!model.config.isUseEvacuationTimeColor());
......@@ -58,7 +58,7 @@ public class SettingsDialog extends org.vadere.gui.components.view.SettingsDialo
});
PedestrianColorPanel pedestrianColorPanel = new PedestrianColorPanel(model.getPedestrianColorTableModel());
getColorLayeredPane().add(pedestrianColorPanel, cc.xyw(2, 20, 8));
getColorLayeredPane().add(pedestrianColorPanel, cc.xyw(2, 22, 8));
......
......@@ -12,14 +12,7 @@ import org.vadere.gui.topographycreator.control.AttributeModifier;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.attributes.scenario.AttributesCar;
import org.vadere.state.attributes.scenario.AttributesTopography;
import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.ScenarioElement;
import org.vadere.state.scenario.Source;
import org.vadere.state.scenario.Stairs;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Teleporter;
import org.vadere.state.scenario.Topography;
import org.vadere.state.scenario.*;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
......@@ -42,6 +35,7 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
private LinkedList<Stairs> stairs;
private LinkedList<Source> sources;
private LinkedList<Target> targets;
private LinkedList<AbsorbingArea> absorbingAreas;
private Teleporter teleporter;
private LinkedList<ScenarioElement> topographyElements;
private AttributesTopography attributes;
......@@ -57,6 +51,7 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
stairs = new LinkedList<>();
sources = new LinkedList<>();
targets = new LinkedList<>();
absorbingAreas = new LinkedList<>();
topographyElements = new LinkedList<>();
attributes = new AttributesTopography();
}
......@@ -77,6 +72,7 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
}
sources = new LinkedList<>(topography.getSources());
targets = new LinkedList<>(topography.getTargets());
absorbingAreas = new LinkedList<>(topography.getAbsorbingAreas());
teleporter = topography.getTeleporter();
} catch (SecurityException | IllegalArgumentException e) {
e.printStackTrace();
......@@ -90,6 +86,7 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
topographyElements.addAll(pedestrians);
topographyElements.addAll(sources);
topographyElements.addAll(targets);
topographyElements.addAll(absorbingAreas);
}
/**
......@@ -133,6 +130,9 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
for (Target target : targets)
topography.addTarget(target);
for (AbsorbingArea absorbingArea : absorbingAreas)
topography.addAbsorbingArea(absorbingArea);
for (AgentWrapper pedestrian : pedestrians)
topography.addInitialElement(pedestrian.getAgentInitialStore());
......@@ -167,6 +167,8 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
return pedestrians.remove(element);
case TARGET:
return targets.remove(element);
case ABSORBING_AREA:
return absorbingAreas.remove(element);
case SOURCE:
return sources.remove(element);
default:
......@@ -222,12 +224,23 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
this.targets.add(target);
}
public void addAbsorbingArea(final AbsorbingArea absorbingArea) {
this.topographyElements.add(absorbingArea);
this.absorbingAreas.add(absorbingArea);
}
public Target removeLastTarget() {
Target target = targets.removeLast();
topographyElements.remove(target);
return target;
}
public AbsorbingArea removeLastAbsorbingArea() {
AbsorbingArea absorbingArea = absorbingAreas.removeLast();
topographyElements.remove(absorbingArea);
return absorbingArea;
}
public Source removeLastSource() {
Source source = sources.removeLast();
topographyElements.remove(source);
......@@ -274,6 +287,10 @@ public class TopographyBuilder implements Iterable<ScenarioElement> {
return targets.iterator();
}
public Iterator<AbsorbingArea> getAbsorbingAreaIterator() {
return absorbingAreas.iterator();
}
public Iterator<Source> getSourceIterator() {
return sources.iterator();
}
......
......@@ -196,6 +196,9 @@ public class TopographyCreatorModel extends DefaultModel implements IDrawPanelMo
case TARGET:
element = topographyBuilder.removeLastTarget();
break;
case ABSORBING_AREA:
element = topographyBuilder.removeLastAbsorbingArea();
break;
case TELEPORTER:
element = topographyBuilder.removeTeleporter();
break;
......@@ -294,6 +297,9 @@ public class TopographyCreatorModel extends DefaultModel implements IDrawPanelMo
case TARGET:
topographyBuilder.addTarget((org.vadere.state.scenario.Target) shape);
break;
case ABSORBING_AREA:
topographyBuilder.addAbsorbingArea((org.vadere.state.scenario.AbsorbingArea) shape);
break;
case TELEPORTER:
topographyBuilder.setTeleporter((org.vadere.state.scenario.Teleporter) shape);
break;
......
package org.vadere.gui.topographycreator.model;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesObstacle;
import org.vadere.state.attributes.scenario.AttributesSource;
import org.vadere.state.attributes.scenario.AttributesStairs;
import org.vadere.state.attributes.scenario.AttributesTarget;