Commit 6c627813 authored by hm-schuhba1's avatar hm-schuhba1

Merge branch 'measurementAreaRefactorProcessors_rebased' into 'master'

Measurement area refactor processors rebased

See merge request !55
parents dcffc7d3 83cb5e48
Pipeline #103785 passed with stages
in 137 minutes and 9 seconds
......@@ -25,4 +25,6 @@ public @interface DataProcessorClass {
String label() default "";
String description() default "";
String[] processorFlags() default {};
}
......@@ -5,6 +5,8 @@ import com.google.auto.service.AutoService;
import org.vadere.annotation.factories.BaseFactoryProcessor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import javax.annotation.processing.Processor;
......@@ -12,6 +14,10 @@ import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
@SupportedAnnotationTypes("org.vadere.annotation.factories.dataprocessors.DataProcessorClass")
@SupportedSourceVersion(SourceVersion.RELEASE_11)
......@@ -32,10 +38,23 @@ public class DataProcessorFactoryProcessor extends BaseFactoryProcessor {
protected void addLastConstructor(Set<? extends Element> elements, PrintWriter writer) {
for (Element e : elements) {
writer.append(" addMember(");
writer.append(e.getSimpleName().toString()).append(".class, ");
writer.append("this::").append("get").append(name(e)).append(", ");
writer.append(quote(label(e))).append(", ");
writer.append(quote(descr(e))).println("); ");
writer.append(quote(descr(e))).append(", ");
writer.append(e.getSimpleName().toString()).append(".class");
//if flags are provides here...
String[] flags = processorFlags(e);
if (flags.length > 0){
writer.append(", ");
for (int i = 0; i < flags.length -1; i++) {
writer.append(quote(flags[i])).append(", ");
}
writer.append(quote(flags[flags.length-1]));
writer.println("); ");
} else {
writer.println("); ");
}
}
}
......@@ -76,4 +95,29 @@ public class DataProcessorFactoryProcessor extends BaseFactoryProcessor {
return dataProcessorClass.description();
}
private String[] processorFlags(Element element){
DataProcessorClass dataProcessorClass = element.getAnnotation(DataProcessorClass.class);
Elements elementUtil = processingEnv.getElementUtils();
Types typeUtil = processingEnv.getTypeUtils();
ArrayList<String> flags = new ArrayList<>();
TypeMirror processorFlag = elementUtil
.getTypeElement("org.vadere.simulator.projects.dataprocessing.flags.ProcessorFlag")
.asType();
// cast possible becuse element is a class
TypeElement e = (TypeElement)element;
for (TypeMirror anInterface : e.getInterfaces()) {
if (typeUtil.isAssignable(anInterface, processorFlag)){
flags.add(typeUtil.asElement(anInterface).getSimpleName().toString());
}
}
flags.addAll(Arrays.asList(dataProcessorClass.processorFlags()));
return flags.toArray(String[]::new);
}
}
......@@ -7,10 +7,10 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@FactoryType(
factoryClassName = "JoltTransformationFactory",
extendedClassName = "JoltTransformationBaseFactory",
factoryImports = {"org.vadere.simulator.projects.migration.jolttranformation.JoltTransformationBaseFactory"},
factoryPackage = "org.vadere.simulator.projects.migration.jolttranformation"
factoryClassName = "JsonTransformationFactory",
extendedClassName = "JsonTransformationBaseFactory",
factoryImports = {"org.vadere.simulator.projects.migration.jsontranformation.JsonTransformationBaseFactory"},
factoryPackage = "org.vadere.simulator.projects.migration.jsontranformation"
)
public @interface MigrationTransformation {
......
{
"name" : "Neues_Szenario",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......@@ -75,20 +75,8 @@
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityVoronoiProcessor",
"attributes" : {
"measurementArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
},
"voronoiArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"measurementAreaId" : 1,
"voronoiMeasurementAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaSpeedProcessor",
......@@ -148,26 +136,14 @@
"id" : 15,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianWaitingTimeProcessor",
"attributes" : {
"waitingArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"waitingAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianWaitingEndTimeProcessor",
"id" : 16,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianWaitingEndTimeProcessor",
"attributes" : {
"waitingArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"waitingAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOSMStrideLengthProcessor",
......@@ -341,7 +317,17 @@
"acceleration" : 2.0
},
"dynamicElements" : [ ],
"attributesCar" : null
"attributesCar" : null,
"measurementAreas" : [ {
"shape" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : 1
} ]
}
}
}
\ No newline at end of file
{
"name" : "01_unsupported_event_exception_for_unsupported_models",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -112,6 +112,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "02_bang_event_one_agent",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -112,6 +112,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "03_bang_event_multiple_agents",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -112,6 +112,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "04_bang_event_one_agent_one_obstacle",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -121,6 +121,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "05_bang_event_narrowed_street",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -834,6 +834,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "06_bang_event_guimaraes_platz",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -1086,6 +1086,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "01_wait_event_osm_sequential",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -128,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "02_wait_event_osm_event_driven",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -128,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "03_wait_event_recurring_osm_sequential",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -128,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "04_wait_in_area_event_osm_sequential",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -128,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "05_wait_in_area_event_bhm",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -116,6 +116,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "06_bang_event_osm_sequential",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -128,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "07_bang_event_osm_event_driven",
"description" : "",
"release" : "0.7",
"commithash" : "3d1bcfd83a7d3848a4dd5baa50e802a2dce0c3e7",
"release" : "0.8",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -129,6 +128,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_1_chicken_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -99,6 +99,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_1_chicken_gnm1_displaced",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -99,6 +99,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_1_chicken_gnm2",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -99,6 +99,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_2_density_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -108,6 +108,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_3_1_wall_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -81,6 +81,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_3_2_wall_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -81,6 +81,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_3_3_wall_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -81,6 +81,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_4_1_wall_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -81,6 +81,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "basic_4_2_wall_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -81,6 +81,7 @@
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......
{
"name" : "rimea_01_pathway_gnm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
......@@ -72,6 +72,7 @@
"bounded" : true
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
......