Commit 7ecc4813 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

resolve merge conflict.

parents 4846b945 145f1026
Pipeline #59614 passed with stage
in 48 seconds
package org.vadere.state.attributes.scenario;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.AttributesEmbedShape;
import org.vadere.util.geometry.shapes.VShape;
public class AttributesObstacle extends Attributes {
public class AttributesObstacle extends AttributesEmbedShape {
private VShape shape;
private int id;
......@@ -19,10 +19,12 @@ public class AttributesObstacle extends Attributes {
this.shape = shape;
}
@Override
public void setShape(VShape shape) {
this.shape = shape;
}
@Override
public VShape getShape() {
return shape;
}
......
......@@ -4,12 +4,12 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.AttributesEmbedShape;
import org.vadere.state.scenario.ConstantDistribution;
import org.vadere.state.types.DynamicElementType;
import org.vadere.util.geometry.shapes.VShape;
public class AttributesSource extends Attributes {
public class AttributesSource extends AttributesEmbedShape {
public static final String CONSTANT_DISTRIBUTION = ConstantDistribution.class.getName();
public static final int NO_MAX_SPAWN_NUMBER_TOTAL = -1;
......@@ -123,10 +123,12 @@ public class AttributesSource extends Attributes {
return id;
}
@Override
public void setShape(VShape shape) {
this.shape = shape;
}
@Override
public VShape getShape() {
return shape;
}
......
......@@ -2,6 +2,7 @@ package org.vadere.state.attributes.scenario;
import org.apache.log4j.Logger;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.AttributesEmbedShape;
import org.vadere.state.scenario.Stairs;
import org.vadere.util.geometry.Vector2D;
import org.vadere.util.geometry.shapes.VShape;
......@@ -16,7 +17,7 @@ import org.vadere.util.geometry.shapes.VShape;
*
*
*/
public class AttributesStairs extends Attributes {
public class AttributesStairs extends AttributesEmbedShape {
private VShape shape = null;
private int id = ID_NOT_SET;
......@@ -42,10 +43,12 @@ public class AttributesStairs extends Attributes {
}
}
@Override
public void setShape(VShape shape) {
this.shape = shape;
}
@Override
public VShape getShape() {
return shape;
}
......
package org.vadere.state.attributes.scenario;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.AttributesEmbedShape;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VShape;
......@@ -8,7 +9,7 @@ import org.vadere.util.geometry.shapes.VShape;
* Attributes of a target area, used by TargetController in VadereSimulation.
*
*/
public class AttributesTarget extends Attributes {
public class AttributesTarget extends AttributesEmbedShape {
private int id = ID_NOT_SET;
/**
......@@ -99,10 +100,12 @@ public class AttributesTarget extends Attributes {
return id;
}
@Override
public void setShape(VShape shape) {
this.shape = shape;
}
@Override
public VShape getShape() {
return shape;
}
......
......@@ -7,6 +7,7 @@ import java.util.Random;
import org.apache.commons.math3.random.JDKRandomGenerator;
import org.apache.commons.math3.random.RandomGenerator;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.util.geometry.Vector2D;
import org.vadere.util.geometry.shapes.VCircle;
......@@ -31,7 +32,7 @@ public abstract class Agent extends DynamicElement {
private double freeFlowSpeed;
private final AttributesAgent attributes;
private AttributesAgent attributes;
public Agent(AttributesAgent attributesAgent) {
position = new VPoint(0, 0);
......@@ -184,6 +185,11 @@ public abstract class Agent extends DynamicElement {
// Setters...
@Override
public void setAttributes(Attributes attributes){
this.attributes = (AttributesAgent) attributes;
}
/**
* Set the index pointing to the next target in the target list.
*
......
......@@ -2,6 +2,7 @@ package org.vadere.state.scenario;
import java.util.Random;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesCar;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.Vector2D;
......@@ -11,7 +12,7 @@ import org.vadere.util.geometry.shapes.VRectangle;
public class Car extends Agent implements Comparable<Car> {
private final AttributesCar attributesCar;
private AttributesCar attributesCar;
public Car(AttributesCar attributesCar, Random random) {
super(attributesCar, random);
......@@ -63,6 +64,10 @@ public class Car extends Agent implements Comparable<Car> {
return this.attributesCar;
}
public void setAttributes(Attributes attributes) {
this.attributesCar = (AttributesCar) attributes;
}
@Override
public int getId() {
return attributesCar.getId();
......
package org.vadere.state.scenario;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.attributes.scenario.AttributesObstacle;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VShape;
public class Obstacle extends ScenarioElement {
private final AttributesObstacle attributes;
private AttributesObstacle attributes;
public Obstacle(AttributesObstacle attributes) {
if (attributes == null)
......@@ -71,6 +72,12 @@ public class Obstacle extends ScenarioElement {
return attributes;
}
@Override
public void setAttributes(Attributes attributes){
this.attributes = (AttributesObstacle) attributes;
}
@Override
public Obstacle clone() {
return new Obstacle((AttributesObstacle) attributes.clone());
......
......@@ -25,4 +25,7 @@ public abstract class ScenarioElement {
public abstract ScenarioElement clone();
public abstract Attributes getAttributes();
public abstract void setAttributes(Attributes attributes);
}
package org.vadere.state.scenario;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesSource;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VShape;
public class Source extends ScenarioElement {
private final AttributesSource attributes;
private AttributesSource attributes;
public Source(AttributesSource attributes) {
this.attributes = attributes;
......@@ -32,6 +33,13 @@ public class Source extends ScenarioElement {
return attributes;
}
@Override
public void setAttributes(Attributes attributes){
this.attributes = (AttributesSource) attributes;
}
public double getStartTime() {
return attributes.getStartTime();
}
......
......@@ -5,8 +5,10 @@ import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
import org.vadere.state.attributes.Attributes;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.state.attributes.scenario.AttributesStairs;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VLine;
......@@ -25,17 +27,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];
......@@ -76,6 +76,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);
......
......@@ -6,13 +6,14 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesTarget;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.VShape;
public class Target extends ScenarioElement implements Comparable<Target> {
private final AttributesTarget attributes;
private AttributesTarget attributes;
private final Map<Integer, Double> enteringTimes;
/**
......@@ -113,6 +114,13 @@ public class Target extends ScenarioElement implements Comparable<Target> {
return attributes;
}
@Override
public void setAttributes(Attributes attributes){
this.attributes = (AttributesTarget) attributes;
}
/** Is this target actually a pedestrian? @see scenario.TargetPedestrian */
public boolean isTargetPedestrian() {
return false;
......
package org.vadere.state.scenario;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesTeleporter;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.Vector2D;
......@@ -8,7 +9,7 @@ import org.vadere.util.geometry.shapes.VShape;
public class Teleporter extends ScenarioElement {
private final AttributesTeleporter attributes;
private AttributesTeleporter attributes;
public Teleporter(AttributesTeleporter attributes) {
this.attributes = attributes;
......@@ -37,6 +38,11 @@ public class Teleporter extends ScenarioElement {
return attributes;
}
@Override
public void setAttributes(Attributes attributes) {
this.attributes = (AttributesTeleporter) attributes;
}
@Override
public ScenarioElementType getType() {
return ScenarioElementType.TELEPORTER;
......
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