本文整理汇总了Java中org.osmdroid.bonuspack.routing.RoadNode类的典型用法代码示例。如果您正苦于以下问题:Java RoadNode类的具体用法?Java RoadNode怎么用?Java RoadNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RoadNode类属于org.osmdroid.bonuspack.routing包,在下文中一共展示了RoadNode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: putRoadNodes
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
private void putRoadNodes(Road road){
mRoadNodeMarkers.getItems().clear();
Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_node, null);
int n = road.mNodes.size();
MarkerInfoWindow infoWindow = new MarkerInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map);
TypedArray iconIds = getResources().obtainTypedArray(R.array.direction_icons);
for (int i=0; i<n; i++){
RoadNode node = road.mNodes.get(i);
String instructions = (node.mInstructions==null ? "" : node.mInstructions);
Marker nodeMarker = new Marker(map);
nodeMarker.setTitle(getString(R.string.step)+ " " + (i+1));
nodeMarker.setSnippet(instructions);
nodeMarker.setSubDescription(Road.getLengthDurationText(this, node.mLength, node.mDuration));
nodeMarker.setPosition(node.mLocation);
nodeMarker.setIcon(icon);
nodeMarker.setInfoWindow(infoWindow); //use a shared infowindow.
int iconId = iconIds.getResourceId(node.mManeuverType, R.drawable.ic_empty);
if (iconId != R.drawable.ic_empty){
Drawable image = ResourcesCompat.getDrawable(getResources(), iconId, null);
nodeMarker.setImage(image);
}
mRoadNodeMarkers.add(nodeMarker);
}
iconIds.recycle();
}
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:26,代码来源:MapActivity.java
示例2: getView
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
@Override public View getView(int position, View convertView, ViewGroup viewGroup) {
RoadNode entry = (RoadNode)getItem(position);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.item_layout, null);
}
TextView tvTitle = (TextView)convertView.findViewById(R.id.title);
String instructions = (entry.mInstructions==null ? "" : entry.mInstructions);
tvTitle.setText("" + (position+1) + ". " + instructions);
TextView tvDetails = (TextView)convertView.findViewById(R.id.details);
tvDetails.setText(Road.getLengthDurationText(mContext, entry.mLength, entry.mDuration));
int iconId = iconIds.getResourceId(entry.mManeuverType, R.drawable.ic_empty);
Drawable icon = mContext.getResources().getDrawable(iconId);
ImageView ivManeuver = (ImageView)convertView.findViewById(R.id.thumbnail);
ivManeuver.setImageDrawable(icon);
return convertView;
}
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:19,代码来源:RouteActivity.java
示例3: initRouteInstructions
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
private void initRouteInstructions(Road road){
if(road != null && road.mNodes != null) {
final ListView lstRouteDesc = (ListView)getView().findViewById(R.id.lstRouteDesc);
final List<DescriptionRow> descriptions = new ArrayList<DescriptionRow>();
int waypoint = 0;
for(int i = 0; i < road.mNodes.size(); i++){
final RoadNode node = road.mNodes.get(i);
String instructions = node.mInstructions;
if(node.mInstructions.toUpperCase().contains(getResources().getString(R.string.destination).toUpperCase())){
instructions = RouteManager.getInstance().getWaypoints().get(waypoint).getName();
waypoint++;
}
descriptions.add(new DescriptionRow(getIconForManeuver(node.mManeuverType),instructions));
}
lstRouteDesc.setAdapter(new RouteDescAdapter(getActivity(),android.R.layout.simple_list_item_1,descriptions));
}
}
开发者ID:oSoc14,项目名称:Artoria,代码行数:18,代码来源:MapFragment.java
示例4: putRoadNodes
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
private void putRoadNodes(Road road) {
roadNodeMarkers.removeAllItems();
Drawable marker = getResources().getDrawable(R.drawable.marker_node);
int n = road.mNodes.size();
TypedArray iconIds = getResources().obtainTypedArray(
R.array.direction_icons);
for (int i = 0; i < n; i++) {
RoadNode node = road.mNodes.get(i);
String instructions = (node.mInstructions == null ? ""
: node.mInstructions);
ExtendedOverlayItem nodeMarker = new ExtendedOverlayItem("Step "
+ (i + 1), instructions, node.mLocation, this);
nodeMarker.setSubDescription(road.getLengthDurationText(
node.mLength, node.mDuration));
nodeMarker.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
nodeMarker.setMarker(marker);
int iconId = iconIds.getResourceId(node.mManeuverType,
R.drawable.ic_empty);
if (iconId != R.drawable.ic_empty) {
Drawable icon = getResources().getDrawable(iconId);
nodeMarker.setImage(icon);
}
roadNodeMarkers.addItem(nodeMarker);
}
}
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:26,代码来源:MapActivity.java
示例5: drawRoadWithWaypoints
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
/**
* Draws the WayPoints of the Road, with instructions on them
* @param road The Road we are going to add the WayPoints to
* @param map The MapView on which the WayPoints will be added
*/
public void drawRoadWithWaypoints(Road road, MapView map) {
/* TODO add support for even more directions markers type */
Drawable nodeIcon = ContextCompat.getDrawable(context, R.drawable.marker_node);
for (int i = 0; i < road.mNodes.size(); i++) {
RoadNode node = road.mNodes.get(i); // We get the i-ème node of the route
Marker nodeMarker = new Marker(map);
nodeMarker.setPosition(node.mLocation);
nodeMarker.setIcon(nodeIcon);
nodeMarker.setTitle(context.getString(R.string.step_nbr) + " " + i);
map.getOverlays().add(nodeMarker);
// And we fill the bubbles with the directions
nodeMarker.setSnippet(node.mInstructions);
nodeMarker.setSubDescription(Road.getLengthDurationText(node.mLength, node.mDuration));
// Finally, we add an icon to the bubble
Drawable icon = ContextCompat.getDrawable(context, R.drawable.ic_continue);
switch (node.mManeuverType) {
case 1:
icon = ContextCompat.getDrawable(context, R.drawable.ic_continue);
break;
case 3:
icon = ContextCompat.getDrawable(context, R.drawable.ic_slight_left);
break;
case 4:
icon = ContextCompat.getDrawable(context, R.drawable.ic_turn_left);
break;
case 5:
icon = ContextCompat.getDrawable(context, R.drawable.ic_sharp_left);
break;
case 6:
icon = ContextCompat.getDrawable(context, R.drawable.ic_slight_right);
break;
case 7:
icon = ContextCompat.getDrawable(context, R.drawable.ic_turn_right);
break;
case 8:
icon = ContextCompat.getDrawable(context, R.drawable.ic_sharp_right);
break;
case 12:
icon = ContextCompat.getDrawable(context, R.drawable.ic_u_turn);
break;
default:
break;
}
nodeMarker.setImage(icon);
}
map.invalidate();
}
开发者ID:WikiJourney,项目名称:wikijourney_app,代码行数:56,代码来源:Routing.java
示例6: doInBackground
import org.osmdroid.bonuspack.routing.RoadNode; //导入依赖的package包/类
/**
* Calculating the directions from the current to the location of the
* topComment. Builds a road overlay and adds it to the openMapView
* objects overlays.
*/
@Override
protected Void doInBackground(Void... params) {
RoadManager roadManager = new OSRMRoadManager();
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
GeoLocation currentLocation = new GeoLocation(
locationListenerService);
waypoints.add(new GeoPoint(currentLocation.getLatitude(),
currentLocation.getLongitude()));
waypoints.add(originalPostMarker.getPosition());
Road road = roadManager.getRoad(waypoints);
roadOverlay = RoadManager.buildRoadOverlay(road, getActivity());
Drawable nodeIcon = getResources().getDrawable(
R.drawable.marker_node);
Drawable nodeImage = getResources().getDrawable(
R.drawable.ic_continue);
for (int i = 0; i < road.mNodes.size(); i++) {
RoadNode node = road.mNodes.get(i);
GeoLocation geoLocation = new GeoLocation(node.mLocation);
CustomMarker nodeMarker = new CustomMarker(geoLocation,
mapData.getMap(), nodeIcon);
MarkerInfoWindow infoWindow = new MarkerInfoWindow(
R.layout.bonuspack_bubble, mapData.getMap());
nodeMarker.setInfoWindow(infoWindow);
nodeMarker.setTitle("Step " + i);
nodeMarker.setSnippet(node.mInstructions);
nodeMarker.setSubDescription(Road.getLengthDurationText(
node.mLength, node.mDuration));
nodeMarker.setImage(nodeImage);
setMarkerListeners(nodeMarker);
directionsClusterMarkers.add(nodeMarker);
markers.add(nodeMarker);
}
return null;
}
开发者ID:CMPUT301W14T08,项目名称:GeoChan,代码行数:50,代码来源:MapViewFragment.java
注:本文中的org.osmdroid.bonuspack.routing.RoadNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论