高德地图实现公交路线-添加标记-轨迹回放-中心点-图层

效果图

高德地图实现公交路线-添加标记-轨迹回放-中心点-图层_第1张图片

 

轨迹回放

高德地图实现公交路线-添加标记-轨迹回放-中心点-图层_第2张图片

 

 

JSP

 

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>





XXX	

    
     
    
    
    
   
    
	
    
    



	

轨迹回放部分

 

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>





轨迹回放	

    
     
    
    
    
   



 

 

 

 

 

 

 

后台

 

 

@Controller
@RequestMapping(value = "xxx")
public class BusMonitorController extends BaseController {

	@Autowired
	private BusMonitorService busMonitorService;


	/**
	 * 地图初始化
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "loadBusMapInfo")
	public String loadBusMapInfo(Model model) {
		// 公交场站
		List> busHubList = busMonitorService.findBusHubList();
		model.addAttribute("busHubList", busHubList);

		// 公交车
		List> busList = busMonitorService.findBusList();
		model.addAttribute("busList", busList);

		// 公交线路
		 List> busRoutesList =
		 busMonitorService.findBusRoutes();
		 model.addAttribute("busRoutesList", busRoutesList);

		return "busMap";
	}

	/**
	 * 轨迹回放
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "busTrackPlayback")
	public String busTrackPlayback(Model model) {
		Map track = busMonitorService.findBusTrack();
		model.addAttribute("track", track);
		return "busTrackPlayback";
	}

	

}

 

 

 

 

@Service
@Transactional(readOnly = true)
public class BusMonitorService {

	@Autowired
	public WarningRecordService warningRecordService;

	// 所有公交场站
	public List> findBusHubList() {

		ArrayList> list = new ArrayList<>();

		Map busHub = new HashMap();
		busHub.put("Cotent", "XXX公交场站信息");
		busHub.put("x", "105.734014");
		busHub.put("y", "35.96336");

		Map busHub1 = new HashMap();
		busHub1.put("Cotent", "YYY公交场站信息");
		busHub1.put("x", "105.725431");
		busHub1.put("y", "35.964576");

		list.add(busHub);
		list.add(busHub1);

		return list;
	}

	// 所有公交车
	public List> findBusList() {

		ArrayList> list = new ArrayList<>();

		Map bus = new HashMap();
		bus.put("number", "YY991");
		bus.put("name", "李雷");
		bus.put("company", "一家公交公司");
		bus.put("line", "一号线");
		bus.put("x", "105.730383");
		bus.put("y", "35.963638");

		list.add(bus);

		return list;
	}

	// 轨迹回放
	public Map findBusTrack() {

		Map track = new HashMap();
		track.put("number", "YY991");
		track.put("x", "105.730383");
		track.put("y", "35.963638");
		track.put("tx", "105.723222,105.725947,105.727293,105.727132,105.726467,105.727572,105.729471,105.730383");
		track.put("ty", "35.968935,35.968774,35.968714,35.967858,35.965062,35.963855,35.963673,35.963638");

		return track;
	}

	

	// 公交线路

	public List> findBusRoutes() {

		ArrayList> list = new ArrayList<>();

		Map busRoutes = new HashMap();
		busRoutes.put("name", "1号线");
		busRoutes.put("x",
				"105.733892,105.731338,105.731338,105.727132,105.726725,105.724536");
		busRoutes.put("y",
				"35.966109,35.966143,35.966143,35.966456,35.966595,35.967463");
		list.add(busRoutes);

		Map busRoutes1 = new HashMap();
		busRoutes1.put("name", "二号线");
		busRoutes1.put("x",
				"105.733259,105.732143,105.730383,105.729471,105.727572,105.726467,105.727132,105.727293,105.725947,105.723222");
		busRoutes1.put("y",
				"35.963508,35.963586,35.963638,35.963673,35.963855,35.965062,35.967858,35.968714,35.968774,35.968935");
		list.add(busRoutes1);

		return list;
	}

}

 

 

 

 

 

 

 

你可能感兴趣的:(杂七杂八,java,高德地图)