本文整理汇总了Java中com.mapbox.mapboxsdk.maps.OnMapReadyCallback类的典型用法代码示例。如果您正苦于以下问题:Java OnMapReadyCallback类的具体用法?Java OnMapReadyCallback怎么用?Java OnMapReadyCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnMapReadyCallback类属于com.mapbox.mapboxsdk.maps包,在下文中一共展示了OnMapReadyCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMapTracking
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
public void setMapTracking() {
final String trackingPref = getTrackingPreference();
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
TrackingSettings tracking = mapboxMap.getTrackingSettings();
switch(trackingPref)
{
case "position":
tracking.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
tracking.setMyBearingTrackingMode(MyBearingTracking.NONE);
break;
case "direction":
tracking.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
tracking.setMyBearingTrackingMode(MyBearingTracking.COMPASS);
break;
case "movement":
tracking.setMyBearingTrackingMode(MyLocationTracking.TRACKING_NONE);
tracking.setMyLocationTrackingMode(MyBearingTracking.GPS);
break;
}
}
});
}
示例2: recenterMap
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
public void recenterMap() {
final Location l = gps.getLocation();
// This shouldn't normally happen, but does on the Android emulator.
// It only occurs if recenterMap is called before we receive our first
// gps ping. We normally receive a ping within a second or two of app
// launch, but *not* if the emulator only pings on demand.
if( l == null )
return;
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// We'll maintain zoom level and tilt, just want to change position
CameraPosition old = mapboxMap.getCameraPosition();
CameraPosition pos = new CameraPosition.Builder()
.target(new LatLng(l.getLatitude(), l.getLongitude()))
.zoom(old.zoom)
.tilt(old.tilt)
.build();
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos));
}
});
}
示例3: recenterCamera
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
public void recenterCamera(View view) {
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
Location loc = gps.getLocation();
if( loc == null )
return;
CameraPosition position = new CameraPosition.Builder()
.target(new LatLng(loc.getLatitude(), loc.getLongitude()))
.zoom(17)
.bearing(0)
.build();
mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), 3000);
}
});
}
示例4: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the account manager
setContentView(R.layout.activity_simple_mapview);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
}
});
}
示例5: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_language_switch);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
}
});
}
示例6: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_mapbox_studio);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
}
});
}
示例7: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_default);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
DefaultStyleActivity.this.mapboxMap = mapboxMap;
// customize map with markers, polylines, etc
}
});
}
示例8: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_basic_simple_mapview);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
}
});
}
示例9: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_marathon_extrusion);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
MarathonExtrusionActivity.this.mapboxMap = mapboxMap;
// Add the marathon route source to the map
GeoJsonSource courseRouteGeoJson = new GeoJsonSource("coursedata", loadJsonFromAsset("marathon_route.geojson"));
mapboxMap.addSource(courseRouteGeoJson);
addExtrusionsLayerToMap();
}
});
}
示例10: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_extrusion_rotation);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap map) {
mapboxMap = map;
setupBuildingExtrusionPlugin();
}
});
}
示例11: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
setContentView(R.layout.activity_extrusion_light);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap map) {
mapboxMap = map;
setupBuildings();
setupLight();
}
});
}
示例12: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_create_hotspots_points);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
addClusteredGeoJsonSource(mapboxMap);
}
});
}
示例13: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_simplify_polyline);
mapView = (MapView) findViewById(R.id.mapview);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
new DrawGeoJson().execute();
}
});
}
示例14: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_mas_map_matching);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
new DrawGeoJson().execute();
}
});
}
示例15: onCreate
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_annotation_polygon);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
drawPolygon(mapboxMap);
}
});
}