Beispiel #1
0
  /** Utilisé pour le calcul des statistiques sur un polygone */
  protected double statPixel(Graphics g, int x, int y, ViewSimple v, HistItem onMouse) {

    // Mise à jour des stats
    double pix;
    PlanImage pi = (PlanImage) v.pref;
    Color col = g.getColor();

    if (!(plan instanceof PlanBG)
        && (y < 0
            || y >= pi.naxis2
            || x < 0
            || x >= pi.naxis1
            || (pi.fmt == PlanImage.JPEG || pi.pixelsOrigin == null && !pi.isBigImage()))) {
      pix = Double.NaN;
    } else {
      pix = pi.getPixelInDouble(x, y);
    }

    double zoom = v.getZoom();

    // Coloriage du pixel si concerné
    if (g != null && onMouse != null && onMouse.contains(pix)) {
      Point p = v.getViewCoord(x + 0.5, y + 0.5);
      if (p != null) {
        g.setColor(Color.cyan);
        int z1 = (int) zoom;
        if (z1 < 1) z1 = 2;
        g.fillRect(p.x - z1 / 2, p.y - z1 / 2, z1, z1);
      }
    }

    if (zoom > 2) {
      Point p = v.getViewCoord(x + 0.5, y + 0.5);
      if (Double.isNaN(pix)) g.setColor(Color.orange);
      else g.setColor(Color.red);
      if (zoom > 4) Util.fillCircle5(g, p.x, p.y);
      else Util.fillCircle2(g, p.x, p.y);
    }
    g.setColor(col);

    return statPixel(pix);
  }
Beispiel #2
0
  /** Utilisé pour le calcul des statistiques sur un polygone */
  protected double statPixel(
      Graphics g, double pix, double ra, double dec, ViewSimple v, HistItem onMouse) {

    Coord coo = new Coord(ra, dec);
    v.getProj().getXY(coo);
    Color col = g.getColor();

    // Détermination de la taille d'un pixel Healpix sur la vue.
    double pixelSize =
        v.rv.height / (v.getTailleDE() / ((PlanBG) v.pref).getPixelResolution()) / Math.sqrt(2);

    // Coloriage du pixel si concerné
    if (g != null && onMouse != null && onMouse.contains(pix)) {
      Point p = v.getViewCoord(coo.x, coo.y);
      if (p != null) {
        g.setColor(Color.cyan);
        int z1 = (int) pixelSize;
        if (z1 < 1) z1 = 2;
        Polygon pol =
            new Polygon(
                new int[] {p.x, p.x + z1, p.x, p.x - z1},
                new int[] {p.y - z1, p.y, p.y + z1, p.y},
                4);
        g.fillPolygon(pol);
      }
    }

    if (pixelSize > 4) {
      Point p = v.getViewCoord(coo.x, coo.y);
      if (Double.isNaN(pix)) g.setColor(Color.orange);
      else g.setColor(Color.red);
      if (pixelSize > 8) Util.fillCircle5(g, p.x, p.y);
      else Util.fillCircle2(g, p.x, p.y);
    }
    g.setColor(col);

    return statPixel(pix);
  }