Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rvieras/droidar updates #23

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions droidar/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
6 changes: 6 additions & 0 deletions droidar/.project
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
4 changes: 2 additions & 2 deletions droidar/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-->

<activity
android:name="system.ArActivity"
android:name="entry.ArActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:screenOrientation="landscape" >
Expand Down Expand Up @@ -64,7 +64,7 @@
work for devices with android 1.5 as well. The development version is set
to 1.6 to get access to stuff like high res. screens (eg samsung galaxy tab)
-->
<uses-sdk android:minSdkVersion="5" />
<uses-sdk android:minSdkVersion="11" />

<!--
IMPORTANT: The following permissions should also be added to each project
Expand Down
4 changes: 2 additions & 2 deletions droidar/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# "ant.properties", and override values to adapt the script to your
# project structure.

android.library=true
android.library=false
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-8
target=android-19
52 changes: 24 additions & 28 deletions droidar/src/actions/Action.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
package actions;

import listeners.EventListener;
import logger.ARLogger;
import util.Log;
import util.Vec;
import worldData.Updateable;
import worlddata.Updateable;
import android.location.Location;
import android.view.MotionEvent;

/**
* Base implementation to provide actions to various augmented elements.
*/
public abstract class Action implements EventListener, Updateable {

// protected static final float BUFFER_SPEED_ACCEL_SENSOR = 500;
// protected static final float BUFFER_SPEED_MAGNET_SENSOR = 1500;

protected static final float SMOOTH_ROTATION_SPEED = 2;
protected static final float SMOOTH_MOTION_SPEED = 3;
private static final float SMOOTH_ROTATION_SPEED = 2;
//private static final float SMOOTH_MOTION_SPEED = 3;
private static final String LOG_TAG = "action event";

private boolean accelNotCatchedOutputFlag;
private boolean magnetNotCatchedOutputFlag;
private boolean mAccelNotCatchedOutputFlag;
private boolean mMagnetNotCatchedOutputFlag;

@Override
public boolean onOrientationChanged(float[] values) {
Log.e("action event",
"onOrientationChanged not catched by defined action: "
ARLogger.error(LOG_TAG,
"onOrientationChanged not catched by defined action: "
+ this.getClass());
return false;
}

@Override
public boolean onLocationChanged(Location location) {

String s = "";
s += "Time: " + location.getTime() + "\n";
s += "\t Latitude: " + location.getLatitude() + "\n";
s += "\t Longitude: " + location.getLongitude() + "\n";
s += "\t Altitude: " + location.getAltitude() + "\n";
s += "\t Accuracy: " + location.getAccuracy() + "\n";
Log.d("Location Info", s);

Log.e("action event", "changeLocation not catched by defined action: "
ARLogger.debug(LOG_TAG, s);
ARLogger.error(LOG_TAG, "changeLocation not catched by defined action: "
+ this.getClass());
return false;
}
Expand All @@ -53,9 +52,9 @@ public boolean onTouchMove(MotionEvent e1, MotionEvent e2,

@Override
public boolean onAccelChanged(float[] values) {
if (!accelNotCatchedOutputFlag) {
accelNotCatchedOutputFlag = true;
Log.e("action event",
if (!mAccelNotCatchedOutputFlag) {
mAccelNotCatchedOutputFlag = true;
ARLogger.error(LOG_TAG,
"AccelerationValuesChanged not catched by defined action: "
+ this.getClass());
}
Expand All @@ -64,45 +63,42 @@ public boolean onAccelChanged(float[] values) {

@Override
public boolean onMagnetChanged(float[] values) {
if (!magnetNotCatchedOutputFlag) {
magnetNotCatchedOutputFlag = true;
Log.e("action event",
"MegnetometerValuesChanged not catched by defined action: "
if (!mMagnetNotCatchedOutputFlag) {
mMagnetNotCatchedOutputFlag = true;
ARLogger.error(LOG_TAG,
"MagnetValuesChanged not catched by defined action: "
+ this.getClass());
}
return false;
}

@Override
public boolean onReleaseTouchMove() {
Log.e("action event",
ARLogger.error(LOG_TAG,
"onReleaseTouchMove not catched by defined action: "
+ this.getClass());
return false;
}

@Override
public boolean onTrackballEvent(float x, float y, MotionEvent event) {
Log.e(LOG_TAG, "onTrackballEvent not catched by defined action: "
ARLogger.error(LOG_TAG, "onTrackballEvent not catched by defined action: "
+ this.getClass());
return false;
}

@Override
public boolean update(float timeDelta, Updateable parent) {
Log.e(LOG_TAG,
ARLogger.error(LOG_TAG,
"update event was not handeld correctly by this action type:"
+ this.getClass().toString());
Log.e(LOG_TAG,
ARLogger.error(LOG_TAG,
" > As a reaction to this, the action will now be removed from "
+ "the update cycle! Impelemnt the update method in the specified "
+ "action and return true to fix this error!");
return false;
}

/**
* default implementation done here (Vec.morphToNewAngleVec())
*/
@Override
public void onCamRotationVecUpdate(Vec target, Vec values, float timeDelta) {
Vec.morphToNewAngleVec(target, values.x, values.y, values.z, timeDelta
Expand Down
33 changes: 17 additions & 16 deletions droidar/src/actions/ActionBufferedCameraAR.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
*/
public class ActionBufferedCameraAR extends Action {

// x is the short side of the screen (in landscape mode)
private final float TOUCH_SENSITY_X;
// y is the long side of the screen
private final float TOUCH_SENSITY_Y;
private GLCamera myTargetCamera;
private static final float DEFAULT_X_TOUCH_SENSITY = 2;
private static final float DEFAULT_Y_TOUCH_SENSITY = 36;
private final float mXTouchSensity;
private final float mYTouchSensity;
private GLCamera mTargetCamera;

/**
* @param glCamera
* {@link GLCamera}
* @param sensityX
* is the vertical value (should be around 2, smaller is faster)
* @param sensityY
Expand All @@ -29,33 +30,33 @@ public class ActionBufferedCameraAR extends Action {
*/
public ActionBufferedCameraAR(GLCamera glCamera, float sensityX,
float sensityY) {
myTargetCamera = glCamera;
TOUCH_SENSITY_X = sensityX;
TOUCH_SENSITY_Y = sensityY;
mTargetCamera = glCamera;
mXTouchSensity = sensityX;
mYTouchSensity = sensityY;
}

/**
* uses default accuracy
* uses default accuracy.
*
* @param camera
* @param camera - {@link gl.GLCamera}
*/
public ActionBufferedCameraAR(GLCamera camera) {
this(camera, 2, 36);
this(camera, DEFAULT_X_TOUCH_SENSITY, DEFAULT_Y_TOUCH_SENSITY);
}

@Override
public boolean onTouchMove(MotionEvent e1, MotionEvent e2,
float screenDeltaX, float screenDeltaY) {
screenDeltaX = screenDeltaX / TOUCH_SENSITY_X;
screenDeltaY = -screenDeltaY / TOUCH_SENSITY_Y;
myTargetCamera.changeZAngleBuffered(screenDeltaX);
myTargetCamera.changeZPositionBuffered(screenDeltaY);
screenDeltaX = screenDeltaX / mXTouchSensity;
screenDeltaY = -screenDeltaY / mYTouchSensity;
mTargetCamera.changeZAngleBuffered(screenDeltaX);
mTargetCamera.changeZPositionBuffered(screenDeltaY);
return true;
}

@Override
public boolean onReleaseTouchMove() {
myTargetCamera.resetBufferedAngle();
mTargetCamera.resetBufferedAngle();
return true;
}

Expand Down
Loading