package com.game.cloudymon.bean;
import java.util.List;
import com.game.cloudymon.dal.EntityDAO;
import com.game.cloudymon.entity.RouteMap;
import com.game.util.Utils;
public class PlayBean
{
public static RouteMap getRouteMapByLatLng(Double lat, Double lng)
{
//List<RouteMap> routeMaps = StaticDataDAO.getAllRouteMaps();
List<RouteMap> routeMaps = EntityDAO.getAllObj(RouteMap.class, null, null);
int len = routeMaps.size();
double min = Double.MAX_VALUE;
int minIdx = 0;
for (int i = 0; i < len; i++)
{
RouteMap rm = routeMaps.get(i);
double dis = Utils.distance2Location(lat, lng, rm.lat, rm.lng, "K");
if (dis < min)
{
min = dis;
minIdx = i;
}
}
return routeMaps.get(minIdx);
}
}