本文整理汇总了Java中com.mapbox.mapboxsdk.constants.MyLocationTracking类的典型用法代码示例。如果您正苦于以下问题:Java MyLocationTracking类的具体用法?Java MyLocationTracking怎么用?Java MyLocationTracking使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyLocationTracking类属于com.mapbox.mapboxsdk.constants包,在下文中一共展示了MyLocationTracking类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setMapTracking
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的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;
}
}
});
}
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:25,代码来源:MainActivity.java
示例2: onLocationUpdate
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的package包/类
@Override
public void onLocationUpdate(VenueLocation location) {
currentLocation = location;
runOnUiThread(new Runnable() {
@Override
public void run() {
mMapView.setMyLocation(currentLocation);
String currentindex = getBuildingFloorIndex(currentFloor);
String locationindex = currentLocation.getBuilding()+"/"+currentLocation.getFloor();
if (!currentindex.equals(locationindex) && mMapView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_FOLLOW) {
showBuildingFloor(currentFloor);
}
}
});
// Send new location to geofencing engine
venueGeofencingManager.sendNewLocation(location);
}
开发者ID:geolys,项目名称:geolys-android-sdk,代码行数:22,代码来源:VenueActivity.java
示例3: newOrigin
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的package包/类
private void newOrigin() {
if (mapboxMap != null) {
LatLng latLng = Utils.getRandomLatLng(new double[] {-77.1825, 38.7825, -76.9790, 39.0157});
((MockLocationEngine) locationEngine).setLastLocation(
Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())
);
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12));
mapboxMap.setMyLocationEnabled(true);
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
}
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:12,代码来源:MockNavigationActivity.java
示例4: initializeMap
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的package包/类
private void initializeMap() {
mapView.setStyleUrl("asset://mapstyle.json");
mapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
mapView.setLogoVisibility(View.GONE);
mapView.setAttributionVisibility(View.GONE);
mapView.setOnMyLocationChangeListener(new MapView.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(@Nullable Location location) {
makeUseOfNewLocation(location);
if (!firstLocationLock) {
goToUserLocation();
firstLocationLock = true;
}
}
});
mapView.setOnScrollListener(new MapView.OnScrollListener() {
@Override
public void onScroll() {
fetchNearbyPages();
}
});
mapView.setOnMarkerClickListener(new MapView.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(@NonNull Marker marker) {
NearbyPage page = findNearbyPageFromMarker(marker);
if (page != null) {
PageTitle title = new PageTitle(page.getTitle(), site, page.getThumblUrl());
((PageActivity) getActivity()).showLinkPreview(title, HistoryEntry.SOURCE_NEARBY, page.getLocation());
return true;
} else {
return false;
}
}
});
}
开发者ID:gnosygnu,项目名称:xowa_android,代码行数:39,代码来源:NearbyFragment.java
示例5: enableLocationTracking
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的package包/类
private void enableLocationTracking() {
// Enable location and bearing tracking
map.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
map.getTrackingSettings().setMyBearingTrackingMode(MyBearingTracking.COMPASS);
}
开发者ID:jingsam,项目名称:mapbox-go,代码行数:6,代码来源:MainActivity.java
示例6: initializeMap
import com.mapbox.mapboxsdk.constants.MyLocationTracking; //导入依赖的package包/类
private void initializeMap() {
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
if (!isAdded()) {
return;
}
NearbyFragment.this.mapboxMap = mapboxMap;
enableUserLocationMarker();
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
mapboxMap.setOnScrollListener(new MapboxMap.OnScrollListener() {
@Override
public void onScroll() {
fetchNearbyPages();
}
});
mapboxMap.setOnMarkerClickListener(new MapboxMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(@NonNull Marker marker) {
NearbyPage page = findNearbyPageFromMarker(marker);
if (page != null) {
PageTitle title = new PageTitle(page.getTitle(), lastResult.getWiki(), page.getThumbUrl());
onLoadPage(title, HistoryEntry.SOURCE_NEARBY, page.getLocation());
return true;
} else {
return false;
}
}
});
if (lastCameraPos != null) {
mapboxMap.setCameraPosition(lastCameraPos);
} else {
goToUserLocationOrPromptPermissions();
}
if (lastResult != null) {
showNearbyPages(lastResult);
}
}
});
}
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:44,代码来源:NearbyFragment.java
注:本文中的com.mapbox.mapboxsdk.constants.MyLocationTracking类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论