Commit d0b4615c authored by Jakob Schöttl's avatar Jakob Schöttl

Fix names and warnings

parent c2783e57
......@@ -176,20 +176,23 @@ public class TextView extends JPanel implements IJsonView {
try {
switch (attributeType) {
case MODEL:
ModelDefinition modelDefinition = JsonConverter.deserializeModelDefinition(json);
currentScenario.getScenarioStore().mainModel = modelDefinition.getMainModel();
currentScenario.setAttributesModel(modelDefinition.getAttributesList());
break;
case SIMULATION:
currentScenario.setAttributesSimulation(StateJsonConverter.deserializeAttributesSimulation(json));
break;
case OUTPUTPROCESSOR:
currentScenario.setDataProcessingJsonManager(DataProcessingJsonManager.deserialize(json));
break;
case TOPOGRAPHY:
currentScenario.setTopography(StateJsonConverter.deserializeTopography(json));
break;
case MODEL:
ModelDefinition modelDefinition = JsonConverter.deserializeModelDefinition(json);
currentScenario.getScenarioStore().mainModel = modelDefinition.getMainModel();
currentScenario.setAttributesModel(modelDefinition.getAttributesList());
break;
case SIMULATION:
currentScenario
.setAttributesSimulation(StateJsonConverter.deserializeAttributesSimulation(json));
break;
case OUTPUTPROCESSOR:
currentScenario.setDataProcessingJsonManager(DataProcessingJsonManager.deserialize(json));
break;
case TOPOGRAPHY:
currentScenario.setTopography(StateJsonConverter.deserializeTopography(json));
break;
default:
throw new RuntimeException("attribute type not implemented.");
}
currentScenario.updateCurrentStateSerialized();
ScenarioPanel.removeJsonParsingErrorMsg();
......@@ -217,28 +220,30 @@ public class TextView extends JPanel implements IJsonView {
}
private void setVadereScenarioThrows(Scenario scenario) throws JsonProcessingException {
this.currentScenario = scenario;
currentScenario = scenario;
switch (attributeType) {
case MODEL:
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeMainModelAttributesModelBundle(
scenario.getSortedAttributesMode(), scenario.getScenarioStore().mainModel));
break;
case SIMULATION:
this.txtrTextfiletextarea
.setText(StateJsonConverter.serializeAttributesSimulation(scenario.getAttributesSimulation()));
break;
case OUTPUTPROCESSOR:
this.txtrTextfiletextarea.setText(scenario.getDataProcessingJsonManager().serialize());
break;
case TOPOGRAPHY:
Topography topography = scenario.getTopography().clone();
topography.removeBoundary();
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeTopography(topography));
break;
case MODEL:
txtrTextfiletextarea.setText(StateJsonConverter.serializeMainModelAttributesModelBundle(
scenario.getModelAttributes(), scenario.getScenarioStore().mainModel));
break;
case SIMULATION:
txtrTextfiletextarea
.setText(StateJsonConverter.serializeAttributesSimulation(scenario.getAttributesSimulation()));
break;
case OUTPUTPROCESSOR:
txtrTextfiletextarea.setText(scenario.getDataProcessingJsonManager().serialize());
break;
case TOPOGRAPHY:
Topography topography = scenario.getTopography().clone();
topography.removeBoundary();
txtrTextfiletextarea.setText(StateJsonConverter.serializeTopography(topography));
break;
default:
throw new RuntimeException("attribute type not implemented.");
}
this.txtrTextfiletextarea.setCaretPosition(0);
txtrTextfiletextarea.setCaretPosition(0);
}
@Override
......
......@@ -29,7 +29,7 @@ public class TestVadereTestProject {
final Scenario srm = JsonConverter.deserializeScenarioRunManager(scenarioJson);
assertEquals("Neues_Szenario", srm.getName());
assertEquals(3, srm.getAttributesModel().size());
assertEquals(3, srm.getModelAttributes().size());
assertEquals(21, srm.getDataProcessingJsonManager().getDataProcessors().size());
assertEquals(6, srm.getDataProcessingJsonManager().getOutputFiles().size());
assertTrue(srm.getAttributesPedestrian() != null);
......
......@@ -95,20 +95,10 @@ public class Scenario {
return scenarioStore;
}
public List<Attributes> getAttributesModel() {
public List<Attributes> getModelAttributes() {
return scenarioStore.attributesList;
}
/**
* Returns a copy of the used ModelTypes in a natural order.
* This is useful for displaying the different Model Attributes in a good order.
*
* @return the used ModelTypes in a natural order
*/
public List<Attributes> getSortedAttributesMode() {
return new ArrayList<>(scenarioStore.attributesList);
}
public AttributesAgent getAttributesPedestrian() {
return scenarioStore.topography.getAttributesPedestrian();
}
......@@ -129,10 +119,6 @@ public class Scenario {
scenarioStore.attributesList = attributesList;
}
public void setAttributesPedestrian(AttributesAgent attributesPedestrian) {
scenarioStore.topography.setAttributesPedestrian(attributesPedestrian);
}
public void setAttributesSimulation(AttributesSimulation attributesSimulation) {
this.scenarioStore.attributesSimulation = attributesSimulation;
}
......
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