Search in sources :

Example 1 with Projection

use of com.google.android.maps.Projection in project ignition by mttkay.

the class AccuracyCircleOverlay method draw.

@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    Projection projection = mapView.getProjection();
    if (shadow && projection == null) {
        Log.v(LOG_TAG, "drawing not done because shadow and projection are null");
        return;
    }
    Point pt = new Point();
    projection.toPixels(geoPoint, pt);
    float circleRadius = metersToRadius(accuracy, projection, geoPoint.getLatitudeE6());
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(0x186666ff);
    paint.setStyle(Style.FILL_AND_STROKE);
    canvas.drawCircle(pt.x, pt.y, circleRadius, paint);
    paint.setColor(0xff6666ff);
    paint.setStyle(Style.STROKE);
    canvas.drawCircle(pt.x, pt.y, circleRadius, paint);
    paint.setColor(Color.RED);
    paint.setStyle(Style.FILL_AND_STROKE);
    canvas.drawCircle(pt.x, pt.y, 3, paint);
    super.draw(canvas, mapView, shadow);
}
Also used : Projection(com.google.android.maps.Projection) Point(android.graphics.Point) GeoPoint(com.google.android.maps.GeoPoint) Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)1 Point (android.graphics.Point)1 GeoPoint (com.google.android.maps.GeoPoint)1 Projection (com.google.android.maps.Projection)1