Android Open Source - android-augment-reality-framework Paintable Position






From Project

Back to project page android-augment-reality-framework.

License

The source code is released under:

GNU General Public License

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;
/*  w  w  w .  j a v a 2s .  co m*/
import android.graphics.Canvas;


/**
 * This class extends PaintableObject and adds the ability to rotate and scale.
 * 
 * @author Justin Wetherell <phishman3579@gmail.com>
 */
public class PaintablePosition extends PaintableObject {

    private float width = 0, height = 0;
    private float objX = 0, objY = 0, objRotation = 0, objScale = 0;
    private PaintableObject obj = null;

    public PaintablePosition(PaintableObject drawObj, float x, float y, float rotation, float scale) {
        set(drawObj, x, y, rotation, scale);
    }

    /**
     * Set this objects parameters. This should be used instead of creating new
     * objects.
     * 
     * @param drawObj
     *            Object to set for this Position.
     * @param x
     *            X coordinate of the Position.
     * @param y
     *            Y coordinate of the Position.
     * @param rotation
     *            Rotation of the Position.
     * @param scale
     *            Scale of the Position.
     * @throws NullPointerException
     *             if PaintableObject is NULL.
     */
    public void set(PaintableObject drawObj, float x, float y, float rotation, float scale) {
        if (drawObj == null) throw new NullPointerException();

        this.obj = drawObj;
        this.objX = x;
        this.objY = y;
        this.objRotation = rotation;
        this.objScale = scale;
        this.width = obj.getWidth();
        this.height = obj.getHeight();
    }

    /**
     * Move the object.
     * 
     * @param x
     *            New X coordinate of the Position.
     * @param y
     *            New Y coordinate of the Position.
     */
    public void move(float x, float y) {
        objX = x;
        objY = y;
    }

    /**
     * X coordinate of the Object.
     * 
     * @return float X coordinate.
     */
    public float getObjectsX() {
        return objX;
    }

    /**
     * Y coordinate of the Object.
     * 
     * @return float Y coordinate.
     */
    public float getObjectsY() {
        return objY;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void paint(Canvas canvas) {
        if (canvas == null || obj == null) throw new NullPointerException();

        paintObj(canvas, obj, objX, objY, objRotation, objScale);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float getWidth() {
        return width;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float getHeight() {
        return height;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return "< objX=" + objX + " objY=" + objY + " width=" + width + " height=" + height + " >";
    }
}




Java Source Code List

com.jwetherell.augmented_reality.activity.AugmentedReality.java
com.jwetherell.augmented_reality.activity.AugmentedView.java
com.jwetherell.augmented_reality.activity.Demo.java
com.jwetherell.augmented_reality.activity.SensorsActivity.java
com.jwetherell.augmented_reality.camera.CameraCompatibility.java
com.jwetherell.augmented_reality.camera.CameraModel.java
com.jwetherell.augmented_reality.camera.CameraSurface.java
com.jwetherell.augmented_reality.common.LowPassFilter.java
com.jwetherell.augmented_reality.common.Matrix.java
com.jwetherell.augmented_reality.common.Navigation.java
com.jwetherell.augmented_reality.common.Orientation.java
com.jwetherell.augmented_reality.common.ReusableString.java
com.jwetherell.augmented_reality.common.Vector.java
com.jwetherell.augmented_reality.data.ARData.java
com.jwetherell.augmented_reality.data.BuzzDataSource.java
com.jwetherell.augmented_reality.data.DataSource.java
com.jwetherell.augmented_reality.data.GooglePlacesDataSource.java
com.jwetherell.augmented_reality.data.LocalDataSource.java
com.jwetherell.augmented_reality.data.NetworkDataSource.java
com.jwetherell.augmented_reality.data.PhysicalLocation.java
com.jwetherell.augmented_reality.data.ScreenPosition.java
com.jwetherell.augmented_reality.data.TwitterDataSource.java
com.jwetherell.augmented_reality.data.WikipediaDataSource.java
com.jwetherell.augmented_reality.ui.IconMarker.java
com.jwetherell.augmented_reality.ui.Marker.java
com.jwetherell.augmented_reality.ui.Radar.java
com.jwetherell.augmented_reality.ui.objects.PaintableBox.java
com.jwetherell.augmented_reality.ui.objects.PaintableBoxedText.java
com.jwetherell.augmented_reality.ui.objects.PaintableCircle.java
com.jwetherell.augmented_reality.ui.objects.PaintableGps.java
com.jwetherell.augmented_reality.ui.objects.PaintableIcon.java
com.jwetherell.augmented_reality.ui.objects.PaintableLine.java
com.jwetherell.augmented_reality.ui.objects.PaintableObject.java
com.jwetherell.augmented_reality.ui.objects.PaintablePoint.java
com.jwetherell.augmented_reality.ui.objects.PaintablePosition.java
com.jwetherell.augmented_reality.ui.objects.PaintableRadarPoints.java
com.jwetherell.augmented_reality.ui.objects.PaintableText.java
com.jwetherell.augmented_reality.widget.VerticalSeekBar.java
com.jwetherell.augmented_reality.widget.VerticalTextView.java