@Override public void onZoomBegin(float scale, Origination origin) { if (origin == null) { mTileCanvasViewGroup.suppressRender(); } mDetailLevelManager.setScale(scale); }
public TileView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTileCanvasViewGroup = new TileCanvasViewGroup(context); addView(mTileCanvasViewGroup); mCompositePathView = new CompositePathView(context); addView(mCompositePathView); mScalingLayout = new ScalingLayout(context); addView(mScalingLayout); mMarkerLayout = new MarkerLayout(context); addView(mMarkerLayout); mCalloutLayout = new CalloutLayout(context); addView(mCalloutLayout); mDetailLevelManager.setDetailLevelChangeListener(this); mTileCanvasViewGroup.setTileRenderListener(this); addZoomPanListener(this); mRenderThrottleHandler = new RenderThrottleHandler(this); requestRender(); }
/** Restore visible state (generally after a call to pause). Appropriate for Activity.onResume. */ public void resume() { setWillNotDraw(false); updateViewport(); mTileCanvasViewGroup.updateTileSet(mDetailLevelManager.getCurrentDetailLevel()); requestRender(); requestLayout(); }
@Override public void onZoomEnd(float scale, Origination origin) { if (origin == null) { mTileCanvasViewGroup.resumeRender(); } mDetailLevelManager.setScale(scale); requestRender(); }
/** * Allows the TileView to render tiles while panning. * * @param shouldRender True if it should render while panning. */ public void setShouldRenderWhilePanning(boolean shouldRender) { mShouldRenderWhilePanning = shouldRender; int buffer = shouldRender ? TileCanvasViewGroup.FAST_RENDER_BUFFER : TileCanvasViewGroup.DEFAULT_RENDER_BUFFER; mTileCanvasViewGroup.setRenderBuffer(buffer); }
@Override public void onScaleChanged(float scale, float previous) { super.onScaleChanged(scale, previous); mDetailLevelManager.setScale(scale); mHotSpotManager.setScale(scale); mTileCanvasViewGroup.setScale(scale); mScalingLayout.setScale(scale); mCompositePathView.setScale(scale); mMarkerLayout.setScale(scale); mCalloutLayout.setScale(scale); }
@Override public void onDetailLevelChanged(DetailLevel detailLevel) { requestRender(); mTileCanvasViewGroup.updateTileSet(detailLevel); }
/** * Clear tile image files and remove all views, appropriate for Activity.onDestroy. After invoking * this method, the TileView instance should be removed from any view trees, and references to it * should be set to null. */ public void destroy() { pause(); mTileCanvasViewGroup.destroy(); mCompositePathView.clear(); removeAllViews(); }
/** * Defines whether tile bitmaps should be rendered using an AlphaAnimation * * @param enabled True if the TileView should render tiles with fade transitions */ public void setTransitionsEnabled(boolean enabled) { mTileCanvasViewGroup.setTransitionsEnabled(enabled); }
/** * Instructs Tile instances to recycle (or not). This can be useful if using a caching system that * re-uses bitmaps and expects them to not have been recycled. * * <p>The default value is true. * * @deprecated This value is no longer considered - bitmaps are always recycled when they're no * longer used. * @param shouldRecycleBitmaps True if bitmaps should call Bitmap.recycle when they are removed * from view. */ public void setShouldRecycleBitmaps(boolean shouldRecycleBitmaps) { mTileCanvasViewGroup.setShouldRecycleBitmaps(shouldRecycleBitmaps); }
/** * Sets a custom class to perform the getBitmap operation when tile bitmaps are requested for tile * images only. By default, a BitmapDecoder implementation is provided that renders bitmaps from * the context's Assets, but alternative implementations could be used that fetch images via HTTP, * or from the SD card, or resources, SVG, etc. * * @param bitmapProvider A class instance that implements BitmapProvider, and must define a * getBitmap method, which accepts a String file name and a Context object, and returns a * Bitmap */ public void setBitmapProvider(BitmapProvider bitmapProvider) { mTileCanvasViewGroup.setBitmapProvider(bitmapProvider); }
/** Notify the TileView that it should resume tiles rendering. */ public void resumeRender() { mTileCanvasViewGroup.resumeRender(); }
/** * Notify the TileView that it should continue to render any pending tiles, but should not accept * new render tasks. */ public void suppressRender() { mTileCanvasViewGroup.suppressRender(); }
/** * Notify the TileView that it may stop rendering tiles. The rendering thread will be sent an * interrupt request, but no guarantee is provided when the request will be responded to. */ public void cancelRender() { mTileCanvasViewGroup.cancelRender(); }
/** * Request that the current tile set is re-examined and re-drawn. The request is added to a queue * and is not guaranteed to be processed at any particular time, and will never be handled * immediately. */ public void requestRender() { mTileCanvasViewGroup.requestRender(); }