@Override public com.car2go.maps.model.LatLng map(LatLng input) { return new com.car2go.maps.model.LatLng( input.latitude, input.longitude ); }
public LatLng createFromParcel(Parcel source) { return new LatLng(source); }
public static com.car2go.maps.model.LatLng convert(LatLng point) { return new com.car2go.maps.model.LatLng(point.latitude, point.longitude); }
/** * @return center of the region */ public LatLng getCenter() { // Implementation copied from original obfuscated version of LatLngBounds double var1 = (this.southwest.latitude + this.northeast.latitude) / 2.0D; double var3 = this.northeast.longitude; double var5 = this.southwest.longitude; double var7; if (var5 <= var3) { var7 = (var3 + var5) / 2.0D; } else { var7 = (var3 + 360.0D + var5) / 2.0D; } return new LatLng(var1, var7); }
/** * @return new instance of {@link LatLngBounds} * @throws IllegalStateException if less than 2 unique points were specified */ public LatLngBounds build() { if (Double.isNaN(southWestLongitude)) { throw new IllegalStateException("No included points"); } return new LatLngBounds( new LatLng(southWestLattitude, southWestLongitude), new LatLng(northEastLattitude, northEastLongitude) ); }
public static LatLng fromLocation(Location location) { return new LatLng(location.getLatitude(), location.getLongitude()); }
/** * Gets the current camera position. * * @return the camera position */ public CameraPosition currentCameraPosition() { MapStatus mapStatus = map.getMapStatus(); return new CameraPosition( new LatLng(mapStatus.target.latitude, mapStatus.target.longitude), mapStatus.zoom ); } }
/** * @return {@link LatLng} with same coordinates as {@link IGeoPoint} */ public static LatLng toLatLng(IGeoPoint geoPoint) { return new LatLng( geoPoint.getLatitude(), geoPoint.getLongitude() ); }
private CameraPosition currentCameraPosition() { final IGeoPoint center = map.getMapCenter(); final int zoomLevel = map.getZoomLevel(); return new CameraPosition( new LatLng(center.getLatitude(), center.getLongitude()), zoomLevel ); }
@Test public void testToGeoPoints() throws Exception { // Given final List<LatLng> input = asList( new LatLng(10d, 20d), new LatLng(30d, 40d) ); final List<GeoPoint> expected = asList( new GeoPoint(10d, 20d), new GeoPoint(30d, 40d) ); // When List<IGeoPoint> output = OsmUtils.toGeoPoints(input); // Then assertEquals(expected, output); }
@Test public void testInside() throws Exception { assertTrue(createFence().contains(new LatLng(0, 0))); assertTrue(createFence().contains(new LatLng(0.999, 0.999))); assertTrue(createFence().contains(new LatLng(-0.999, 0.999))); assertTrue(createFence().contains(new LatLng(-0.999, -0.999))); assertTrue(createFence().contains(new LatLng(0.999, -0.999))); }
@Test public void testToGeoPoint() throws Exception { // Given final LatLng input = new LatLng(10d, 20d); final GeoPoint expected = new GeoPoint(10d, 20d); // When IGeoPoint output = OsmUtils.toGeoPoint(input); // Then assertEquals(expected, output); }
@Test public void testMap() throws Exception { // Given LatLngMapper mapper = new LatLngMapper(); LatLng input = new LatLng(10, 10); // When com.google.android.gms.maps.model.LatLng output = mapper.map(input); // Then TestUtil.assertEquals(input, output); }
@Test public void testToLatLng() throws Exception { // Given final GeoPoint input = new GeoPoint(10d, 20d); final LatLng expected = new LatLng(10d, 20d); // When LatLng output = OsmUtils.toLatLng(input); // Then assertEquals(expected, output); }
@Test public void testMoveCameraToPosition() throws Exception { // Given CameraUpdateHandler handler = new CameraUpdateHandler(map); final LatLng center = new LatLng(10, 10); OsmCameraUpdate cameraUpdate = new OsmCameraUpdate.Builder() .center(center) .build(); // When handler.moveCamera(cameraUpdate); // Then verify(mapController).setCenter(eq(toGeoPoint(center))); verifyNoMoreInteractions(mapController); }
@Test public void testAnimateCamera() throws Exception { // Given CameraUpdateHandler handler = spy(new CameraUpdateHandler(map)); final LatLng center = new LatLng(10, 10); OsmCameraUpdate cameraUpdate = new OsmCameraUpdate.Builder() .center(center) .build(); // When handler.animateCamera(cameraUpdate); // Then verify(handler).moveCamera(refEq(cameraUpdate)); }