本文整理汇总了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();
}
示例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);
}
示例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;
}