If you think the Android project android-augment-reality-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.jwetherell.augmented_reality.ui.objects;
/*fromwww.java2s.com*/import android.graphics.Canvas;
/**
* This class extends PaintableObject to draw a circle with a given radius and a
* stroke width.
*
* @author Justin Wetherell <phishman3579@gmail.com>
*/publicclass PaintableGps extends PaintableObject {
privatefloat radius = 0;
privatefloat strokeWidth = 0;
privateboolean fill = false;
privateint color = 0;
public PaintableGps(float radius, float strokeWidth, boolean fill, int color) {
set(radius, strokeWidth, fill, color);
}
/**
* Set this objects parameters. This should be used instead of creating new
* objects.
*
* @param radius
* Radius of the circle representing the GPS position.
* @param strokeWidth
* Stroke width of the text representing the GPS position.
* @param fill
* Fill color of the circle representing the GPS position.
* @param color
* Color of the circle representing the GPS position.
*/publicvoid set(float radius, float strokeWidth, boolean fill, int color) {
this.radius = radius;
this.strokeWidth = strokeWidth;
this.fill = fill;
this.color = color;
}
/**
* {@inheritDoc}
*/
@Override
publicvoid paint(Canvas canvas) {
if (canvas == null) thrownew NullPointerException();
canvas.save();
canvas.translate(-radius, -radius);
setStrokeWidth(strokeWidth);
setFill(fill);
setColor(color);
paintCircle(canvas, x, y, radius);
canvas.restore();
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getWidth() {
return (radius * 2);
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getHeight() {
return (radius * 2);
}
}