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;
}
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)));
}
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));
}
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));
}
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));
}
Aggregations