Commit d0fddaea authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

Merge branch 'master' into...

Merge branch 'master' into 260-change-pedestrianpositionprocessor-to-use-interpolation-of-pedestrianfootstepprocessor
parents cbb7bd4e 4b51581a
Pipeline #146603 failed with stages
in 1 minute and 24 seconds
......@@ -38,7 +38,8 @@ ScenarioChecker.overlap.obstacle.source=Obstacle overlaps with a source. This se
ScenarioChecker.overlap.obstacle.obstacle=Two obstacles overlap / is enclosed completely. Delete one for better performance.
ScenarioChecker.simAttr.simTimeStepWrong=simTimeStep parameter outside of allowed range
ScenarioChecker.processor.measurementArea.hasToBeRectangular=Measurement Areas for the AreaDensityVoronoiProcessor have to be rectangular
ScenarioChecker.processor.checkAreasInAreaDensityVoronoiProcessor.mismatch=Sizes of measurement areas for the two areas for AreaDensityVoronoiProcessor do not match. Make sure that the area for the calculation of the density is smaller (or equal) than the area for the generation of the Voronoi diagram.
ScenarioChecker.processor.measuremetarea.doesNotExist=MeasurementArea referenced in processor does not exist.
ScenarioChecker.msg.ok=Scenario ok.
......
......@@ -39,6 +39,9 @@ ScenarioChecker.overlap.obstacle.obstacle=Zwei identische bzw. eingeschlossene H
ScenarioChecker.simAttr.simTimeStepWrong=simTimeStep Parameter au\u00dferhalb des Definitionsbereichs
ScenarioChecker.processor.measurementArea.hasToBeRectangular=Measurement Areas f\u00fcr den AreaDensityVoronoiProcessor m\u00fcssen rechteckig sein
ScenarioChecker.processor.checkAreasInAreaDensityVoronoiProcessor.mismatch=Die Measurement Areas f\u00fcr den AreaDensityVoronoiProcessor passen nicht zusammen. Es muss beachtet werden, dass die Flaeche f\u00fcr die Berechnung der Dichte kleiner (oder gleich) der Flaeche fuer die Generierung des Voronoi-Diagrams sein muss
ScenarioChecker.processor.measuremetarea.doesNotExist=Referenzierte Messfläche im Daten Prozessor existiert nicht.
ScenarioChecker.msg.ok=Szenario ok.
......
......@@ -3,6 +3,7 @@ package org.vadere.simulator.utils.scenariochecker;
import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.utils.scenariochecker.checks.ScenarioCheckerTest;
import org.vadere.simulator.utils.scenariochecker.checks.dataProcessors.CheckAreasInAreaDensityVoronoiProcessor;
import org.vadere.simulator.utils.scenariochecker.checks.dataProcessors.DataProcessorsLinkedToMeasurementArea;
import org.vadere.simulator.utils.scenariochecker.checks.simulation.SimulationTimeStepLengthCheck;
import org.vadere.simulator.utils.scenariochecker.checks.topography.PedestrianSpeedSetupCheck;
......@@ -69,6 +70,7 @@ public class ScenarioChecker {
ret.addAll(checkMinSourceRadius());
ret.addAll(runCheck(new TopographyOffsetCheck()));
ret.addAll(runCheck(new DataProcessorsLinkedToMeasurementArea()));
ret.addAll(runCheck(new CheckAreasInAreaDensityVoronoiProcessor()));
return ret;
}
......
......@@ -42,7 +42,11 @@ public enum ScenarioCheckerReason {
// Simulation attribute reasons
SIM_TIME_STEP_WRONG("ScenarioChecker.simAttr.simTimeStepWrong"),
PROCESSOR_MEASUREMENT_AREA("ScenarioChecker.processor.measuremetarea.doesNotExist");
PROCESSOR_MEASUREMENT_AREA("ScenarioChecker.processor.measurementarea.doesNotExist"),
// AreaDensityVoronoiProcessor
AREAS_DENSITY_VORONOI_PROCESSOR_MISMATCH("ScenarioChecker.processor.checkAreasInAreaDensityVoronoiProcessor.mismatch"),
MEASUREMENT_AREA_NOT_RECTANGULAR("ScenarioChecker.processor.measurementArea.hasToBeRectangular");
private String msgId;
......
package org.vadere.simulator.utils.scenariochecker.checks.dataProcessors;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.dataprocessing.flags.UsesMeasurementArea;
import org.vadere.simulator.projects.dataprocessing.processor.AreaDensityVoronoiProcessor;
import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor;
import org.vadere.simulator.utils.scenariochecker.ScenarioCheckerMessage;
import org.vadere.simulator.utils.scenariochecker.ScenarioCheckerReason;
import org.vadere.simulator.utils.scenariochecker.checks.AbstractScenarioCheck;
import org.vadere.state.attributes.processor.AttributesAreaDensityVoronoiProcessor;
import org.vadere.state.scenario.MeasurementArea;
import java.awt.geom.Rectangle2D;
import java.util.List;
import java.util.PriorityQueue;
import java.util.stream.Collectors;
public class CheckAreasInAreaDensityVoronoiProcessor extends AbstractScenarioCheck {
@Override
public PriorityQueue<ScenarioCheckerMessage> runScenarioCheckerTest(Scenario scenario) {
PriorityQueue<ScenarioCheckerMessage> ret = new PriorityQueue<>();
List<DataProcessor<?, ?>> processors
= scenario.getDataProcessingJsonManager().getDataProcessors();
List <DataProcessor> areaVoronoiProc = processors.stream().filter(dataProcessor -> dataProcessor.getClass().equals(AreaDensityVoronoiProcessor.class)).collect(Collectors.toList());
if(!areaVoronoiProc.isEmpty()){
// get all measurement areas
List<MeasurementArea> measurementAreas = scenario.getTopography().getMeasurementAreas();
for(int i = 0; i < areaVoronoiProc.size(); i++) {
AreaDensityVoronoiProcessor voronoiProcessor = (AreaDensityVoronoiProcessor) areaVoronoiProc.get(i);
AttributesAreaDensityVoronoiProcessor voronoiAtt = (AttributesAreaDensityVoronoiProcessor) voronoiProcessor.getAttributes();
int voronoiMeasId = voronoiAtt.getVoronoiMeasurementAreaId();
int voronoiDiagramId = voronoiAtt.getMeasurementAreaId();
MeasurementArea voronoiMeasArea = scenario.getTopography().getMeasurementArea(voronoiMeasId);
MeasurementArea voronoiDiagramArea = scenario.getTopography().getMeasurementArea(voronoiDiagramId);
if (!voronoiMeasArea.isRectangular() || !voronoiDiagramArea.isRectangular()){
ret.add(msgBuilder.dataProcessorAttrError()
.reason(ScenarioCheckerReason.MEASUREMENT_AREA_NOT_RECTANGULAR,
String.format(" [Processor id: %d]", voronoiProcessor.getId())).build());
}
if(!voronoiDiagramArea.getShape().contains((Rectangle2D)voronoiMeasArea.getShape())){
ret.add(msgBuilder.dataProcessorAttrError()
.reason(ScenarioCheckerReason.AREAS_DENSITY_VORONOI_PROCESSOR_MISMATCH,
String.format(" [Processor id: %d]", voronoiProcessor.getId())).build());
}
}
}
return ret;
}
}
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