Commit 8688064d authored by hengwen's avatar hengwen

Add street sign

parent d3446a30
......@@ -8,12 +8,15 @@ public class Dataframe {
private double posY;
private double posZ;
private double steering = 4;
private double engine = 5;
private double brake = 6;
private double steering;
private double engine;
private double brake;
private double[][] rotation;
private double[] velocity;
private double[] acceleration;
private double deltaTime = 7;
private double totalTime = 8;
private double deltaTime;
private double totalTime;
public double getPosX() {
return posX;
......@@ -63,6 +66,30 @@ public class Dataframe {
this.brake = brake;
}
public double[][] getRotation() {
return rotation;
}
public void setRotation(double[][] rotation) {
this.rotation = rotation;
}
public double[] getVelocity() {
return velocity;
}
public void setVelocity(double[] velocity) {
this.velocity = velocity;
}
public double[] getAcceleration() {
return acceleration;
}
public void setAcceleration(double[] acceleration) {
this.acceleration = acceleration;
}
public double getDeltaTime() {
return deltaTime;
}
......
......@@ -12,12 +12,14 @@ public class MapModel {
private double longitude;
private double latitude;
private double altitude;
private StreetSign streetSign;
public Node(long id, double longitude, double latitude, double altitude){
public Node(long id, double longitude, double latitude, double altitude, StreetSign streetSign) {
this.id = id;
this.longitude = longitude;
this.latitude = latitude;
this.altitude = altitude;
this.streetSign = streetSign;
}
public long getId() {
......@@ -35,6 +37,77 @@ public class MapModel {
public double getAltitude() {
return altitude;
}
public StreetSign getStreetSign() {
return streetSign;
}
}
public static class StreetSign{
private long id;
private String type;
private boolean one;
private boolean two;
private double x1;
private double x2;
private double y1;
private double y2;
private double z1;
private double z2;
public StreetSign(long id, String type, boolean one, boolean two, double x1, double x2, double y1, double y2, double z1, double z2) {
this.id = id;
this.type = type;
this.one = one;
this.two = two;
this.x1 = x1;
this.x2 = x2;
this.y1 = y1;
this.y2 = y2;
this.z1 = z1;
this.z2 = z2;
}
public long getId() {
return id;
}
public String getType() {
return type;
}
public boolean isOne() {
return one;
}
public boolean isTwo() {
return two;
}
public double getX1() {
return x1;
}
public double getX2() {
return x2;
}
public double getY1() {
return y1;
}
public double getY2() {
return y2;
}
public double getZ1() {
return z1;
}
public double getZ2() {
return z2;
}
}
public static class Street{
......
......@@ -117,6 +117,10 @@ public class SimulatorService {
List<Dataframe> frames = new ArrayList<>();
for (SimulationDataFrame f: vframe.getFramesList()){
double[][] rotation = new double[f.getRotationCount()][f.getRotation(0).getValueCount()];
for (int i = 0; i < f.getRotationCount(); i++) {
rotation[i] = f.getRotation(i).getValueList().stream().mapToDouble(Double::doubleValue).toArray();
}
frames.add(new Dataframe(){{
setPosX(f.getPosX());
setPosY(f.getPosY());
......@@ -125,6 +129,9 @@ public class SimulatorService {
setSteering(f.getSteering());
setEngine(f.getEngine());
setBrake(f.getBrake());
setRotation(rotation);
setVelocity(f.getVelocity().getValueList().stream().mapToDouble(Double::doubleValue).toArray());
setAcceleration(f.getAcceleration().getValueList().stream().mapToDouble(Double::doubleValue).toArray());
setDeltaTime(f.getDeltaTime());
setTotalTime(f.getTotalTime());
......@@ -244,7 +251,8 @@ public class SimulatorService {
node.getId(),
node.getLonitude(),
node.getLatitude(),
node.getAltitude()
node.getAltitude(),
null
));
}
return result;
......
......@@ -65,12 +65,19 @@ public class WorldBuilderService {
List<MapModel.Node> result = new ArrayList<>();
for (EnvNode node : nodes) {
double x = node.getX().doubleValue(), y = node.getY().doubleValue();
StreetSign sign = node.getStreetSign();
result.add(new MapModel.Node(
node.getOsmId(),
(float) converter.convertXToLong(x, y),
(float) converter.convertYToLat(y),
node.getZ().floatValue()
node.getZ().floatValue(),
sign == null ? null : new MapModel.StreetSign(
sign.getId(), sign.getType().toString(), sign.isOne(), sign.isTwo(),
sign.getX1(), sign.getX2(),
sign.getY1(), sign.getY2(),
sign.getZ1(), sign.getZ2()
)
));
}
return result;
......
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