當前位置: 首頁>>代碼示例>>Java>>正文


Java Overlay類代碼示例

本文整理匯總了Java中org.mapsforge.android.maps.overlay.Overlay的典型用法代碼示例。如果您正苦於以下問題:Java Overlay類的具體用法?Java Overlay怎麽用?Java Overlay使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Overlay類屬於org.mapsforge.android.maps.overlay包,在下文中一共展示了Overlay類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onResume

import org.mapsforge.android.maps.overlay.Overlay; //導入依賴的package包/類
@Override
protected void onResume() {

    // notes type
    boolean doCustom = preferences.getBoolean(Constants.PREFS_KEY_NOTES_CHECK, false);
    if (doCustom) {
        String opacityStr = preferences.getString(Constants.PREFS_KEY_NOTES_OPACITY, "100");
        String sizeStr = preferences.getString(Constants.PREFS_KEY_NOTES_SIZE, "15");
        String colorStr = preferences.getString(Constants.PREFS_KEY_NOTES_CUSTOMCOLOR, "blue");
        int noteSize = Integer.parseInt(sizeStr);
        float opacity = Float.parseFloat(opacityStr) * 255 / 100;

        OvalShape notesShape = new OvalShape();
        Paint notesPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        notesPaint.setStyle(Paint.Style.FILL);
        notesPaint.setColor(ColorUtilities.toColor(colorStr));
        notesPaint.setAlpha((int) opacity);

        ShapeDrawable notesShapeDrawable = new ShapeDrawable(notesShape);
        Paint paint = notesShapeDrawable.getPaint();
        paint.set(notesPaint);
        notesShapeDrawable.setIntrinsicHeight(noteSize);
        notesShapeDrawable.setIntrinsicWidth(noteSize);
        notesDrawable = notesShapeDrawable;
    } else {
        notesDrawable = getResources().getDrawable(R.drawable.information);
    }

    dataOverlay = new ArrayGeopaparazziOverlay(this);
    List<Overlay> overlays = mapView.getOverlays();
    overlays.clear();
    overlays.add(dataOverlay);

    super.onResume();
}
 
開發者ID:GitHubDroid,項目名稱:geodroid_master_update,代碼行數:36,代碼來源:MapsActivity.java

示例2: MapView

import org.mapsforge.android.maps.overlay.Overlay; //導入依賴的package包/類
/**
 * @param context
 *            the enclosing MapActivity instance.
 * @param attributeSet
 *            a set of attributes.
 * @throws IllegalArgumentException
 *             if the context object is not an instance of {@link MapActivity}.
 */
public MapView(Context context, AttributeSet attributeSet) {
	super(context, attributeSet);

	if (!(context instanceof MapActivity)) {
		throw new IllegalArgumentException("context is not an instance of MapActivity");
	}
	MapActivity mapActivity = (MapActivity) context;

	setBackgroundColor(FrameBuffer.MAP_VIEW_BACKGROUND);
	setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
	setWillNotDraw(false);

	this.debugSettings = new DebugSettings(false, false, false);
	this.fileSystemTileCache = new FileSystemTileCache(DEFAULT_TILE_CACHE_SIZE_FILE_SYSTEM,
			mapActivity.getMapViewId());
	this.fpsCounter = new FpsCounter();
	this.frameBuffer = new FrameBuffer(this);
	this.inMemoryTileCache = new InMemoryTileCache(DEFAULT_TILE_CACHE_SIZE_IN_MEMORY);
	this.jobParameters = null;
	this.jobQueue = new JobQueue(this);
	this.mapDatabase = new MapDatabase();
	this.mapViewPosition = new MapViewPosition(this);
	this.mapScaleBar = new MapScaleBar(this);
	this.mapZoomControls = new MapZoomControls(context, this);
	this.overlays = Collections.synchronizedList(new ArrayList<Overlay>());
	this.projection = new MapViewProjection(this);
	this.touchEventHandler = new TouchEventHandler(mapActivity, this);

	this.databaseRenderer = new DatabaseRenderer(this.mapDatabase);

	this.mapWorker = new MapWorker(this);
	this.mapWorker.start();

	this.mapMover = new MapMover(this);
	this.mapWorker.setDatabaseRenderer(this.databaseRenderer);
	this.mapMover.start();

	this.zoomAnimator = new ZoomAnimator(this);
	this.zoomAnimator.start();

	this.overlayController = new OverlayController(this);
	this.overlayController.start();

	GeoPoint startPoint = this.databaseRenderer.getStartPoint();
	Byte startZoomLevel = this.databaseRenderer.getStartZoomLevel();
	if (startPoint != null) {
		this.mapViewPosition.setCenter(startPoint);
	}
	if (startZoomLevel != null) {
		this.mapViewPosition.setZoomLevel(startZoomLevel.byteValue());
	}

	mapActivity.registerMapView(this);
}
 
開發者ID:DonTomika,項目名稱:mapsforge,代碼行數:63,代碼來源:MapView.java

示例3: getOverlays

import org.mapsforge.android.maps.overlay.Overlay; //導入依賴的package包/類
/**
 * Returns a thread-safe list of overlays for this MapView. It is necessary to manually synchronize on this list
 * when iterating over it.
 * 
 * @return the overlay list.
 */
public List<Overlay> getOverlays() {
	return this.overlays;
}
 
開發者ID:DonTomika,項目名稱:mapsforge,代碼行數:10,代碼來源:MapView.java


注:本文中的org.mapsforge.android.maps.overlay.Overlay類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。