summaryrefslogtreecommitdiff
path: root/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java
blob: 34413fb979b19d865fd20c11b755148f65b54734 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.mapbox.mapboxgl.annotations;

import com.mapbox.mapboxgl.geometry.LatLng;


public class Marker extends Annotation {

    /**
     * Member fields are without access qualifiers
     * so that they can be directly set by MarkerOptions
     * from within the module.
     */
    float anchorU;
    float anchorV;
    boolean draggable;
    boolean flat;
    float infoWindowAnchorU;
    float infoWindowAnchorV;
    LatLng position;
    float rotation;
    String snippet;
    String title;

    private boolean infoWindowShown = false;

    public Marker() {}

    public boolean equals(Object other) {
        double lat = position.getLatitude();
        double lng = position.getLongitude();
        // TODO Implement equals
        return false;
    }

    public float getAlpha() {
        return alpha;
    }

    /**
     * NOTE: Google Maps Android API uses String for IDs.
     *
     * Internal C++ id is stored as unsigned int.
     *
     * @return the annotation id
     */
    public long getId() {
        return id;
    }

    public LatLng getPosition() {
        return position;
    }

    public float getRotation() {
        return rotation;
    }

    public String getSnippet() {
        return snippet;
    }

    public String getTitle() {
        return title;
    }

//    Method in Google Maps Android API
//    public int hashCode()

    public void hideInfoWindow() {
        //TODO hideInfoWindow
        infoWindowShown = false;
    }

    public boolean isDraggable() {
        return draggable;
    }

    public boolean isFlat() {
        return flat;
    }

    public boolean isInfoWindowShown () {
        return infoWindowShown;
    }

    void setAlpha(float alpha) {
        this.alpha = alpha;
    }

    void setDraggable(boolean draggable) {
        this.draggable = draggable;
    }

    void setFlat(boolean flat) {
        this.flat = flat;
    }

    // TODO: Implement this method of Google Maps Android API
//    void setIcon(BitmapDescriptor icon) {
//
//    }

    void setInfoWindowAnchor(float u, float v) {
        infoWindowAnchorU = u;
        infoWindowAnchorV = v;
    }

    void setPosition(LatLng latlng) {
        this.position = position;
    }

    void setRotation(float rotation) {
        this.rotation = rotation;
    }

    void setSnippet(String snippet) {
        this.snippet = snippet;
    }

    void setTitle(String title) {
        this.title = title;
    }

    void showInfoWindow() {
        infoWindowShown = true;
    }
}