本文整理匯總了Java中com.google.android.maps.GeoPoint.getLatitudeE6方法的典型用法代碼示例。如果您正苦於以下問題:Java GeoPoint.getLatitudeE6方法的具體用法?Java GeoPoint.getLatitudeE6怎麽用?Java GeoPoint.getLatitudeE6使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.maps.GeoPoint
的用法示例。
在下文中一共展示了GeoPoint.getLatitudeE6方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
super.draw(canvas, mapView, shadow);
if (shadow || pointsToDraw == null || pointsToDraw.length == 0)
return;
for (GeoPoint p : pointsToDraw) {
// convert point to pixels
Point screenPts = new Point();
GeoPoint pointToDraw = new GeoPoint(p.getLatitudeE6(),
p.getLongitudeE6());
mapView.getProjection().toPixels(pointToDraw, screenPts);
int pointRadius = (int) mapView.getProjection()
.metersToEquatorPixels(5);
int dotRadius = (int) mapView.getProjection()
.metersToEquatorPixels(2);
canvas.drawCircle(screenPts.x, screenPts.y, pointRadius,
mPaintPoint);
canvas.drawCircle(screenPts.x, screenPts.y, pointRadius,
mPaintPointBorder);
canvas.drawCircle(screenPts.x, screenPts.y, dotRadius,
mPaintPointDot);
}
return;
}
示例2: Parking
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* constructor, fills all the fields
* @param point location
* @param title car park name
* @param id RDF id
* @param availabilityResource the resource where this car park's availability can be updated
* @param updateResource the resource where new properties for this car park should be sent
* @param available availability status
* @param timestamp timestamp (may be null) of the availability status
* @param availTTL time-to-live (in ms) for the availability information
* @param titleProperty the property that was used to get the name, will be ignored in presentation, is null when the server gave us no title
* @param unconfirmed whether the car park is submitted recently and not yet approved
*/
public Parking(GeoPoint point, String title, Uri id, String availabilityResource, String updateResource, Availability available, Long timestamp, long availTTL, Property titleProperty, boolean unconfirmed) {
super(point, title, id);
this.latitude = point.getLatitudeE6() / 1000000.;
this.longitude = point.getLongitudeE6() / 1000000.;
this.availabilityEffective = available;
this.availabilityReported = available;
this.availabilityTimestamp = timestamp;
this.availabilityResource = availabilityResource;
this.updateResource = updateResource;
this.titleProperty = titleProperty;
this.unconfirmed = unconfirmed;
this.hasAnyTitle = titleProperty != null;
checkIfOutdatedInfo();
this.lastAvailUpdate = System.currentTimeMillis();
this.nextAvailUpdate = this.lastAvailUpdate + availTTL;
// there might be race conditions if two parkings with the same ID are created in parallel, when the one that remains in the map would be under the other's ID object and could potentially disappear when that object is GCd
// but since parkings are only created in tiledownloaderthread in sequence, this is not an issue so there's no synchronization here
knownParkings.remove(id); // necessary so that the new entry created below uses this particular ID object
knownParkings.put(id, new WeakReference<Parking>(this));
}
示例3: onTouchEvent
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
final int action = event.getAction();
final int x = (int) event.getX();
final int y = (int) event.getY();
if (action == MotionEvent.ACTION_DOWN) {
long thisTime = System.currentTimeMillis();
if (thisTime - lastTouchTime < 250) {
lastTouchTime = -1;
GeoPoint geoPoint = mapView.getProjection().fromPixels(
(int) event.getX(), (int) event.getY());
double latitude = geoPoint.getLatitudeE6() / 1E6;
double longitude = geoPoint.getLongitudeE6() / 1E6;
Log.i(getClass().getSimpleName(), String.format(
"%d, %d >> %f, %f", x, y, latitude, longitude));
locationChanged(latitude, longitude);
return true;
} else {
lastTouchTime = thisTime;
}
}
return super.onTouchEvent(event, mapView);
}
示例4: onClick
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Starts a new search when the user clicks the search button.
*/
public void onClick(View view) {
// Get the search area
int latHalfSpan = mMapView.getLatitudeSpan() >> 1;
int longHalfSpan = mMapView.getLongitudeSpan() >> 1;
// Remember how the map was displayed so we can show it the same way later
GeoPoint center = mMapView.getMapCenter();
int zoom = mMapView.getZoomLevel();
int latitudeE6 = center.getLatitudeE6();
int longitudeE6 = center.getLongitudeE6();
Intent i = new Intent(this, ImageList.class);
i.putExtra(ImageManager.ZOOM_EXTRA, zoom);
i.putExtra(ImageManager.LATITUDE_E6_EXTRA, latitudeE6);
i.putExtra(ImageManager.LONGITUDE_E6_EXTRA, longitudeE6);
float minLong = ((float) (longitudeE6 - longHalfSpan)) / MILLION;
float maxLong = ((float) (longitudeE6 + longHalfSpan)) / MILLION;
float minLat = ((float) (latitudeE6 - latHalfSpan)) / MILLION;
float maxLat = ((float) (latitudeE6 + latHalfSpan)) / MILLION;
mImageManager.clear();
// Start downloading
mImageManager.load(minLong, maxLong, minLat, maxLat);
// Show results
startActivity(i);
}
示例5: distanceKm
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Computes the distance in kilometers between two points on Earth.
*
* @param p1 First point
* @param p2 Second point
* @return Distance between the two points in kilometers.
*/
public static double distanceKm(GeoPoint p1, GeoPoint p2) {
double lat1 = p1.getLatitudeE6() / (double)MILLION;
double lon1 = p1.getLongitudeE6() / (double)MILLION;
double lat2 = p2.getLatitudeE6() / (double)MILLION;
double lon2 = p2.getLongitudeE6() / (double)MILLION;
return distanceKm(lat1, lon1, lat2, lon2);
}
示例6: bearing
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Computes the bearing in degrees between two points on Earth.
*
* @param p1 First point
* @param p2 Second point
* @return Bearing between the two points in degrees. A value of 0 means due
* north.
*/
public static double bearing(GeoPoint p1, GeoPoint p2) {
double lat1 = p1.getLatitudeE6() / (double) MILLION;
double lon1 = p1.getLongitudeE6() / (double) MILLION;
double lat2 = p2.getLatitudeE6() / (double) MILLION;
double lon2 = p2.getLongitudeE6() / (double) MILLION;
return bearing(lat1, lon1, lat2, lon2);
}
示例7: distanceKm
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* * Computes the distance in kilometers between two points on Earth. * * @param
* p1 First point * @param p2 Second point * @return Distance between the
* two points in kilometers.
*/
public static double distanceKm(final GeoPoint p1, final GeoPoint p2) {
final double lat1 = p1.getLatitudeE6() / (double) GeoUtils.MILLION;
final double lon1 = p1.getLongitudeE6() / (double) GeoUtils.MILLION;
final double lat2 = p2.getLatitudeE6() / (double) GeoUtils.MILLION;
final double lon2 = p2.getLongitudeE6() / (double) GeoUtils.MILLION;
return GeoUtils.distanceKm(lat1, lon1, lat2, lon2);
}
示例8: bearing
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* * Computes the bearing in degrees between two points on Earth. * * @param
* p1 First point * @param p2 Second point * @return Bearing between the two
* points in degrees. A value of 0 means due * north.
*/
public static double bearing(final GeoPoint p1, final GeoPoint p2) {
final double lat1 = p1.getLatitudeE6() / (double) GeoUtils.MILLION;
final double lon1 = p1.getLongitudeE6() / (double) GeoUtils.MILLION;
final double lat2 = p2.getLatitudeE6() / (double) GeoUtils.MILLION;
final double lon2 = p2.getLongitudeE6() / (double) GeoUtils.MILLION;
return GeoUtils.bearing(lat1, lon1, lat2, lon2);
}
示例9: returnGeoPoint
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
private void returnGeoPoint(GeoPoint location) {
// Release memory used by the overlay image
Bitmap image = imageOverlay.getOverlayImage();
imageOverlay.setOverlayImage(null, 0, 0);
if (image != null && !image.isRecycled()) {
image.recycle();
}
System.gc();
// Save UI values for next invocation
new PreferenceHelper().saveValues();
// Return the selected GeoPoint to calling activity in the original Intent
Intent result = getIntent();
int[] geoPoint = new int[] {location.getLatitudeE6(), location.getLongitudeE6()};
result.putExtra(GEO_POINT_E6, geoPoint);
setResult(RESULT_OK, result);
finish();
}
示例10: computeAndReturnTiepoints
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
public void computeAndReturnTiepoints() {
if (imageToGeo == null) {
imageOverlay.computeImageWarp(mapView);
imageToGeo = imageOverlay.computeImageToGeoMatrix(mapView);
computeImageCornerGeoPoints();
}
int[] cornerGeoPoints = new int[8];
int i = 0;
for (GeoPoint gp : imageCornerGeoPoints) {
cornerGeoPoints[i++] = gp.getLatitudeE6();
cornerGeoPoints[i++] = gp.getLongitudeE6();
}
Intent result = getIntent();
result.putExtra(CORNER_GEO_POINTS, cornerGeoPoints);
setResult(RESULT_OK, result);
finish();
}
示例11: computeImageToGeoMatrix
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Resolves matrix mapping image points to geo points based on the MapView and
* previously computed image to screen matrix (in computeImageWarp()).
*/
public Matrix computeImageToGeoMatrix(MapView map) {
if (image == null) {
return new Matrix();
}
int w = image.getWidth();
int h = image.getHeight();
float[] imageCorners = new float[] {0, 0, w, 0, w, h, 0, h};
float[] geoCorners = new float[8];
imageMatrix.mapPoints(geoCorners, imageCorners);
for (int i = 0; i < 8; i += 2) {
int x = Math.round(geoCorners[i]);
int y = Math.round(geoCorners[i + 1]);
GeoPoint gp = map.getProjection().fromPixels(x, y);
geoCorners[i] = gp.getLongitudeE6() / 1E6f;
geoCorners[i + 1] = gp.getLatitudeE6() / 1E6f;
}
Matrix result = new Matrix();
if (!result.setPolyToPoly(imageCorners, 0, geoCorners, 0, 4)) {
Log.w(CustomMaps.LOG_TAG, "Failed to create image-to-geo matrix");
}
return result;
}
示例12: launchTiePointActivity
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Launches tie point activity to associate geo coordinates for a selected
* image point.
*
* @param tiepoint image point to be associated with geo coordinates
*/
private void launchTiePointActivity(TiePoint tiepoint) {
Intent assignGeoPoint = new Intent(this, TiePointActivity.class);
assignGeoPoint.putExtra(TiePointActivity.BITMAP_DATA, tiepoint.getPngData());
Point p = tiepoint.getOffset();
int[] selectedOffset = new int[] {p.x, p.y};
assignGeoPoint.putExtra(TiePointActivity.IMAGE_POINT, selectedOffset);
GeoPoint geoLocation = tiepoint.getGeoPoint();
if (geoLocation != null) {
int[] geopointE6 = new int[] {geoLocation.getLatitudeE6(), geoLocation.getLongitudeE6()};
assignGeoPoint.putExtra(TiePointActivity.GEO_POINT_E6, geopointE6);
}
assignGeoPoint.putExtra(TiePointActivity.RESTORE_SETTINGS, !firstTiepoint);
int index = tiepointAdapter.getPosition(tiepoint);
if (index < 0) {
Log.e(CustomMaps.LOG_TAG, "Given tiepoint was not found in tiepoint adapter!!!");
}
// store (index + 1), since value '0' means "not stored"
assignGeoPoint.putExtra(TIEPOINT_INDEX, index);
startActivityForResult(assignGeoPoint, SELECT_GEO_LOCATION);
}
示例13: launchPreviewActivity
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* Displays current image overlaid on Google maps
*/
private void launchPreviewActivity() {
if (tiepointAdapter.getCount() < 2) {
Toast.makeText(this, R.string.editor_need_two_points, Toast.LENGTH_LONG).show();
return;
}
Intent preview = new Intent(this, PreviewMapActivity.class);
preview.putExtra(PreviewMapActivity.BITMAP_FILE, bitmapFilename);
if (!tiepointAdapter.isEmpty()) {
int[] imagePointArray = new int[2 * tiepointAdapter.getCount()];
int[] geoPointArray = new int[2 * tiepointAdapter.getCount()];
for (int i = 0; i < tiepointAdapter.getCount(); i++) {
TiePoint tiepoint = tiepointAdapter.getItem(i);
Point p = tiepoint.getImagePoint();
imagePointArray[2 * i] = p.x;
imagePointArray[2 * i + 1] = p.y;
GeoPoint g = tiepoint.getGeoPoint();
geoPointArray[2 * i] = g.getLatitudeE6();
geoPointArray[2 * i + 1] = g.getLongitudeE6();
}
preview.putExtra(PreviewMapActivity.IMAGE_POINTS, imagePointArray);
preview.putExtra(PreviewMapActivity.TIEPOINTS, geoPointArray);
}
startActivityForResult(preview, PREVIEW);
}
示例14: onTouchEvent
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView)
{
if (event.getAction() == 1) {
GeoPoint geopoint = mapView.getProjection().fromPixels(
(int) event.getX(),
(int) event.getY());
// latitude
double lat = geopoint.getLatitudeE6() / 1E6;
// longitude
double lon = geopoint.getLongitudeE6() / 1E6;
//Toast.makeText(context, "Lat: " + lat + ", Lon: "+lon, Toast.LENGTH_SHORT).show();
}
return false;
}
示例15: geopoint2location
import com.google.android.maps.GeoPoint; //導入方法依賴的package包/類
/**
* GeoPointをLocationに変換
*/
public static Location geopoint2location( GeoPoint geoPoint )
{
float latitude = geoPoint.getLatitudeE6() / 1000000F;
float longitude = geoPoint.getLongitudeE6() / 1000000F;
Location location = locationFromCoordinate(latitude, longitude);
// @see http://stackoverflow.com/questions/531324/android-location-distanceto-not-working-correctly
// http://stackoverflow.com/questions/3472603/convert-geopoint-to-location
return location;
}