当前位置: 首页>>代码示例>>Java>>正文


Java OnMapReadyCallback类代码示例

本文整理汇总了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;
            }
        }
    });
}
 
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:25,代码来源:MainActivity.java

示例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));
        }
    });
}
 
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:25,代码来源:MainActivity.java

示例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);
        }
    });
}
 
开发者ID:DaylightingSociety,项目名称:WhereAreTheEyes,代码行数:17,代码来源:MainActivity.java

示例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.
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:SimpleMapViewActivity.java

示例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;

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:LanguageSwitchActivity.java

示例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.

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:23,代码来源:MapboxStudioStyleActivity.java

示例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

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:24,代码来源:DefaultStyleActivity.java

示例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.

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:23,代码来源:SimpleMapViewActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:26,代码来源:MarathonExtrusionActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:RotationExtrusionActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:AdjustExtrusionLightActivity.java

示例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);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:21,代码来源:CreateHotspotsActivity.java

示例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();

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:24,代码来源:SimplifyPolylineActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:MapMatchingActivity.java

示例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);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:21,代码来源:DrawPolygonActivity.java


注:本文中的com.mapbox.mapboxsdk.maps.OnMapReadyCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。