Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding onTap for a Path drawn in an Overlay
    primarykey
    data
    text
    <p>I am trying to override onTap function for an overlay of Mapview which contains a set of lines drawn using a Path. I was wondering if there is any specific overlay designed which has the onTap for lines? </p> <p>My overlay looks like this: </p> <pre><code>public class MyPathOverlay extends Overlay { MapView map; Projection projection; ArrayList&lt;Pair&lt;GeoPoint, Integer&gt;&gt; pointsList; // Set of points and the // color of the line // starting from this point public MyPathOverlay(MapView contextMap, ArrayList&lt;Pair&lt;GeoPoint, Integer&gt;&gt; points) { map = contextMap; projection = map.getProjection(); pointsList = points; } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); if (shadow == false &amp;&amp; pointsList !=null) { for (int i = 0; i &lt; pointsList.size() - 1; i++) { Paint paint = new Paint(); paint.setDither(true); Pair&lt;GeoPoint, Integer&gt; p1 = pointsList.get(i); GeoPoint gp1 = p1.first; paint.setColor(p1.second); GeoPoint gp2 = pointsList.get(i + 1).first; paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeWidth(5); Point point1 = new Point(); Point point2 = new Point(); projection.toPixels(gp1, point1); projection.toPixels(gp2, point2); Path path = new Path(); path.moveTo(point2.x, point2.y); path.lineTo(point1.x, point1.y); canvas.drawPath(path, paint); } } } @Override public boolean onTap(GeoPoint p, MapView mapView) { return super.onTap(p, mapView); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload