当前位置: 首页>>代码示例>>Java>>正文


Java TransitRouteLine.TransitStep方法代码示例

本文整理汇总了Java中com.baidu.mapapi.search.route.TransitRouteLine.TransitStep方法的典型用法代码示例。如果您正苦于以下问题:Java TransitRouteLine.TransitStep方法的具体用法?Java TransitRouteLine.TransitStep怎么用?Java TransitRouteLine.TransitStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.baidu.mapapi.search.route.TransitRouteLine的用法示例。


在下文中一共展示了TransitRouteLine.TransitStep方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIconForStep

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
private BitmapDescriptor getIconForStep(TransitRouteLine.TransitStep step) {
    switch (step.getStepType()) {
        case BUSLINE:
            return BitmapDescriptorFactory.fromAssetWithDpi("Icon_bus_station.png");
        case SUBWAY:
            return BitmapDescriptorFactory.fromAssetWithDpi("Icon_subway_station.png");
        case WAKLING:
            return BitmapDescriptorFactory.fromAssetWithDpi("Icon_walk_route.png");
        default:
            return null;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:TransitRouteOverlay.java

示例2: doGetMode

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
/**
 * 获取节结果信息
 */
private void doGetMode() {
    LatLng nodeLocation = null;
    String nodeTitle = null;
    Object step = route.getAllStep().get(nodeIndex);
    if (step instanceof DrivingRouteLine.DrivingStep) {
        nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
        nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
    } else if (step instanceof WalkingRouteLine.WalkingStep) {
        nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
        nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
    } else if (step instanceof TransitRouteLine.TransitStep) {
        nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
        nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
    } else if (step instanceof BikingRouteLine.BikingStep) {
        nodeLocation = ((BikingRouteLine.BikingStep) step).getEntrance().getLocation();
        nodeTitle = ((BikingRouteLine.BikingStep) step).getInstructions();
    }
    if (nodeLocation == null || nodeTitle == null) {
        return;
    }
    // 移动节点至中心
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
    // show popup
    TextView popupText = new TextView(this);
    popupText.setBackgroundResource(R.drawable.popup);
    popupText.setTextColor(0xFF000000);
    popupText.setText(nodeTitle);
    mBaiduMap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:33,代码来源:GeoCodeActivity.java

示例3: getIconForStep

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
private BitmapDescriptor getIconForStep(TransitRouteLine.TransitStep step) {
	switch (step.getStepType()) {
	case BUSLINE:
		return BitmapDescriptorFactory
				.fromAssetWithDpi("Icon_bus_station.png");
	case SUBWAY:
		return BitmapDescriptorFactory
				.fromAssetWithDpi("Icon_subway_station.png");
	case WAKLING:
		return BitmapDescriptorFactory
				.fromAssetWithDpi("Icon_walk_route.png");
	default:
		return null;
	}
}
 
开发者ID:ContentCoderJian,项目名称:SmartTransXA,代码行数:16,代码来源:TransitRouteOverlay.java

示例4: getView

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	try{
		convertView = mInflater.inflate(R.layout.transit_route_list_item, null);
           ImageView imageView = (ImageView)convertView.findViewById(R.id.transit_route_list_item_img);
           TextView textView = (TextView)convertView.findViewById(R.id.transit_route_list_item_title);
           
           if(position == 0){
           	imageView.setImageResource(R.drawable.route_crosscity_detail_startpoint);
           	textView.setText(startPosition);
           }else if(position == getCount()-2){
           	imageView.setImageResource(R.drawable.route_crosscity_detail_endpoint);
           	textView.setText(endPosition);
           }else if(position == getCount()-1){
           	convertView.setBackgroundColor(Color.parseColor("#00FFFFFF"));
           	imageView.setImageResource(R.drawable.none_bg);
           	textView.setText("");
           }else{
           
            Object step = getItem(position-1);
               if (step instanceof TransitRouteLine.TransitStep) {
               	String nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
               	textView.setText(nodeTitle.trim());
               	if(nodeTitle.startsWith("乘坐")){
               		imageView.setImageResource(R.drawable.icon_route_sectional_bus);
               	}else if(nodeTitle.startsWith("步行")){
               		imageView.setImageResource(R.drawable.icon_route_sectional_walk);
               	}
               }
           }

	}catch(Exception e){
		e.printStackTrace();
	}
	
	return convertView;
}
 
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:38,代码来源:TransitRouteResultActivity.java

示例5: nodeClick

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
/**
 * 节点浏览示例
 *
 * @param v
 */
public void nodeClick(View v) {
    if (route == null || route.getAllStep() == null) {
        return;
    }
    if (nodeIndex == -1 && v.getId() == R.id.pre) {
        return;
    }
    // 设置节点索引
    if (v.getId() == R.id.next) {
        if (nodeIndex < route.getAllStep().size() - 1) {
            nodeIndex++;
        } else {
            return;
        }
    } else if (v.getId() == R.id.pre) {
        if (nodeIndex > 0) {
            nodeIndex--;
        } else {
            return;
        }
    }
    // 获取节结果信息
    LatLng nodeLocation = null;
    String nodeTitle = null;
    Object step = route.getAllStep().get(nodeIndex);
    if (step instanceof DrivingRouteLine.DrivingStep) {
        nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
        nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
    } else if (step instanceof WalkingRouteLine.WalkingStep) {
        nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
        nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
    } else if (step instanceof TransitRouteLine.TransitStep) {
        nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
        nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
    } else if (step instanceof BikingRouteLine.BikingStep) {
        nodeLocation = ((BikingRouteLine.BikingStep) step).getEntrance().getLocation();
        nodeTitle = ((BikingRouteLine.BikingStep) step).getInstructions();
    }

    if (nodeLocation == null || nodeTitle == null) {
        return;
    }
    // 移动节点至中心
    mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
    // show popup
    popupText = new TextView(RoutePlanDemo.this);
    popupText.setBackgroundResource(R.drawable.popup);
    popupText.setTextColor(0xFF000000);
    popupText.setText(nodeTitle);
    mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));

}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:58,代码来源:RoutePlanDemo.java

