Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GeoFenceFeature.java « geofence « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f838761ea6738713039fe05ba0d4e2993d5882bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.mapswithme.maps.geofence;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.mapswithme.maps.bookmarks.data.FeatureId;

/**
 * Represents CampaignFeature from core.
 */
public class GeoFenceFeature implements Parcelable
{
  @NonNull
  private final FeatureId mFeatureId;
  private final double latitude;
  private final double longitude;

  public GeoFenceFeature(@NonNull FeatureId featureId, double latitude, double longitude)
  {
    mFeatureId = featureId;
    this.latitude = latitude;
    this.longitude = longitude;
  }

  public double getLatitude()
  {
    return latitude;
  }

  public double getLongitude()
  {
    return longitude;
  }

  @NonNull
  public FeatureId getId()
  {
    return mFeatureId;
  }

  @Override
  public int describeContents()
  {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags)
  {
    dest.writeParcelable(this.mFeatureId, flags);
    dest.writeDouble(this.latitude);
    dest.writeDouble(this.longitude);
  }

  protected GeoFenceFeature(Parcel in)
  {
    this.mFeatureId = in.readParcelable(FeatureId.class.getClassLoader());
    this.latitude = in.readDouble();
    this.longitude = in.readDouble();
  }

  public static final Creator<GeoFenceFeature> CREATOR = new Creator<GeoFenceFeature>()
  {
    @Override
    public GeoFenceFeature createFromParcel(Parcel source)
    {
      return new GeoFenceFeature(source);
    }

    @Override
    public GeoFenceFeature[] newArray(int size)
    {
      return new GeoFenceFeature[size];
    }
  };

  @Override
  public String toString()
  {
    final StringBuilder sb = new StringBuilder("GeoFenceFeature{");
    sb.append("mFeatureId=").append(mFeatureId);
    sb.append(", latitude=").append(latitude);
    sb.append(", longitude=").append(longitude);
    sb.append('}');
    return sb.toString();
  }

  @Override
  public boolean equals(Object o)
  {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    GeoFenceFeature that = (GeoFenceFeature) o;

    return mFeatureId.equals(that.mFeatureId);
  }

  @Override
  public int hashCode()
  {
    return mFeatureId.hashCode();
  }
}