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
c6997cb8
Commit
c6997cb8
authored
May 15, 2019
by
Daniel Lehmberg
Browse files
some comments and minor code changes
parent
3fba9b7e
Pipeline
#113335
passed with stages
in 142 minutes and 47 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaDataProcessor.java
View file @
c6997cb8
...
...
@@ -4,7 +4,6 @@ import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
import
org.vadere.state.attributes.processor.AttributesAreaProcessor
;
import
org.vadere.state.scenario.MeasurementArea
;
import
org.vadere.util.geometry.shapes.VRectangle
;
/**
* @author Mario Teixeira Parente
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaDensityCountingProcessor.java
View file @
c6997cb8
...
...
@@ -5,7 +5,6 @@ import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import
org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor
;
import
org.vadere.state.attributes.processor.AttributesProcessor
;
import
org.vadere.state.scenario.Pedestrian
;
import
java.util.Collection
;
import
org.vadere.annotation.factories.dataprocessors.DataProcessorClass
;
...
...
@@ -13,6 +12,11 @@ import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
/**
* @author Daniel Lehmberg
* Processor counts number of pedestrians in a measurement area of any shape.
*
* To avoid unneccessary complicated structures this class does *not* extend from @AreaDensityProcessor (which requires
* an intern class or a separate class implementing the density algorithm). However, AreaDensityProcessor is a better
* description of what the processor does.
* See e.g. AreaDensityVoronoiProcessor / AreaDensityVoronoiAlgorithm
*/
@DataProcessorClass
(
label
=
"AreaDensityCountingProcessor"
)
public
class
AreaDensityCountingProcessor
extends
AreaDataProcessor
<
Integer
>
{
...
...
@@ -24,18 +28,23 @@ public class AreaDensityCountingProcessor extends AreaDataProcessor<Integer> {
@Override
protected
void
doUpdate
(
final
SimulationState
state
)
{
int
step
=
state
.
getStep
();
// Compute density by counting the pedestrians
// With the area of the shape the density can be normalized to [ped/m^2] "pedCount/area"
int
pedCount
=
0
;
// Here could also be another processor. However, because a processor uses more memory, all pedestrians
// are collected from the state directly.
Collection
<
Pedestrian
>
pedestrians
=
state
.
getTopography
().
getPedestrianDynamicElements
().
getElements
();
// Alternatively, this could be implemented with "Streams"
for
(
Pedestrian
p
:
pedestrians
)
{
if
(
this
.
getMeasurementArea
().
getShape
().
contains
(
p
.
getPosition
())){
pedCount
++;
}
}
this
.
putValue
(
new
TimestepKey
(
st
ep
),
pedCount
);
this
.
putValue
(
new
TimestepKey
(
st
ate
.
getStep
()
),
pedCount
);
}
@Override
...
...
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