public LocationAssert hasAltitude() { isNotNull(); assertThat(actual.hasAltitude()) // .overridingErrorMessage("Expected to have altitude but did not.") // .isTrue(); return this; }
public LocationAssert hasNoAltitude() { isNotNull(); assertThat(actual.hasAltitude()) // .overridingErrorMessage("Expected to not have altitude but did.") // .isFalse(); return this; }
coordinates.put(PARAM_ACCURACY, location.getAccuracy()); if (location.hasAltitude()) { coordinates.put(PARAM_ALTITUDE, location.getAltitude());
Location location; /* Get current location from GPS */ location = Location(LocationManager.GPS_PROVIDER); /* Check if the requested Location has its altitude set */ location.hasAltitude();
/** * Formats the altitude from the #Location into a string, with a * second unit field ("M" for meters). If the altitude is * unknown, it returns two empty fields. */ public String formatAltitude(Location location) { String s = ""; if (location.hasAltitude()) s += location.getAltitude() + ",M"; else s += ","; return s; }
public double getAltitude() { return _Location.hasAltitude() ? _Location.getAltitude() : NOT_AVAILABLE; } public float getSpeed() { return _Location.hasSpeed() ? _Location.getSpeed() : NOT_AVAILABLE; }
public LocationAssert hasAltitude() { isNotNull(); assertThat(actual.hasAltitude()) // .overridingErrorMessage("Expected to have altitude but did not.") // .isTrue(); return this; }
public LocationAssert hasNoAltitude() { isNotNull(); assertThat(actual.hasAltitude()) // .overridingErrorMessage("Expected to not have altitude but did.") // .isFalse(); return this; }
public void put(Location location) { if (location == null) return; ContentValues values = new ContentValues(); values.put(FIELD_MAC, location.getExtras().getString(LocationRetriever .EXTRA_MAC_ADDRESS)); values.put(FIELD_LATITUDE, location.getLatitude()); values.put(FIELD_LONGITUDE, location.getLongitude()); if (location.hasAltitude()) { values.put(FIELD_ALTITUDE, location.getAltitude()); } if (location.hasAccuracy()) { values.put(FIELD_ACCURACY, location.getAccuracy()); } values.put(FIELD_TIME, location.getTime()); values.put(FIELD_VERIFIED, location.getExtras().getLong(LocationRetriever .EXTRA_VERIFIED_TIME)); db.insertWithOnConflict(TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE); }
protected void _simulate(Location location) { if (!location.hasAccuracy()) { location.setAccuracy(accuracy); } if (!location.hasAltitude()) { location.setAltitude(0); } try { Method locationJellyBeanFixMethod = Location.class.getMethod("makeComplete"); if (locationJellyBeanFixMethod != null) { locationJellyBeanFixMethod.invoke(location); } } catch (IllegalAccessException ignored) { } catch (NoSuchMethodException ignored) { } catch (InvocationTargetException ignored) {} mLocationManager.setTestProviderLocation(locationProviderName, location); }
/** * Write location to database. * * @param loc Location */ void writeLocation(Location loc) { if (Logger.DEBUG) { Log.d(TAG, "[writeLocation]"); } ContentValues values = new ContentValues(); values.put(DbContract.Positions.COLUMN_TIME, loc.getTime() / 1000); values.put(DbContract.Positions.COLUMN_LATITUDE, loc.getLatitude()); values.put(DbContract.Positions.COLUMN_LONGITUDE, loc.getLongitude()); if (loc.hasBearing()) { values.put(DbContract.Positions.COLUMN_BEARING, loc.getBearing()); } if (loc.hasAltitude()) { values.put(DbContract.Positions.COLUMN_ALTITUDE, loc.getAltitude()); } if (loc.hasSpeed()) { values.put(DbContract.Positions.COLUMN_SPEED, loc.getSpeed()); } if (loc.hasAccuracy()) { values.put(DbContract.Positions.COLUMN_ACCURACY, loc.getAccuracy()); } values.put(DbContract.Positions.COLUMN_PROVIDER, loc.getProvider()); db.insert(DbContract.Positions.TABLE_NAME, null, values); }
public double getAltitudeCorrected(double AltitudeManualCorrection, boolean EGMCorrection) { if (_Location != null) { if (!_Location.hasAltitude()) return NOT_AVAILABLE; if ((EGMCorrection) && (getAltitudeEGM96Correction() != NOT_AVAILABLE)) return _Location.getAltitude() - getAltitudeEGM96Correction() + AltitudeManualCorrection; else return _Location.getAltitude() + AltitudeManualCorrection; } return NOT_AVAILABLE; } }
lon += value.getLongitude() * weight; acc += value.getAccuracy() * weight; if (value.hasAltitude()) { alt += value.getAltitude(); altTotal += weight;
public synchronized void update(Location location) { if (location == null) return; // Reusable final double accuracy = location.getAccuracy(); double position, noise; long timeMs = location.getTime(); predict(timeMs); mTimeOfUpdate = timeMs; samples++; // Latitude position = location.getLatitude(); noise = accuracy * BackendService.METER_TO_DEG; mLatTracker.update(position, noise); // Longitude position = location.getLongitude(); noise = accuracy * Math.cos(Math.toRadians(location.getLatitude())) * BackendService.METER_TO_DEG ; mLonTracker.update(position, noise); // Altitude if (location.hasAltitude()) { position = location.getAltitude(); noise = accuracy; if (mAltTracker == null) { mAltTracker = new Kalman1Dim(ALTITUDE_NOISE, timeMs); mAltTracker.setState(position, 0.0, noise); } else { mAltTracker.update(position, noise); } } }
/** * * @param location */ public Kalman(Location location, double coordinateNoise) { final double accuracy = location.getAccuracy(); final double coordinateNoiseDegrees = coordinateNoise * BackendService.METER_TO_DEG; double position, noise; long timeMs = location.getTime(); // Latitude position = location.getLatitude(); noise = accuracy * BackendService.METER_TO_DEG; mLatTracker = new Kalman1Dim(coordinateNoiseDegrees, timeMs); mLatTracker.setState(position, 0.0, noise); // Longitude position = location.getLongitude(); noise = accuracy * Math.cos(Math.toRadians(location.getLatitude())) * BackendService.METER_TO_DEG; mLonTracker = new Kalman1Dim(coordinateNoiseDegrees, timeMs); mLonTracker.setState(position, 0.0, noise); // Altitude if (location.hasAltitude()) { position = location.getAltitude(); noise = accuracy; mAltTracker = new Kalman1Dim(ALTITUDE_NOISE, timeMs); mAltTracker.setState(position, 0.0, noise); } mTimeOfUpdate = timeMs; samples = 1; }
/** * Create a new SerialziableLocation with the values of the given Location. */ public SerializableLocation(Location location) { this.latitude = location.getLatitude(); this.longitude = location.getLongitude(); this.accuracy = location.getAccuracy(); this.altitude = location.getAltitude(); this.bearing = location.getBearing(); this.provider = location.getProvider(); this.speed = location.getSpeed(); this.time = location.getTime(); this.hasAccuracy = location.hasAccuracy(); this.hasAltitude = location.hasAltitude(); this.hasBearing = location.hasBearing(); this.hasSpeed = location.hasSpeed(); }
@Implementation public void set(Location l) { time = l.getTime(); provider = l.getProvider(); latitude = l.getLatitude(); longitude = l.getLongitude(); accuracy = l.getAccuracy(); bearing = l.getBearing(); altitude = l.getAltitude(); speed = l.getSpeed(); hasAccuracy = l.hasAccuracy(); hasAltitude = l.hasAltitude(); hasBearing = l.hasBearing(); hasSpeed = l.hasSpeed(); }
@Implementation public void set(Location l) { time = l.getTime(); provider = l.getProvider(); latitude = l.getLatitude(); longitude = l.getLongitude(); accuracy = l.getAccuracy(); bearing = l.getBearing(); altitude = l.getAltitude(); speed = l.getSpeed(); hasAccuracy = l.hasAccuracy(); hasAltitude = l.hasAltitude(); hasBearing = l.hasBearing(); hasSpeed = l.hasSpeed(); }
String altitude = location.hasAltitude() ? String.format("%.1f", location.getAltitude()) : "-"; tvAlt.setText(getString(R.string.activity_main_fmt_alt, altitude));
if (mLastLocation.hasAltitude()) {