Commit 6f2ca6d5 authored by hengwen's avatar hengwen

Switch to xyz coordinate

parent c66935e6
......@@ -69,8 +69,10 @@ public class WorldBuilderService {
result.add(new MapModel.Node(
node.getOsmId(),
(float) converter.convertXToLong(x, y),
(float) converter.convertYToLat(y),
x, y,
// uncomment blowing code to get longitude/latitude coordinate
// converter.convertXToLong(x, y),
// converter.convertYToLat(y),
node.getZ().floatValue(),
sign == null ? null : new MapModel.StreetSign(
sign.getId(), sign.getType().toString(), sign.isOne(), sign.isTwo(),
......@@ -88,12 +90,14 @@ public class WorldBuilderService {
double minX = bound.getMinX(), minY = bound.getMinY(),
maxX = bound.getMaxX(), maxY = bound.getMaxY();
mapModel.setBounds(new MapModel.Bound(
(float) converter.convertXToLong(minX, minY),
(float) converter.convertYToLat(minY),
(float) bound.getMinZ(),
(float) converter.convertXToLong(maxX, maxY),
(float) converter.convertYToLat(maxY),
(float) bound.getMaxZ()
minX, minY, bound.getMinZ(), maxX, maxY, bound.getMaxZ()
// uncomment blowing code to get longitude/latitude coordinate
// converter.convertXToLong(minX, minY),
// converter.convertYToLat(minY),
// bound.getMinZ(),
// converter.convertXToLong(maxX, maxY),
// converter.convertYToLat(maxY),
// bound.getMaxZ()
));
}
......
......@@ -12,15 +12,16 @@ import org.slf4j.LoggerFactory;
import rpc.protobuf.DoubleArray;
import rpc.protobuf.SimulationDataFrame;
import rpc.protobuf.VehicleSimulationDataFrame;
import simulation.environment.WorldModel;
import simulation.environment.osm.ApproximateConverter;
import simulation.vehicle.PhysicalVehicle;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* SimulationObserver collects simulation result from simulators
......@@ -85,14 +86,18 @@ public class SimulationObserver implements SimulationLoopNotifiable {
double[] position = ((PhysicalVehicle) simulationLoopExecutable).getPosition().toArray();
String id = String.valueOf((int) ((PhysicalVehicle) simulationLoopExecutable).getId());
ApproximateConverter cvt = null;
try {
cvt = WorldModel.getInstance().getParser().getConverter().getApproximateConverter();
} catch (Exception e) {
e.printStackTrace();
}
double longitude = cvt.convertXToLong(position[0], position[1]);
double latitude = cvt.convertYToLat(position[1]);
// uncomment the lines below to use longitude/latitude coordinate
// ApproximateConverter cvt = null;
// try {
// cvt = WorldModel.getInstance().getParser().getConverter().getApproximateConverter();
// } catch (Exception e) {
// e.printStackTrace();
// }
// double longitude = cvt.convertXToLong(position[0], position[1]);
// double latitude = cvt.convertYToLat(position[1]);
double longitude = position[0];
double latitude = position[1];
SimulationDataframe frame = new SimulationDataframe();
frame.setId(((PhysicalVehicle) simulationLoopExecutable).getId());
......
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