Commit 6c75b16b authored by hm-lehmberg's avatar hm-lehmberg

adapt mock in test and clean code

parent 4bd57b11
Pipeline #113071 passed with stages
in 139 minutes and 17 seconds
......@@ -63,7 +63,7 @@ public class ProcessorManager {
}
if (requireRectangular && !measurementArea.isRectangular()) {
throw new RuntimeException("DataProcessor only supports Rectangular measurement areas.");
throw new RuntimeException(String.format("Measurement area for %d is required to be rectangular", measurementAreaId));
}
return measurementArea;
......
......@@ -7,6 +7,9 @@ import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.util.factory.processors.Flag;
import java.util.List;
/**
* @author Mario Teixeira Parente
......@@ -23,11 +26,12 @@ public class AreaDensityVoronoiProcessor extends AreaDensityProcessor implements
@Override
public void init(final ProcessorManager manager) {
super.init(manager);
AttributesAreaDensityVoronoiProcessor att = (AttributesAreaDensityVoronoiProcessor) this.getAttributes();
MeasurementArea measurementArea = manager.getMeasurementArea(att.getMeasurementAreaId(), true);
MeasurementArea measurementVoronoiArea = manager.getMeasurementArea(att.getVoronoiMeasurementAreaId(), true);
this.setAlgorithm(new AreaDensityVoronoiAlgorithm(this.getMeasurementArea(), measurementArea));
this.setAlgorithm(new AreaDensityVoronoiAlgorithm(measurementVoronoiArea, measurementArea));
}
@Override
......
......@@ -43,7 +43,8 @@ public class AreaSpeedProcessor extends AreaDataProcessor<Double> {
final int pedId = entry.getKey().getPedestrianId();
final VPoint pos = entry.getValue();
if (getMeasurementArea().asVRectangle().contains(pos)) {
//getMeasurementArea from AreaDataProcessor
if (this.getMeasurementArea().getShape().contains(pos)) {
sumVelocities += this.pedVelProc.getValue(new TimestepPedestrianIdKey(step, pedId));
pedCount++;
}
......
......@@ -36,6 +36,7 @@ public class AreaDensityVoronoiProcessorTestEnv extends ProcessorTestEnv<Timeste
attr.setMeasurementAreaId(42);
MeasurementArea measurementArea = new MeasurementArea(
new AttributesMeasurementArea(42, new VRectangle(0, 0, 16, 16)));
Mockito.when(manager.getMeasurementArea(42, false)).thenReturn(measurementArea);
Mockito.when(manager.getMeasurementArea(42, true)).thenReturn(measurementArea);
}
......
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