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


Java Marker.setInfoWindow方法代码示例

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


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

示例1: setMarkers

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
/**
 * Given the request the user is viewing, set the map according to the start and end locations of the trip.
 */
private void setMarkers() {
    Marker startMarker = new Marker(map);
    startMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_start_marker, null));
    Marker endMarker = new Marker(map);
    endMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_end_marker, null));

    startMarker.setPosition(startPoint);
    startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    startMarker.setTitle("START:\n" + request.getStart().getAddress());
    startMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
    endMarker.setPosition(endPoint);
    endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    endMarker.setTitle("END:\n" + request.getEnd().getAddress());
    endMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));

    map.getOverlays().add(startMarker);
    map.getOverlays().add(endMarker);
    map.invalidate();
}
 
开发者ID:CMPUT301F16T01,项目名称:Carrier,代码行数:23,代码来源:DriverViewRequestActivity.java

示例2: setMarkers

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
/**
 * Set the start and end markers based on the exact positions the user gave for them
 */
private void setMarkers() {
    // set the map
    Marker startMarker = new Marker(map);
    startMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_start_marker, null));
    Marker endMarker = new Marker(map);
    endMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_end_marker, null));

    startMarker.setPosition(startPoint);
    startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    startMarker.setTitle("START:\n" + start.getAddress());
    startMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
    endMarker.setPosition(endPoint);
    endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    endMarker.setTitle("END:\n" + end.getAddress());
    endMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));

    map.getOverlays().add(startMarker);
    map.getOverlays().add(endMarker);
    map.invalidate();
}
 
开发者ID:CMPUT301F16T01,项目名称:Carrier,代码行数:24,代码来源:ViewLocationsActivity.java

示例3: setMarkers

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
/**
 * Given the request passed in by the user, set the map according to the start and end locations
 */
private void setMarkers() {
    Marker startMarker = new Marker(map);
    startMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_start_marker, null));
    Marker endMarker = new Marker(map);
    endMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_end_marker, null));

    startMarker.setPosition(startPoint);
    startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    startMarker.setTitle("START:\n" + request.getStart().getAddress());
    startMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
    endMarker.setPosition(endPoint);
    endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    endMarker.setTitle("END:\n" + request.getEnd().getAddress());
    endMarker.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));

    map.getOverlays().add(startMarker);
    map.getOverlays().add(endMarker);
    map.invalidate();
}
 
开发者ID:CMPUT301F16T01,项目名称:Carrier,代码行数:23,代码来源:RiderRequestActivity.java

示例4: putRoadNodes

import org.osmdroid.views.overlay.Marker; //导入方法依赖的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

