use of il.ac.technion.cs.yp.btw.classes.Crossroad in project BTW by TechnionYearlyProject.
the class FreeFormMapSimulatorTest method testParameterMapRadius.
@Test
public void testParameterMapRadius() {
int testCityRadius = 10000;
FreeFormMapSimulator f = new FreeFormMapSimulator().setCityRadius(testCityRadius);
f.build();
for (Crossroad crossroad : f.getCrossRoads()) {
assertTrue(FreeFormMapSimulator.calculateLengthBetween2Points(f.getCityCenter(), crossroad) <= (f.getCityRadius() + DEFAULT_RADIUS_MARGIN_OF_ERROR));
}
}
use of il.ac.technion.cs.yp.btw.classes.Crossroad in project BTW by TechnionYearlyProject.
the class FreeFormMapSimulatorTest method testManyBlocksParameterMapRadius.
@Test
public void testManyBlocksParameterMapRadius() {
int testCityRadius = 10000;
int testNumOfBlocks = 300;
FreeFormMapSimulator f = new FreeFormMapSimulator().setCityRadius(testCityRadius).setNumOfCityBlocks(testNumOfBlocks);
f.build();
for (Crossroad crossroad : f.getCrossRoads()) {
assertTrue(FreeFormMapSimulator.calculateLengthBetween2Points(f.getCityCenter(), crossroad) <= (f.getCityRadius() + DEFAULT_RADIUS_MARGIN_OF_ERROR));
}
}
use of il.ac.technion.cs.yp.btw.classes.Crossroad 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) {
System.out.println("query has failed");
}
Crossroad crossRoad = new DataCrossRoad(this.position, trafficLights, mapName);
return crossRoad;
}
use of il.ac.technion.cs.yp.btw.classes.Crossroad in project BTW by TechnionYearlyProject.
the class FreeFormMapSimulatorTest method testDefaultMapRadius.
@Test
public void testDefaultMapRadius() {
FreeFormMapSimulator f = new FreeFormMapSimulator();
f.build();
for (Crossroad crossroad : f.getCrossRoads()) {
assertTrue(FreeFormMapSimulator.calculateLengthBetween2Points(f.getCityCenter(), crossroad) <= (f.getCityRadius() + DEFAULT_RADIUS_MARGIN_OF_ERROR));
}
}
Aggregations