use of il.ac.technion.cs.yp.btw.db.DataObjects.DataCrossRoad in project BTW by TechnionYearlyProject.
the class TestGeoJasonToJavaParser method testCrossRoadsCorrect.
@Test
public void testCrossRoadsCorrect() {
GeoJasonToJavaParser parser = new GeoJasonToJavaParser(mapName, geoJson);
assertNotNull(parser.getTrafficLights());
Iterator<Crossroad> crossRoadsIterator = parser.getCrossRoads().iterator();
DataCrossRoad dataCrossroad = (DataCrossRoad) (crossRoadsIterator.next());
assertNotNull(dataCrossroad);
assertEquals(0.0014190683853251293, dataCrossroad.getCoordinateX(), 0.0000000000000000000001);
assertEquals(0.014645366930914668, dataCrossroad.getCoordinateY(), 0.0000000000000000000001);
assertEquals(1, parser.getCrossRoads().size());
}
use of il.ac.technion.cs.yp.btw.db.DataObjects.DataCrossRoad in project BTW by TechnionYearlyProject.
the class QueryCrossRoad method arrangeRecievedData.
/*
* @author Sharon Hadar
* @Date 21/01/2018
* construct a cross road from the data base results
* */
@Override
public Crossroad arrangeRecievedData(ResultSet resultSet) {
Set<TrafficLight> trafficLights = new HashSet();
try {
while (resultSet.next()) {
String nameID = resultSet.getString("nameID");
double cordx = resultSet.getDouble("cordx");
double cordy = resultSet.getDouble("cordy");
String sourceRoadId = nameID.split("from:|to:")[1];
// resultSet.getString("from");
String destinationRoadIf = nameID.split("to:")[1];
// resultSet.getString("to");
long overload = resultSet.getLong("overload");
Point position = new PointImpl(cordx, cordy);
TrafficLight trafficLight = new DataTrafficLight(nameID, position, sourceRoadId, destinationRoadIf, overload, mapName);
trafficLights.add(trafficLight);
}
} catch (SQLException e) {
logger.error("queryCrossRoad has failed");
}
Crossroad crossRoad = new DataCrossRoad(this.position, trafficLights, mapName);
return crossRoad;
}
Aggregations