Android Open Source - WhatsUp Geo Location






From Project

Back to project page WhatsUp.

License

The source code is released under:

GNU General Public License

If you think the Android project WhatsUp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package nu.placebo.whatsup.model;
/* w  w w  .j a v a2s  .  c  o m*/
import org.json.JSONException;
import org.json.JSONObject;

import com.google.android.maps.GeoPoint;

/**
 * This class represents a "compressed" version of an Annotation. It holds basic data like
 * where on the map the annotation is, its title and who wrote it. Basically, everything
 * needed for simply showing annotations on the map view.
 */
public class GeoLocation {
  private GeoPoint gp;
  private String title;
  private int id;

  public GeoLocation(int id, int microLat, int microLong, String title) {
    this.gp = new GeoPoint(microLat, microLong);
    this.title = title;
    this.id = id;
  }

  public GeoLocation(GeoLocation gl) {
    this.gp = gl.gp;
    this.title = gl.title;
    this.id = gl.id;
  }

  public GeoLocation(int id, double latitude, double longitude, String title) {
    this(id, (int) (latitude * 1000000 + 0.5),
        (int) (longitude * 1000000 + 0.5), title);

  }

  public GeoLocation(JSONObject j) throws JSONException {
    this(j.getInt("nid"), j.getDouble("latitude"),
        j.getDouble("longitude"), j.getString("title"));
  }

  /**
   * @return the id
   */
  public int getId() {
    return id;
  }

  /**
   * @return the location
   */
  public GeoPoint getLocation() {
    return gp;
  }

  /**
   * @param gp
   *            the gp to set
   */
  public void setLocation(GeoPoint gp) {
    this.gp = gp;
  }

  /**
   * @return the title
   */
  public String getTitle() {
    return title;
  }

  /**
   * @param title
   *            the title to set
   */
  public void setTitle(String title) {
    this.title = title;
  }
  @Override
  public boolean equals(Object o) {
    if(o != null && o instanceof GeoLocation) {
      GeoLocation other = (GeoLocation) o;
      return this.getId() == other.getId() &&
           this.getTitle().equals(other.getTitle()) &&
           this.getLocation().equals(other.getLocation());
    }
    return false;
  }
  
  @Override
  public int hashCode() {
    int result = 0;
    result += gp.hashCode();
    result += id;
    result += title.hashCode();
    return result;
  }
}




Java Source Code List

nu.placebo.whatsup.activity.AnnotationActivity.java
nu.placebo.whatsup.activity.CreateAnnotationActivity.java
nu.placebo.whatsup.activity.CreateCommentActivity.java
nu.placebo.whatsup.activity.ListViewActivity.java
nu.placebo.whatsup.activity.LogInActivity.java
nu.placebo.whatsup.activity.LoginRegTabActivity.java
nu.placebo.whatsup.activity.MapViewActivity.java
nu.placebo.whatsup.activity.Marker.java
nu.placebo.whatsup.activity.MenuHelper.java
nu.placebo.whatsup.activity.PositionPickerActivity.java
nu.placebo.whatsup.activity.RefPointActivity.java
nu.placebo.whatsup.activity.RegisterActivity.java
nu.placebo.whatsup.android.os.AsyncTask.java
nu.placebo.whatsup.balloon.BalloonItemizedOverlay.java
nu.placebo.whatsup.balloon.BalloonOverlayView.java
nu.placebo.whatsup.constants.Constants.java
nu.placebo.whatsup.ctrl.SessionHandler.java
nu.placebo.whatsup.datahandling.DataProvider.java
nu.placebo.whatsup.datahandling.DataReturnListener.java
nu.placebo.whatsup.datahandling.DataReturn.java
nu.placebo.whatsup.datahandling.DatabaseConnectionLayer.java
nu.placebo.whatsup.datahandling.DatabaseHelper.java
nu.placebo.whatsup.model.Annotation.java
nu.placebo.whatsup.model.Comment.java
nu.placebo.whatsup.model.ExtendedOverlayItem.java
nu.placebo.whatsup.model.GeoLocation.java
nu.placebo.whatsup.model.ListMarker.java
nu.placebo.whatsup.model.ReferencePoint.java
nu.placebo.whatsup.model.SessionInfo.java
nu.placebo.whatsup.network.AbstractNetworkOperation.java
nu.placebo.whatsup.network.Action.java
nu.placebo.whatsup.network.AnnotationCreate.java
nu.placebo.whatsup.network.AnnotationRetrieve.java
nu.placebo.whatsup.network.CommentCreate.java
nu.placebo.whatsup.network.GeoLocationsRetrieve.java
nu.placebo.whatsup.network.Login.java
nu.placebo.whatsup.network.NetworkCalls.java
nu.placebo.whatsup.network.NetworkOperationListener.java
nu.placebo.whatsup.network.NetworkOperation.java
nu.placebo.whatsup.network.NetworkTask.java
nu.placebo.whatsup.network.OperationResult.java
nu.placebo.whatsup.network.RegisterOperation.java
nu.placebo.whatsup.network.SessionTest.java
nu.placebo.whatsup.util.GeoPointUtil.java
nu.placebo.whatsup.util.Geodetics.java
nu.placebo.whatsup.util.ValidationUtil.java
nu.placebo.whatsuptest.TestStarter.java
nu.placebo.whatsuptest.activitytest.AnnotationActivityTest.java
nu.placebo.whatsuptest.activitytest.ListViewActivityTest.java
nu.placebo.whatsuptest.activitytest.MapViewActivityTest.java
nu.placebo.whatsuptest.networktest.NetworkTest.java
nu.placebo.whatsuptest.utiltest.GeoPointUtilTest.java
nu.placebo.whatsuptest.utiltest.GeodeticsTest.java
nu.placebo.whatsuptest.utiltest.ValidationTest.java