当前位置: 首页>>代码示例>>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;未经允许,请勿转载。