Esempio n. 1
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();
 }
Esempio n. 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();
  }
Esempio n. 3
0
 @Override
 public void onZoomBegin(float scale, Origination origin) {
   if (origin == null) {
     mTileCanvasViewGroup.suppressRender();
   }
   mDetailLevelManager.setScale(scale);
 }
Esempio n. 4
0
 protected void updateViewport() {
   int left = getScrollX();
   int top = getScrollY();
   int right = left + getWidth();
   int bottom = top + getHeight();
   mDetailLevelManager.updateViewport(left, top, right, bottom);
 }
Esempio n. 5
0
 @Override
 public void onZoomEnd(float scale, Origination origin) {
   if (origin == null) {
     mTileCanvasViewGroup.resumeRender();
   }
   mDetailLevelManager.setScale(scale);
   requestRender();
 }
Esempio n. 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);
 }
Esempio n. 7
0
 /**
  * Allows the use of a custom {@link DetailLevelManager}.
  * <p>
  * For example, to change the logic of {@link DetailLevel} choice for a given scale, you
  * declare your own {@code DetailLevelMangerCustom} that extends {@link DetailLevelManager} :
  * <pre>{@code
  * private class DetailLevelManagerCustom extends DetailLevelManager{
  *  @literal @Override
  *   public DetailLevel getDetailLevelForScale(){
  *     // your logic here
  *   }
  * }
  * }
  * </pre>
  * Then you should use {@code TileView.setDetailLevelManager} before other method calls, especially
  * {@code TileView.setSize} and {@code TileView.addDetailLevel}.
  * </p>
  *
  * @param manager The DetailLevelManager instance used.
  */
 public void setDetailLevelManager(DetailLevelManager manager) {
   mDetailLevelManager = manager;
   mDetailLevelManager.setDetailLevelChangeListener(this);
 }
Esempio n. 8
0
 /**
  * Recycles bitmap image files, prevents path drawing, and clears pending Handler messages,
  * appropriate for Activity.onPause.
  */
 public void pause() {
   mRenderThrottleHandler.clear();
   mDetailLevelManager.invalidateAll();
   setWillNotDraw(true);
 }
Esempio n. 9
0
 /**
  * Pads the viewport by the number of pixels passed. e.g., setViewportPadding( 100 ) instructs the
  * TileView to interpret it's actual viewport offset by 100 pixels in each direction (top, left,
  * right, bottom), so more tiles will qualify for "visible" status when intersections are
  * calculated.
  *
  * @param padding The number of pixels to pad the viewport by
  */
 public void setViewportPadding(int padding) {
   mDetailLevelManager.setViewportPadding(padding);
 }
Esempio n. 10
0
 /**
  * Register a tile set to be used for a particular detail level. Each tile set to be used must be
  * registered using this method, and at least one tile set must be registered for the TileView to
  * render any tiles.
  *
  * @param detailScale Scale at which the TileView should use the tiles in this set.
  * @param data An arbitrary object of any type that is passed to the (Adapter|Decoder) for each
  *     tile on this level.
  * @param tileWidth Size of each tiled column.
  * @param tileHeight Size of each tiled row.
  */
 public void addDetailLevel(float detailScale, Object data, int tileWidth, int tileHeight) {
   mDetailLevelManager.addDetailLevel(detailScale, data, tileWidth, tileHeight);
 }
Esempio n. 11
0
 /**
  * Defines the total size, in pixels, of the tile set at 100% scale. The TileView wills pan within
  * it's layout dimensions, with the content (scrollable) size defined by this method.
  *
  * @param width Total width of the tiled set.
  * @param height Total height of the tiled set.
  */
 @Override
 public void setSize(int width, int height) {
   super.setSize(width, height);
   mDetailLevelManager.setSize(width, height);
   mCoordinateTranslater.setSize(width, height);
 }