Commit 26e99ade authored by Christina's avatar Christina

added sort

parent 450550be
Pipeline #301894 failed with stages
in 2 minutes and 4 seconds
......@@ -530,4 +530,4 @@
},
"stimulusInfos" : [ ]
}
}
}
\ No newline at end of file
{
"name" : "New_scenario",
"description" : "",
"release" : "1.14",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
"filename" : "postvis.traj",
"processors" : [ 1, 2 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
"processors" : [ 3 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"processors" : [ 4 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FootStepProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FootStepTargetIDProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 3
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.NumberOverlapsProcessor",
"id" : 4,
"attributesType" : "org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : null,
"attributesModel" : { },
"attributesSimulation" : {
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 5663626838207873416,
"simulationSeed" : 0
},
"attributesPsychology" : {
"usePsychologyLayer" : false,
"psychologyLayer" : {
"perception" : "SimplePerceptionModel",
"cognition" : "SimpleCognitionModel"
}
},
"attributesStrategy" : {
"useStrategyModel" : false,
"strategyModel" : null
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 10.0,
"height" : 10.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ ],
"targetChangers" : [ ],
"absorbingAreas" : [ ],
"sources" : [ ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footstepHistorySize" : 4,
"searchRadius" : 1.0,
"walkingDirectionCalculation" : "BY_TARGET_CENTER",
"walkingDirectionSameIfAngleLessOrEqual" : 45.0
},
"teleporter" : null,
"attributesCar" : {
"id" : -1,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footstepHistorySize" : 4,
"searchRadius" : 1.0,
"walkingDirectionCalculation" : "BY_TARGET_CENTER",
"walkingDirectionSameIfAngleLessOrEqual" : 45.0,
"length" : 4.5,
"width" : 1.7,
"direction" : {
"x" : 1.0,
"y" : 0.0
}
}
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
{
"name" : "bottleneck_2m",
"description" : "",
"release" : "1.13",
"release" : "1.14",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -192,6 +192,10 @@
"cognition" : "SimpleCognitionModel"
}
},
"attributesStrategy" : {
"useStrategyModel" : false,
"strategyModel" : null
},
"topography" : {
"attributes" : {
"bounds" : {
......@@ -306,4 +310,4 @@
},
"stimulusInfos" : [ ]
}
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package org.vadere.simulator.projects.migration.jsontranformation;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.vadere.state.attributes.AttributesStrategyModel;
import org.vadere.util.version.Version;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.JsonConverter;
......@@ -133,7 +134,9 @@ public abstract class AbstractJsonTransformation implements JsonTransformation,
// choose sort order based on targetVersion.
public JsonNode sort (JsonNode node) {
if (getTargetVersion().equalOrBigger(Version.V1_7)) {
if (getTargetVersion().equalOrBigger(Version.V1_14)) {
node = sort_since_V1_14(node);
} else if (getTargetVersion().equalOrBigger(Version.V1_7)){
node = sort_since_V1_7(node);
} else if (getTargetVersion().equalOrBigger(Version.V1_5)){
node = sort_since_V1_5(node);
......@@ -146,6 +149,19 @@ public abstract class AbstractJsonTransformation implements JsonTransformation,
return node;
}
private JsonNode sort_since_V1_14(JsonNode node) {
LinkedHashMap source = (LinkedHashMap) StateJsonConverter.convertJsonNodeToObject(node);
LinkedHashMap<Object, Object> sortedRoot = new LinkedHashMap<>();
putObject(sortedRoot, source, "name");
putObject(sortedRoot, source, "description");
putObject(sortedRoot, source, "release");
putObject(sortedRoot, source, "commithash");
putObject(sortedRoot, source, "processWriters","files", "processors", "isTimestamped", "isWriteMetaData");
putObject(sortedRoot, source, "scenario", "mainModel", "attributesModel", AttributesSimulation.JSON_KEY, AttributesPsychology.JSON_KEY, AttributesStrategyModel.JSON_KEY, "topography", "stimulusInfos");
return StateJsonConverter.deserializeToNode(sortedRoot);
}
private JsonNode sort_since_V1_7(JsonNode node) {
LinkedHashMap source = (LinkedHashMap) StateJsonConverter.convertJsonNodeToObject(node);
LinkedHashMap<Object, Object> sortedRoot = new LinkedHashMap<>();
......
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