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


Java Overlay类代码示例

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


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

示例1: onSearchRouteResponse

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
@Override
public void onSearchRouteResponse(final Overlay overlay, final ServerResponse taskStatus) {
    // actually plots the route on the map
    if(taskStatus == ServerResponse.SUCCESS){
        Polyline roadOverlay = (Polyline) overlay;
        roadOverlay.setColor(ROUTE_LINE_COLORS.get(ROUTES_COUNTER));
        roadOverlay.setWidth(10);
        mapView.addOverlay(roadOverlay, OverlayTags.ROUTE);
        ROUTES_COUNTER++;
    }else if(taskStatus == ServerResponse.TIMEOUT){
        Toast.makeText(context, getString(R.string.error_server_timeout), Toast.LENGTH_SHORT).show();
    }else if (taskStatus == ServerResponse.CONNECTION_FAILED){
        Toast.makeText(context, R.string.error_connection_failed, Toast.LENGTH_SHORT).show();
    }else if(ROUTES_COUNTER == MAX_ROUTES){
        Toast.makeText(context, R.string.msg_routes_limit, Toast.LENGTH_SHORT).show();
    }
    (getActivity().findViewById(R.id.progress_bar)).setVisibility(View.INVISIBLE);
}
 
开发者ID:smartufpa,项目名称:SmartUFPA,代码行数:19,代码来源:MapFragment.java

示例2: addOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** 
 * Converts the overlay to a KmlFeature and add it inside this. 
 * Conversion from Overlay subclasses to KML Features is as follow: <br>
 *   FolderOverlay, MarkerClusterer => Folder<br>
 *   Marker => Point<br>
 *   Polygon => Polygon<br>
 *   Polyline => LineString<br>
 *   GroundOverlay => GroundOverlay<br>
 *   Else, add nothing. 
 * @param overlay to convert and add
 * @param kmlDoc for style handling. 
 * @return true if OK, false if the overlay has not been added. 
 */
