Commit 939c6119 authored by Daniel Lehmberg's avatar Daniel Lehmberg

[WIP] Example: Stairs with new attribute in ScenarioElement

parent 2530cd7e
Pipeline #59448 failed with stage
in 21 seconds
......@@ -5,6 +5,7 @@ import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesStairs;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VLine;
......@@ -22,17 +23,15 @@ public class Stairs extends ScenarioElement {
}
}
private final AttributesStairs attributes;
private final Tread[] treads;
private AttributesStairs attributes;
private Tread[] treads;
private double treadDepth;
public Stairs(AttributesStairs attributes) {
this.attributes = attributes;
treads = initializeTreads();
setAttributes(attributes);
}
private Tread[] initializeTreads() {
private Tread[] computeTreads() {
// tread count + 2 since the first and last treads must be placed outside of the shape and
// on the next floor.
Tread[] treadsResult = new Tread[this.getAttributes().getTreadCount() + 2];
......@@ -73,6 +72,12 @@ public class Stairs extends ScenarioElement {
return treadsResult;
}
@Override
public void setAttributes(Attributes attributes) {
this.attributes = (AttributesStairs) attributes;
treads = computeTreads();
}
@Override
public void setShape(VShape newShape) {
attributes.setShape(newShape);
......
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