Skip to content

Commit

Permalink
Removing debug
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwedgbury committed Jun 17, 2018
1 parent 5d932e4 commit b567ed0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion 26
defaultConfig {
applicationId "uk.co.appoly.arcore_location"
minSdkVersion 15
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.ArrayList;

import uk.co.appoly.arcorelocation.rendering.LocationNode;
import uk.co.appoly.arcorelocation.rendering.LocationNodeRender;
import uk.co.appoly.arcorelocation.sensor.DeviceLocation;
import uk.co.appoly.arcorelocation.sensor.DeviceLocationChanged;
import uk.co.appoly.arcorelocation.sensor.DeviceOrientation;
Expand Down Expand Up @@ -53,6 +52,7 @@ public void run() {
mHandler.postDelayed(anchorRefreshTask, anchorRefreshInterval);
}
};
private boolean debugEnabled = false;
private Session mSession;
private DeviceLocationChanged locationChangedEvent;
public LocationScene(Context mContext, Activity mActivity, ArSceneView mArSceneView) {
Expand All @@ -69,6 +69,14 @@ public LocationScene(Context mContext, Activity mActivity, ArSceneView mArSceneV
deviceOrientation.resume();
}

public boolean isDebugEnabled() {
return debugEnabled;
}

public void setDebugEnabled(boolean debugEnabled) {
this.debugEnabled = debugEnabled;
}

public boolean minimalRefreshing() {
return minimalRefreshing;
}
Expand Down Expand Up @@ -125,8 +133,8 @@ public void setAnchorRefreshInterval(int anchorRefreshInterval) {
}

public void clearMarkers() {
for(LocationMarker lm : mLocationMarkers) {
if(lm.anchorNode != null) {
for (LocationMarker lm : mLocationMarkers) {
if (lm.anchorNode != null) {
lm.anchorNode.getAnchor().detach();
lm.anchorNode.setEnabled(false);
lm.anchorNode = null;
Expand Down Expand Up @@ -283,7 +291,7 @@ private void refreshAnchorsIfRequired(Frame frame) {
mLocationMarkers.get(i).anchorNode.setGradualScalingMinScale(mLocationMarkers.get(i).getGradualScalingMinScale());
mLocationMarkers.get(i).anchorNode.setHeight(mLocationMarkers.get(i).getHeight());

if(minimalRefreshing)
if (minimalRefreshing)
mLocationMarkers.get(i).anchorNode.scaleAndRotate();
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package uk.co.appoly.arcorelocation.sensor;

import android.content.Context;
import android.location.Criteria;
import android.location.GpsStatus;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
Expand Down Expand Up @@ -169,13 +167,16 @@ private boolean filterAndAddLocation(Location location) {
if (age > 5 * 1000) { //more than 5 seconds
Log.d(TAG, "Location is old");
oldLocationList.add(location);
Toast.makeText(locationScene.mContext, "Rejected: old", Toast.LENGTH_SHORT).show();

if (locationScene.isDebugEnabled())
Toast.makeText(locationScene.mContext, "Rejected: old", Toast.LENGTH_SHORT).show();
return false;
}

if (location.getAccuracy() <= 0) {
Log.d(TAG, "Latitidue and longitude values are invalid.");
Toast.makeText(locationScene.mContext, "Rejected: invalid", Toast.LENGTH_SHORT).show();
if (locationScene.isDebugEnabled())
Toast.makeText(locationScene.mContext, "Rejected: invalid", Toast.LENGTH_SHORT).show();
noAccuracyLocationList.add(location);
return false;
}
Expand All @@ -185,7 +186,8 @@ private boolean filterAndAddLocation(Location location) {
if (horizontalAccuracy > getMinimumAccuracy()) { //10meter filter
Log.d(TAG, "Accuracy is too low.");
inaccurateLocationList.add(location);
Toast.makeText(locationScene.mContext, "Rejected: innacurate", Toast.LENGTH_SHORT).show();
if (locationScene.isDebugEnabled())
Toast.makeText(locationScene.mContext, "Rejected: innacurate", Toast.LENGTH_SHORT).show();
return false;
}

Expand Down Expand Up @@ -220,7 +222,8 @@ private boolean filterAndAddLocation(Location location) {
}

kalmanNGLocationList.add(location);
Toast.makeText(locationScene.mContext, "Rejected: kalman filter", Toast.LENGTH_SHORT).show();
if (locationScene.isDebugEnabled())
Toast.makeText(locationScene.mContext, "Rejected: kalman filter", Toast.LENGTH_SHORT).show();
return false;
} else {
kalmanFilter.consecutiveRejectCount = 0;
Expand Down

0 comments on commit b567ed0

Please sign in to comment.