The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 571686f9 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

[WIP] further reflection statements were removed

parent fd2924ab
Pipeline #59479 passed with stage
in 46 seconds
...@@ -184,8 +184,8 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen ...@@ -184,8 +184,8 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
} else if (scenarioElement instanceof Pedestrian) { } else if (scenarioElement instanceof Pedestrian) {
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement)); this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement));
} else { } else {
this.txtrTextfiletextarea.setText(StateJsonConverter this.txtrTextfiletextarea.setText(StateJsonConverter
.serializeObject(ReflectionAttributeModifier.getAttributes(scenarioElement))); .serializeObject(scenarioElement.getAttributes()));
} }
} }
} }
......
...@@ -31,8 +31,11 @@ public class ReflectionAttributeModifier { ...@@ -31,8 +31,11 @@ public class ReflectionAttributeModifier {
double y = shape.getBounds2D().getCenterY(); double y = shape.getBounds2D().getCenterY();
((AgentWrapper) element).getAgentInitialStore().setPosition(new VPoint(x, y)); ((AgentWrapper) element).getAgentInitialStore().setPosition(new VPoint(x, y));
} else { } else {
Attributes attributes = Attributes attributes = element.getAttributes(); // replaces Relection code from above
org.vadere.simulator.entrypoints.ReflectionAttributeModifier.getAttributes(element);
//TODO: issue #91 Cannot easily replace the relection in the following code. Some Attributes classes have a
//TODO: setShape(shape) method such as AttributesStairs, but not all, so there is no guarantee...
//TODO: If there is no field "shape", then only the stacktrace is printed...
field = attributes.getClass().getDeclaredField("shape"); field = attributes.getClass().getDeclaredField("shape");
field.setAccessible(true); field.setAccessible(true);
field.set(attributes, shape); field.set(attributes, shape);
......
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