public boolean addOverlay(Overlay overlay, KmlDocument kmlDoc){
	if (overlay == null)
		return false;
	KmlFeature kmlItem;
	if (overlay instanceof GroundOverlay){
		kmlItem = new KmlGroundOverlay((GroundOverlay)overlay);
	} else if (overlay instanceof FolderOverlay){
		kmlItem = new KmlFolder((FolderOverlay)overlay, kmlDoc);
	} else if (overlay instanceof MarkerClusterer){
		kmlItem = new KmlFolder((MarkerClusterer)overlay, kmlDoc);
	} else if (overlay instanceof Marker){
		Marker marker = (Marker)overlay;
		kmlItem = new KmlPlacemark(marker);
	} else if (overlay instanceof Polygon){
		Polygon polygon = (Polygon)overlay;
		kmlItem = new KmlPlacemark(polygon, kmlDoc);
	} else if (overlay instanceof Polyline){
		Polyline polyline = (Polyline)overlay;
		kmlItem = new KmlPlacemark(polyline, kmlDoc);
	} else {
		return false;
	}
	mItems.add(kmlItem);
	return true;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:39,代码来源:KmlFolder.java

示例3: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding Marker overlay */	
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Marker marker = new Marker(map);
	marker.setTitle(kmlPlacemark.mName);
	marker.setSnippet(kmlPlacemark.mDescription);
	marker.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	marker.setPosition(getPosition());
	//keep the link from the marker to the KML feature:
	marker.setRelatedObject(this);
	if (styler == null){
		applyDefaultStyling(marker, defaultStyle, kmlPlacemark, kmlDocument, map);
	} else
		styler.onPoint(marker, kmlPlacemark, this);
	return marker;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:17,代码来源:KmlPoint.java

示例4: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding Polyline overlay */	
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Context context = map.getContext();
	Polyline lineStringOverlay = new Polyline(context);
	lineStringOverlay.setPoints(mCoordinates);
	lineStringOverlay.setTitle(kmlPlacemark.mName);
	lineStringOverlay.setSnippet(kmlPlacemark.mDescription);
	lineStringOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler != null)
		styler.onLineString(lineStringOverlay, kmlPlacemark, this);
	else {
		applyDefaultStyling(lineStringOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	}
	return lineStringOverlay;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:17,代码来源:KmlLineString.java

示例5: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding Polygon overlay */
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Context context = map.getContext();
	Polygon polygonOverlay = new Polygon(context);
	polygonOverlay.setPoints(mCoordinates);
	if (mHoles != null)
		polygonOverlay.setHoles(mHoles);
	polygonOverlay.setTitle(kmlPlacemark.mName);
	polygonOverlay.setSnippet(kmlPlacemark.mDescription);
	polygonOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler == null)
		applyDefaultStyling(polygonOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	else
		styler.onPolygon(polygonOverlay, kmlPlacemark, this);
	return polygonOverlay;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:18,代码来源:KmlPolygon.java

示例6: createPointOfInterestOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
private RadiusMarkerClusterer createPointOfInterestOverlay(List<Overlay> overlays) {
    //10. Marker Clustering
    RadiusMarkerClusterer poiMarkers = new RadiusMarkerClustererWithInfo(this) {
        @Override
        public Marker buildClusterMarker(StaticCluster cluster, MapView mapView) {
            Marker result = super.buildClusterMarker(cluster,mapView);
            if (cluster.getSize() > 0) {
                // show data of the first object in cluster
                result.setRelatedObject(cluster.getItem(0).getRelatedObject());
            }
            return result;
        }
    };

    Drawable clusterIconD = getResources().getDrawable(R.drawable.marker_red_empty);
    poiMarkers.setIcon(((BitmapDrawable) clusterIconD).getBitmap());

    //end of 10.
    //11. Customizing the clusters design
    poiMarkers.getTextPaint().setTextSize(12.0f);
    poiMarkers.mAnchorV = Marker.ANCHOR_BOTTOM;
    poiMarkers.mTextAnchorU = 0.70f;
    poiMarkers.mTextAnchorV = 0.27f;
    //end of 11.
    if (overlays != null) {
        overlays.add(poiMarkers);
    }
    return poiMarkers;
}
 
开发者ID:k3b,项目名称:LocationMapViewer,代码行数:30,代码来源:LocationMapViewer.java

示例7: DelayedSetCenterZoom

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** calculate min/max from all Markers in all overlaysWithMarkers */
public DelayedSetCenterZoom(List<? extends Overlay> overlaysWithMarkers, int zoomLevel) {
    if (overlaysWithMarkers.size() > 0) {
        Marker first = (Marker) overlaysWithMarkers.get(0);
        GeoPoint min = new GeoPoint(first.getPosition().clone());
        GeoPoint max = null;
        if (overlaysWithMarkers.size() > 1) {
            max = min.clone();
            for (Overlay item : overlaysWithMarkers) {
                getMinMax(min, max, ((Marker) item).getPosition());
            }
        }
        mMin = min;
        mMax = max;
    }
    mZoomLevel = zoomLevel;
}
 
开发者ID:k3b,项目名称:LocationMapViewer,代码行数:18,代码来源:LocationMapViewer.java

示例8: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding overlay.
 * Currently: a Polyline of gx:coords */
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark,
		KmlDocument kmlDocument){
	Polyline lineStringOverlay = new Polyline();
	lineStringOverlay.setGeodesic(true);
	lineStringOverlay.setPoints(mCoordinates);
	lineStringOverlay.setTitle(kmlPlacemark.mName);
	lineStringOverlay.setSnippet(kmlPlacemark.mDescription);
	lineStringOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler != null)
		styler.onTrack(lineStringOverlay, kmlPlacemark, this);
	else {
		applyDefaultStyling(lineStringOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	}
	return lineStringOverlay;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:18,代码来源:KmlTrack.java

示例9: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding Polyline overlay */	
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Polyline lineStringOverlay = new Polyline();
	lineStringOverlay.setGeodesic(true);
	lineStringOverlay.setPoints(mCoordinates);
	lineStringOverlay.setTitle(kmlPlacemark.mName);
	lineStringOverlay.setSnippet(kmlPlacemark.mDescription);
	lineStringOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler != null)
		styler.onLineString(lineStringOverlay, kmlPlacemark, this);
	else {
		applyDefaultStyling(lineStringOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	}
	return lineStringOverlay;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:17,代码来源:KmlLineString.java

示例10: buildOverlay

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/** Build the corresponding Polygon overlay */
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Polygon polygonOverlay = new Polygon();
	polygonOverlay.setPoints(mCoordinates);
	if (mHoles != null)
		polygonOverlay.setHoles(mHoles);
	polygonOverlay.setTitle(kmlPlacemark.mName);
	polygonOverlay.setSnippet(kmlPlacemark.mDescription);
	polygonOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler == null)
		applyDefaultStyling(polygonOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	else
		styler.onPolygon(polygonOverlay, kmlPlacemark, this);
	return polygonOverlay;
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:17,代码来源:KmlPolygon.java

示例11: setWayOverlayEnabled

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/**
 * Show or hide way overlay.
 * TODO: This method is buggy and still does not work properly, because the edges are still the same as in the first
 * loaded the same across all maps show later.
 *
 * @param enabled for enabling or disabling the way overlay
 */
private void setWayOverlayEnabled(final boolean enabled) {
    // If this overlay is added then the snapping-demonstration is activated:
    final Collection<Edge> edges = getWayManager().getEdges();
    showToast("Es wurden " + edges.size() + " Edges hinzugefügt.");
    if (wayOverlay == null) {
        wayOverlay = new WayOverlay(this, getWayManager());
    }
    final List<Overlay> overlays = mapView.getOverlays();
    if (overlays.contains(wayOverlay)) {
        if (!enabled) {
            overlays.remove(wayOverlay);
        }
    } else {
        if (enabled) {
            overlays.add(wayOverlay);
        }
    }

    mapView.invalidate();
}
 
开发者ID:tarent,项目名称:invio,代码行数:28,代码来源:MapActivity.java

示例12: createPolygon

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
/**
 * converts the bounding box into a color filled polygon
 *
 * @param key
 * @param value
 * @param redthreshold
 * @param orangethreshold
 * @return
 */
private Overlay createPolygon(BoundingBox key, Integer value, int redthreshold, int orangethreshold) {
    Polygon polygon = new Polygon(mMapView);
    if (value < orangethreshold)
        polygon.setFillColor(Color.parseColor(alpha + yellow));
    else if (value < redthreshold)
        polygon.setFillColor(Color.parseColor(alpha + orange));
    else if (value >= redthreshold)
        polygon.setFillColor(Color.parseColor(alpha + red));
    else {
        //no polygon
    }
    polygon.setStrokeColor(polygon.getFillColor());

    //if you set this to something like 20f and have a low alpha setting,
    // you'll end with a gaussian blur like effect
    polygon.setStrokeWidth(0f);
    List<GeoPoint> pts = new ArrayList<GeoPoint>();
    pts.add(new GeoPoint(key.getLatNorth(), key.getLonWest()));
    pts.add(new GeoPoint(key.getLatNorth(), key.getLonEast()));
    pts.add(new GeoPoint(key.getLatSouth(), key.getLonEast()));
    pts.add(new GeoPoint(key.getLatSouth(), key.getLonWest()));
    polygon.setPoints(pts);
    return polygon;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:34,代码来源:HeatMap.java

示例13: addOverlayMyLocation

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
public MyLocationOverlay2 addOverlayMyLocation(boolean toAdd) {
    if (toAdd) {
        // Add
        if (this.myLocation == null) {
            this.myLocation = new MyLocationOverlay2(getActivity(), this.mapView);
        }
        List<Overlay> overlays = mapView.getOverlays();
        if (!overlays.contains(myLocation)) {
            //  myLocation.enableMyLocation();
            overlays.add(myLocation);
        }
    } else {
        // Delete
        if (myLocation != null) {
            myLocation.disableMyLocation();
            mapView.getOverlays().remove(myLocation);
        }
    }
    return myLocation;
}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:21,代码来源:OsmMapFragment.java

示例14: printOverlays

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
public void printOverlays() {
    List<Overlay> overlays = mapView.getOverlays();
    int overlayCount = overlays != null ? overlays.size() : 0;
    Log.d(TAG, "### Map Overlay count : " + overlayCount);
    Log.d(TAG, "### Map Overlay MiniMap  : " + miniMapOverlay);
    Log.d(TAG, "### Map Overlay MiniMap Search : " + searchOverlays(MinimapOverlay.class));

    if (overlays != null && !overlays.isEmpty()) {
        int i = 0;
        for (Overlay overlay : overlays) {
            Log.d(TAG, "### Map Overlay " + (++i) +
                    " : " + overlay);
        }
    }

}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:17,代码来源:OsmMapFragment.java

示例15: updateUIWithRoad

import org.osmdroid.views.overlay.Overlay; //导入依赖的package包/类
void updateUIWithRoad(Road road) {
	roadNodeMarkers.removeAllItems();
	List<Overlay> mapOverlays = mv.getOverlays();
	if (roadOverlay != null) {
		mapOverlays.remove(roadOverlay);
	}
	if (road == null)
		return;
	if (road.mStatus == Road.STATUS_DEFAULT)
		Toast.makeText(mv.getContext(),
				"We have a problem to get the route", Toast.LENGTH_SHORT)
				.show();
	roadOverlay = RoadManager.buildRoadOverlay(road, mv.getContext());
	Overlay removedOverlay = mapOverlays.set(1, roadOverlay);
	// we set the road overlay at the "bottom", just above the
	// MapEventsOverlay,
	// to avoid covering the other overlays.
	mapOverlays.add(removedOverlay);
	putRoadNodes(road);
	mv.invalidate();
	// Set route info in the text view:
	// ((TextView) findViewById(R.id.routeInfo)).setText(road
	// .getLengthDurationText(-1));
}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:25,代码来源:MapActivity.java


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