Exemplo n.º 1
0
 @Override
 public List<Article> makeArticleList(List<BaiduPlace> placeList, String bd09Lng, String bd09Lat) {
   // 项目的根路径
   String basePath = ValueUtil.PROJECT_ROOT;
   List<Article> list = new ArrayList<Article>();
   BaiduPlace place = null;
   logger.info("组装地点的图文消息");
   for (int i = 0; i < placeList.size(); i++) {
     place = placeList.get(i);
     Article article = new Article();
     article.setTitle(place.getName() + "\n距离约" + place.getDistance() + "米");
     // P1表示用户发送的位置(坐标转换后),p2表示当前POI所在位置
     article.setUrl(
         String.format(
             basePath + "map/route?p1=%s,%s&p2=%s,%s",
             bd09Lng,
             bd09Lat,
             place.getLng(),
             place.getLat()));
     // 将首条图文的图片设置为大图
     if (i == 0) {
       article.setPicUrl(basePath + "images/map_head.jpg");
     } else {
       article.setPicUrl(basePath + "images/map_point.png");
     }
     list.add(article);
   }
   return list;
 }