Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
9f8b8855
Commit
9f8b8855
authored
Apr 18, 2020
by
Maxim Dudin
Browse files
added a minimal time for a contact to be counted, attribute is adjustable over json
parent
8917e4ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/PedestriansNearbyProcessor.java
View file @
9f8b8855
...
...
@@ -13,8 +13,7 @@ import org.vadere.state.scenario.Topography;
import
org.vadere.util.geometry.LinkedCellsGrid
;
import
org.vadere.util.geometry.shapes.VPoint
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -26,6 +25,7 @@ public class PedestriansNearbyProcessor extends DataProcessor<TimestepPedestrian
private
double
maxDistance
;
// todo adjustable with json
private
int
sampleEveryNthStep
;
private
int
allowedAbsenceTimestepsIfContactReturns
;
private
int
minTimespanOfContactTimesteps
;
public
PedestriansNearbyProcessor
()
{
...
...
@@ -54,6 +54,19 @@ public class PedestriansNearbyProcessor extends DataProcessor<TimestepPedestrian
}
}
@Override
public
void
postLoop
(
final
SimulationState
state
)
{
List
<
TimestepPedestriansNearbyIdKey
>
toBeRemoved
=
new
ArrayList
<>();
for
(
TimestepPedestriansNearbyIdKey
key
:
getKeys
())
{
if
(
getValue
(
key
).
getDurationTimesteps
()
<
minTimespanOfContactTimesteps
)
{
toBeRemoved
.
add
(
key
);
}
}
for
(
TimestepPedestriansNearbyIdKey
toRemove:
toBeRemoved
)
{
removeKey
(
toRemove
);
}
}
public
String
[]
toStrings
(
final
TimestepPedestriansNearbyIdKey
key
)
{
return
this
.
hasValue
(
key
)
?
this
.
getValue
(
key
).
toStrings
()
:
new
String
[]{
"N/A"
,
"N/A"
};
}
...
...
@@ -79,6 +92,7 @@ public class PedestriansNearbyProcessor extends DataProcessor<TimestepPedestrian
maxDistance
=
att
.
getMaxDistanceForANearbyPedestrian
();
sampleEveryNthStep
=
att
.
getSampleEveryNthStep
();
allowedAbsenceTimestepsIfContactReturns
=
att
.
getAllowedAbsenceTimestepsIfContactReturns
();
minTimespanOfContactTimesteps
=
att
.
getMinTimespanOfContactTimesteps
();
}
private
List
<
DynamicElement
>
getDynElementsAtPosition
(
final
Topography
topography
,
VPoint
sourcePosition
,
double
radius
)
{
...
...
VadereState/src/org/vadere/state/attributes/processor/AttributesPedestrianNearbyProcessor.java
View file @
9f8b8855
...
...
@@ -9,6 +9,7 @@ public class AttributesPedestrianNearbyProcessor extends AttributesProcessor {
private
double
maxDistanceForANearbyPedestrian
=
1.5
;
private
int
sampleEveryNthStep
=
1
;
private
int
allowedAbsenceTimestepsIfContactReturns
=
0
;
private
int
minTimespanOfContactTimesteps
=
1
;
public
double
getMaxDistanceForANearbyPedestrian
()
{
return
maxDistanceForANearbyPedestrian
;
...
...
@@ -21,4 +22,8 @@ public class AttributesPedestrianNearbyProcessor extends AttributesProcessor {
public
int
getAllowedAbsenceTimestepsIfContactReturns
()
{
return
allowedAbsenceTimestepsIfContactReturns
;
}
public
int
getMinTimespanOfContactTimesteps
()
{
return
minTimespanOfContactTimesteps
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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