本文整理汇总了Java中org.osmdroid.bonuspack.routing.Road.STATUS_TECHNICAL_ISSUE属性的典型用法代码示例。如果您正苦于以下问题:Java Road.STATUS_TECHNICAL_ISSUE属性的具体用法?Java Road.STATUS_TECHNICAL_ISSUE怎么用?Java Road.STATUS_TECHNICAL_ISSUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osmdroid.bonuspack.routing.Road
的用法示例。
在下文中一共展示了Road.STATUS_TECHNICAL_ISSUE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPolyline
private boolean createPolyline() {
if (map == null || road.mStatus == Road.STATUS_INVALID || road.mStatus == Road.STATUS_TECHNICAL_ISSUE)
return false;// some error with the road
roadOverlay = RoadManager.buildRoadOverlay(road);
roadOverlay.setColor(context.getResources().getColor(R.color.colorAccent));
roadOverlay.setWidth(16);
roadOverlay.setGeodesic(true);
// Drawable nodeIcon = context.getResources().getDrawable(R.drawable.ic_location);
// for (int i = 0; i < road.mNodes.size(); i++) {
// RoadNode node = road.mNodes.get(i);
// Marker nodeMarker = new Marker(map);
// nodeMarker.setPosition(node.mLocation);
// nodeMarker.setIcon(nodeIcon);
// nodeMarker.setTitle("Step " + i);
// map.getOverlays().add(nodeMarker);
// nodeMarker.setSnippet(node.mInstructions);
// nodeMarker.setSubDescription(Road.getLengthDurationText(context, node.mLength, node.mDuration));
// Drawable icon = context.getResources().getDrawable(R.drawable.ic_filter_selected);
// nodeMarker.setImage(icon);
// }
map.getOverlays().add(roadOverlay);
map.invalidate();
return true;
}
示例2: onPostExecute
@Override
protected void onPostExecute(Road[] roads) {
double minLength = 0;
Road bestRoad = null;
roadList = roads;
if (roads == null)
return;
if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE) {
Toast.makeText(activity, "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
} else if (roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE) { //functional issues
Toast.makeText(activity, "No possible route here", Toast.LENGTH_SHORT).show();
}
List<Overlay> mapOverlays = map.getOverlays();
for (Road road : roads) {
if(road.mLength < minLength || minLength == 0) {
minLength = road.mLength;
bestRoad = road;
}
}
String routeDesc = bestRoad.getLengthDurationText(activity, -1);
Polyline roadPolyline = RoadManager.buildRoadOverlay(bestRoad);
roadPolyline.setTitle(getString(R.string.app_name) + " - " + routeDesc);
roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
mapOverlays.add(0, roadPolyline);
map.invalidate();
}
示例3: onPostExecute
@Override
protected void onPostExecute(Road[] roads) {
double minLength = 0;
Road bestRoad = null;
roadList = roads;
if (roads == null)
return;
if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE) {
Toast.makeText(activity, "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
} else if (roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE) { //functional issues
Toast.makeText(activity, "No possible route here", Toast.LENGTH_SHORT).show();
}
List<Overlay> mapOverlays = map.getOverlays();
for (Road road : roads) {
if(road.mLength < minLength || minLength == 0) {
minLength = road.mLength;
bestRoad = road;
}
}
String routeDesc = bestRoad.getLengthDurationText(activity, -1);
bundle.putDouble("distance", bestRoad.mLength);
bundle.putDouble("duration", bestRoad.mDuration);
Polyline roadPolyline = RoadManager.buildRoadOverlay(bestRoad);
roadPolyline.setTitle(getString(R.string.app_name) + " - " + routeDesc);
roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
mapOverlays.add(0, roadPolyline);
map.invalidate();
}
示例4: onPostExecute
@Override
protected void onPostExecute(Road[] roads) {
double minLength = 0;
Road bestRoad = null;
roadList = roads;
if (roads == null)
return;
if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE) {
Toast.makeText(activity, "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
} else if (roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE) { //functional issues
Toast.makeText(activity, "No possible route here", Toast.LENGTH_SHORT).show();
}
List<Overlay> mapOverlays = map.getOverlays();
for (Road road : roads) {
if (road.mLength < minLength || minLength == 0) {
minLength = road.mLength;
bestRoad = road;
}
}
String routeDesc = bestRoad.getLengthDurationText(activity, -1);
Polyline roadPolyline = RoadManager.buildRoadOverlay(bestRoad);
roadPolyline.setTitle(getString(R.string.app_name) + " - " + routeDesc);
roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
mapOverlays.add(0, roadPolyline);
map.invalidate();
}
示例5: updateUIWithRoad
public void updateUIWithRoad(Road road){
isRoutingStuffAdded = true;
mRoad = road;
mRoadNodeMarkers.getItems().clear();
List<Overlay> mapOverlays = this.getOverlays();
if (mRoadOverlay != null){
mapOverlays.remove(mRoadOverlay);
mRoadOverlay = null;
}
if (road == null)
return;
if (road.mStatus == Road.STATUS_TECHNICAL_ISSUE) {
Toast.makeText(this.getContext(), "Technical error in calculating route", Toast.LENGTH_SHORT).show();
}
else if (road.mStatus > Road.STATUS_TECHNICAL_ISSUE) //functional issues
Toast.makeText(this.getContext(), "No routes found", Toast.LENGTH_SHORT).show();
mRoadOverlay = buildRoadOverlay(road, Color.parseColor("#004eff"), 7.0f, this.getContext());
String routeDesc = road.getLengthDurationText(-1);
mRoadOverlay.setTitle("path" + " - " + routeDesc);
mapOverlays.add(0, mRoadOverlay);
//we dinsert the road overlay at the "bottom", just above the MapEventsOverlay,
//to avoid covering the other overlays.
if (routingZoomToBoundingBox)
this.zoomToBoundingBox(road.mBoundingBox);
putRoadNodes(road);
this.invalidate();
}
示例6: updateUIWithRoads
void updateUIWithRoads(Road[] roads){
mRoadNodeMarkers.getItems().clear();
TextView textView = (TextView)findViewById(R.id.routeInfo);
textView.setText("");
List<Overlay> mapOverlays = map.getOverlays();
if (mRoadOverlays != null){
for (int i=0; i<mRoadOverlays.length; i++)
mapOverlays.remove(mRoadOverlays[i]);
mRoadOverlays = null;
}
if (roads == null)
return;
if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE)
Toast.makeText(map.getContext(), "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
else if (roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE) //functional issues
Toast.makeText(map.getContext(), "No possible route here", Toast.LENGTH_SHORT).show();
mRoadOverlays = new Polyline[roads.length];
for (int i=0; i<roads.length; i++) {
Polyline roadPolyline = RoadManager.buildRoadOverlay(roads[i]);
mRoadOverlays[i] = roadPolyline;
if (mWhichRouteProvider == GRAPHHOPPER_BICYCLE || mWhichRouteProvider == GRAPHHOPPER_PEDESTRIAN) {
Paint p = roadPolyline.getPaint();
p.setPathEffect(new DashPathEffect(new float[]{10, 5}, 0));
}
String routeDesc = roads[i].getLengthDurationText(this, -1);
roadPolyline.setTitle(getString(R.string.route) + " - " + routeDesc);
roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
roadPolyline.setRelatedObject(i);
roadPolyline.setOnClickListener(new RoadOnClickListener());
mapOverlays.add(1, roadPolyline);
//we insert the road overlays at the "bottom", just above the MapEventsOverlay,
//to avoid covering the other overlays.
}
selectRoad(0);
}