summaryrefslogtreecommitdiff
path: root/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java
blob: f87b91c98877aa43e908e8a0e55a8f4948b7445f (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
package com.mapbox.mapboxgl.annotations;

import com.mapbox.mapboxgl.geometry.LatLng;

import java.util.List;

public class PolylineOptions {

    private Polyline polyline;

    public PolylineOptions() {
        polyline = new Polyline();
    }

    public PolylineOptions alpha(float alpha) {
        polyline.alpha = alpha;
        return this;
    }

    public PolylineOptions add(LatLng point) {
        polyline.points.add(point);
        return this;
    }

    public PolylineOptions add(LatLng... points) {
        for (LatLng point : points) {
            add(point);
        }
        return this;
    }

    public PolylineOptions addAll(Iterable<LatLng> points) {
        for (LatLng point : points) {
            add(point);
        }
        return this;
    }

    public PolylineOptions color(int color) {
        polyline.color = color;
        return this;
    }

    // TODO: Implement geodesic of Google Maps Android API
//    public PolylineOptions geodesic (boolean geodesic) {
//
//    }

    public int getColor() {
        return polyline.color;
    }

    public List<LatLng> getPoints() {
        return polyline.points;
    }

    public Polyline getPolyline() {
        return polyline;
    }

    public float getWidth() {
        return polyline.width;
    }

    // TODO: Implement getZIndex of Google Maps Android API
//    public float getZIndex() {
//
//    }

    // TODO: Implement isGeodesic of Google Maps Android API
//    public boolean isGeodesic() {
//
//    }

    public boolean isVisible() {
        return polyline.visible;
    }

    public PolylineOptions visible(boolean visible) {
        polyline.visible = visible;
        return this;
    }

    /**
     * Sets the width of the polyline.
     *
     * @param width in pixels
     * @return
     */
    public PolylineOptions width(float width) {
        polyline.width = width;
        return this;
    }

    // TODO: Implement writeToParcel of Google Maps Android API
//    public void writeToParcel(Parcel out, int flags) {
//
//    }

    // TODO: Implement zIndex of Google Maps Android API
//    public PolylineOptions zIndex(float zIndex) {
//
//        return this;
//    }

}