Commit bdd6e83e authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Removed mirroring

parent 056e56ef
......@@ -280,12 +280,7 @@ public class VehicleMovementModel implements MovementModel, EventHandler {
e.printStackTrace();
}
if (scenarioHeight != -1) {
component.updateCurrentLocation(new PositionVector(position.getLongitude(), Math.min(scenarioHeight, height) - position.getLatitude()));
} else {
// This would be vertically mirrored
component.updateCurrentLocation(new PositionVector(position.getLongitude(), position.getLatitude()));
}
component.setMovementSpeed(_controller.getVehicleSpeed(vehicle));
......
......@@ -733,24 +733,41 @@ public class TraciSimulationController implements VehicleController, SimulationS
return angle;
}
@Override
public List<Location> getLaneShape(String pLaneID) {
List<Location> positions = new ArrayList<>();
SumoCommand laneShapeCommand = Lane.getShape(pLaneID);
SumoGeometry geometry = (SumoGeometry)requestObject(laneShapeCommand);
for (SumoPosition2D location : geometry.coords) {
if (!isObservedAreaSet()) {
positions.add(new PositionVector(location.x, location.y));
} else {
if (_startX <= location.x && location.x <= _endX && _startY <= location.y && location.y <= _endY) {
positions.add(new PositionVector(location.x - _startX, location.y - _startY));
}
}
}
return positions;
}
@Override
public Location getEdgeMeanPosition(String pEdgeID) {
List<SumoPosition2D> positions = new ArrayList<>();
List<Location> positions = new ArrayList<>();
for (RoadNetworkLane lane : _roadNetwork.getEdge(pEdgeID).getLanes()) {
String laneID = lane.getLaneID();
SumoCommand laneShapeCommand = Lane.getShape(laneID);
SumoGeometry geometry = (SumoGeometry)requestObject(laneShapeCommand);
positions.addAll(geometry.coords);
positions.addAll(getLaneShape(laneID));
}
double x = 0;
double y = 0;
int count = 0;
for (SumoPosition2D sumoPosition2D : positions) {
x += sumoPosition2D.x;
y += sumoPosition2D.y;
for (Location position : positions) {
x += position.getLongitude();
y += position.getLatitude();
count++;
}
......
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