Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
13b33141
Commit
13b33141
authored
Jun 27, 2019
by
Benedikt Zoennchen
Browse files
bug fix and test update.
parent
f50e2e76
Pipeline
#126944
passed with stages
in 109 minutes and 57 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereGui/tests/org/vadere/gui/postvisualization/TestTrajectory.java
View file @
13b33141
...
...
@@ -29,7 +29,7 @@ public class TestTrajectory extends TestCase {
@Override
protected
void
setUp
()
throws
Exception
{
pedestriansByStep
=
new
HashMap
<>();
List
<
Step
>
steps
=
Arrays
.
asList
(
new
Step
(
2
),
new
Step
(
4
),
new
Step
(
5
),
new
Step
(
7
));
List
<
Step
>
steps
=
Arrays
.
asList
(
new
Step
(
1
),
new
Step
(
4
),
new
Step
(
5
),
new
Step
(
7
));
List
<
Pedestrian
>
pedestrians
=
Arrays
.
asList
(
new
Pedestrian
(
new
AttributesAgent
(
1
),
new
Random
()),
new
Pedestrian
(
new
AttributesAgent
(
2
),
new
Random
()),
...
...
@@ -47,7 +47,7 @@ public class TestTrajectory extends TestCase {
@Test
public
void
testGetPedestrian
()
{
Trajectory
trajectory
=
new
Trajectory
(
pedestriansByStep
,
1
);
Trajectory
trajectory
=
new
Trajectory
(
pedestriansByStep
,
1
,
0.4
);
assertEquals
(
trajectory
.
getAgent
(
new
Step
(
3
)),
(
trajectory
.
getAgent
(
new
Step
(
2
))));
assertTrue
(
trajectory
.
getAgent
(
new
Step
(
3
)).
isPresent
());
assertEquals
(
trajectory
.
getAgent
(
new
Step
(
6
)),
(
trajectory
.
getAgent
(
new
Step
(
5
))));
...
...
@@ -66,8 +66,9 @@ public class TestTrajectory extends TestCase {
@Test
public
void
testGetPositionReverse
()
{
Trajectory
trajectory
=
new
Trajectory
(
pedestriansByStep
,
2
);
IntStream
.
rangeClosed
(
1
,
17
).
forEach
(
stepNumber
->
assertTrue
(
Trajectory
trajectory
=
new
Trajectory
(
pedestriansByStep
,
2
,
0.4
);
trajectory
.
fill
();
IntStream
.
rangeClosed
(
1
,
7
).
forEach
(
stepNumber
->
assertTrue
(
trajectory
.
getPositionsReverse
(
new
Step
(
stepNumber
)).
count
()
+
"!="
+
stepNumber
,
trajectory
.
getPositionsReverse
(
new
Step
(
stepNumber
)).
count
()
==
stepNumber
));
List
<
VPoint
>
reversePositions
=
trajectory
.
getPositionsReverse
(
new
Step
(
12
)).
collect
(
Collectors
.
toList
());
...
...
VadereSimulator/src/org/vadere/simulator/control/OfflineSimulation.java
View file @
13b33141
...
...
@@ -38,7 +38,7 @@ public class OfflineSimulation {
.
flatMap
(
entry
->
entry
.
getValue
().
stream
())
.
map
(
ped
->
ped
.
getId
())
.
distinct
()
.
map
(
id
->
new
Trajectory
(
pedestriansByStep
,
id
))
.
map
(
id
->
new
Trajectory
(
pedestriansByStep
,
id
,
vadere
.
getAttributesSimulation
().
getSimTimeStepLength
()
))
.
collect
(
Collectors
.
toMap
(
t
->
t
.
getPedestrianId
(),
t
->
t
));
topographyController
.
prepareTopography
();
...
...
VadereState/src/org/vadere/state/simulation/Step.java
View file @
13b33141
...
...
@@ -58,11 +58,7 @@ public class Step implements Comparable<Step> {
* @return the decremented step or this step (if this step is the minimal step).
*/
public
Step
decrement
()
{
if
(
stepNumber
>
MINIMAL_STEP
)
{
return
new
Step
(
stepNumber
-
1
);
}
else
{
return
this
;
}
return
new
Step
(
stepNumber
-
1
);
}
public
boolean
isGreaterThan
(
final
Step
step
)
{
...
...
VadereState/src/org/vadere/state/simulation/Trajectory.java
View file @
13b33141
...
...
@@ -55,11 +55,13 @@ public class Trajectory {
* since the complete {@link Map} <tt>pedestrianByStep</tt> has to be iterated for each
* pedestrian. A better way is to construct all {@link Trajectory} objects at once.
*
* @param pedestrianByStep container for a set of trajectories
* @param pedestrianId a specific and unique pedestrian id
* @param pedestrianByStep container for a set of trajectories
* @param pedestrianId a specific and unique pedestrian id
* @param simStepLengthInSec step length of one time step in seconds
*/
public
Trajectory
(
final
Map
<
Step
,
List
<
Agent
>>
pedestrianByStep
,
final
int
pedestrianId
)
{
public
Trajectory
(
final
Map
<
Step
,
List
<
Agent
>>
pedestrianByStep
,
final
int
pedestrianId
,
final
double
simStepLengthInSec
)
{
this
.
pedestrianId
=
pedestrianId
;
this
.
simStepLengthInSec
=
simStepLengthInSec
;
// create for each step that contains an pedestrian with the specific pedestrianId
this
.
trajectoryPoints
=
pedestrianByStep
.
entrySet
().
stream
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment