@Override public void onReceive(Context context, Intent intent) { location = NovoCompass.getLocator().getLocation(); magField = new GeomagneticField((float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); } };
public void setLocation(Location location) { GeomagneticField geomagneticField = new GeomagneticField( (float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); declination = (float) Math.toRadians(geomagneticField.getDeclination()); } }
private static void trueNorth() { long time = System.currentTimeMillis(); GeomagneticField geo = new GeomagneticField((float) startLat, (float) startLon, altitude, time); decl = geo.getDeclination(); }
/** * Set the GeomagneticField based on a Location. Note that this should only be called when there has been a significant change in location. * @param location The location to use for the compensation. */ public void setGeomagneticField(Location location) { geoMagField = new GeomagneticField((float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); } }
GeomagneticField gmf = new GeomagneticField((float)latitude, (float)longitude, 0, time); double dec = -gmf.getDeclination();
GeomagneticField gmf = new GeomagneticField((float)location.getLatitude(), (float)location.getLongitude(), 0, System.currentTimeMillis()); mDeclination = -gmf.getDeclination();
GeomagneticField gmf = new GeomagneticField((float) lat, (float) lon, 0, System.currentTimeMillis()); double bearing = Double.parseDouble(chop.substring(0, 3)) + gmf.getDeclination(); GeomagneticField gmf = new GeomagneticField((float)lat, (float)lon, 0, System.currentTimeMillis()); double bearing = Double.parseDouble(chop.substring(0, 3)) + gmf.getDeclination();