示例5: buildClusterMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
@Override public Marker buildClusterMarker(StaticCluster cluster, MapView mapView) {
    Marker m = new Marker(mapView);
    m.setPosition(cluster.getPosition());
    m.setInfoWindow(null);
    m.setAnchor(mAnchorU, mAnchorV);

    Bitmap finalIcon = Bitmap.createBitmap(mClusterIcon.getWidth(), mClusterIcon.getHeight(), mClusterIcon.getConfig());
    Canvas iconCanvas = new Canvas(finalIcon);
    iconCanvas.drawBitmap(mClusterIcon, 0, 0, null);
    String text = "" + cluster.getSize();
    int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
    iconCanvas.drawText(text,
            mTextAnchorU * finalIcon.getWidth(),
            mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
            mTextPaint);
    m.setIcon(new BitmapDrawable(mapView.getContext().getResources(), finalIcon));

    return m;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:20,代码来源:RadiusMarkerClusterer.java

示例6: buildClusterMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
/** Build the marker for a cluster. 
 * Uses the cluster icon, and displays inside the number of markers it contains. <br/>
 * In the standard Google coordinate system for Marker icons: <br/>
 * - The cluster icon is anchored at mAnchorU, mAnchorV. <br/>
 * - The text showing the number of markers is anchored at mTextAnchorU, mTextAnchorV. 
 * This text is centered horizontally and vertically. */
@Override public Marker buildClusterMarker(StaticCluster cluster, MapView mapView){
	Marker m = new Marker(mapView);
	m.setPosition(cluster.getPosition());
	m.setInfoWindow(null);
	m.setAnchor(mAnchorU, mAnchorV);
	Bitmap finalIcon = Bitmap.createBitmap(mClusterIcon.getWidth(), mClusterIcon.getHeight(), mClusterIcon.getConfig());
	Canvas iconCanvas = new Canvas(finalIcon);
	iconCanvas.drawBitmap(mClusterIcon, 0, 0, null);
	String text = ""+cluster.getSize();
    int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
	iconCanvas.drawText(text, 
			mTextAnchorU*finalIcon.getWidth(), 
			mTextAnchorV*finalIcon.getHeight() - textHeight/2, 
			mTextPaint);
	m.setIcon(new BitmapDrawable(mapView.getContext().getResources(), finalIcon));
	return m;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:24,代码来源:GridMarkerClusterer.java

示例7: addLatLngToMap

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
/**
 * Add a LatLng to the map
 *
 * @param map
 * @param latLng
 * @param options
 * @return
 */
public static Marker addLatLngToMap(MapView map, GeoPoint latLng,
                                    MarkerOptions options) {
    Marker m = new Marker(map);
    m.setPosition(latLng);
    if (options!=null) {
        if (options.getIcon()!=null){
            m.setIcon(options.getIcon());
        }
        m.setAlpha(options.getAlpha());
        m.setTitle(options.getTitle());
        m.setSubDescription(options.getSubdescription());
        m.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
    }
    map.getOverlayManager().add(m);
    return m;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:25,代码来源:OsmMapShapeConverter.java

示例8: addMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
public static Marker addMarker(Context context, MapView map, double latitude, double longitude) {
    if (map == null || context == null) return null;
    Marker marker = new Marker(map);
    marker.setPosition(new GeoPoint(latitude, longitude));
    marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    marker.setIcon(context.getResources().getDrawable(R.drawable.ic_location));
    marker.setInfoWindow(null);
    map.getOverlays().add(marker);
    map.invalidate();
    return marker;
}
 
开发者ID:CityZenApp,项目名称:Android-Development,代码行数:12,代码来源:MapUtils.java

示例9: myLocation

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
public static Marker myLocation(Context context, MapView map, double latitude, double longitude) {
    if (map == null || context == null) return null;
    Marker marker = new Marker(map);
    marker.setPosition(new GeoPoint(latitude, longitude));
    marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    marker.setIcon(context.getResources().getDrawable(R.drawable.ic_gps_location));
    marker.setInfoWindow(null);
    map.getOverlays().add(marker);
    map.invalidate();
    return marker;
}
 
开发者ID:CityZenApp,项目名称:Android-Development,代码行数:12,代码来源:MapUtils.java

示例10: buildClusterMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
@Override public Marker buildClusterMarker(StaticCluster cluster, MapView mapView) {
    Marker m = new Marker(mapView);
    m.setPosition(cluster.getPosition());

    final InfoWindow infoWindow = (cluster.getSize() > 0) ? cluster.getItem(0).getInfoWindow() : null;
    m.setInfoWindow(infoWindow);
    m.setAnchor(mAnchorU, mAnchorV);

    final BitmapDrawable icon = getClusterMarkerIcon("" + cluster.getSize(), mapView);
    m.setIcon(icon);

    setRadius(48);

    return m;
}
 
开发者ID:k3b,项目名称:LocationMapViewer,代码行数:16,代码来源:RadiusMarkerClustererWithInfo.java

示例11: createMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
private Marker createMarker(MapView map, IGeoPointInfo aGeoPoint) {
    // final OverlayItem overlayItem = new OverlayItem(aGeoPoint.getId(), aGeoPoint.getName(), aGeoPoint.getDescription(), toOsmGeoPoint(aGeoPoint));
    // items.add(overlayItem);

    Marker poiMarker = new Marker(map);
    poiMarker.setTitle(aGeoPoint.getName());
    final String description = aGeoPoint.getDescription();
    poiMarker.setSnippet(description);
    poiMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    poiMarker.setPosition(toOsmGeoPoint(aGeoPoint));

    if (BookmarkUtil.isNotEmpty(description) || BookmarkUtil.isNotEmpty(aGeoPoint.getLink()) || BookmarkUtil.isNotEmpty(aGeoPoint.getName())) {
        poiMarker.setIcon(mPoiIconWithData);
        // 7.
        poiMarker.setInfoWindow(new GeoPointMarkerInfoWindow(map));
    } else {
        poiMarker.setIcon(mPoiIconWithoutData);
        poiMarker.setInfoWindow(null);
    }
    /*
    if (poi.mThumbnail != null){
        poiMarker.setImage(new BitmapDrawable(poi.mThumbnail));
    }*/

    poiMarker.setRelatedObject(aGeoPoint);

    return poiMarker;
}
 
开发者ID:k3b,项目名称:LocationMapViewer,代码行数:29,代码来源:LocationMapViewer.java

示例12: updateUIWithPOI

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
void updateUIWithPOI(ArrayList<POI> pois, String featureTag){
	if (pois != null){
		POIInfoWindow poiInfoWindow = new POIInfoWindow(map);
		for (POI poi:pois){
			Marker poiMarker = new Marker(map);
			poiMarker.setTitle(poi.mType);
			poiMarker.setSnippet(poi.mDescription);
			poiMarker.setPosition(poi.mLocation);
			Drawable icon = null;
			if (poi.mServiceId == POI.POI_SERVICE_NOMINATIM || poi.mServiceId == POI.POI_SERVICE_OVERPASS_API){
				icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_poi, null);
				poiMarker.setAnchor(Marker.ANCHOR_CENTER, 1.0f);
			} else if (poi.mServiceId == POI.POI_SERVICE_GEONAMES_WIKIPEDIA){
				if (poi.mRank < 90)
					icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_poi_wikipedia_16, null);
				else
					icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_poi_wikipedia_32, null);
			} else if (poi.mServiceId == POI.POI_SERVICE_FLICKR){
				icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_poi_flickr, null);
			} else if (poi.mServiceId == POI.POI_SERVICE_PICASA){
				icon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_poi_picasa_24, null);
				poiMarker.setSubDescription(poi.mCategory);
			}
			poiMarker.setIcon(icon);
			poiMarker.setRelatedObject(poi);
			poiMarker.setInfoWindow(poiInfoWindow);
			//thumbnail loading moved in async task for better performances. 
			mPoiMarkers.add(poiMarker);
		}
	}
	mPoiMarkers.setName(featureTag);
	mPoiMarkers.invalidate();
	map.invalidate();
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:35,代码来源:MapActivity.java

