Package com.game.cloudymon.bean

Source Code of com.game.cloudymon.bean.PlayBean

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);
  }
}
TOP

Related Classes of com.game.cloudymon.bean.PlayBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.