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


Java PolylineOptions类代码示例

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


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

示例1: drawRoute

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawRoute(DirectionsRoute route) {
  List<LatLng> points = new ArrayList<>();
  List<Point> coords = LineString.fromPolyline(route.geometry(), Constants.PRECISION_6).coordinates();

  for (Point point : coords) {
    points.add(new LatLng(point.latitude(), point.longitude()));
  }

  if (!points.isEmpty()) {

    if (polyline != null) {
      mapboxMap.removePolyline(polyline);
    }

    // Draw polyline on map
    polyline = mapboxMap.addPolyline(new PolylineOptions()
      .addAll(points)
      .color(Color.parseColor("#4264fb"))
      .width(5));
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:22,代码来源:RerouteActivity.java

示例2: onMyLocationChange

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
@Override
public void onMyLocationChange(@Nullable Location location) {
    LatLng pos = new LatLng(location.getLatitude(), location.getLongitude());
    if (mLine != null) {
        mMap.removePolyline(mLine);
        mMap.animateCamera(CameraUpdateFactory.newLatLng(pos));
    } else {
        //zoom first time
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 15));
    }


    mLine = mMap.addPolyline(new PolylineOptions()
            .add(pos)
            .add(mKaabePos)
            .color(Color.parseColor("#3bb2d0"))
            .width(3));


}
 
开发者ID:metinkale38,项目名称:prayer-times-android,代码行数:21,代码来源:FragMap.java

示例3: setPolylineColor

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void setPolylineColor(PolylineOptions options, int lastType) {
    switch (lastType) {
        case IN_VEHICLE:
            options.color(RED);
            break;
        case ON_BICYCLE:
            options.color(BLUE);
            break;
        case WALKING:
            options.color(YELLOW);
            break;
        case RUNNING:
            options.color(GREEN);
            break;
    }
}
 
开发者ID:ralphpina,项目名称:ActivityMapper,代码行数:17,代码来源:MapFragment.java

