summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java
blob: e49126531a25036aeac6f7686fb267b7faefda93 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
package com.mapbox.mapboxsdk.maps;

import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.RectF;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.mapbox.geojson.Feature;
import com.mapbox.geojson.Geometry;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.Polygon;
import com.mapbox.mapboxsdk.annotations.Polyline;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.geometry.ProjectedMeters;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.sources.Source;

import java.util.List;

interface NativeMap {

  //
  // Lifecycle API
  //

  void resizeView(int width, int height);

  void onLowMemory();

  void destroy();

  boolean isDestroyed();

  //
  // Camera API
  //

  void jumpTo(@NonNull LatLng center, double zoom, double pitch, double bearing);

  void easeTo(@NonNull LatLng center, double zoom, double bearing, double pitch, long duration,
              boolean easingInterpolator);

  void flyTo(@NonNull LatLng center, double zoom, double bearing, double pitch, long duration);

  void moveBy(double deltaX, double deltaY, long duration);

  @NonNull
  CameraPosition getCameraPosition();

  CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds bounds, int[] padding, double bearing, double pitch);

  CameraPosition getCameraForGeometry(@NonNull Geometry geometry, int[] padding, double bearing, double pitch);

  void resetPosition();

  void setLatLng(@NonNull LatLng latLng, long duration);

  LatLng getLatLng();

  void setLatLngBounds(@NonNull LatLngBounds latLngBounds);

  void setVisibleCoordinateBounds(@NonNull LatLng[] coordinates, @NonNull RectF padding,
                                  double direction, long duration);

  void setPitch(double pitch, long duration);

  double getPitch();

  void setZoom(double zoom, @NonNull PointF focalPoint, long duration);

  double getZoom();

  void setMinZoom(double zoom);

  double getMinZoom();

  void setMaxZoom(double zoom);

  double getMaxZoom();

  void resetZoom();

  void rotateBy(double sx, double sy, double ex, double ey, long duration);

  void setBearing(double degrees, long duration);

  void setBearing(double degrees, double fx, double fy, long duration);

  double getBearing();

  void resetNorth();

  void cancelTransitions();

  //
  // Style API
  //

  void setStyleUrl(String url);

  @NonNull
  String getStyleUrl();

  void setStyleJson(String newStyleJson);

  @NonNull
  String getStyleJson();

  boolean isFullyLoaded();

  void addLayer(@NonNull Layer layer);

  void addLayerBelow(@NonNull Layer layer, @NonNull String below);

  void addLayerAbove(@NonNull Layer layer, @NonNull String above);

  void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index);

  @NonNull
  List<Layer> getLayers();

  Layer getLayer(String layerId);

  boolean removeLayer(@NonNull String layerId);

  boolean removeLayer(@NonNull Layer layer);

  boolean removeLayerAt(@IntRange(from = 0) int index);

  void addSource(@NonNull Source source);

  @NonNull
  List<Source> getSources();

  Source getSource(@NonNull String sourceId);

  boolean removeSource(@NonNull String sourceId);

  boolean removeSource(@NonNull Source source);

  void setTransitionOptions(@NonNull TransitionOptions transitionOptions);

  @NonNull
  TransitionOptions getTransitionOptions();

  void addImages(Image[] images);

  Bitmap getImage(String name);

  void removeImage(String name);

  Light getLight();

  //
  // Content padding API
  //

  void setContentPadding(float[] padding);

  float[] getContentPadding();

  //
  // Query API
  //

  @NonNull
  List<Feature> queryRenderedFeatures(@NonNull PointF coordinates,
                                      @Nullable String[] layerIds,
                                      @Nullable Expression filter);

  @NonNull
  List<Feature> queryRenderedFeatures(@NonNull RectF coordinates,
                                      @Nullable String[] layerIds,
                                      @Nullable Expression filter);

  //
  // Projection API
  //

  double getMetersPerPixelAtLatitude(double lat);

  ProjectedMeters projectedMetersForLatLng(@NonNull LatLng latLng);

  LatLng latLngForProjectedMeters(@NonNull ProjectedMeters projectedMeters);

  @NonNull
  PointF pixelForLatLng(@NonNull LatLng latLng);

  LatLng latLngForPixel(@NonNull PointF pixel);

  //
  // Utils API
  //

  void setOnFpsChangedListener(@NonNull MapboxMap.OnFpsChangedListener listener);

  void setDebug(boolean debug);

  boolean getDebug();

  void cycleDebugOptions();

  void setReachability(boolean status);

  void setApiBaseUrl(String baseUrl);

  void setPrefetchTiles(boolean enable);

  boolean getPrefetchTiles();

  void setGestureInProgress(boolean inProgress);

  float getPixelRatio();

  //
  // Deprecated Annotations API
  //

  long addMarker(Marker marker);

  @NonNull
  long[] addMarkers(@NonNull List<Marker> markers);

  long addPolyline(Polyline polyline);

  @NonNull
  long[] addPolylines(@NonNull List<Polyline> polylines);

  long addPolygon(Polygon polygon);

  @NonNull
  long[] addPolygons(@NonNull List<Polygon> polygons);

  void updateMarker(@NonNull Marker marker);

  void updatePolygon(@NonNull Polygon polygon);

  void updatePolyline(@NonNull Polyline polyline);

  void removeAnnotation(long id);

  void removeAnnotations(long[] ids);

  double getTopOffsetPixelsForAnnotationSymbol(String symbolName);

  void addAnnotationIcon(String symbol, int width, int height, float scale, byte[] pixels);

  void removeAnnotationIcon(String symbol);

  @NonNull
  long[] queryPointAnnotations(RectF rectF);

  @NonNull
  long[] queryShapeAnnotations(RectF rectF);

}