Commit 16e03511 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

attributes for output processor should now be displayed (with default values)...

attributes for output processor should now be displayed (with default values) if they are newly created via the gui.
parent 07df80a2
......@@ -4,7 +4,14 @@
"release" : "0.2",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.EvacuationTimeProcessor",
"id" : 1,
"attributesType" : "org.vadere.state.attributes.processor.AttributesEvacuationTimeProcessor",
"attributes" : {
"pedestrianEvacuationTimeProcessorId" : 1
}
} ],
"isTimestamped" : true
},
"scenario" : {
......
......@@ -2,6 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.state.attributes.processor.AttributesAreaDensityVoronoiProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
/**
* @author Mario Teixeira Parente
......@@ -16,4 +17,13 @@ public class AreaDensityVoronoiProcessor extends AreaDensityProcessor {
AttributesAreaDensityVoronoiProcessor att = (AttributesAreaDensityVoronoiProcessor) this.getAttributes();
this.setAlgorithm(new AreaDensityVoronoiAlgorithm(this.getMeasurementArea(), att.getVoronoiArea()));
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesAreaDensityVoronoiProcessor());
}
return super.getAttributes();
}
}
......@@ -6,6 +6,7 @@ import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesAreaSpeedProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.Map;
......@@ -56,4 +57,13 @@ public class AreaSpeedProcessor extends AreaDataProcessor<Double> {
super.init(manager);
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesAreaSpeedProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.NoDataKey;
import org.vadere.state.attributes.processor.AttributesEvacuationTimeProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import java.util.Collections;
......@@ -44,4 +45,13 @@ public class EvacuationTimeProcessor extends DataProcessor<NoDataKey, Double> {
AttributesEvacuationTimeProcessor att = (AttributesEvacuationTimeProcessor) this.getAttributes();
this.pedEvacTimeProc = (PedestrianEvacuationTimeProcessor) manager.getProcessor(att.getPedestrianEvacuationTimeProcessorId());
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesEvacuationTimeProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.NoDataKey;
import org.vadere.state.attributes.processor.AttributesMeanPedestrianEvacuationTimeProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import java.util.List;
import java.util.stream.Collectors;
......@@ -44,4 +45,13 @@ public class MeanPedestrianEvacuationTimeProcessor extends DataProcessor<NoDataK
? nonNans.stream().reduce(0.0, (val1, val2) -> val1 + val2) / count
: Double.NaN);
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesMeanPedestrianEvacuationTimeProcessor());
}
return super.getAttributes();
}
}
......@@ -2,6 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.state.attributes.processor.AttributesPedestrianDensityCountingProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
/**
* @author Mario Teixeira Parente
......@@ -18,4 +19,13 @@ public class PedestrianDensityCountingProcessor extends PedestrianDensityProcess
super.init(manager);
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianDensityCountingProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianDensityProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.Pedestrian;
/**
......@@ -36,4 +37,13 @@ public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepP
this.pedPosProc =
(PedestrianPositionProcessor) manager.getProcessor(attDensProc.getPedestrianPositionProcessorId());
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianDensityProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianEvacuationTimeProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.Pedestrian;
/**
......@@ -66,4 +67,12 @@ public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianI
.forEach(key -> this.putValue(key, Double.NaN));
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianEvacuationTimeProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianFlowProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -43,4 +44,13 @@ public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdK
this.pedVelProc = (PedestrianVelocityProcessor) manager.getProcessor(att.getPedestrianVelocityProcessorId());
this.pedDensProc = (PedestrianDensityProcessor) manager.getProcessor(att.getPedestrianDensityProcessorId());
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianFlowProcessor());
}
return super.getAttributes();
}
}
......@@ -5,6 +5,7 @@ import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianLastPositionProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.Map;
......@@ -44,4 +45,13 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdK
return new String[] { Double.toString(pos.x), Double.toString(pos.y) };
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianLastPositionProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianOverlapProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.Map;
......@@ -37,4 +38,13 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
private int calculateOverlaps(final Map<Integer, VPoint> pedPosMap, VPoint pos) {
return (int) pedPosMap.values().stream().filter(pedPos -> pedPos.distance(pos) < 2*this.pedRadius).count();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianOverlapProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianVelocityProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -64,4 +65,13 @@ public class PedestrianVelocityProcessor extends DataProcessor<TimestepPedestria
return posNow.subtract(posBefore).scalarMultiply(1 / (currentSimTime - this.lastSimTimes.getFirst()))
.distanceToOrigin();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianVelocityProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianWaitingEndTimeProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
......@@ -41,4 +42,13 @@ public class PedestrianWaitingEndTimeProcessor extends DataProcessor<PedestrianI
AttributesPedestrianWaitingEndTimeProcessor att = (AttributesPedestrianWaitingEndTimeProcessor) this.getAttributes();
this.waitingArea = att.getWaitingArea();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianWaitingEndTimeProcessor());
}
return super.getAttributes();
}
}
......@@ -4,6 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianWaitingTimeProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
......@@ -48,4 +49,13 @@ public class PedestrianWaitingTimeProcessor extends DataProcessor<PedestrianIdKe
AttributesPedestrianWaitingTimeProcessor att = (AttributesPedestrianWaitingTimeProcessor) this.getAttributes();
this.waitingArea = att.getWaitingArea();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianWaitingTimeProcessor());
}
return super.getAttributes();
}
}
......@@ -9,6 +9,7 @@ import org.vadere.simulator.models.potential.fields.PotentialFieldTarget;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepRowKey;
import org.vadere.state.attributes.processor.AttributesFloorFieldProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.data.FloorFieldGridRow;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -77,4 +78,13 @@ public class TargetFloorFieldGridProcessor extends DataProcessor<TimestepRowKey,
public String[] toStrings(TimestepRowKey key) {
return this.getValue(key).toStrings();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesFloorFieldProcessor());
}
return super.getAttributes();
}
}
......@@ -10,6 +10,7 @@ import org.vadere.simulator.models.potential.fields.PotentialFieldTarget;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPositionKey;
import org.vadere.state.attributes.processor.AttributesFloorFieldProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import java.awt.*;
......@@ -56,4 +57,13 @@ public class TargetFloorFieldProcessor extends DataProcessor<TimestepPositionKey
this.att = (AttributesFloorFieldProcessor) this.getAttributes();
this.targetId = att.getTargetId();
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesFloorFieldProcessor());
}
return super.getAttributes();
}
}
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