Tabnine Logo
GeoPoint
Code IndexAdd Tabnine to your IDE (free)

How to use
GeoPoint
in
com.google.android.maps

Best Java code snippets using com.google.android.maps.GeoPoint (Showing top 20 results out of 315)

Refine searchRefine arrow

  • MotionEvent
  • MapView
origin: stackoverflow.com

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: ");
origin: stackoverflow.com

 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;
}
origin: stackoverflow.com

selectedLatitude = geoPoint.getLatitudeE6(); 
selectedLongitude = geoPoint.getLongitudeE6();
return super.onTap(geoPoint,mapView);
  Projection projection = mapV.getProjection();
  Point pt = new Point();
  projection.toPixels(globalGeoPoint,pt);
origin: stackoverflow.com

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;
   }
origin: stackoverflow.com

 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);
}
origin: stackoverflow.com

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);
origin: ybonnel/TransportsRennes

public GeoPoint toGeoPoint() {
  return new GeoPoint((int)(x*1.0E6), (int)(y*1.0E6));
}

origin: org.robolectric/shadows-maps

@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);
}
origin: stackoverflow.com

 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);
}
origin: stackoverflow.com

 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;

    }
}
origin: stackoverflow.com

 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);
origin: stackoverflow.com

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;
origin: stackoverflow.com

 @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);

}
origin: org.robolectric/shadows-maps

 @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;
 }
}
origin: org.robolectric/shadows-maps

@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);
}
origin: stackoverflow.com

 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;
}
origin: stackoverflow.com

  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) {
origin: stackoverflow.com

 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;
}
origin: ybonnel/TransportsRennes

public GeoPoint toGeoPoint() {
  return new GeoPoint((int)(x*1.0E6), (int)(y*1.0E6));
}

origin: stackoverflow.com

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);
com.google.android.mapsGeoPoint

Most used methods

  • <init>
  • getLatitudeE6
  • getLongitudeE6
  • destinationPoint
  • equals
  • hashCode

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Permission (java.security)
    Legacy security code; do not use.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now