Refine search
mapView.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == 1) { final GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); final StringBuilder msg = new StringBuilder(); new Thread(new Runnable() { public void run() { final double lon = p.getLongitudeE6() / 1E6; final double lat = p.getLatitudeE6() / 1E6; final double alt = getAltitude(lon, lat); msg.append("Lon: ");
private Route directions(final GeoPoint start, final GeoPoint dest) { Parser parser; //https://developers.google.com/maps/documentation/directions/#JSON <- get api String jsonURL = "http://maps.googleapis.com/maps/api/directions/json?"; final StringBuffer sBuf = new StringBuffer(jsonURL); sBuf.append("origin="); sBuf.append(start.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(start.getLongitudeE6()/1E6); sBuf.append("&destination="); sBuf.append(dest.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(dest.getLongitudeE6()/1E6); sBuf.append("&sensor=true&mode=driving"); parser = new GoogleParser(sBuf.toString()); Route r = parser.parse(); return r; }
selectedLatitude = geoPoint.getLatitudeE6(); selectedLongitude = geoPoint.getLongitudeE6(); return super.onTap(geoPoint,mapView); Projection projection = mapV.getProjection(); Point pt = new Point(); projection.toPixels(globalGeoPoint,pt);
public boolean onTouchEvent(MotionEvent event, MapView mapView) { if (event.getAction() == 1) { GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Toast.makeText(getBaseContext(), p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_SHORT).show(); mapView.getOverlays().add(new MarkerOverlay(p)); mapView.invalidate(); } return false; }
public boolean onTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) { GeoPoint centerGeoPoint = this.getMapCenter(); if (currentCenter == null || (currentCenter.getLatitudeE6() != centerGeoPoint.getLatitudeE6()) || (currentCenter.getLongitudeE6() != centerGeoPoint.getLongitudeE6()) ) { firePanEvent(currentCenter, this.getMapCenter()); } currentCenter = this.getMapCenter(); } return super.onTouchEvent(ev); }
public boolean onTouchEvent(MotionEvent e, MapView mapView) { if (e.getAction() == MotionEvent.ACTION_UP) { GeoPoint newCenter = mapView.getMapCenter(); int minLat, maxLat, minLng, maxLng; minLat = mapCenter.getLatitudeE6() - mapView.getLatitudeSpan()/2; maxLat = mapCenter.getLatitudeE6() + mapView.getLatitudeSpan()/2; minLng = mapCenter.getLongitudeE6() - mapView.getLongitudeSpan()/2; maxLng = mapCenter.getLongitudeE6() + mapView.getLongitudeSpan()/2; if (newCenter.getLatitudeE6() > maxLat || newCenter.getLatitudeE6() < minLat || newCenter.getLongitudeE6() > maxLng || newCenter.getLongitudeE6() < minLng) mapCenter = mapView.getMapCenter(); Location mapCenterLoc = new Location(providerName); mapCenterLoc.setLatitude(newCenter.getLatitudeE6()/1E6); mapCenterLoc.setLongitude(newCenter.getLongitudeE6()/1E6); Store[] newClosestStores = storeDB.getClosestStores(mapCenterLoc);
public GeoPoint toGeoPoint() { return new GeoPoint((int)(x*1.0E6), (int)(y*1.0E6)); }
@Override public GeoPoint fromPixels(int x, int y) { int lat = scalePixel(y, realView.getBottom(), -realMapView.getHeight(), mapCenter.getLatitudeE6(), latitudeSpan); int lng = scalePixel(x, realView.getLeft(), realMapView.getWidth(), mapCenter.getLongitudeE6(), longitudeSpan); return new GeoPoint(lat, lng); }
protected void backAndForth(MapView mv){ GeoPoint centreGpt = mv.getMapCenter(); int inLon = centreGpt.getLongitudeE6(); int inLat = centreGpt.getLatitudeE6(); Point p = new Point(); mv.getProjection().toPixels(centreGpt, p); GeoPoint backGpt = mv.getProjection().fromPixels(p.x, p.y); int outLat = backGpt.getLatitudeE6(); int outLon = backGpt.getLongitudeE6(); String res = "In lat " + inLat + " In lon " + inLon + " Out lat " + outLat + " Out lon " + outLon; Log.d("POS_TAG", res); }
class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean onTap(GeoPoint p, MapView mapView) { // TODO Auto-generated method stub mc= mapView.getController(); mc.animateTo(p); latitude=p.getLatitudeE6() / 1E6; longitude=p.getLongitudeE6() /1E6 ; Toast.makeText(Activity.this, p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_SHORT).show(); return true; } }
GeoPoint pEast = position.destinationPoint(width, 90.0f); GeoPoint pSouthEast = pEast.destinationPoint(height, -180.0f); int north = position.getLatitudeE6()*2 - pSouthEast.getLatitudeE6(); int west = position.getLongitudeE6()*2 - pEast.getLongitudeE6(); BoundingBoxE6 bb = new BoundingBoxE6(north, pEast.getLongitudeE6(), pSouthEast.getLatitudeE6(), west);
public void draw(Canvas canvas, MapView mapview, boolean shadow) { super.draw(canvas, mapview, shadow); if(mapview.getZoomLevel() > 1){ GeoPoint g0 = mapview.getProjection().fromPixels(0, height/2); GeoPoint g1 = mapview.getProjection().fromPixels(width, height/2); l0.setLatitude(g0.getLatitudeE6()/1E6); l0.setLongitude(g0.getLongitudeE6()/1E6); l1.setLatitude(g1.getLatitudeE6()/1E6); l1.setLongitude(g1.getLongitudeE6()/1E6); float d01=l0.distanceTo(l1); float d02=d01*scaleBarProportion;
@Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { Projection proj = mapView.getProjection(); GeoPoint loc = new GeoPoint(geo.getLat(), geo.getLng()); Point point = new Point(); proj.toPixels(loc, point); float rad = (float) (proj.metersToEquatorPixels(radius) * (1 / Math.cos(Math.toRadians(loc.getLatitudeE6() / 1000000)))); Paint circle = new Paint(); circle.setColor(colour); circle.setAlpha(30); circle.setAntiAlias(true); circle.setStyle(Style.FILL); canvas.drawCircle(point.x, point.y, rad, circle); super.draw(canvas, mapView, shadow); }
@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; } }
@Override @Implementation public boolean equals(Object o) { if (o == null) return false; o = ShadowExtractor.extract(o); if (o == null) return false; if (this == o) return true; if (getClass() != o.getClass()) return false; ShadowOverlayItem that = (ShadowOverlayItem) o; return Strings.equals(title, that.title) && Strings.equals(snippet, that.snippet) && geoPoint == null ? that.geoPoint == null : geoPoint.equals(that.geoPoint); }
public boolean onTouchEvent(MotionEvent event, MapView mapView) { if (event.getAction() == 1) { GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Toast.makeText(getBaseContext(), "lat and longtd is \n "+ p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_LONG).show(); // mapView.getOverlays().add(new MarkerOverlay(p)); mapView.invalidate(); } return true; }
Integer latspan = mapData.getLatitudeSpan(); Integer lonspan = mapData.getLongitudeSpan(); Integer maxLat = center.getLatitudeE6() + (latspan / 2); Integer maxLon = center.getLongitudeE6() + (lonspan / 2); Integer minLat = center.getLatitudeE6() - (latspan / 2); Integer minLon = center.getLongitudeE6() - (lonspan / 2); public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) {
public float getDistanceInMiles(GeoPoint p1, GeoPoint p2) { double lat1 = ((double)p1.getLatitudeE6()) / 1e6; double lng1 = ((double)p1.getLongitudeE6()) / 1e6; double lat2 = ((double)p2.getLatitudeE6()) / 1e6; double lng2 = ((double)p2.getLongitudeE6()) / 1e6; float [] dist = new float[1]; Location.distanceBetween(lat1, lng1, lat2, lng2, dist); return dist[0] * 0.000621371192f; }
public GeoPoint toGeoPoint() { return new GeoPoint((int)(x*1.0E6), (int)(y*1.0E6)); }
locationA.setLatitude(point.getLatitudeE6()); locationA.setLongitude(point.getLongitudeE6()); mapView.getProjection().toPixels(p, screenPts); canvas.drawBitmap(bmp, screenPts.x-bmp.getWidth()/2, screenPts.y-bmp.getHeight(), null);