Commit 1157af27 authored by Christina's avatar Christina

reset AreaDensityCountingProcessor

parent 201fd4d3
......@@ -41,32 +41,28 @@
"id" : 5,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2001,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2001
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2002,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2002
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2003,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2003
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 1000,
"countsInsteadOfDensity" : false
"measurementAreaId" : 1000
}
} ],
"isTimestamped" : false,
......@@ -402,4 +398,4 @@
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
}
......@@ -41,35 +41,31 @@
"id" : 5,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2001,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2001
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2002,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2002
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 7,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 2003,
"countsInsteadOfDensity" : false
"measurementAreaId" : 2003
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor",
"attributes" : {
"measurementAreaId" : 1000,
"countsInsteadOfDensity" : false
"measurementAreaId" : 1000
}
} ],
"isTimestamped" : false,
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
......@@ -402,4 +398,4 @@
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
}
......@@ -5,6 +5,7 @@ import com.github.cschen1205.fuzzylogic.*;
import com.github.cschen1205.fuzzylogic.memberships.*;
import org.vadere.simulator.control.strategy.models.navigation.INavigationModel;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.processor.AreaDensityCountingProcessor;
import org.vadere.state.scenario.Pedestrian;
import java.util.*;
......@@ -135,15 +136,15 @@ public class RouteChoiceThreeCorridors implements INavigationModel {
private double getDensityFromDataProcessor(int processorId, ProcessorManager processorManager) {
double density = -1.0;
if (processorManager != null) {
TreeMap data = (TreeMap) processorManager.getProcessor(processorId).getData();
AreaDensityCountingProcessor a = (AreaDensityCountingProcessor) processorManager.getProcessor(processorId);
TreeMap data = (TreeMap) a.getData();
double area = a.getMeasurementArea().asPolygon().getArea();
if (data.size() > 0) {
density = (double) data.lastEntry().getValue();
density = (double) (Integer) data.lastEntry().getValue();
density = density/area;
}
}
return density;
......
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.simulation.SimulationState;
import org.vadere.simulator.projects.dataprocessing.datakey.NoDataKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
......@@ -21,7 +20,7 @@ import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
*/
@DataProcessorClass(label = "AreaDensityCountingProcessor")
public class AreaDensityCountingProcessor extends AreaDataProcessor<Double> {
public class AreaDensityCountingProcessor extends AreaDataProcessor<Integer> {
public AreaDensityCountingProcessor() {
super("areaDensityCounting");
......@@ -46,20 +45,14 @@ public class AreaDensityCountingProcessor extends AreaDataProcessor<Double> {
}
}
double result;
if (getAttributes().getCountsInsteadOfDensity()) { result = pedCount; }
else {
double measurementAreaSize = getMeasurementArea().asPolygon().getArea();
result = pedCount/measurementAreaSize; }
this.putValue(new TimestepKey(state.getStep()),result);
this.putValue(new TimestepKey(state.getStep()), pedCount);
}
@Override
public AttributesAreaDensityCountingProcessor getAttributes() {
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesAreaDensityCountingProcessor());
}
return (AttributesAreaDensityCountingProcessor) super.getAttributes();
return super.getAttributes();
}
}
......@@ -5,26 +5,5 @@ package org.vadere.state.attributes.processor;
*/
public class AttributesAreaDensityCountingProcessor extends AttributesAreaProcessor {
boolean countsInsteadOfDensity = true;
private int measurementAreaId = -1;
public boolean getCountsInsteadOfDensity()
{
return countsInsteadOfDensity;
}
public void setCountsInsteadOfDensity(boolean countsInsteadOfDensity)
{
this.countsInsteadOfDensity = countsInsteadOfDensity;
}
public int getMeasurementAreaId() {
return this.measurementAreaId;
}
public void setMeasurementAreaId(int measurementAreaId) {
checkSealed();
this.measurementAreaId = measurementAreaId;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment