Commit 21ad9c1d authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

Merge branch 'master' into 151_diff_origin

parents 184bdd82 e9873189
Pipeline #76228 failed with stages
in 46 minutes and 3 seconds
......@@ -46,6 +46,7 @@ VadereModelTests/TestOSM/output/*
VadereModelTests/TestOSM_Group/output/*
VadereModelTests/TestSFM/output/*
VadereModelTests/TestGNM/output/*
VadereModelTests/TestBHM/output/*
VadereModelTests/TestOVM/output/*
VadereModelTests/TestOSM/legacy/*
VadereModelTests/TestOSM_Group/legacy/*
......@@ -67,7 +68,7 @@ VadereGui/output/
#mac osx files
.DS_Store
#linux deskopt dotfiles
#linux desktop dotfiles
**/.directory
/VadereModelTests/TestStairs/output
/VadereModelTests/TestStairs/legacy
......@@ -13,6 +13,8 @@ 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/blob/master/VadereMeshing/README.md).
## Pipeline Status
| Branch | Pipeline Status | Coverage |
......
......@@ -4,7 +4,7 @@
# Note: script contains some print statements so that progress can be tracked
# a little bit while script is running in continuous integration pipeline.
# Wach out: call this script from root directory of project. E.g.
# Watch out: call this script from root directory of project. E.g.
#
# python Tools/my_script.py
......@@ -46,6 +46,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
failed_scenarios_with_exception = []
for i, scenario_file in enumerate(scenario_files):
try:
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
......@@ -96,6 +97,7 @@ def print_summary(passed_and_failed_scenarios):
print("Failed: {}".format(total_failed_scenarios))
if __name__ == "__main__":
long_running_scenarios = [
"basic_4_1_wall_gnm1",
"queueing",
......@@ -103,8 +105,10 @@ if __name__ == "__main__":
"rimea_11",
"TestSFM",
"thin_wall_and_closer_source_nelder_mead_ok",
"thin_wall_and_closer_source_pso_could_fail"
"thin_wall_and_closer_source_pso_could_fail",
"rimea_04_flow_osm1_550_up",
]
excluded_scenarios = ["TESTOVM", "output", "legacy"]
excluded_scenarios.extend(long_running_scenarios)
......
......@@ -297,6 +297,7 @@ TopographyCreator.btnCutTopography.tooltip=Cut Scenario
TopographyCreator.btnInsertPedestrian.tooltip=Pedestrian
TopographyCreator.btnTopographyBound.tooltip=Topography Bound
TopographyCreator.btnTranslation.tooltip=Translate topography
TopographyCreator.btnElementTranslation.tooltip=Translate topography elements
TopographyCreator.btnInsertObstacle.tooltip=Obstacle
TopographyCreator.btnInsertTarget.tooltip=Target
TopographyCreator.btnInsertSource.tooltip=Source
......
......@@ -293,6 +293,7 @@ TopographyCreator.btnInsertObstacle.tooltip=Hindernis
TopographyCreator.btnInsertTarget.tooltip=Ziel
TopographyCreator.btnTopographyBound.tooltip=Topographie Grenze
TopographyCreator.btnTranslation.tooltip=Topographie verschieben
TopographyCreator.btnElementTranslation.tooltip=Elemente der Topography verschieben
TopographyCreator.btnInsertSource.tooltip=Quelle
TopographyCreator.btnInsertStairs.tooltip=Treppen
TopographyCreator.btnErase.tooltip=Radierer
......
......@@ -174,12 +174,12 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
} else {
if (scenarioElement instanceof AgentWrapper) {
this.txtrTextfiletextarea.setText(
StateJsonConverter.serializeObject(((AgentWrapper) scenarioElement).getAgentInitialStore()));
StateJsonConverter.serializeObjectPretty(((AgentWrapper) scenarioElement).getAgentInitialStore()));
} else if (scenarioElement instanceof Pedestrian) {
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement));
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObjectPretty(scenarioElement));
} else {
this.txtrTextfiletextarea.setText(StateJsonConverter
.serializeObject(scenarioElement.getAttributes()));
.serializeObjectPretty(scenarioElement.getAttributes()));
}
}
}
......
......@@ -4,12 +4,15 @@ import java.awt.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.components.view.DefaultRenderer;
import org.vadere.gui.components.view.SimulationRenderer;
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.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
public class OnlinevisualizationRenderer extends SimulationRenderer {
......@@ -102,4 +105,18 @@ public class OnlinevisualizationRenderer extends SimulationRenderer {
}
}
}
/*
* This method should replace pedestrianPositions.get(ped.getId()).addFirst(ped.getPosition());
* However the simulation runs in an separated thread. Therefore, foot steps might be cleared
* before they can be drawn! Solution: deep clone of the topography, which is costly and difficult.
*/
private Stream<VPoint> getFootStepsPosition(@NotNull final Agent agent) {
if(agent instanceof Pedestrian) {
return ((Pedestrian) agent).getFootSteps().stream().map(footStep -> footStep.getStart());
}
else {
return Stream.of(agent.getPosition());
}
}
}
......@@ -111,7 +111,6 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
// to have fast access to the key values.
Map<Integer, Step> map = agentsByStep
.keySet().stream()
.sorted(stepComparator)
.collect(Collectors.toMap(s -> s.getStepNumber(), s -> s));
......
package org.vadere.gui.topographycreator.control;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.topographycreator.model.IDrawPanelModel;
import org.vadere.gui.topographycreator.model.TopographyCreatorModel;
import org.vadere.gui.topographycreator.view.ActionTranslateTopographyDialog;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import java.awt.event.ActionEvent;
import java.awt.geom.Rectangle2D;
import javax.swing.*;
import javax.swing.undo.UndoableEditSupport;
/**
* @author Benedikt Zoennchen
*/
public class ActionTranslateElements extends TopographyAction {
private TopographyAction action;
private final UndoableEditSupport undoableEditSupport;
public ActionTranslateElements(final String name,
final ImageIcon icon,
@NotNull final IDrawPanelModel<?> panelModel,
@NotNull final TopographyAction action,
@NotNull final UndoableEditSupport undoSupport) {
super(name, icon, panelModel);
this.action = action;
this.undoableEditSupport = undoSupport;
}
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(e);
TopographyCreatorModel model = (TopographyCreatorModel) getScenarioPanelModel();
ActionTranslateTopographyDialog dialog = new ActionTranslateTopographyDialog(0, 0);
if (dialog.getValue()){
double x = dialog.getX();
double y = dialog.getY();
TopographyCreatorModel topographyCreatorModel = (TopographyCreatorModel) getScenarioPanelModel();
topographyCreatorModel.translateElements(x, y);
undoableEditSupport.postEdit(new EditTranslateElements(topographyCreatorModel, x, y));
}
getScenarioPanelModel().notifyObservers();
}
}
package org.vadere.gui.topographycreator.control;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.topographycreator.model.TopographyCreatorModel;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
/**
* @author Benedikt Zoennchen
*/
public class EditTranslateElements extends AbstractUndoableEdit {
private static final long serialVersionUID = 5176192525116057658L;
private final TopographyCreatorModel panelModel;
private final double dx;
private final double dy;
public EditTranslateElements(@NotNull final TopographyCreatorModel panelModel,
final double dx,
final double dy) {
this.panelModel = panelModel;
this.dx = dx;
this.dy = dy;
}
@Override
public void undo() throws CannotUndoException {
panelModel.translateElements(-dx, -dy);
}
@Override
public void redo() throws CannotRedoException {
panelModel.translateTopography(dx, dy);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public boolean canRedo() {
return true;
}
@Override
public String getPresentationName() {
return "translate elements";
}
}
......@@ -335,12 +335,16 @@ public class TopographyCreatorModel extends DefaultModel implements IDrawPanelMo
public void translateTopography(final double x, final double y) {
double oldX = getTopographyBound().x;
double oldY = getTopographyBound().y;
topographyBuilder.translateElements(x - oldX, y - oldY);
translateElements(x - oldX, y - oldY);
setTopographyBound(new VRectangle(x, y, getTopographyBound().getWidth(), getTopographyBound().getHeight()));
setChanged();
}
public void translateElements(final double dx, final double dy) {
topographyBuilder.translateElements(dx, dy);
setChanged();
}
@Override
public VShape translate(final Point vector) {
VPoint worldVector = new VPoint(vector.x / getScaleFactor(), -vector.y / getScaleFactor());
......
......@@ -4,6 +4,7 @@ import org.vadere.gui.projectview.view.ProjectView;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.Locale;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
......@@ -22,7 +23,7 @@ public class ActionTranslateTopographyDialog {
public ActionTranslateTopographyDialog(final double x, double y){
this.textField = new JTextField(30);
this.textField.setText(String.format("%f, %f", x, y));
this.textField.setText(String.format(Locale.ENGLISH, "%f, %f", x, y));
this.textField.getDocument().addDocumentListener(new DialogListener());
this.valid = false;
this.x = x;
......
......@@ -31,6 +31,7 @@ import org.vadere.gui.topographycreator.control.ActionSelectSelectShape;
import org.vadere.gui.topographycreator.control.ActionSwitchCategory;
import org.vadere.gui.topographycreator.control.ActionSwitchSelectionMode;
import org.vadere.gui.topographycreator.control.ActionTopographyMakroMenu;
import org.vadere.gui.topographycreator.control.ActionTranslateElements;
import org.vadere.gui.topographycreator.control.ActionTranslateTopography;
import org.vadere.gui.topographycreator.control.ActionUndo;
import org.vadere.gui.topographycreator.control.ActionZoomIn;
......@@ -308,10 +309,14 @@ public class TopographyWindow extends JPanel {
new ImageIcon(Resources.class.getResource("/icons/topography_icon.png")),
panelModel, selectShape, undoSupport);
TopographyAction translateTopography =new ActionTranslateTopography("SetTopograpyBound",
TopographyAction translateTopography =new ActionTranslateTopography("TranslateTopography",
new ImageIcon(Resources.class.getResource("/icons/translation_icon.png")),
panelModel, selectShape, undoSupport);
TopographyAction translateElements =new ActionTranslateElements("TranslateElements",
new ImageIcon(Resources.class.getResource("/icons/translation_elements_icon.png")),
panelModel, selectShape, undoSupport);
/* Makros */
ActionTopographyMakroMenu actionTopographyMakroMenu =
new ActionTopographyMakroMenu("TopographyMakros",
......@@ -353,6 +358,7 @@ public class TopographyWindow extends JPanel {
addActionToToolbar(toolbar, maximizeAction, "TopographyCreator.btnMaximizeTopography.tooltip");
addActionToToolbar(toolbar, resizeTopographyBound, "TopographyCreator.btnTopographyBound.tooltip");
addActionToToolbar(toolbar, translateTopography, "TopographyCreator.btnTranslation.tooltip");
addActionToToolbar(toolbar, translateElements, "TopographyCreator.btnElementTranslation.tooltip");
toolbar.addSeparator(new Dimension(5, 50));
addActionToToolbar(toolbar, selectCutAction, "TopographyCreator.btnCutTopography.tooltip");
addActionToToolbar(toolbar, resetScenarioAction, "TopographyCreator.btnNewTopography.tooltip");
......
# EikMesh
TODO
\ No newline at end of file
......@@ -53,6 +53,16 @@
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.tests.TestPedestrianWaitingTimeProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesTestPedestrianWaitingTimeProcessor",
"attributes" : {
"expectedResult" : "SUCCESS",
"pedestrianWaitingTimeProcessorId" : 2,
"maximalWaitingTime" : 0.0,
"minimalWaitingTime" : 0.0
}
} ],
"isTimestamped" : true
},
......
......@@ -78,7 +78,7 @@
"finishTime" : 400.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
......
......@@ -102,6 +102,11 @@ public class BehaviouralHeuristicsModel implements MainModel {
@Override
public void update(final double simTimeInSec) {
// all those foot steps are done in previous sim time steps
for(PedestrianBHM ped : pedestrianEventsQueue) {
ped.clearFootSteps();
}
// event driven update
if (!pedestrianEventsQueue.isEmpty()) {
while (pedestrianEventsQueue.peek().getTimeOfNextStep() < simTimeInSec) {
......
......@@ -13,6 +13,7 @@ import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.geometry.shapes.Vector2D;
import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -152,9 +153,11 @@ public class PedestrianBHM extends Pedestrian {
updateTargetDirection();
this.nextPosition = navigation.getNavigationPosition();
VPoint position = getPosition();
makeStep();
getFootSteps().add(new FootStep(position, getPosition(), timeOfNextStep, timeOfNextStep + durationNextStep));
this.timeOfNextStep = timeOfNextStep + durationNextStep;
}
......
......@@ -3,6 +3,7 @@ package org.vadere.simulator.models.bmm;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.vadere.annotation.factories.models.ModelClass;
......@@ -15,6 +16,7 @@ import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
......@@ -92,6 +94,8 @@ public class BiomechanicsModel implements MainModel {
public void update(final double simTimeInSec) {
double deltaTime = simTimeInSec - lastSimTimeInSec;
List<VPoint> positions = pedestriansBMM.stream().map(ped -> ped.getPosition()).collect(Collectors.toList());
for (PedestrianBMM agent : pedestriansBMM) {
agent.update(simTimeInSec, deltaTime);
}
......@@ -104,6 +108,12 @@ public class BiomechanicsModel implements MainModel {
agent.reverseCollisions();
}
for(int i = 0; i < pedestriansBMM.size(); i++) {
PedestrianBMM agent = pedestriansBMM.get(i);
agent.clearFootSteps();
agent.getFootSteps().add(new FootStep(positions.get(i), agent.getPosition(), lastSimTimeInSec, simTimeInSec));
}
this.lastSimTimeInSec = simTimeInSec;
}
......
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