Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see es.axios.udig.ui.georeferencing.internal.ui.MarkPresenter#draw()
   */
  public void draw() {

    assert this.context != null;

    if (hide) return;

    ViewportGraphics graphics = context.getGraphics();

    graphics.setColor(createColor(getMarkModel().hashCode()));

    if (point != null) {
      final int halfsize = EXTENT_SIZE / 2;

      this.extent =
          new Rectangle(
              (int) (point.getX() - halfsize),
              (int) (point.getY() - halfsize),
              EXTENT_SIZE,
              EXTENT_SIZE);

      graphics.fillOval(extent.x, extent.y, extent.width, extent.height);
      Rectangle2D stringBounds = graphics.getStringBounds(String.valueOf(getMarkModel().getID()));
      graphics.drawString(
          String.valueOf(getMarkModel().getID()),
          (int) point.getX(),
          (int) (point.getY() + stringBounds.getHeight()),
          ViewportGraphics.ALIGN_MIDDLE,
          ViewportGraphics.ALIGN_BOTTOM);
    }
  }