public FakeMapView(MapView parent, double scale) {
    super(
        null, null,
        null); // TODO MapView constructor contains registering listeners and other code, that
    // probably shouldn't be called in fake map view
    this.parent = parent;
    this.scale = scale;

    ProjectionBounds parent_bounds = parent.getProjectionBounds();
    max_east_west = parent_bounds.maxEast - parent_bounds.minEast;
  }
  public void setProjectionBounds(ProjectionBounds bounds) {
    view_bounds = bounds;

    if (bounds.maxEast - bounds.minEast > max_east_west) {
      max_east_west = bounds.maxEast - bounds.minEast;

      /* We need to set the parent MapView's bounds (i.e.
       * zoom level) to the same as ours max possible
       * bounds to avoid WMSLayer thinking we're zoomed
       * out more than we are or it'll pop up an annoying
       * "requested area is too large" popup.
       */
      EastNorth parent_center = parent.getCenter();
      parent.zoomTo(
          new ProjectionBounds(
              new EastNorth(parent_center.east() - max_east_west / 2, parent_center.north()),
              new EastNorth(parent_center.east() + max_east_west / 2, parent_center.north())));

      /* Request again because NavigatableContent adds
       * a border just to be sure.
       */
      ProjectionBounds new_bounds = parent.getProjectionBounds();
      max_east_west = new_bounds.maxEast - new_bounds.minEast;
    }

    Point vmin = getPoint(bounds.getMin());
    Point vmax = getPoint(bounds.getMax());
    int w = vmax.x + 1;
    int h = vmin.y + 1;

    if (w <= ground_width && h <= ground_height) {
      graphics.setClip(0, 0, w, h);
      return;
    }

    if (w > ground_width) ground_width = w;
    if (h > ground_height) ground_height = h;

    ground_image = new BufferedImage(ground_width, ground_height, BufferedImage.TYPE_INT_RGB);
    graphics = ground_image.createGraphics();
    graphics.setClip(0, 0, w, h);
  }