Пример #1
0
 @Override
 public void onZoomBegin(float scale, Origination origin) {
   if (origin == null) {
     mTileCanvasViewGroup.suppressRender();
   }
   mDetailLevelManager.setScale(scale);
 }
Пример #2
0
  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();
  }
Пример #3
0
 /** 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();
 }
Пример #4
0
 @Override
 public void onZoomEnd(float scale, Origination origin) {
   if (origin == null) {
     mTileCanvasViewGroup.resumeRender();
   }
   mDetailLevelManager.setScale(scale);
   requestRender();
 }
Пример #5
0
 /**
  * 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);
 }
Пример #6
0
 @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);
 }
Пример #7
0
 @Override
 public void onDetailLevelChanged(DetailLevel detailLevel) {
   requestRender();
   mTileCanvasViewGroup.updateTileSet(detailLevel);
 }
Пример #8
0
 /**
  * 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();
 }
Пример #9
0
 /**
  * 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);
 }
Пример #10
0
 /**
  * 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);
 }
Пример #11
0
 /**
  * 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);
 }
Пример #12
0
 /** Notify the TileView that it should resume tiles rendering. */
 public void resumeRender() {
   mTileCanvasViewGroup.resumeRender();
 }
Пример #13
0
 /**
  * Notify the TileView that it should continue to render any pending tiles, but should not accept
  * new render tasks.
  */
 public void suppressRender() {
   mTileCanvasViewGroup.suppressRender();
 }
Пример #14
0
 /**
  * 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();
 }
Пример #15
0
 /**
  * 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();
 }