Search in sources :

Example 16 with LatLng

use of fr.free.nrw.commons.location.LatLng in project apps-android-commons by commons-app.

the class LengthUtilsTest method testOneDegreeFortyFiveDegrees.

@Test
public void testOneDegreeFortyFiveDegrees() {
    LatLng pointA = new LatLng(45, 0, 0);
    LatLng pointB = new LatLng(45, 1, 0);
    String distance = LengthUtils.formatDistanceBetween(pointA, pointB);
    Assert.assertThat(distance, is("78.6km"));
}
Also used : LatLng(fr.free.nrw.commons.location.LatLng) Test(org.junit.Test)

Example 17 with LatLng

use of fr.free.nrw.commons.location.LatLng in project apps-android-commons by commons-app.

the class LatLngTests method testTooBigWestValue.

@Test
public void testTooBigWestValue() {
    LatLng place = new LatLng(20, -190, 0);
    String prettyString = place.getPrettyCoordinateString();
    Assert.assertThat(prettyString, is("20.0 N, 170.0 E"));
}
Also used : LatLng(fr.free.nrw.commons.location.LatLng) Test(org.junit.Test)

Example 18 with LatLng

use of fr.free.nrw.commons.location.LatLng in project apps-android-commons by commons-app.

the class LatLngTests method testZeroZero.

@Test
public void testZeroZero() {
    LatLng place = new LatLng(0, 0, 0);
    String prettyString = place.getPrettyCoordinateString();
    Assert.assertThat(prettyString, is("0.0 N, 0.0 E"));
}
Also used : LatLng(fr.free.nrw.commons.location.LatLng) Test(org.junit.Test)

Example 19 with LatLng

use of fr.free.nrw.commons.location.LatLng in project apps-android-commons by commons-app.

the class LatLngTests method testRoundingAgain.

@Test
public void testRoundingAgain() {
    LatLng place = new LatLng(-0.000001, -0.999999, 0);
    String prettyString = place.getPrettyCoordinateString();
    Assert.assertThat(prettyString, is("0.0 S, 1.0 W"));
}
Also used : LatLng(fr.free.nrw.commons.location.LatLng) Test(org.junit.Test)

Example 20 with LatLng

use of fr.free.nrw.commons.location.LatLng in project apps-android-commons by commons-app.

the class NearbyInfoDialog method initUi.

private void initUi() {
    Bundle bundle = getArguments();
    placeTitle.setText(bundle.getString(ARG_TITLE));
    placeDescription.setText(bundle.getString(ARG_DESC));
    location = new LatLng(bundle.getDouble(ARG_LATITUDE), bundle.getDouble(ARG_LONGITUDE), 0);
    getArticleLink(bundle);
}
Also used : Bundle(android.os.Bundle) LatLng(fr.free.nrw.commons.location.LatLng)

Aggregations

LatLng (fr.free.nrw.commons.location.LatLng)22 Test (org.junit.Test)16 Bundle (android.os.Bundle)2 NearbyBaseMarker (fr.free.nrw.commons.nearby.NearbyBaseMarker)2 BufferedReader (java.io.BufferedReader)2 InputStreamReader (java.io.InputStreamReader)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 Uri (android.net.Uri)1 StrictMode (android.os.StrictMode)1 OnItemClick (butterknife.OnItemClick)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 Place (fr.free.nrw.commons.nearby.Place)1 UriDeserializer (fr.free.nrw.commons.utils.UriDeserializer)1 IOException (java.io.IOException)1 Type (java.lang.reflect.Type)1 URLConnection (java.net.URLConnection)1 List (java.util.List)1 Matcher (java.util.regex.Matcher)1