Search in sources :

Example 1 with GeoPoint

use of com.google.android.maps.GeoPoint in project robolectric by robolectric.

the class ShadowOverlayItem method hashCode.

@Override
@Implementation
public int hashCode() {
    int result = 13;
    result = title == null ? result : 19 * result + title.hashCode();
    result = snippet == null ? result : 19 * result + snippet.hashCode();
    result = geoPoint == null ? result : 19 * result + geoPoint.hashCode();
    return result;
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) Implementation(org.robolectric.annotation.Implementation)

Example 2 with GeoPoint

use of com.google.android.maps.GeoPoint in project robolectric by robolectric.

the class ShadowMapViewTest method dispatchTouchEvents_shouldDragMapByCorrectAmountInMultipleSteps.

// todo 2.0-cleanup
@Ignore("not yet working in 2.0, sorry :-(")
@Test
public void dispatchTouchEvents_shouldDragMapByCorrectAmountInMultipleSteps() throws Exception {
    initMapForDrag();
    dispatchTouchEvent(MotionEvent.ACTION_DOWN, 10, 10);
    dispatchTouchEvent(MotionEvent.ACTION_MOVE, 11, 11);
    dispatchTouchEvent(MotionEvent.ACTION_MOVE, 12, 12);
    dispatchTouchEvent(MotionEvent.ACTION_UP, 11, 11);
    assertThat(mapView.getMapCenter()).isEqualTo(new GeoPoint(toE6(26), toE6(24)));
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with GeoPoint

use of com.google.android.maps.GeoPoint in project robolectric by robolectric.

the class ShadowMapViewTest method getProjection_toPixels_shouldPerformCorrectTranslations.

@Test
public void getProjection_toPixels_shouldPerformCorrectTranslations() throws Exception {
    int centerLat = 11;
    int centerLng = 16;
    int spanLat = 20;
    int spanLng = 30;
    mapView.getController().setCenter(new GeoPoint(toE6(centerLat), toE6(centerLng)));
    mapView.getController().zoomToSpan(toE6(spanLat), toE6(spanLng));
    mapView.layout(50, 60, 650, 460);
    assertThat(mapView.getProjection().toPixels(new GeoPoint(toE6(21), toE6(1)), null)).isEqualTo(new Point(50, 60));
    assertThat(mapView.getProjection().toPixels(new GeoPoint(toE6(11), toE6(16)), null)).isEqualTo(new Point(350, 260));
    assertThat(mapView.getProjection().toPixels(new GeoPoint(toE6(1), toE6(31)), null)).isEqualTo(new Point(650, 460));
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) Point(android.graphics.Point) GeoPoint(com.google.android.maps.GeoPoint) Point(android.graphics.Point) GeoPoint(com.google.android.maps.GeoPoint) Test(org.junit.Test)

Example 4 with GeoPoint

use of com.google.android.maps.GeoPoint in project cw-andtutorials by commonsguy.

the class StatusMap method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.status_map);
    map = (MapView) findViewById(R.id.map);
    map.getController().setZoom(17);
    double lat = getIntent().getDoubleExtra(Patchy.LATITUDE, 0);
    double lon = getIntent().getDoubleExtra(Patchy.LONGITUDE, 0);
    GeoPoint status = new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0));
    map.getController().setCenter(status);
    map.setBuiltInZoomControls(true);
    String statusText = getIntent().getStringExtra(Patchy.STATUS_TEXT);
    Drawable marker = getResources().getDrawable(R.drawable.marker);
    marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
    map.getOverlays().add(new StatusOverlay(marker, status, statusText));
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) Drawable(android.graphics.drawable.Drawable)

Example 5 with GeoPoint

use of com.google.android.maps.GeoPoint in project robolectric by robolectric.

the class ShadowMapViewTest method initMapForDrag.

private void initMapForDrag() {
    mapView = new MapView(RuntimeEnvironment.application, "");
    mapView.layout(0, 0, 50, 50);
    mapView.getController().setCenter(new GeoPoint(toE6(25), toE6(25)));
    mapView.getController().zoomToSpan(toE6(50), toE6(50));
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) MapView(com.google.android.maps.MapView)

Aggregations

GeoPoint (com.google.android.maps.GeoPoint)11 Test (org.junit.Test)5 Point (android.graphics.Point)4 Ignore (org.junit.Ignore)2 Implementation (org.robolectric.annotation.Implementation)2 Paint (android.graphics.Paint)1 Drawable (android.graphics.drawable.Drawable)1 AccuracyCircleOverlay (com.github.ignition.samples.location.overlays.AccuracyCircleOverlay)1 MapView (com.google.android.maps.MapView)1 Overlay (com.google.android.maps.Overlay)1 Projection (com.google.android.maps.Projection)1