コード例 #1
0
  @Override
  public void onDraw(Canvas canvas, RectF latlonRect, RectF tilesRect, DrawSettings settings) {
    if (!Session.viewVehicles) {
      return;
    }
    mView.calculateTileRectangle(
        boundsRect,
        mView.getCenterPointX(),
        mView.getCenterPointY(),
        mView.getXTile(),
        mView.getYTile(),
        tileRect);

    /** Only draw visible Vehicles */
    for (int i = 0; i < locations.size(); i++) {
      VehicleLocation location = locations.get(i);
      if (location != null) {
        if (mView.isPointOnTheRotatedMap(location.getLatitude(), location.getLongitude())) {
          VehicleIcon icon = iconMap.get(location.getStatus());
          if (icon != null) {
            icon.draw(canvas, mView, location);
          }
        }
      }
    }
  }
コード例 #2
0
 @Override
 public void vehicleModified(VehicleLocation vehicle) {
   if (locations.contains(vehicle)) locations.remove(vehicle.getId());
   locations.add(vehicle);
 }