示例4: buildEditionPolygon

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void buildEditionPolygon() {
    // Current selected poiNodeRef
    PoiNodeRef currentPoiNodeRef = wayMarkerSelected.getPoiNodeRef();

    // Polyline related to this poiNodeRef
    PolylineOptions currentPolyline = polylinesWays.get(currentPoiNodeRef.getId());

    // Item of the poiNodeRef in the polilyne
    int indexOfPoiNodeRef = currentPolyline.getPoints().indexOf(new LatLng(currentPoiNodeRef.getLatitude(), currentPoiNodeRef.getLongitude()));

    LatLng previousPoint = currentPolyline.getPoints().get(indexOfPoiNodeRef == 0 ? indexOfPoiNodeRef + 1 : indexOfPoiNodeRef - 1);
    LatLng nextPoint =
            currentPolyline.getPoints().get(indexOfPoiNodeRef == currentPolyline.getPoints().size() - 1 ? indexOfPoiNodeRef - 1 : indexOfPoiNodeRef + 1);
    editionPolyline = new PolylineOptions().add(previousPoint, currentPolyline.getPoints().get(indexOfPoiNodeRef), nextPoint)
            .alpha(0.4f)
            .width(1.8f)
            .color(Color.parseColor("#F57C00"));

    mapboxMap.addPolyline(editionPolyline);
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:21,代码来源:MapFragment.java

示例5: drawRoute

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawRoute(DirectionsRoute route) {
  // Convert LineString coordinates into LatLng[]
  LineString lineString = LineString.fromPolyline(route.getGeometry(), PRECISION_6);
  List<Position> coordinates = lineString.getCoordinates();
  LatLng[] points = new LatLng[coordinates.size()];
  for (int i = 0; i < coordinates.size(); i++) {
    points[i] = new LatLng(
      coordinates.get(i).getLatitude(),
      coordinates.get(i).getLongitude());
  }

  // Draw Points on MapView
  map.addPolyline(new PolylineOptions()
    .add(points)
    .color(Color.parseColor("#009688"))
    .width(5));
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:18,代码来源:DirectionsActivity.java

示例6: drawSimplify

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawSimplify(List<Position> points) {

    Position[] before = new Position[points.size()];
    for (int i = 0; i < points.size(); i++) {
      before[i] = points.get(i);
    }

    Position[] after = PolylineUtils.simplify(before, 0.001);

    LatLng[] result = new LatLng[after.length];
    for (int i = 0; i < after.length; i++) {
      result[i] = new LatLng(after[i].getLatitude(), after[i].getLongitude());
    }

    map.addPolyline(new PolylineOptions()
      .add(result)
      .color(Color.parseColor("#3bb2d0"))
      .width(4));
  }
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:20,代码来源:SimplifyPolylineActivity.java

示例7: drawRoute

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawRoute(DirectionsRoute route, String profile) {
    // Convert LineString coordinates into LatLng[]
    LineString lineString = LineString.fromPolyline(route.getGeometry(), Constants.OSRM_PRECISION_V5);
    List<Position> coordinates = lineString.getCoordinates();
    LatLng[] points = new LatLng[coordinates.size()];
    for (int i = 0; i < coordinates.size(); i++) {
        points[i] = new LatLng(
                coordinates.get(i).getLatitude(),
                coordinates.get(i).getLongitude());
    }

    // Draw Points on MapView
    int color;
    if (profile.equals(DirectionsCriteria.PROFILE_CYCLING)) {
        color = ContextCompat.getColor(mActivity, R.color.polyBike);
    } else if (profile.equals(DirectionsCriteria.PROFILE_DRIVING)) {
        color = ContextCompat.getColor(mActivity, R.color.polyCar);
    } else {
        color = ContextCompat.getColor(mActivity, R.color.polyWalk);
    }

    if (routePolyLine != null) {
        map.removePolyline(routePolyLine);
    }

    routePolyLine = map.addPolyline(new PolylineOptions()
            .add(points)
            .color(color)
            .width(5));
}
 
开发者ID:opticod,项目名称:Moto-Navigator,代码行数:31,代码来源:MapFragment.java

示例8: onCameraChangeUpdatePolyline

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
public void onCameraChangeUpdatePolyline() {
    if (editionPolyline != null) {
        List<LatLng> points = editionPolyline.getPoints();
        points.set(1, mapboxMap.getCameraPosition().target);

        removePolyline(editionPolyline);
        editionPolyline = new PolylineOptions().addAll(points).alpha(0.4f).width(1.8f).color(Color.parseColor("#F57C00"));
        mapboxMap.addPolyline(editionPolyline);
    }
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:11,代码来源:MapFragment.java

示例9: clearAllNodeRef

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void clearAllNodeRef() {
    for (WayMarkerOptions locationMarker : markersNodeRef.values()) {
        removeWayMarker(locationMarker);
    }
    for (PolylineOptions polylineOptions : polylinesWays.values()) {
        removePolyline(polylineOptions);
    }
    markersNodeRef.clear();
    polylinesWays.clear();
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:11,代码来源:MapFragment.java

示例10: drawBeforeSimplify

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawBeforeSimplify(List<Position> points) {

    LatLng[] pointsArray = new LatLng[points.size()];
    for (int i = 0; i < points.size(); i++) {
      pointsArray[i] = new LatLng(points.get(i).getLatitude(), points.get(i).getLongitude());
    }

    map.addPolyline(new PolylineOptions()
      .add(pointsArray)
      .color(Color.parseColor("#8a8acb"))
      .width(4));
  }
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:13,代码来源:SimplifyPolylineActivity.java

示例11: drawBeforeMapMatching

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawBeforeMapMatching(List<Position> points) {
  LatLng[] pointsArray = new LatLng[points.size()];
  for (int i = 0; i < points.size(); i++) {
    pointsArray[i] = new LatLng(points.get(i).getLatitude(), points.get(i).getLongitude());
  }

  map.addPolyline(new PolylineOptions()
          .add(pointsArray)
          .color(Color.parseColor("#8a8acb"))
          .alpha(0.65f)
          .width(4));
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:13,代码来源:MapMatchingActivity.java

示例12: drawOptimizedRoute

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
private void drawOptimizedRoute(DirectionsRoute route) {
  // Remove old polyline
  if (optimizedPolyline != null) {
    mapboxMap.removePolyline(optimizedPolyline);
  }
  // Draw points on MapView
  LatLng[] pointsToDraw = convertLineStringToLatLng(route);
  optimizedPolyline = mapboxMap.addPolyline(new PolylineOptions()
    .add(pointsToDraw)
    .color(Color.parseColor(TEAL_COLOR))
    .width(POLYLINE_WIDTH));
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:13,代码来源:OptimizationActivity.java

示例13: onPostExecute

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
@Override
protected void onPostExecute(List<LatLng> points) {
  super.onPostExecute(points);

  if (points.size() > 0) {

    // Draw polyline on map
    mapboxMap.addPolyline(new PolylineOptions()
      .addAll(points)
      .color(Color.parseColor("#3bb2d0"))
      .width(2));
  }
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:14,代码来源:DrawGeojsonLineActivity.java

示例14: Way

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
public Way(Poi poi) {
    this.poi = poi;
    polylineOptions = new PolylineOptions().alpha(0.8f).width(1.8f).color(Color.parseColor("#1565C0"));
    poiNodeRefs = new HashSet<>();
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:6,代码来源:Way.java

示例15: getPolylineOptions

import com.mapbox.mapboxsdk.annotations.PolylineOptions; //导入依赖的package包/类
public PolylineOptions getPolylineOptions() {
    return polylineOptions;
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:4,代码来源:Way.java


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