示例6: nodeClick

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
/**
 * 节点浏览示例
 *
 * @param v
 */
public void nodeClick(View v) {
    if (route == null ||
            route.getAllStep() == null) {
        return;
    }
    if (nodeIndex == -1 && v.getId() == R.id.pre) {
        return;
    }
    //设置节点索引
    if (v.getId() == R.id.next) {
        if (nodeIndex < route.getAllStep().size() - 1) {
            nodeIndex++;
        } else {
            return;
        }
    } else if (v.getId() == R.id.pre) {
        if (nodeIndex > 0) {
            nodeIndex--;
        } else {
            return;
        }
    }
    //获取节结果信息
    LatLng nodeLocation = null;
    String nodeTitle = null;
    Object step = route.getAllStep().get(nodeIndex);
    if (step instanceof DrivingRouteLine.DrivingStep) {
        nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
        nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
    } else if (step instanceof WalkingRouteLine.WalkingStep) {
        nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
        nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
    } else if (step instanceof TransitRouteLine.TransitStep) {
        nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
        nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
    }

    if (nodeLocation == null || nodeTitle == null) {
        return;
    }
    //移动节点至中心
    mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
    // show popup
    popupText = new TextView(RoutePlanActivity.this);
    popupText.setBackgroundResource(R.drawable.popup);
    popupText.setTextColor(0xFF000000);
    popupText.setText(nodeTitle);
    mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));

}
 
开发者ID:BeckNiu,项目名称:MyCar,代码行数:56,代码来源:RoutePlanActivity.java

示例7: nodeClick

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
/**
 * 节点浏览示例
 *
 * @param v
 */
public void nodeClick(View v) {
    if (route == null || route.getAllStep() == null) {
        return;
    }
    if (nodeIndex == -1 && v.getId() == R.id.pre) {
        return;
    }
    // 设置节点索引
    if (v.getId() == R.id.next) {
        if (nodeIndex < route.getAllStep().size() - 1) {
            nodeIndex++;
        } else {
            return;
        }
    } else if (v.getId() == R.id.pre) {
        if (nodeIndex > 0) {
            nodeIndex--;
        } else {
            return;
        }
    }
    // 获取节结果信息
    LatLng nodeLocation = null;
    String nodeTitle = null;
    Object step = route.getAllStep().get(nodeIndex);
    if (step instanceof DrivingRouteLine.DrivingStep) {
        nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
        nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
    } else if (step instanceof WalkingRouteLine.WalkingStep) {
        nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
        nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
    } else if (step instanceof TransitRouteLine.TransitStep) {
        nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
        nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
    } else if (step instanceof BikingRouteLine.BikingStep) {
        nodeLocation = ((BikingRouteLine.BikingStep) step).getEntrance().getLocation();
        nodeTitle = ((BikingRouteLine.BikingStep) step).getInstructions();
    }

    if (nodeLocation == null || nodeTitle == null) {
        return;
    }
    // 移动节点至中心
    mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
    // show popup
    popupText = new TextView(RoutePlan.this);
    popupText.setBackgroundResource(R.drawable.popup);
    popupText.setTextColor(0xFF000000);
    popupText.setText(nodeTitle);
    mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));

}
 
