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


Java MapboxMap类代码示例

本文整理汇总了Java中com.mapbox.mapboxsdk.maps.MapboxMap的典型用法代码示例。如果您正苦于以下问题:Java MapboxMap类的具体用法?Java MapboxMap怎么用?Java MapboxMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapboxMap类属于com.mapbox.mapboxsdk.maps包,在下文中一共展示了MapboxMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMapReady

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
/**
 * Fired after the map is ready, this is our cue to finish
 * setting up the rest of the plugins / location engine.
 * <p>
 * Also, we check for launch data (coordinates or route).
 *
 * @param mapboxMap used for route, camera, and location UI
 * @since 0.6.0
 */
@Override
public void onMapReady(MapboxMap mapboxMap) {
  map = mapboxMap;
  map.setPadding(0, 0, 0, summaryBottomSheet.getHeight());
  ThemeSwitcher.setMapStyle(getContext(), map, new MapboxMap.OnStyleLoadedListener() {
    @Override
    public void onStyleLoaded(String style) {
      initRoute();
      initLocationLayer();
      initLifecycleObservers();
      initNavigationPresenter();
      initClickListeners();
      map.addOnScrollListener(NavigationView.this);
      onNavigationReadyCallback.onNavigationReady();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:27,代码来源:NavigationView.java

示例2: updateMapSourceFromFeatureCollection

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
/**
 * Takes a {@link FeatureCollection} and creates a map GeoJson source using the sourceId also
 * provided.
 *
 * @param mapboxMap  that the current mapView is using
 * @param collection the feature collection to be added to the map style
 * @param sourceId   the source's id for identifying it when adding layers
 * @since 0.8.0
 */
public static void updateMapSourceFromFeatureCollection(@NonNull MapboxMap mapboxMap,
                                                        @Nullable FeatureCollection collection,
                                                        @NonNull String sourceId) {
  if (collection == null) {
    collection = FeatureCollection.fromFeatures(new Feature[] {});
  }

  GeoJsonSource source = mapboxMap.getSourceAs(sourceId);
  if (source == null) {
    GeoJsonOptions routeGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16);
    GeoJsonSource routeSource = new GeoJsonSource(sourceId, collection, routeGeoJsonOptions);
    mapboxMap.addSource(routeSource);
  } else {
    source.setGeoJson(collection);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:26,代码来源:MapUtils.java

示例3: onMapChangeLocationLayerRedrawn

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void onMapChangeLocationLayerRedrawn() throws Exception {
  executeLocationLayerTest(new LocationLayerPluginAction.onPerformLocationLayerAction() {
    @Override
    public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
                                      UiController uiController) {
      locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
      mapboxMap.setStyleUrl(Style.SATELLITE);
      uiController.loopMainThreadForAtLeast(500);
      assertEquals(locationLayerPlugin.getLocationLayerMode(), LocationLayerMode.TRACKING);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
        .equals(Property.VISIBLE));
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:18,代码来源:LocationLayerTest.java

示例4: onMapReady

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Override
public void onMapReady(MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;

  locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
  locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);

  navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap);

  mapboxMap.setOnMapClickListener(this);
  Snackbar.make(mapView, "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();

  locationEngine = new MockLocationEngine(1000, 50, true);
  mapboxMap.setLocationSource(locationEngine);

  newOrigin();
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:18,代码来源:MockNavigationActivity.java

示例5: onCameraIdle

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
/**
 * Might re-cluster.
 */
@Override
public void onCameraIdle() {
  Timber.d("OnCamerIdle");
  if (mRenderer instanceof MapboxMap.OnCameraIdleListener) {
    ((MapboxMap.OnCameraIdleListener) mRenderer).onCameraIdle();
  }

  // Don't re-compute clusters if the map has just been panned/tilted/rotated.
  CameraPosition position = mMap.getCameraPosition();
  if (mPreviousCameraPosition != null && mPreviousCameraPosition.zoom == position.zoom) {
    return;
  }
  mPreviousCameraPosition = mMap.getCameraPosition();
  Timber.e("OnCluster");
  cluster();
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:20,代码来源:ClusterManagerPlugin.java

示例6: onMapReady

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Override
public void onMapReady(final MapboxMap mapboxMap) {
  LocationEngine locationEngine = new LostLocationEngine(this);
  locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine);
  locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
  locationLayerPlugin.addCompassListener(new CompassListener() {
    @Override
    public void onCompassChanged(float userHeading) {
      CameraPosition cameraPosition = new CameraPosition.Builder().bearing(userHeading).build();
      mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    }

    @Override
    public void onCompassAccuracyChange(int compassStatus) {
      System.out.println(compassStatus);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:19,代码来源:CompassListenerActivity.java

示例7: onMapReady

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Override
public void onMapReady(MapboxMap mapboxMap) {
    this.mapboxMap = mapboxMap;
    this.mapboxMap.setOnInfoWindowClickListener(new MapboxMap.OnInfoWindowClickListener() {
        @Override
        public boolean onInfoWindowClick(@NonNull Marker marker) {
            for (Acopio acopio: acopios) {
                if (acopio.getNombre().equals(marker.getTitle())) {
                    Intent intent = new Intent(context, ActivityAcopio.class);
                    intent.putExtra("acopio", acopio);
                    startActivity(intent);
                    break;
                }
            }
            return true;
        }
    });
    getAcopios();
}
 
开发者ID:faviotorres,项目名称:AcopioMX,代码行数:20,代码来源:ActivityHome.java

示例8: locationBearingLayersAdded

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void locationBearingLayersAdded() throws Exception {
  executeLocationLayerTest(new LocationLayerPluginAction.onPerformLocationLayerAction() {
    @Override
    public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
                                      UiController uiController) {
      locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
      assertTrue(mapboxMap.getLayer(ACCURACY_LAYER) != null);
      assertTrue(mapboxMap.getLayer(BACKGROUND_LAYER) != null);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
      assertTrue(mapboxMap.getLayer(BEARING_LAYER) != null);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:15,代码来源:LocationLayerTest.java

示例9: lineCapSecondaryBaseLayer

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void lineCapSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Secondary.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:10,代码来源:TrafficPluginTest.java

示例10: animateCameraToPosition

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
/**
 * Will animate the {@link MapboxMap} to the given {@link CameraPosition}
 * with a 2 second duration.
 * <p>
 * If a user interacts with the {@link MapboxMap} while the animation is in progress,
 * the animation will be cancelled.  So it's important to add the {@link ProgressChangeListener}
 * in both onCancel() and onFinish() scenarios.
 *
 * @param position to which the camera should animate
 */
private void animateCameraToPosition(CameraPosition position) {
  mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), 2000,
    new MapboxMap.CancelableCallback() {
      @Override
      public void onCancel() {
        navigation.addProgressChangeListener(NavigationCamera.this);
      }

      @Override
      public void onFinish() {
        navigation.addProgressChangeListener(NavigationCamera.this);
      }
    });
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:25,代码来源:NavigationCamera.java

示例11: lineJoinLocalBaseLayer

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void lineJoinLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Local.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:10,代码来源:TrafficPluginTest.java

示例12: lineWidthFunctionMotorwayCaseLayer

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void lineWidthFunctionMotorwayCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(MotorWay.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getFunction());
      assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
      assertEquals(4, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:16,代码来源:TrafficPluginTest.java

示例13: lineWidthFunctionLocalBaseLayer

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void lineWidthFunctionLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(Local.BASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getFunction());
      assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
      assertEquals(2, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:16,代码来源:TrafficPluginTest.java

示例14: lineCapLocalBaseLayer

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void lineCapLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Local.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:10,代码来源:TrafficPluginTest.java

示例15: reattachSecondaryCaseWithLoadNewStyle

import com.mapbox.mapboxsdk.maps.MapboxMap; //导入依赖的package包/类
@Test
public void reattachSecondaryCaseWithLoadNewStyle() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      mapboxMap.setStyleUrl(Style.DARK);
      controller.loopMainThreadForAtLeast(500);
      assertTrue(mapboxMap.getLayer(Secondary.CASE_LAYER_ID) != null);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:12,代码来源:TrafficPluginTest.java


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