Beispiel #1
0
 /**
  * Add a callout to the the TileView. The callout can be any View. No LayoutParams are required;
  * the View will be laid out using WRAP_CONTENT for both width and height, and positioned
  * according to the x and y values supplied. Callout views will always be positioned at the top of
  * the view tree (at the highest z-index), and will always be removed during any touch event that
  * is not consumed by the callout View.
  *
  * @param view View instance to be added to the TileView.
  * @param x Relative x position the View instance should be positioned at.
  * @param y Relative y position the View instance should be positioned at.
  * @param anchorX The x-axis position of a callout view will be offset by a number equal to the
  *     width of the callout view multiplied by this value.
  * @param anchorY The y-axis position of a callout view will be offset by a number equal to the
  *     height of the callout view multiplied by this value.
  * @return The View instance added to the TileView.
  */
 public View addCallout(View view, double x, double y, Float anchorX, Float anchorY) {
   return mCalloutLayout.addMarker(
       view,
       mCoordinateTranslater.translateX(x),
       mCoordinateTranslater.translateY(y),
       anchorX,
       anchorY);
 }
Beispiel #2
0
 /**
  * Register a HotSpot that should fire a listener when a touch event occurs that intersects the
  * Region defined by the HotSpot.
  *
  * <p>The HotSpot virtually moves and scales with the TileView.
  *
  * @param positions (List<double[]>) List of paired doubles that represents the region.
  * @return HotSpot the hotspot created with this method.
  */
 public HotSpot addHotSpot(List<double[]> positions, HotSpot.HotSpotTapListener listener) {
   Path path = mCoordinateTranslater.pathFromPositions(positions, true);
   RectF bounds = new RectF();
   path.computeBounds(bounds, true);
   Rect rect = new Rect();
   bounds.round(rect);
   Region clip = new Region(rect);
   HotSpot hotSpot = new HotSpot();
   hotSpot.setPath(path, clip);
   hotSpot.setHotSpotTapListener(listener);
   return addHotSpot(hotSpot);
 }
Beispiel #3
0
 /**
  * Register a Path and Paint that will be drawn on a layer above the tiles, but below markers. The
  * Path will be scaled with the TileView, but will always be as wide as the stroke set for the
  * Paint.
  *
  * @param positions List of doubles that represent the points of the Path.
  * @param paint The Paint instance that defines the style of the drawn path.
  * @return The DrawablePath instance passed to the TileView.
  */
 public CompositePathView.DrawablePath drawPath(List<double[]> positions, Paint paint) {
   Path path = mCoordinateTranslater.pathFromPositions(positions, false);
   return mCompositePathView.addPath(path, paint);
 }
Beispiel #4
0
 /**
  * Scrolls and scales (with animation) the TileView to the specified x, y and scale provided. The
  * TileView will be centered to the coordinates passed.
  *
  * @param x The relative x position to move to.
  * @param y The relative y position to move to.
  * @param scale The scale the TileView should be at when the animation is complete.
  */
 public void slideToAndCenterWithScale(double x, double y, float scale) {
   slideToAndCenterWithScale(
       mCoordinateTranslater.translateAndScaleX(x, scale),
       mCoordinateTranslater.translateAndScaleY(y, scale),
       scale);
 }
Beispiel #5
0
 /**
  * Moves an existing marker to another position.
  *
  * @param view The marker View to be repositioned.
  * @param x Relative x position the View instance should be positioned at.
  * @param y Relative y position the View instance should be positioned at.
  */
 public void moveMarker(View view, double x, double y) {
   mMarkerLayout.moveMarker(
       view, mCoordinateTranslater.translateX(x), mCoordinateTranslater.translateY(y));
 }
Beispiel #6
0
 /**
  * Scrolls (with animation) the TileView to the x and y positions provided, then centers the
  * viewport to the position.
  *
  * @param x The relative x position to move to.
  * @param y The relative y position to move to.
  */
 public void slideToAndCenter(double x, double y) {
   slideToAndCenter(
       mCoordinateTranslater.translateAndScaleX(x, getScale()),
       mCoordinateTranslater.translateAndScaleY(y, getScale()));
 }
Beispiel #7
0
 /**
  * Scrolls (instantly) the TileView to the x and y positions provided. The is an overload of
  * scrollTo( int x, int y ) that accepts doubles; if the TileView has relative bounds defined,
  * those relative doubles will be converted to absolute pixel positions.
  *
  * @param x The relative x position to move to.
  * @param y The relative y position to move to.
  */
 public void scrollTo(double x, double y) {
   scrollTo(
       mCoordinateTranslater.translateAndScaleX(x, getScale()),
       mCoordinateTranslater.translateAndScaleY(y, getScale()));
 }
Beispiel #8
0
 /**
  * Unregisters arbitrary bounds and coordinate system. After invoking this method, TileView
  * methods that receive position method parameters will use pixel values, relative to the
  * TileView's registered size (at 1.0f scale).
  */
 public void undefineBounds() {
   mCoordinateTranslater.unsetBounds();
 }
Beispiel #9
0
 /**
  * Register a set of offset points to use when calculating position within the TileView. Any type
  * of coordinate system can be used (any type of lat/lng, percentile-based, etc), and all
  * positioned are calculated relatively. If relative bounds are defined, position parameters
  * received by TileView methods will be translated to the the appropriate pixel value. To remove
  * this process, use undefineBounds.
  *
  * @param left The left edge of the rectangle used when calculating position.
  * @param top The top edge of the rectangle used when calculating position.
  * @param right The right edge of the rectangle used when calculating position.
  * @param bottom The bottom edge of the rectangle used when calculating position.
  */
 public void defineBounds(double left, double top, double right, double bottom) {
   mCoordinateTranslater.setBounds(left, top, right, bottom);
 }
Beispiel #10
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);
 }