Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps API v2 draw part of circle on MapFragment
    primarykey
    data
    text
    <p>I need to draw something like this which will be painted and have little transparency</p> <p>Also it needs to be clickable (onTouch event etc)</p> <p><img src="https://i.stack.imgur.com/8Ons4.png" alt="enter image description here"></p> <p>I know that in API v1 you have to use Overlay and extend it using canvas and some mathematics. What is easiest way to do it in Google Map API v2? </p> <p>PS: Radius is variable.</p> <p>(For further reference) EDIT 1:</p> <p>I implemented CanvasTileProvider subclass and override its onDraw() method:</p> <pre><code>@Override void onDraw(Canvas canvas, TileProjection projection) { // TODO Auto-generated method stub LatLng tempLocation = moveByDistance(mSegmentLocation, mSegmentRadius, mSegmentAngle); DoublePoint segmentLocationPoint = new DoublePoint(0, 0); DoublePoint tempLocationPoint = new DoublePoint(0, 0); projection.latLngToPoint(mSegmentLocation, segmentLocationPoint); projection.latLngToPoint(tempLocationPoint, tempLocationPoint); float radiusInPoints = FloatMath.sqrt((float) (Math.pow( (segmentLocationPoint.x - tempLocationPoint.x), 2) + Math.pow( (segmentLocationPoint.y - tempLocationPoint.y), 2))); RectF segmentArea = new RectF(); segmentArea.set((float)segmentLocationPoint.x - radiusInPoints, (float)segmentLocationPoint.y - radiusInPoints, (float)segmentLocationPoint.x + radiusInPoints, (float)segmentLocationPoint.y + radiusInPoints); canvas.drawArc(segmentArea, getAdjustedAngle(mSegmentAngle), getAdjustedAngle(mSegmentAngle + 60), true, getOuterCirclePaint()); } </code></pre> <p>Also, I added this from MapActivity:</p> <pre><code>private void loadSegmentTiles() { TileProvider tileProvider; TileOverlay tileOverlay = mMap.addTileOverlay( new TileOverlayOptions().tileProvider(new SegmentTileProvider(new LatLng(45.00000,15.000000), 250, 30))); } </code></pre> <p>Now I'm wondering why my arc isn't on map?</p>
    singulars
    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.
 

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