Commit beffd272 authored by BZoennchen's avatar BZoennchen

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

parents bcd1d449 a303cac0
......@@ -2,10 +2,17 @@
**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
### 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).
- Draw also Voronoi diagram in `TikzGenerator`.
- 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
### 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)
### Pre-Built Releases
......@@ -46,23 +46,22 @@ The ZIP file contains:
### Run the Application
1. Start the Application: After building the application, you can start Vadere by running `java -jar VadereGui/target/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`).
Open a terminal and enter `path/to/openjdk/java -jar vadere-gui.jar`.
### Run Built-In Examples
With the following steps, you can run a simulation with one of the built-in examples from [VadereModelTests](VadereModelTests):
- start Vadere
- *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*
- select the scenario on the left and press *run selected scenario*
- Start Vadere
- Click *Project* > *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 tahe scenario on the left and press *run selected scenario*
## Build from Source
### Dependencies
* Java 11 (OpenJDK recommended)
* Java 11 or above (OpenJDK recommended)
* Maven 3.0
* Git
* OpenCL (optional but recommended)
......
......@@ -14,6 +14,7 @@ DeleteTestQuestionOne.text=Do you really want to delete this scenario?
DeleteTestQuestionMultiple.text=Do you really want to delete these scenarios?
DeleteTestQuestion.title=Delete scenario
Gui.DropAction.Error.text=Cannot import file!
Error.text=Error.
Clone.text=clone
Finished.text=Finished.
......@@ -328,7 +329,6 @@ TopographyCreator.btnGenerateIds.tooltip=Generate missing Ids for sources, targe
select_shape_tooltip=Select Shape
# tab titles Topography creator / postvis
Tab.Simulation.title=Simulation
Tab.Model.title=Model
......@@ -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.
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?
DeleteTestQuestionMultiple.text=Diese Szenarios wirklich l\u00F6schen?
DeleteTestQuestion.title=Szenario l\u00F6schen
Gui.DropAction.Error.text=Datei nicht importierbar!
Error.text=Fehler.
Clone.text=Klon
Finished.text=Fertig.
......@@ -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.
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;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.components.control.IViewportChangeListener;
import org.vadere.gui.components.control.JViewportChangeListener;
import org.vadere.gui.components.control.PanelResizeListener;
......@@ -23,20 +24,26 @@ import org.vadere.util.io.IOUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.dnd.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Observer;
import java.util.Optional;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import java.util.List;
/**
* Main Window of the new post visualization.
*
* @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 JToolBar toolbar;
private ScenarioPanel scenarioPanel;
......@@ -312,6 +319,9 @@ public class PostvisualizationWindow extends JPanel implements Observer {
getActionMap().put("deselect", new ActionDeselect(model, this, null));
repaint();
revalidate();
// Make "this" window a drop target ("this" also handles the drops).
new DropTarget(this, DnDConstants.ACTION_MOVE, this, true);
}
private void buildKeyboardShortcuts() {
......@@ -407,4 +417,99 @@ public class PostvisualizationWindow extends JPanel implements Observer {
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",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{
"name" : "floor_field_navigation_test_ok",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{
"name" : "01_unsupported_event_exception_for_unsupported_models",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "02_bang_event_one_agent",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "03_bang_event_multiple_agents",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "04_bang_event_one_agent_one_obstacle",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "05_bang_event_narrowed_street",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "06_bang_event_guimaraes_platz",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "01_wait_event_osm_sequential",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "02_wait_event_osm_event_driven",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "03_wait_event_recurring_osm_sequential",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "04_wait_in_area_event_osm_sequential",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "05_wait_in_area_event_bhm",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "06_bang_event_osm_sequential",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "07_bang_event_osm_event_driven",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "basic_1_chicken_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_1_chicken_gnm1_displaced",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_1_chicken_gnm2",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_2_density_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_3_1_wall_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_3_2_wall_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_3_3_wall_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_4_1_wall_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "basic_4_2_wall_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_01_pathway_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_04_flow_gnm1_025_h",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_04_flow_gnm1_050_h",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_04_flow_gnm1_075_h",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_04_flow_gnm1_100_h",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_04_flow_gnm1_125_h",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_05_react_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_06_corner_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_07_speeds_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_09_publicRoom_gnm1_2",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_09_publicRoom_gnm1_4",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_10_pathfinding_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_11_exitSelection_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_12_evacuation_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_13_stairs_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "rimea_14_selectRoute_gnm1",
"description" : "",
"release" : "0.10",
"release" : "1.0",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
......
{
"name" : "counterflow",
"description" : "",
"release" : "0.10",