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


Java DrivingRouteLine类代码示例

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


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

示例1: doGetMode

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的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

示例2: getView

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    NodeViewHolder holder;
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.activity_transit_item, null);
        holder = new NodeViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.transitName);
        holder.lightNum = (TextView) convertView.findViewById(R.id.lightNum);
        holder.dis = (TextView) convertView.findViewById(R.id.dis);
        convertView.setTag(holder);
    } else {
        holder = (NodeViewHolder) convertView.getTag();
    }

    switch (mtype) {
        case  TRANSIT_ROUTE:
            holder.name.setText("路线" + (position + 1));
            int time = routeLines.get(position).getDuration();
            if ( time / 3600 == 0 ) {
                holder.lightNum.setText( "大约需要:" + time / 60 + "分钟" );
            } else {
                holder.lightNum.setText( "大约需要:" + time / 3600 + "小时" + (time % 3600) / 60 + "分钟" );
            }
            holder.dis.setText("距离大约是:" + routeLines.get(position).getDistance());
            break;

        case DRIVING_ROUTE:
            DrivingRouteLine drivingRouteLine = (DrivingRouteLine) routeLines.get(position);
            holder.name.setText( "线路" + (position + 1));
            holder.lightNum.setText( "红绿灯数:" + drivingRouteLine.getLightNum());
            holder.dis.setText("拥堵距离为:" + drivingRouteLine.getCongestionDistance() + "米");
            break;

        default:

    }

    return convertView;
}
 
开发者ID:modricwang,项目名称:FindYou,代码行数:40,代码来源:RouteLineAdapter.java

示例3: getView

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    NodeViewHolder holder;
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.activity_transit_item, null);
        holder = new NodeViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.transitName);
        holder.lightNum = (TextView) convertView.findViewById(R.id.lightNum);
        holder.dis = (TextView) convertView.findViewById(R.id.dis);
        convertView.setTag(holder);
    } else {
        holder = (NodeViewHolder) convertView.getTag();
    }

    switch (mtype) {
        case  TRANSIT_ROUTE:
        case WALKING_ROUTE:
        case BIKING_ROUTE:
            holder.name.setText("路线" + (position + 1));
            int time = routeLines.get(position).getDuration();
            if ( time / 3600 == 0 ) {
                holder.lightNum.setText( "大约需要:" + time / 60 + "分钟" );
            } else {
                holder.lightNum.setText( "大约需要:" + time / 3600 + "小时" + (time % 3600) / 60 + "分钟" );
            }
            holder.dis.setText("距离大约是:" + routeLines.get(position).getDistance() + "米");
            break;

        case DRIVING_ROUTE:
            DrivingRouteLine drivingRouteLine = (DrivingRouteLine) routeLines.get(position);
            holder.name.setText( "线路" + (position + 1));
            holder.lightNum.setText( "红绿灯数:" + drivingRouteLine.getLightNum());
            holder.dis.setText("拥堵距离为:" + drivingRouteLine.getCongestionDistance() + "米");
            break;
        case MASS_TRANSIT_ROUTE:
            MassTransitRouteLine massTransitRouteLine = (MassTransitRouteLine) routeLines.get(position);
            holder.name.setText("线路" + (position + 1));
            holder.lightNum.setText( "预计达到时间:" + massTransitRouteLine.getArriveTime() );
            holder.dis.setText("总票价:" + massTransitRouteLine.getPrice() + "元");
            break;

        default:
            break;

    }

    return convertView;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:49,代码来源:RouteLineAdapter.java

示例4: nodeClick

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的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

示例5: nodeClick

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的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

示例6: nodeClick

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的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

示例7: nodeClick

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的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

示例8: setData

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的package包/类
/**
 * 设置路线数据
 * 
 * @param routeLine
 *            路线数据
 */
public void setData(DrivingRouteLine routeLine) {
    this.mRouteLine = routeLine;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DrivingRouteOverlay.java

示例9: setData

import com.baidu.mapapi.search.route.DrivingRouteLine; //导入依赖的package包/类
/**
 * 设置路线数据
 *
 * @param routeLine 路线数据
 */
public void setData(DrivingRouteLine routeLine) {
    this.mRouteLine = routeLine;
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:9,代码来源:DrivingRouteOverlay.java


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