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.comimport com.jwetherell.augmented_reality.data.ARData;
import com.jwetherell.augmented_reality.ui.Marker;
import com.jwetherell.augmented_reality.ui.Radar;
import android.graphics.Canvas;
/**
* This class extends PaintableObject to draw all the Markers at their
* appropriate locations.
*
* @author Justin Wetherell <phishman3579@gmail.com>
*/publicclass PaintableRadarPoints extends PaintableObject {
privatefinalfloat[] locationArray = newfloat[3];
private PaintablePoint paintablePoint = null;
private PaintablePosition pointContainer = null;
/**
* {@inheritDoc}
*/
@Override
publicvoid paint(Canvas canvas) {
if (canvas == null) thrownew NullPointerException();
// Draw the markers in the circle
float range = ARData.getRadius() * 1000;
float scale = range / Radar.RADIUS;
for (Marker pm : ARData.getMarkers()) {
pm.getLocation().get(locationArray);
float x = locationArray[0] / scale;
float y = locationArray[2] / scale;
if ((x*x + y*y) < (Radar.RADIUS * Radar.RADIUS)) {
if (paintablePoint == null) paintablePoint = new PaintablePoint(pm.getColor(), true);
else paintablePoint.set(pm.getColor(), true);
if (pointContainer == null) pointContainer = new PaintablePosition(paintablePoint, (x + Radar.RADIUS - 1), (y + Radar.RADIUS - 1), 0, 1);
else pointContainer.set(paintablePoint, (x+Radar.RADIUS-1), (y+Radar.RADIUS-1), 0, 1);
pointContainer.paint(canvas);
}
}
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getWidth() {
return Radar.RADIUS * 2;
}
/**
* {@inheritDoc}
*/
@Override
publicfloat getHeight() {
return Radar.RADIUS * 2;
}
}