Commit ba8e4f92 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Merge branch 'java_migration' into event_handling

parents 0bc321bd c8360445
Pipeline #94060 failed with stages
in 1 minute and 34 seconds
......@@ -27,13 +27,16 @@ How can you reproduce the issue?
Please, use code blocks (backticks) and if it is much text, encapsulate the text in `<details>` tag:
```
A short
code block
```
<details>
<summary>Expand file xy...</summary>
<summary>A long code block...</summary>
<pre>
```
Line 1 of log file xy`
Line 2 of log file xy`
```
</pre>
</details>
......
......@@ -201,6 +201,9 @@ AdjustPanel.lblVelocity.text=FPS
AdjustPanel.lblTime=Time
AdjustPanel.lblStep.text=Timestep
ProjectView.warning.lwjgl.title=Warning
ProjectView.warning.opencl.title=Warning
ProjectView.warning.opencl.text=OpenCL acceleration disabled.\nOpenCL is not supported on your machine.\nDriver updates might resolve the issue.
ProjectView.mntmOutputToSceneario.text=Generate scenario
ProjectView.mntmRunOutput.text=Run offline again
ProjectView.OpenInExplorer.text=Open in Explorer
......
......@@ -63,6 +63,9 @@ ProjectView.JSONSwitch.link=<u>Wechsle zum <b>{0}</b> Modus</u>
ProjectView.JSONDisplay.label=Keine Auswahl
ProjectView.btnAbout.tooltip=\u00dcber
ProjectView.about.title=\u00dcber
ProjectView.warning.lwjgl.title=Warnung
ProjectView.warning.opencl.title=Warnung
ProjectView.warning.opencl.text=OpenCL-Beschleunigung deaktiviert.\nEs konnte keine OpenCL Unterst\u00FCtzung gefunden werden.\nTreiber-Aktualisierung kann das Problem beheben.
ProjectView.title=Vadere
ProjectView.version= Version {0}
ProjectView.license.text=Dieses Software ist unter der {0} lizenziert
......
......@@ -6,12 +6,15 @@ import org.vadere.gui.projectview.view.ProjectView;
import org.vadere.util.io.IOUtils;
import org.vadere.util.logging.Logger;
import org.vadere.util.logging.StdOutErrLog;
import org.vadere.util.opencl.CLUtils;
import java.io.IOException;
import java.util.prefs.BackingStoreException;
import java.util.prefs.InvalidPreferencesFormatException;
import java.util.prefs.Preferences;
import javax.swing.*;
/**
* Entry point for the Vadere GUI.
*
......
package org.vadere.gui.projectview.view;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.postvisualization.control.Player;
import org.vadere.gui.projectview.VadereApplication;
......@@ -44,6 +45,7 @@ import org.vadere.simulator.projects.SingleScenarioFinishedListener;
import org.vadere.simulator.projects.VadereProject;
import org.vadere.util.io.IOUtils;
import org.vadere.util.logging.Logger;
import org.vadere.util.opencl.CLUtils;
import java.awt.*;
import java.awt.event.ActionEvent;
......@@ -263,9 +265,26 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
frame.setSize(1200, 800);
frame.openLastUsedProject(model);
checkDependencies(frame);
});
}
private static void checkDependencies(@NotNull final JFrame frame) {
try {
if(!CLUtils.isOpenCLSupported()) {
JOptionPane.showMessageDialog(frame,
Messages.getString("ProjectView.warning.opencl.text"),
Messages.getString("ProjectView.warning.opencl.title"),
JOptionPane.WARNING_MESSAGE);
}
} catch (UnsatisfiedLinkError linkError) {
JOptionPane.showMessageDialog(frame,
"[LWJGL]: " + linkError.getMessage(),
Messages.getString("ProjectView.warning.lwjgl.title"),
JOptionPane.WARNING_MESSAGE);
}
}
private void openLastUsedProject(final ProjectViewModel model) {
String lastUsedProjectPath =
Preferences.userNodeForPackage(VadereApplication.class).get("last_used_project", null);
......
......@@ -8,7 +8,7 @@
<version>0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>VadereGeometry</name>
<name>VadereMeshing</name>
<artifactId>meshing</artifactId>
<build>
......@@ -36,44 +36,6 @@
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<!-- Maven Surefire is used to cup unit tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<enableAssertions>true</enableAssertions>
<excludes>
<exclude></exclude>
</excludes>
<failIfNoTests>false</failIfNoTests>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
<version>0.0.5</version>
<executions>
<execution>
<id>unpacknatives</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
......
{
"name" : "rimea_14_select_route_pso",
"description" : "",
<<<<<<< HEAD:VadereModelTests/TestOSM/scenarios/rimea_14_selectRoute_osm1.scenario
"release" : "0.3",
=======
"release" : "0.6",
>>>>>>> master:VadereModelTests/TestOSM/scenarios/rimea_14_select_route_pso.scenario
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.MaxOverlapProcessor",
"id" : 3,
"attributesType" : "org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 2
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.NumberOverlapsProcessor",
"id" : 4,
"attributesType" : "org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 2
}
} ],
"isTimestamped" : true
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"attributesModel" : {
"org.vadere.state.attributes.models.AttributesFloorField" : {
"createMethod" : "HIGH_ACCURACY_FAST_MARCHING",
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
"obstacleDensityWeight" : 3.5,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT"
}
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" : 1,
"varyStepDirection" : false,
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"movementThreshold" : 0.0,
"optimizationType" : "PSO",
"movementType" : "ARBITRARY",
"dynamicStepLength" : false,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"minimumStepLength" : false,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
"submodels" : [ ]
},
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
}
},
"attributesSimulation" : {
"finishTime" : 100.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 1,
"simulationSeed" : 1
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 25.0,
"height" : 35.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true
},
"obstacles" : [ {
"shape" : {
"x" : 12.0,
"y" : 9.0,
"width" : 4.0,
"height" : 19.0,
"type" : "RECTANGLE"
},
"id" : -1
}, {
"shape" : {
"x" : 0.4,
"y" : 0.5,
"width" : 24.8,
"height" : 6.5,
"type" : "RECTANGLE"
},
"id" : -1
}, {
"shape" : {
"x" : 18.0,
"y" : 4.2,
"width" : 7.2,
"height" : 26.8,
"type" : "RECTANGLE"
},
"id" : -1
}, {
"shape" : {
"x" : 0.0,
"y" : 9.0,
"width" : 10.0,
"height" : 19.0,
"type" : "RECTANGLE"
},
"id" : -1
}, {
"shape" : {
"x" : 5.6,
"y" : 18.8,
"width" : 0.1,
"height" : 0.1,
"type" : "RECTANGLE"
},
"id" : -1
}, {
"shape" : {
"x" : 7.0,
"y" : 30.0,
"width" : 18.2,
"height" : 4.5,
"type" : "RECTANGLE"
},
"id" : -1
} ],
"stairs" : [ {
"shape" : {
"x" : 10.0,
"y" : 24.0,
"width" : 2.0,
"height" : 4.0,
"type" : "RECTANGLE"
},
"id" : 10,
"treadCount" : 12,
"upwardDirection" : {
"x" : 0.0,
"y" : 1.0
}
}, {
"shape" : {
"x" : 10.0,
"y" : 9.0,
"width" : 2.0,
"height" : 4.0,
"type" : "RECTANGLE"
},
"id" : 11,
"treadCount" : 12,
"upwardDirection" : {
"x" : 0.0,
"y" : -1.0
}
} ],
"targets" : [ {
"id" : 1,
"absorbing" : true,
"shape" : {
"x" : 0.5,
"y" : 7.1,
"width" : 1.5,
"height" : 1.8,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
"waitingTimeYellowPhase" : 0.0,
"parallelWaiters" : 0,
"individualWaiting" : true,
"deletionDistance" : 0.1,
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 1.0,
"y" : 29.0,
"width" : 5.0,
"height" : 5.0,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 100,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -9,7 +9,6 @@
<artifactId>simulator</artifactId>
<name>Vadere Simulator</name>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>tests</testSourceDirectory>
......@@ -39,10 +38,11 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>write_version_control_info_to_file</id>
<phase>validate</phase>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
......@@ -58,19 +58,6 @@
<outputFile>resources/current_commit_hash.txt</outputFile>
</configuration>
</plugin>
<plugin>
<groupId>com.nativelibs4java</groupId>
<artifactId>maven-javacl-plugin</artifactId>
<version>1.0.0-RC4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......@@ -87,20 +74,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<!-- Maven Surefire is used to cup unit tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<enableAssertions>true</enableAssertions>
<excludes>
<exclude></exclude>
</excludes>
<failIfNoTests>false</failIfNoTests>
</configuration>
</plugin>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default.
......@@ -130,56 +103,8 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.nativelibs4java
</groupId>
<artifactId>
maven-javacl-plugin
</artifactId>
<versionRange>
[1.0.0-RC4,)
</versionRange>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- local repository for all jars without an external repo -->
<repositories>
<repository>
<id>nativelibs4java</id>
<name>nativelibs4java Maven2 Repository</name>
<url>http://nativelibs4java.sourceforge.net/maven</url>
</repository>
</repositories>
<properties>
<platform.dependency>windows-x86_64</platform.dependency>
</properties>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
......
This diff is collapsed.
package org.vadere.simulator.control;
import org.vadere.simulator.control.events.EventController;
import org.vadere.simulator.control.factory.SourceControllerFactory;
import org.vadere.simulator.models.DynamicElementFactory;
import org.vadere.simulator.models.MainModel;
import org.vadere.simulator.models.Model;
import org.vadere.simulator.models.osm.PedestrianOSM;
import org.vadere.simulator.models.potential.PotentialFieldModel;
import org.vadere.simulator.models.potential.fields.IPotentialField;
import org.vadere.simulator.models.potential.fields.IPotentialFieldTarget;
import org.vadere.simulator.projects.ScenarioStore;
import org.vadere.simulator.projects.SimulationResult;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.state.attributes.AttributesSimulation;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.events.json.EventInfo;
import org.vadere.state.events.types.ElapsedTimeEvent;
import org.vadere.state.events.types.Event;
import org.vadere.state.events.types.EventTimeframe;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Source;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.util.logging.Logger;
import java.awt.geom.Rectangle2D;
import java.util.*;
public class Simulation {
private static Logger logger = Logger.getLogger(Simulation.class);
private final AttributesSimulation attributesSimulation;
private final AttributesAgent attributesAgent;
private final Collection<SourceController> sourceControllers;
private final Collection<TargetController> targetControllers;
private TeleporterController teleporterController;
private TopographyController topographyController;
private DynamicElementFactory dynamicElementFactory;
private final List<PassiveCallback> passiveCallbacks;
private List<Model> models;
private boolean runSimulation = false;
private boolean paused = false;
/**
* current simulation time (seconds)
*/
private double simTimeInSec = 0;
/**
* time (seconds) where the simulation starts
*/
private double startTimeInSec = 0;
/**
* time (seconds) that should be simulated, i.e. the final time is startTimeInSec + runTimeInSec
*/
private double runTimeInSec = 0;
private long lastFrameInMs = 0;
private int step = 0;
private SimulationState simulationState;
private String name;
private final ScenarioStore scenarioStore;
private final MainModel mainModel;
/** Hold the topography in an extra field for convenience. */
private final Topography topography;
private final ProcessorManager processorManager;
private final SourceControllerFactory sourceControllerFactory;
<<<<<<< HEAD
private final EventController eventController;
=======
private SimulationResult simulationResult;
>>>>>>> master
public Simulation(MainModel mainModel, double startTimeInSec, final String name, ScenarioStore scenarioStore,
List<PassiveCallback> passiveCallbacks, Random random, ProcessorManager processorManager, SimulationResult simulationResult) {
this.name = name;
this.mainModel = mainModel;
this.scenarioStore = scenarioStore;
this.attributesSimulation = scenarioStore.getAttributesSimulation();
this.attributesAgent = scenarioStore.getTopography().getAttributesPedestrian();
this.sourceControllers = new LinkedList<>();
this.targetControllers = new LinkedList<>();
this.topography = scenarioStore.getTopography();
this.runTimeInSec = attributesSimulation.getFinishTime();
this.startTimeInSec = startTimeInSec;
this.simTimeInSec = startTimeInSec;
this.simulationResult = simulationResult;
this.models = mainModel.getSubmodels();
this.sourceControllerFactory = mainModel.getSourceControllerFactory();
// TODO [priority=normal] [task=bugfix] - the attributesCar are missing in initialize' parameters
this.dynamicElementFactory = mainModel;
this.processorManager = processorManager;
this.passiveCallbacks = passiveCallbacks;
this.topographyController = new TopographyController(topography, dynamicElementFactory);
<<<<<<< HEAD