Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
The container registry cleanup task is now completed and the registry can be used normally.
Open sidebar
vadere
vadere
Commits
db12ac1c
Commit
db12ac1c
authored
Sep 29, 2016
by
Mario Teixeira Parente
Browse files
Merge branch 'dev/processors' into develop
parents
1709d0cd
8de07160
Changes
36
Hide whitespace changes
Inline
Side-by-side
Documentation/dataprocessing-api/dataprocessing-api.md
View file @
db12ac1c
...
@@ -112,7 +112,7 @@ protected abstract void doUpdate(final SimulationState state) {
...
@@ -112,7 +112,7 @@ protected abstract void doUpdate(final SimulationState state) {
int
timeStep
=
state
.
getStep
();
int
timeStep
=
state
.
getStep
();
int
amountPeds
=
state
.
getTopography
().
getElements
(
Pedestrian
.
class
).
size
();
int
amountPeds
=
state
.
getTopography
().
getElements
(
Pedestrian
.
class
).
size
();
this
.
add
Value
(
new
TimestepDataKey
(
timeStep
),
amountPeds
);
this
.
set
Value
(
new
TimestepDataKey
(
timeStep
),
amountPeds
);
}
}
```
```
...
...
VadereGui/resources/outputTemplates/output_default.json
View file @
db12ac1c
...
@@ -20,6 +20,14 @@
...
@@ -20,6 +20,14 @@
"type"
:
"org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile"
,
"type"
:
"org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile"
,
"filename"
:
"postvis.trajectories"
,
"filename"
:
"postvis.trajectories"
,
"processors"
:
[
1
,
18
]
"processors"
:
[
1
,
18
]
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.outputfile.TimestepRowOutputFile"
,
"filename"
:
"output_ts_row.txt"
,
"processors"
:
[
20
]
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPositionOutputFile"
,
"filename"
:
"output_ts_pos.txt"
,
"processors"
:
[
21
]
}
],
}
],
"processors"
:
[
{
"processors"
:
[
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor"
,
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor"
,
...
@@ -165,5 +173,19 @@
...
@@ -165,5 +173,19 @@
},
{
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.PedestrianSourceIdProcessor"
,
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.PedestrianSourceIdProcessor"
,
"id"
:
19
"id"
:
19
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.FloorFieldGridProcessor"
,
"id"
:
20
,
"attributesType"
:
"org.vadere.state.attributes.processor.AttributesFloorFieldProcessor"
,
"attributes"
:
{
"targetId"
:
1
}
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing.processor.FloorFieldProcessor"
,
"id"
:
21
,
"attributesType"
:
"org.vadere.state.attributes.processor.AttributesFloorFieldProcessor"
,
"attributes"
:
{
"targetId"
:
1
}
}
]
}
]
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/PedestrianId
Data
Key.java
→
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/PedestrianIdKey.java
View file @
db12ac1c
...
@@ -5,10 +5,10 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
...
@@ -5,10 +5,10 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
*
*
*/
*/
public
class
PedestrianId
Data
Key
implements
DataKey
<
PedestrianId
Data
Key
>
{
public
class
PedestrianIdKey
implements
DataKey
<
PedestrianIdKey
>
{
private
final
int
pedestrianId
;
private
final
int
pedestrianId
;
public
PedestrianId
Data
Key
(
int
pedestrianId
)
{
public
PedestrianIdKey
(
int
pedestrianId
)
{
this
.
pedestrianId
=
pedestrianId
;
this
.
pedestrianId
=
pedestrianId
;
}
}
...
@@ -36,14 +36,14 @@ public class PedestrianIdDataKey implements DataKey<PedestrianIdDataKey> {
...
@@ -36,14 +36,14 @@ public class PedestrianIdDataKey implements DataKey<PedestrianIdDataKey> {
return
false
;
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
return
false
;
PedestrianId
Data
Key
other
=
(
PedestrianId
Data
Key
)
obj
;
PedestrianIdKey
other
=
(
PedestrianIdKey
)
obj
;
if
(
pedestrianId
!=
other
.
pedestrianId
)
if
(
pedestrianId
!=
other
.
pedestrianId
)
return
false
;
return
false
;
return
true
;
return
true
;
}
}
@Override
@Override
public
int
compareTo
(
PedestrianId
Data
Key
o
)
{
public
int
compareTo
(
PedestrianIdKey
o
)
{
return
Integer
.
compare
(
pedestrianId
,
o
.
pedestrianId
);
return
Integer
.
compare
(
pedestrianId
,
o
.
pedestrianId
);
}
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/Timestep
Data
Key.java
→
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepKey.java
View file @
db12ac1c
...
@@ -5,14 +5,14 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
...
@@ -5,14 +5,14 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
*
*
*/
*/
public
class
Timestep
Data
Key
implements
DataKey
<
Timestep
Data
Key
>
{
public
class
TimestepKey
implements
DataKey
<
TimestepKey
>
{
private
final
int
timestep
;
private
final
int
timestep
;
public
Timestep
Data
Key
(
int
timestep
)
{
public
TimestepKey
(
int
timestep
)
{
this
.
timestep
=
timestep
;
this
.
timestep
=
timestep
;
}
}
@Override
@Override
public
int
compareTo
(
final
Timestep
Data
Key
o
)
{
public
int
compareTo
(
final
TimestepKey
o
)
{
return
Integer
.
compare
(
timestep
,
o
.
timestep
);
return
Integer
.
compare
(
timestep
,
o
.
timestep
);
}
}
...
@@ -36,7 +36,7 @@ public class TimestepDataKey implements DataKey<TimestepDataKey> {
...
@@ -36,7 +36,7 @@ public class TimestepDataKey implements DataKey<TimestepDataKey> {
return
false
;
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
return
false
;
Timestep
Data
Key
other
=
(
Timestep
Data
Key
)
obj
;
TimestepKey
other
=
(
TimestepKey
)
obj
;
if
(
timestep
!=
other
.
timestep
)
if
(
timestep
!=
other
.
timestep
)
return
false
;
return
false
;
return
true
;
return
true
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepPedestrianId
Data
Key.java
→
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepPedestrianIdKey.java
View file @
db12ac1c
...
@@ -5,11 +5,11 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
...
@@ -5,11 +5,11 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
*
*
*/
*/
public
class
TimestepPedestrianId
Data
Key
implements
DataKey
<
TimestepPedestrianId
Data
Key
>
{
public
class
TimestepPedestrianIdKey
implements
DataKey
<
TimestepPedestrianIdKey
>
{
private
final
int
timestep
;
private
final
int
timestep
;
private
final
int
pedestrianId
;
private
final
int
pedestrianId
;
public
TimestepPedestrianId
Data
Key
(
int
timestep
,
int
pedestrianId
)
{
public
TimestepPedestrianIdKey
(
int
timestep
,
int
pedestrianId
)
{
this
.
timestep
=
timestep
;
this
.
timestep
=
timestep
;
this
.
pedestrianId
=
pedestrianId
;
this
.
pedestrianId
=
pedestrianId
;
}
}
...
@@ -23,7 +23,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
...
@@ -23,7 +23,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
}
}
@Override
@Override
public
int
compareTo
(
TimestepPedestrianId
Data
Key
o
)
{
public
int
compareTo
(
TimestepPedestrianIdKey
o
)
{
int
result
=
Integer
.
compare
(
timestep
,
o
.
timestep
);
int
result
=
Integer
.
compare
(
timestep
,
o
.
timestep
);
if
(
result
==
0
)
{
if
(
result
==
0
)
{
return
Integer
.
compare
(
pedestrianId
,
o
.
pedestrianId
);
return
Integer
.
compare
(
pedestrianId
,
o
.
pedestrianId
);
...
@@ -32,7 +32,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
...
@@ -32,7 +32,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
}
}
public
static
String
[]
getHeaders
()
{
public
static
String
[]
getHeaders
()
{
return
new
String
[]
{
Timestep
Data
Key
.
getHeader
(),
PedestrianId
Data
Key
.
getHeader
()
};
return
new
String
[]
{
TimestepKey
.
getHeader
(),
PedestrianIdKey
.
getHeader
()
};
}
}
@Override
@Override
...
@@ -52,7 +52,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
...
@@ -52,7 +52,7 @@ public class TimestepPedestrianIdDataKey implements DataKey<TimestepPedestrianId
return
false
;
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
return
false
;
TimestepPedestrianId
Data
Key
other
=
(
TimestepPedestrianId
Data
Key
)
obj
;
TimestepPedestrianIdKey
other
=
(
TimestepPedestrianIdKey
)
obj
;
if
(
pedestrianId
!=
other
.
pedestrianId
)
if
(
pedestrianId
!=
other
.
pedestrianId
)
return
false
;
return
false
;
if
(
timestep
!=
other
.
timestep
)
if
(
timestep
!=
other
.
timestep
)
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepPositionKey.java
0 → 100644
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.datakey
;
import
org.jetbrains.annotations.NotNull
;
import
org.vadere.util.geometry.shapes.VPoint
;
/**
* @author Mario Teixeira Parente
*/
public
class
TimestepPositionKey
implements
DataKey
<
TimestepPositionKey
>
{
private
int
timeStep
;
private
VPoint
position
;
public
TimestepPositionKey
(
int
timeStep
,
VPoint
position
)
{
this
.
timeStep
=
timeStep
;
this
.
position
=
position
;
}
public
int
getTimeStep
()
{
return
this
.
timeStep
;
}
public
VPoint
getPosition
()
{
return
this
.
position
;
}
@Override
public
int
compareTo
(
@NotNull
TimestepPositionKey
o
)
{
int
result
=
Integer
.
compare
(
this
.
timeStep
,
o
.
timeStep
);
if
(
result
==
0
)
{
result
=
Double
.
compare
(
this
.
position
.
x
,
o
.
position
.
x
);
if
(
result
==
0
)
{
result
=
Double
.
compare
(
this
.
position
.
y
,
o
.
position
.
y
);
}
}
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
TimestepPositionKey
that
=
(
TimestepPositionKey
)
o
;
if
(
timeStep
!=
that
.
timeStep
)
return
false
;
return
position
.
equals
(
that
.
position
);
}
@Override
public
int
hashCode
()
{
int
result
=
timeStep
;
result
=
31
*
result
+
position
.
hashCode
();
return
result
;
}
public
static
String
[]
getHeaders
()
{
return
new
String
[]
{
"timeStep"
,
"x"
,
"y"
};
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/datakey/TimestepRowKey.java
0 → 100644
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.datakey
;
import
org.jetbrains.annotations.NotNull
;
/**
* @author Mario Teixeira Parente
*
*/
public
class
TimestepRowKey
implements
DataKey
<
TimestepRowKey
>
{
private
int
timeStep
;
private
int
row
;
public
TimestepRowKey
(
int
timeStep
,
int
row
)
{
this
.
timeStep
=
timeStep
;
this
.
row
=
row
;
}
public
int
getTimeStep
()
{
return
this
.
timeStep
;
}
public
int
getRow
()
{
return
this
.
row
;
}
@Override
public
int
compareTo
(
@NotNull
TimestepRowKey
o
)
{
int
result
=
Integer
.
compare
(
this
.
timeStep
,
o
.
timeStep
);
if
(
result
==
0
)
{
return
Integer
.
compare
(
this
.
row
,
o
.
row
);
}
return
result
;
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/PedestrianIdOutputFile.java
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
import
org.vadere.simulator.projects.dataprocessing.datakey.PedestrianId
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey
;
/**
/**
* @author Mario Teixeira Parente
* @author Mario Teixeira Parente
*
*
*/
*/
public
class
PedestrianIdOutputFile
extends
OutputFile
<
PedestrianId
Data
Key
>
{
public
class
PedestrianIdOutputFile
extends
OutputFile
<
PedestrianIdKey
>
{
public
PedestrianIdOutputFile
()
{
public
PedestrianIdOutputFile
()
{
super
(
PedestrianId
Data
Key
.
getHeader
());
super
(
PedestrianIdKey
.
getHeader
());
}
}
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/TimestepOutputFile.java
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
import
org.vadere.simulator.projects.dataprocessing.datakey.Timestep
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
/**
/**
* @author Mario Teixeira Parente
* @author Mario Teixeira Parente
*
*
*/
*/
public
class
TimestepOutputFile
extends
OutputFile
<
Timestep
Data
Key
>
{
public
class
TimestepOutputFile
extends
OutputFile
<
TimestepKey
>
{
public
TimestepOutputFile
()
{
public
TimestepOutputFile
()
{
super
(
"hdfkh"
);
super
(
"hdfkh"
);
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/TimestepPedestrianIdOutputFile.java
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianId
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey
;
/**
/**
* @author Mario Teixeira Parente
* @author Mario Teixeira Parente
*
*
*/
*/
public
class
TimestepPedestrianIdOutputFile
extends
OutputFile
<
TimestepPedestrianId
Data
Key
>
{
public
class
TimestepPedestrianIdOutputFile
extends
OutputFile
<
TimestepPedestrianIdKey
>
{
public
TimestepPedestrianIdOutputFile
()
{
public
TimestepPedestrianIdOutputFile
()
{
super
(
TimestepPedestrianId
Data
Key
.
getHeaders
());
super
(
TimestepPedestrianIdKey
.
getHeaders
());
}
}
@Override
@Override
public
String
[]
toStrings
(
final
TimestepPedestrianId
Data
Key
key
)
{
public
String
[]
toStrings
(
final
TimestepPedestrianIdKey
key
)
{
return
new
String
[]
{
Integer
.
toString
(
key
.
getTimestep
()),
Integer
.
toString
(
key
.
getPedestrianId
())
};
return
new
String
[]
{
Integer
.
toString
(
key
.
getTimestep
()),
Integer
.
toString
(
key
.
getPedestrianId
())
};
}
}
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/TimestepPositionOutputFile.java
0 → 100644
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPositionKey
;
public
class
TimestepPositionOutputFile
extends
OutputFile
<
TimestepPositionKey
>
{
public
TimestepPositionOutputFile
()
{
super
(
TimestepPositionKey
.
getHeaders
());
}
@Override
public
String
[]
toStrings
(
TimestepPositionKey
key
)
{
return
new
String
[]
{
Integer
.
toString
(
key
.
getTimeStep
()),
Double
.
toString
(
key
.
getPosition
().
x
),
Double
.
toString
(
key
.
getPosition
().
y
)
};
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/TimestepRowOutputFile.java
0 → 100644
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.outputfile
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepRowKey
;
public
class
TimestepRowOutputFile
extends
OutputFile
<
TimestepRowKey
>
{
public
TimestepRowOutputFile
()
{
super
(
"timeStep"
,
"row"
);
}
@Override
public
String
[]
toStrings
(
TimestepRowKey
key
)
{
return
new
String
[]
{
Integer
.
toString
(
key
.
getTimeStep
()),
Integer
.
toString
(
key
.
getRow
())
};
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaDataProcessor.java
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.processor
;
package
org.vadere.simulator.projects.dataprocessing.processor
;
import
org.vadere.simulator.projects.dataprocessing.ProcessorManager
;
import
org.vadere.simulator.projects.dataprocessing.ProcessorManager
;
import
org.vadere.simulator.projects.dataprocessing.datakey.Timestep
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
import
org.vadere.state.attributes.processor.AttributesAreaProcessor
;
import
org.vadere.state.attributes.processor.AttributesAreaProcessor
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
org.vadere.util.geometry.shapes.VRectangle
;
...
@@ -10,7 +10,7 @@ import org.vadere.util.geometry.shapes.VRectangle;
...
@@ -10,7 +10,7 @@ import org.vadere.util.geometry.shapes.VRectangle;
*
*
*/
*/
public
abstract
class
AreaDataProcessor
<
V
>
extends
DataProcessor
<
Timestep
Data
Key
,
V
>
{
public
abstract
class
AreaDataProcessor
<
V
>
extends
DataProcessor
<
TimestepKey
,
V
>
{
private
VRectangle
measurementArea
;
private
VRectangle
measurementArea
;
protected
AreaDataProcessor
(
final
String
...
headers
)
{
protected
AreaDataProcessor
(
final
String
...
headers
)
{
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaDensityProcessor.java
View file @
db12ac1c
package
org.vadere.simulator.projects.dataprocessing.processor
;
package
org.vadere.simulator.projects.dataprocessing.processor
;
import
org.vadere.simulator.control.SimulationState
;
import
org.vadere.simulator.control.SimulationState
;
import
org.vadere.simulator.projects.dataprocessing.datakey.Timestep
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
/**
/**
* @author Mario Teixeira Parente
* @author Mario Teixeira Parente
...
@@ -18,6 +18,6 @@ public abstract class AreaDensityProcessor extends AreaDataProcessor<Double> {
...
@@ -18,6 +18,6 @@ public abstract class AreaDensityProcessor extends AreaDataProcessor<Double> {
@Override
@Override
protected
void
doUpdate
(
final
SimulationState
state
)
{
protected
void
doUpdate
(
final
SimulationState
state
)
{
this
.
add
Value
(
new
Timestep
Data
Key
(
state
.
getStep
()),
this
.
densAlg
.
getDensity
(
state
));
this
.
set
Value
(
new
TimestepKey
(
state
.
getStep
()),
this
.
densAlg
.
getDensity
(
state
));
}
}
}
}
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/AreaSpeedProcessor.java
View file @
db12ac1c
...
@@ -2,9 +2,9 @@ package org.vadere.simulator.projects.dataprocessing.processor;
...
@@ -2,9 +2,9 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import
org.vadere.simulator.control.SimulationState
;
import
org.vadere.simulator.control.SimulationState
;
import
org.vadere.simulator.projects.dataprocessing.ProcessorManager
;
import
org.vadere.simulator.projects.dataprocessing.ProcessorManager
;
import
org.vadere.simulator.projects.dataprocessing.datakey.PedestrianId
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey
;
import
org.vadere.simulator.projects.dataprocessing.datakey.Timestep
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianId
Data
Key
;
import
org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey
;
import
org.vadere.state.attributes.processor.AttributesAreaSpeedProcessor
;
import
org.vadere.state.attributes.processor.AttributesAreaSpeedProcessor
;
import
org.vadere.util.geometry.shapes.VPoint
;
import
org.vadere.util.geometry.shapes.VPoint
;
...
@@ -30,22 +30,22 @@ public class AreaSpeedProcessor extends AreaDataProcessor<Double> {
...
@@ -30,22 +30,22 @@ public class AreaSpeedProcessor extends AreaDataProcessor<Double> {
this
.
pedPosProc
.
update
(
state
);
this
.
pedPosProc
.
update
(
state
);
this
.
pedVelProc
.
update
(
state
);
this
.
pedVelProc
.
update
(
state
);
Map
<
PedestrianId
Data
Key
,
VPoint
>
positionMap
=
this
.
pedPosProc
.
getPositions
(
new
Timestep
Data
Key
(
step
));
Map
<
PedestrianIdKey
,
VPoint
>
positionMap
=
this
.
pedPosProc
.
getPositions
(
new
TimestepKey
(
step
));
int
pedCount
=
0
;
int
pedCount
=
0
;
double
sumVelocities
=
0.0
;
double
sumVelocities
=
0.0
;
for
(
Map
.
Entry
<
PedestrianId
Data
Key
,
VPoint
>
entry
:
positionMap
.
entrySet
())
{
for
(
Map
.
Entry
<
PedestrianIdKey
,
VPoint
>
entry
:
positionMap
.
entrySet
())
{
final
int
pedId
=
entry
.
getKey
().
getPedestrianId
();
final
int
pedId
=
entry
.
getKey
().
getPedestrianId
();
final
VPoint
pos
=
entry
.
getValue
();
final
VPoint
pos
=
entry
.
getValue
();
if
(
getMeasurementArea
().
contains
(
pos
))
{
if
(
getMeasurementArea
().
contains
(
pos
))
{
sumVelocities
+=
this
.
pedVelProc
.
getValue
(
new
TimestepPedestrianId
Data
Key
(
step
,
pedId
));
sumVelocities
+=
this
.
pedVelProc
.
getValue
(
new
TimestepPedestrianIdKey
(
step
,
pedId
));
pedCount
++;
pedCount
++;
}
}
}
}
this
.
add
Value
(
new
Timestep
Data
Key
(
step
),
sumVelocities
/
pedCount
);
this
.
set
Value
(
new
TimestepKey
(
step
),
sumVelocities
/
pedCount
);
}
}
@Override
@Override
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/DataProcessor.java
View file @
db12ac1c
...
@@ -20,7 +20,7 @@ import java.util.TreeMap;
...
@@ -20,7 +20,7 @@ import java.util.TreeMap;
*
*
* The method <tt>doUpdate</tt> gets called after every simulation step with the current <tt>SimulationState</tt>.
* The method <tt>doUpdate</tt> gets called after every simulation step with the current <tt>SimulationState</tt>.
* Here, one gets the opportunity to compute a new value or to update the state for a computation in <tt>postLoop</tt>.
* Here, one gets the opportunity to compute a new value or to update the state for a computation in <tt>postLoop</tt>.
* The computed value can be stored afterwards in the data by using the <tt>
add
Value</tt> method.
* The computed value can be stored afterwards in the data by using the <tt>
set
Value</tt> method.
*
*
* To get specific attributes defined in JSON or access to the <tt>MainModel</tt>, one has to use the <tt>init</tt> method which
* To get specific attributes defined in JSON or access to the <tt>MainModel</tt>, one has to use the <tt>init</tt> method which
* gives access to all significant things via the argument <tt>manager</tt> of type <tt>ProcessorManager</tt>.
* gives access to all significant things via the argument <tt>manager</tt> of type <tt>ProcessorManager</tt>.
...
@@ -96,7 +96,7 @@ public abstract class DataProcessor<K extends DataKey<K>, V> {
...
@@ -96,7 +96,7 @@ public abstract class DataProcessor<K extends DataKey<K>, V> {