Ejemplo n.º 1
0
  /** 切换路线图标,刷新地图使其生效 注意: 起终点图标使用中心对齐. */
  public void changeRouteIcon(View v) {
    if (routeOverlay == null) {
      return;
    }
    if (useDefaultIcon) {
      ((Button) v).setText("自定义起终点图标");
      Toast.makeText(this, "将使用系统起终点图标", Toast.LENGTH_SHORT).show();

    } else {
      ((Button) v).setText("系统起终点图标");
      Toast.makeText(this, "将使用自定义起终点图标", Toast.LENGTH_SHORT).show();
    }
    useDefaultIcon = !useDefaultIcon;
    routeOverlay.removeFromMap();
    routeOverlay.addToMap();
  }
Ejemplo n.º 2
0
  private void addMarker2Map() {

    List<OverlayOptions> optionses = new ArrayList<OverlayOptions>();

    for (int i = 0; i < data.size(); i++) {

      MyPoiInfo info = data.get(i);
      BitmapDescriptor descriptor =
          BitmapDescriptorFactory.fromResource(marker_icon_ids[i % marker_icon_ids.length]);
      OverlayOptions oo =
          new MarkerOptions()
              .position(new LatLng(info.lat, info.lng))
              .icon(descriptor)
              .zIndex(i)
              .title(info.name);
      optionses.add(oo);
    }

    overlayManager = new MarkerOverLayManager(baiduMap, optionses);
    overlayManager.addToMap();
    // add maker click listener
    baiduMap.setOnMarkerClickListener(overlayManager);
    baiduMap.removeMarkerClickListener(drivingRouteOverlay);
  }