示例13: buildClusterMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
@Override
public Marker buildClusterMarker(StaticCluster cluster, MapView mapView) {
	Marker m = new Marker(mapView);
	m.setPosition(cluster.getPosition());
	m.setInfoWindow(null);
	m.setAnchor(0.5f, 0.5f);
	int radius = (int) Math.sqrt(cluster.getSize() * 3);
	radius = Math.max(radius, 10);
	radius = Math.min(radius, 30);
	Bitmap finalIcon = Bitmap.createBitmap(radius * 2, radius * 2, mClusterIcon.getConfig());
	Canvas iconCanvas = new Canvas(finalIcon);
	Paint circlePaint = new Paint();
	if (cluster.getSize() < 20)
		circlePaint.setColor(Color.BLUE);
	else
		circlePaint.setColor(Color.RED);
	circlePaint.setAlpha(200);
	iconCanvas.drawCircle(radius, radius, radius, circlePaint);
	String text = "" + cluster.getSize();
	int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
	iconCanvas.drawText(text,
			mTextAnchorU * finalIcon.getWidth(),
			mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
			mTextPaint);
	m.setIcon(new BitmapDrawable(mapView.getContext().getResources(), finalIcon));
	return m;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:28,代码来源:MainActivity.java

示例14: buildClusterMarker

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
@Override public Marker buildClusterMarker(StaticCluster cluster, MapView mapView) {
    Marker m = new Marker(mapView);
    m.setPosition(cluster.getPosition());
    m.setInfoWindow(null);
    m.setAnchor(mAnchorU, mAnchorV);

    if (cluster.getSize() >= 500 )
    {
        setIcon(drawableSources[4]);
    }
    else if (cluster.getSize() >= 250 && cluster.getSize() < 500)
    {
        setIcon(drawableSources[3]);
    }
    else if (cluster.getSize() >= 100 && cluster.getSize() < 250)
    {
        setIcon(drawableSources[3]);
    }
    else if (cluster.getSize() >= 50 && cluster.getSize() < 100)
    {
        setIcon(drawableSources[2]);
    }
    else if (cluster.getSize() >= 10 && cluster.getSize() < 50)
    {
        setIcon(drawableSources[1]);
    }
    else if (cluster.getSize() < 10)
    {
        setIcon(drawableSources[0]);
    }

    Bitmap finalIcon = Bitmap.createBitmap(mClusterIcon.getWidth(), mClusterIcon.getHeight(), mClusterIcon.getConfig());
    Canvas iconCanvas = new Canvas(finalIcon);
    iconCanvas.drawBitmap(mClusterIcon, 0, 0, null);
    String text = "" + cluster.getSize();

    int textHeight = (int) (mTextPaint.descent() + mTextPaint.ascent());
    iconCanvas.drawText(text,
            mTextAnchorU * finalIcon.getWidth(),
            mTextAnchorV * finalIcon.getHeight() - textHeight / 2,
            mTextPaint);
    m.setIcon(new BitmapDrawable(mapView.getContext().getResources(), finalIcon));

    return m;
}
 
开发者ID:BackPackerDz,项目名称:Android-Tariki.dz,代码行数:46,代码来源:RadiusMarkerClusterer.java

示例15: onPoint

import org.osmdroid.views.overlay.Marker; //导入方法依赖的package包/类
@Override
public void onPoint(Marker marker, KmlPlacemark kmlPlacemark, KmlPoint kmlPoint) {
    final HashMap<MarkerStatuses, Drawable> markerDrawable = mapUtils.getMarkerDrawable(MarkerTypes.BUS_STOP);
    marker.setIcon(markerDrawable.get(MarkerStatuses.NOT_CLICKED));
    marker.setInfoWindow(null);
}
 
开发者ID:smartufpa,项目名称:SmartUFPA,代码行数:7,代码来源:BusRouteKmlStyler.java


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