summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/CoordinateBounds.java
blob: 4d3e94f78609e1a4019aa9d9c173cc7a0a23563b (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
package com.mapbox.mapboxsdk.geometry;

/**
 * A rectangular geograpical region defined by a south west {@link LatLng} and a north east {@link LatLng}.
 */
public class CoordinateBounds {

    private LatLng southWest;
    private LatLng northEast;

    public CoordinateBounds(LatLng southWest, LatLng northEast) {
        this.southWest = southWest;
        this.northEast = northEast;
    }

    public LatLng getSouthWest() {
        return southWest;
    }

    public void setSouthWest(LatLng southWest) {
        this.southWest = southWest;
    }

    public LatLng getNorthEast() {
        return northEast;
    }

    public void setNorthEast(LatLng northEast) {
        this.northEast = northEast;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        temp = southWest.hashCode();
        result = (int) (temp ^ (temp >>> 32));
        temp = northEast.hashCode();
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        return result;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o instanceof CoordinateBounds) {
            CoordinateBounds other = (CoordinateBounds) o;
            return getNorthEast().equals(other.getNorthEast())
                    && getSouthWest().equals(other.getSouthWest());
        }
        return false;
    }

    @Override
    public String toString() {
        return "CoordinateBounds [northEast[" + getNorthEast() + "], southWest[]" + getSouthWest() + "]";
    }
}