开发者ID:modricwang,项目名称:FindYou,代码行数:58,代码来源:RoutePlan.java

示例8: nodeClick

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
public void nodeClick(View v) {
    if (route == null ||
            route.getAllStep() == null) {
        return;
    }
    if (nodeIndex == -1 && v.getId() == R.id.pre) {
        return;
    }
    //设置节点索引
    if (v.getId() == R.id.next) {
        if (nodeIndex < route.getAllStep().size() - 1) {
            nodeIndex++;
        } else {
            return;
        }
    } else if (v.getId() == R.id.pre) {
        if (nodeIndex > 0) {
            nodeIndex--;
        } else {
            return;
        }
    }
    //获取节结果信息
    LatLng nodeLocation = null;
    String nodeTitle = null;
    Object step = route.getAllStep().get(nodeIndex);
    if (step instanceof DrivingRouteLine.DrivingStep) {
        nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
        nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
    } else if (step instanceof WalkingRouteLine.WalkingStep) {
        nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
        nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
    } else if (step instanceof TransitRouteLine.TransitStep) {
        nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
        nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
    }

    if (nodeLocation == null || nodeTitle == null) {
        return;
    }
    //移动节点至中心
    mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
    // show popup
    popupText = new TextView(RoutePlan.this);
    popupText.setBackgroundResource(R.drawable.popup);
    popupText.setTextColor(0xFF000000);
    popupText.setText(nodeTitle);
    mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));
}
 
开发者ID:PengZhiPeng,项目名称:Mooc-map,代码行数:50,代码来源:RoutePlan.java

示例9: showResultList

import com.baidu.mapapi.search.route.TransitRouteLine; //导入方法依赖的package包/类
/**
    * 展示搜索结果到界面上
    */
private void showResultList() throws Exception{
	Log.i(TAG, "Search Done, Show Result List");
	if(mRoutePlans==null){
		return;
	}
       mResultListData.clear();
       
       for(int i=0; i<mRoutePlans.size(); i++){
       	TransitRouteLine routeLine = mRoutePlans.get(i);
       	String title = "";
       	int time = routeLine.getDuration();
       	int distance = routeLine.getDistance();
       	int walk = 0;
       	Log.i(TAG+" routeLine title", ""+title);
       	

       	for(int j=0; j<routeLine.getAllStep().size(); j++){
           	
               String nodeTitle = null;
               boolean isFirstRouteTitle = true;
               Object step = routeLine.getAllStep().get(j);
               if (step instanceof TransitRouteLine.TransitStep) {
                   nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
                   Log.i(TAG+"结果",""+nodeTitle);
                   int startPos = -1, endPos = -1;
                   if(nodeTitle.indexOf("乘坐")!=-1){
                   	startPos = nodeTitle.indexOf("乘坐");
                   	endPos = nodeTitle.indexOf(",");
                       
                       if(startPos!=-1 && endPos!=-1){
                       	Log.i(TAG+"乘坐", nodeTitle.substring(startPos+2,endPos));
                       	if(!isFirstRouteTitle){
                       		//TODO 这里是什么??看不懂了-.-
                       		title = title + " " + nodeTitle.substring(startPos+2,endPos);
                       	}else{
                       		title = nodeTitle.substring(startPos+2,endPos);
                       		isFirstRouteTitle = false;
                       	}
                       	
                       }else{
                       	title = "--";
                       }
                   }else if(nodeTitle.indexOf("步行")!=-1){
                   	startPos = nodeTitle.indexOf("步行");
                       endPos = nodeTitle.indexOf("米");
                       if(startPos!=-1 && endPos!=-1){
                       	Log.i(TAG+"步行", nodeTitle.substring(startPos+2,endPos));
                       	walk += Integer.parseInt(
                       			nodeTitle.substring(startPos+2,endPos));
                       }else{
                       	walk = 0;
                       }
                   }
               }
               
           }

       	HashMap<String, Object> map = new HashMap<String, Object>();
           map.put("title", title);
           map.put("time", time/60+"分钟");
           DecimalFormat decimalFormat=new DecimalFormat(".0");
           String dis = decimalFormat.format(distance/1000);
           map.put("distance", ""+dis+"公里");
           map.put("walk", "步行"+walk+"米");
           mResultListData.add(map);
       }
       
       Message msg = mHandler.obtainMessage();
       msg.what = MSG_UPDATE_LIST;
       mHandler.sendMessage(msg);

}
 
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:76,代码来源:RoutePlanActivity.java


注:本文中的com.baidu.mapapi.search.route.TransitRouteLine.TransitStep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。