summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
blob: 6828a6e6d42af898c27b7dbbeb1012a1c97297c1 (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
package com.mapbox.mapboxsdk.maps;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;

import com.mapbox.mapboxsdk.camera.CameraPosition;

/**
 * Builder for composing {@link MapboxMap} objects. These options can be used when adding a
 * map to your application programmatically (as opposed to via XML). If you are using a MapFragment,
 * you can pass these options in using the static factory method newInstance(MapboxMapOptions).
 * If you are using a MapView, you can pass these options in using the constructor MapView(Context, MapboxMapOptions).
 */
public class MapboxMapOptions implements Parcelable {

    public MapboxMap mMapboxMap;

    public MapboxMapOptions(MapboxMap mapboxMap) {
        mMapboxMap = mapboxMap;
    }

    public MapboxMapOptions(Parcel in) {
        throw new UnsupportedOperationException();
    }

    public MapboxMapOptions camera(CameraPosition camera) {
        mMapboxMap.setCameraPosition(camera);
        return this;
    }

    public CameraPosition getCamera() {
        return mMapboxMap.getCameraPosition();
    }

    public MapboxMapOptions compassEnabled(boolean enabled) {
        mMapboxMap.setCompassEnabled(enabled);
        return this;
    }

    public boolean getCompassEnabled() {
        return mMapboxMap.isCompassEnabled();
    }

    public MapboxMapOptions rotateEnabled(boolean rotateEnabled) {
        mMapboxMap.setRotateEnabled(rotateEnabled);
        return this;
    }

    public MapboxMapOptions rotateGesturesEnabled(boolean enabled) {
        mMapboxMap.setRotateEnabled(enabled);
        return this;
    }

    public boolean getRotateGesturesEnabled() {
        return mMapboxMap.isRotateEnabled();
    }

    public MapboxMapOptions scrollGesturesEnabled(boolean enabled) {
        mMapboxMap.setScrollEnabled(enabled);
        return this;
    }

    public boolean getScrollGesturesEnabled() {
        return mMapboxMap.isScrollEnabled();
    }

    public MapboxMapOptions tiltGesturesEnabled(boolean enabled) {
        mMapboxMap.setTiltEnabled(enabled);
        return this;
    }

    public boolean getTiltGesturesEnabled() {
        return mMapboxMap.isTiltEnabled();
    }

    public MapboxMapOptions zoomControlsEnabled(boolean enabled) {
        mMapboxMap.setZoomControlsEnabled(enabled);
        return this;
    }

    public boolean getZoomControlsEnabled() {
        return mMapboxMap.isZoomControlsEnabled();
    }

    public boolean getZoomGesturesEnabled() {
        return mMapboxMap.isZoomEnabled();
    }

    public MapboxMapOptions createFromAttributes(Context context, AttributeSet attrs) {
        throw new UnsupportedOperationException();
    }

    public static final Parcelable.Creator<MapboxMapOptions> CREATOR = new Parcelable.Creator<MapboxMapOptions>() {
        public MapboxMapOptions createFromParcel(Parcel in) {
            return new MapboxMapOptions(in);
        }

        public MapboxMapOptions[] newArray(int size) {
            return new MapboxMapOptions[size];
        }
    };

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

    @Override
    public void writeToParcel(Parcel out, int flags) {
        throw new UnsupportedOperationException();
    }
}