Skip to content

Commit

Permalink
Display location accuracy (addPlot & addTransect)
Browse files Browse the repository at this point in the history
  • Loading branch information
kblairwhite committed Jun 4, 2014
1 parent 3aa3e08 commit d17e23a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/controllers/addPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@ var utmZone;

var current_latitude;
var current_longitude;
var current_accuracy;

//Start continuous location capture - based on distance filter
var gps = require('location');
gps.location(function(latitude, longitude, error) {
gps.location(function(latitude, longitude, accuracy, error) {
if(error == true){
//returns an error
}else{
//updated lat & long
current_latitude = latitude;
current_longitude = longitude;
current_accuracy = accuracy;
}
});

Expand Down Expand Up @@ -381,7 +383,7 @@ function getLocation(){
ltemaAccessDialog.show();
}else{
$.location.visible = true;
$.location.text = "UTM Zone: " + utmZone + "\nUTM Easting: " + UTMEasting + "\nUTM Northing: " + UTMNorthing;
$.location.text = "UTM Zone: " + utmZone + "\nUTM Easting: " + UTMEasting + "\nUTM Northing: " + UTMNorthing + "\nAccuracy: " + Math.round(current_accuracy);
}
});
}
Expand Down
6 changes: 4 additions & 2 deletions app/controllers/addTransect.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var utmZone;

var current_latitude;
var current_longitude;
var current_accuracy;

// Create Stake Orientation TabbedBar labels
var pickStakeLabels = [
Expand All @@ -28,13 +29,14 @@ $.pickStake.labels = pickStakeLabels;

//Start continuous location capture - based on distance filter
var gps = require('location');
gps.location(function(latitude, longitude, error) {
gps.location(function(latitude, longitude, accuracy, error) {
if(error == true){
//returns an error
}else{
//updated lat & long
current_latitude = latitude;
current_longitude = longitude;
current_accuracy = accuracy;
}
});

Expand Down Expand Up @@ -268,7 +270,7 @@ function getLocation(){
ltemaAccessDialog.show();
}else{
$.location.visible = true;
$.location.text = "UTM Zone: " + utmZone + "\nUTM Easting: " + UTMEasting + "\nUTM Northing: " + UTMNorthing;
$.location.text = "UTM Zone: " + utmZone + "\nUTM Easting: " + UTMEasting + "\nUTM Northing: " + UTMNorthing + "\nAccuracy: " + Math.round(current_accuracy);
}
});
}
Expand Down
4 changes: 3 additions & 1 deletion app/lib/location.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function location(callback){
var longitude;
var latitude;
var accuracy;
var error;
//Turn on the GPS
if (Ti.Geolocation.locationServicesEnabled) {
Expand All @@ -20,11 +21,12 @@ if (Ti.Geolocation.locationServicesEnabled) {
error = false;
longitude = e.coords.longitude;
latitude = e.coords.latitude;
accuracy = e.coords.accuracy;

//callback(latitude, longitude, error);
//Ti.API.info(e.coords);
}
callback(latitude, longitude, error);
callback(latitude, longitude, accuracy, error);
});
} else {
error = true;
Expand Down
2 changes: 1 addition & 1 deletion app/styles/addPlot.tss
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
},
"#footerLine": {
height: 1,
top: 464,
top: 479, //464
left: 5,
right: 5,
borderWidth: 1,
Expand Down
2 changes: 1 addition & 1 deletion app/styles/addTransect.tss
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
},
"#footerLine":{
height: 1,
top: 584,
top: 599, //584
left: 5,
right: 5,
borderWidth: 1,
Expand Down

0 comments on commit d17e23a

Please sign in to comment.