Esempio n. 1
0
  public void paintReticle(final TableItem item) {
    if (cursor != null) {
      mapShell.removePaintListener(cursor);
    }
    cursor =
        new PaintListener() {
          public void paintControl(PaintEvent pe) {
            int x = 0, y = 0;
            float xF = 0.0F, yF = 0.0F;

            Entity entity = dp.entityList.get(new Integer(item.getText(0)));

            xF = RadarConsts.WINDOW_BUFFER + dp.maxX - entity.posXAxis;
            yF = entity.posYAxis - (dp.minY - RadarConsts.WINDOW_BUFFER);

            x = (int) (xF * boundsXScale);
            y = (int) (yF * boundsYScale);

            pe.gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));

            pe.gc.drawRectangle(
                x - (RadarConsts.POINT_RADIUS * 2),
                y - (RadarConsts.POINT_RADIUS * 2),
                (RadarConsts.POINT_RADIUS * 4) - 1,
                (RadarConsts.POINT_RADIUS * 4));

            pe.gc.drawLine(
                x - (RadarConsts.POINT_RADIUS * 3), y, x + (RadarConsts.POINT_RADIUS * 3) - 1, y);
            pe.gc.drawLine(
                x, y - (RadarConsts.POINT_RADIUS * 3), x, y + (RadarConsts.POINT_RADIUS * 3) - 1);
          }
        };
    mapShell.addPaintListener(cursor);
    mapShell.redraw();
  }