Commit beffd272 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

Merge branch 'master' of https://gitlab.lrz.de/vadere/vadere

parents bcd1d449 a303cac0
...@@ -2,10 +2,17 @@ ...@@ -2,10 +2,17 @@
**Note:** Before writing into this file, read the guidelines in [Writing Changelog Entries.md](Documentation/contributing/Writing Changelog Entries.md). **Note:** Before writing into this file, read the guidelines in [Writing Changelog Entries.md](Documentation/contributing/Writing Changelog Entries.md).
## In Progress: v0.7 ## In Progress:
### Added ### Added
### Changed
## v1.0 (2019-06-13)
### Added
- Open a trajectory file in the stand-alone application `vadere-postvis.jar` via drag and drop from file explorer.
- Scenario elements like obstacles and targets can now be resized using the mouse in the topography creator tab (first, select element via left-click and then move mouse to one of its edges to get the resize handles). - Scenario elements like obstacles and targets can now be resized using the mouse in the topography creator tab (first, select element via left-click and then move mouse to one of its edges to get the resize handles).
- Draw also Voronoi diagram in `TikzGenerator`. - Draw also Voronoi diagram in `TikzGenerator`.
- Added new scenario element `AbsorbingArea` to absorb agents immediately. - Added new scenario element `AbsorbingArea` to absorb agents immediately.
......
...@@ -26,7 +26,7 @@ The Vadere framework includes a mesh generator for unstructured high-quality 2D ...@@ -26,7 +26,7 @@ The Vadere framework includes a mesh generator for unstructured high-quality 2D
### Dependencies ### Dependencies
* Java 11 (OpenJDK recommended) * Java 11 or above (OpenJDK recommended -> see the official [Java website](https://jdk.java.net/))
* OpenCL (optional but recommended -> see the [install instructions](https://gitlab.lrz.de/vadere/vadere/tree/master/Documentation/installation/OpenCL-Installation.md) for details) * OpenCL (optional but recommended -> see the [install instructions](https://gitlab.lrz.de/vadere/vadere/tree/master/Documentation/installation/OpenCL-Installation.md) for details)
### Pre-Built Releases ### Pre-Built Releases
...@@ -46,23 +46,22 @@ The ZIP file contains: ...@@ -46,23 +46,22 @@ The ZIP file contains:
### Run the Application ### Run the Application
1. Start the Application: After building the application, you can start Vadere by running `java -jar VadereGui/target/vadere-gui.jar`. Open a terminal and enter `path/to/openjdk/java -jar vadere-gui.jar`.
2. (If you only want to use the Postvisualization-Tool you can do so by running `java -jar VadereGui/target/postvis.jar`).
### Run Built-In Examples ### Run Built-In Examples
With the following steps, you can run a simulation with one of the built-in examples from [VadereModelTests](VadereModelTests): With the following steps, you can run a simulation with one of the built-in examples from [VadereModelTests](VadereModelTests):
- start Vadere - Start Vadere
- *Project* > *Open* - Click *Project* > *Open*
- choose `vadere.project` of one of the projects e.g. [TestOSM](https://gitlab.lrz.de/vadere/vadere/tree/master/VadereModelTests/TestOSM) and click *open* - Choose `vadere.project` of one of the test projects, e.g. [TestOSM](https://gitlab.lrz.de/vadere/vadere/tree/master/VadereModelTests/TestOSM) and click *open*
- select the scenario on the left and press *run selected scenario* - Select tahe scenario on the left and press *run selected scenario*
## Build from Source ## Build from Source
### Dependencies ### Dependencies
* Java 11 (OpenJDK recommended) * Java 11 or above (OpenJDK recommended)
* Maven 3.0 * Maven 3.0
* Git * Git
* OpenCL (optional but recommended) * OpenCL (optional but recommended)
......
...@@ -14,6 +14,7 @@ DeleteTestQuestionOne.text=Do you really want to delete this scenario? ...@@ -14,6 +14,7 @@ DeleteTestQuestionOne.text=Do you really want to delete this scenario?
DeleteTestQuestionMultiple.text=Do you really want to delete these scenarios? DeleteTestQuestionMultiple.text=Do you really want to delete these scenarios?
DeleteTestQuestion.title=Delete scenario DeleteTestQuestion.title=Delete scenario
Gui.DropAction.Error.text=Cannot import file!
Error.text=Error. Error.text=Error.
Clone.text=clone Clone.text=clone
Finished.text=Finished. Finished.text=Finished.
...@@ -328,7 +329,6 @@ TopographyCreator.btnGenerateIds.tooltip=Generate missing Ids for sources, targe ...@@ -328,7 +329,6 @@ TopographyCreator.btnGenerateIds.tooltip=Generate missing Ids for sources, targe
select_shape_tooltip=Select Shape select_shape_tooltip=Select Shape
# tab titles Topography creator / postvis # tab titles Topography creator / postvis
Tab.Simulation.title=Simulation Tab.Simulation.title=Simulation
Tab.Model.title=Model Tab.Model.title=Model
...@@ -374,3 +374,5 @@ RunScenarioTopographyCheckerErrors.text=The simulation can't be started with err ...@@ -374,3 +374,5 @@ RunScenarioTopographyCheckerErrors.text=The simulation can't be started with err
RunScenarioNotReadyToRun.text=One or more of the selected scenarios isn't ready to run. RunScenarioNotReadyToRun.text=One or more of the selected scenarios isn't ready to run.
ActionEditScenarioDescription.menu.title=Edit description ActionEditScenarioDescription.menu.title=Edit description
Data.TrajectoryOrScenarioFile.NoData.text=No trajectory or scenario file found.
...@@ -13,6 +13,7 @@ DeleteTestQuestionSingle.text=Dieses Szenario wirklich l\u00F6schen? ...@@ -13,6 +13,7 @@ DeleteTestQuestionSingle.text=Dieses Szenario wirklich l\u00F6schen?
DeleteTestQuestionMultiple.text=Diese Szenarios wirklich l\u00F6schen? DeleteTestQuestionMultiple.text=Diese Szenarios wirklich l\u00F6schen?
DeleteTestQuestion.title=Szenario l\u00F6schen DeleteTestQuestion.title=Szenario l\u00F6schen
Gui.DropAction.Error.text=Datei nicht importierbar!
Error.text=Fehler. Error.text=Fehler.
Clone.text=Klon Clone.text=Klon
Finished.text=Fertig. Finished.text=Fertig.
...@@ -368,3 +369,5 @@ RunScenarioTopographyCheckerErrors.text=Die Simulation kann nicht mit einer fehl ...@@ -368,3 +369,5 @@ RunScenarioTopographyCheckerErrors.text=Die Simulation kann nicht mit einer fehl
RunScenarioNotReadyToRun.text=Eines oder mehrere der ausgew\u00e4hlten Szenario sind derzeit nicht lauff\u00e4hig. RunScenarioNotReadyToRun.text=Eines oder mehrere der ausgew\u00e4hlten Szenario sind derzeit nicht lauff\u00e4hig.
ActionEditScenarioDescription.menu.title=Beschreibung bearbeiten ActionEditScenarioDescription.menu.title=Beschreibung bearbeiten
Data.TrajectoryOrScenarioFile.NoData.text=Keine Trajektorien- oder Szenario-Datei gefunden.
\ No newline at end of file
...@@ -2,6 +2,7 @@ package org.vadere.gui.postvisualization.view; ...@@ -2,6 +2,7 @@ package org.vadere.gui.postvisualization.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 org.jetbrains.annotations.NotNull;
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;
...@@ -23,20 +24,26 @@ import org.vadere.util.io.IOUtils; ...@@ -23,20 +24,26 @@ import org.vadere.util.io.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.dnd.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Observer; import java.util.Observer;
import java.util.Optional;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import java.util.List;
/** /**
* Main Window of the new post visualization. * Main Window of the new post visualization.
* *
* @Version 1.0 * @Version 1.0
* *
*/ */
public class PostvisualizationWindow extends JPanel implements Observer { public class PostvisualizationWindow extends JPanel implements Observer, DropTargetListener {
private static final long serialVersionUID = -8177132133860336295L; private static final long serialVersionUID = -8177132133860336295L;
private JToolBar toolbar; private JToolBar toolbar;
private ScenarioPanel scenarioPanel; private ScenarioPanel scenarioPanel;
...@@ -312,6 +319,9 @@ public class PostvisualizationWindow extends JPanel implements Observer { ...@@ -312,6 +319,9 @@ public class PostvisualizationWindow extends JPanel implements Observer {
getActionMap().put("deselect", new ActionDeselect(model, this, null)); getActionMap().put("deselect", new ActionDeselect(model, this, null));
repaint(); repaint();
revalidate(); revalidate();
// Make "this" window a drop target ("this" also handles the drops).
new DropTarget(this, DnDConstants.ACTION_MOVE, this, true);
} }
private void buildKeyboardShortcuts() { private void buildKeyboardShortcuts() {
...@@ -407,4 +417,99 @@ public class PostvisualizationWindow extends JPanel implements Observer { ...@@ -407,4 +417,99 @@ public class PostvisualizationWindow extends JPanel implements Observer {
frame.pack(); frame.pack();
}); });
} }
// Methods for drop support of this window.
@Override
public void dragEnter(DropTargetDragEvent dtde) {
}
@Override
public void dragOver(DropTargetDragEvent dtde) {
}
@Override
public void dropActionChanged(DropTargetDragEvent dtde) {
}
@Override
public void dragExit(DropTargetEvent dte) {
}
@Override
public void drop(DropTargetDropEvent dtde) {
try{
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
List<File> fileList = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
// This is a robust solution, but user should be warned if multiple files are dropped.
for(File file : fileList){
openScenarioAndTrajectoryFile(file);
}
} catch (Exception ex){
JOptionPane.showMessageDialog(
this,
Messages.getString("Gui.DropAction.Error.text") + "\n"
+ ex.getMessage(),
Messages.getString("InformationDialogError.title"),
JOptionPane.ERROR_MESSAGE);
}
}
public void openScenarioAndTrajectoryFile(@NotNull File scenarioOrTrajectoryFile) {
resources.setProperty("SettingsDialog.outputDirectory.path", scenarioOrTrajectoryFile.getParent());
Preferences.userNodeForPackage(PostVisualisation.class).put("SettingsDialog.outputDirectory.path", scenarioOrTrajectoryFile.getParent());
try {
IOUtils.saveUserPreferences(PostVisualisation.preferencesFilename,
Preferences.userNodeForPackage(PostVisualisation.class));
} catch (IOException | BackingStoreException e1) {
e1.printStackTrace();
}
Runnable runnable = () -> {
Player.getInstance(model).stop();
final JFrame dialog = DialogFactory.createLoadingDialog();
dialog.setVisible(true);
try {
Player.getInstance(model).stop();
File parentDirectory = scenarioOrTrajectoryFile.getParentFile();
Optional<File> trajectoryFile =
IOUtils.getFirstFile(parentDirectory, IOUtils.TRAJECTORY_FILE_EXTENSION);
Optional<File> scenarioFile =
IOUtils.getFirstFile(parentDirectory, IOUtils.SCENARIO_FILE_EXTENSION);
if (trajectoryFile.isPresent() && scenarioFile.isPresent()) {
Scenario vadereScenario = IOOutput.readScenario(scenarioFile.get().toPath());
model.init(IOOutput.readTrajectories(trajectoryFile.get().toPath(), vadereScenario), vadereScenario, trajectoryFile.get().getParent());
model.notifyObservers();
dialog.dispose();
} else {
String errorMessage = String.format("%s\n%s\n%s", Messages.getString("Data.TrajectoryOrScenarioFile.NoData.text"),
trajectoryFile,
scenarioFile);
throw new IOException(errorMessage);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(
null,
e.getMessage(),
Messages.getString("InformationDialogFileError"),
JOptionPane.ERROR_MESSAGE);
}
// when loading is finished, make frame disappear
SwingUtilities.invokeLater(() -> dialog.dispose());
};
new Thread(runnable).start();
}
} }
{ {
"name" : "floor_field_navigation_test_displaced_ok", "name" : "floor_field_navigation_test_displaced_ok",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile", "type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{ {
"name" : "floor_field_navigation_test_ok", "name" : "floor_field_navigation_test_ok",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile", "type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{ {
"name" : "01_unsupported_event_exception_for_unsupported_models", "name" : "01_unsupported_event_exception_for_unsupported_models",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "02_bang_event_one_agent", "name" : "02_bang_event_one_agent",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "03_bang_event_multiple_agents", "name" : "03_bang_event_multiple_agents",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "04_bang_event_one_agent_one_obstacle", "name" : "04_bang_event_one_agent_one_obstacle",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "05_bang_event_narrowed_street", "name" : "05_bang_event_narrowed_street",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "06_bang_event_guimaraes_platz", "name" : "06_bang_event_guimaraes_platz",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "01_wait_event_osm_sequential", "name" : "01_wait_event_osm_sequential",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "02_wait_event_osm_event_driven", "name" : "02_wait_event_osm_event_driven",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "03_wait_event_recurring_osm_sequential", "name" : "03_wait_event_recurring_osm_sequential",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "04_wait_in_area_event_osm_sequential", "name" : "04_wait_in_area_event_osm_sequential",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "05_wait_in_area_event_bhm", "name" : "05_wait_in_area_event_bhm",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "06_bang_event_osm_sequential", "name" : "06_bang_event_osm_sequential",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "07_bang_event_osm_event_driven", "name" : "07_bang_event_osm_event_driven",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ { "files" : [ {
......
{ {
"name" : "basic_1_chicken_gnm1", "name" : "basic_1_chicken_gnm1",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ ],
......
{ {
"name" : "basic_1_chicken_gnm1_displaced", "name" : "basic_1_chicken_gnm1_displaced",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ ],
......
{ {
"name" : "basic_1_chicken_gnm2", "name" : "basic_1_chicken_gnm2",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ ],
......
{ {
"name" : "basic_2_density_gnm1", "name" : "basic_2_density_gnm1",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ ],
......
{ {
"name" : "basic_3_1_wall_gnm1", "name" : "basic_3_1_wall_gnm1",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ ],
......
{ {
"name" : "basic_3_2_wall_gnm1", "name" : "basic_3_2_wall_gnm1",
"description" : "", "description" : "",
"release" : "0.10", "release" : "1.0",
"commithash" : "warning: no commit hash", "commithash" : "warning: no commit hash",