/** * Modification de la position (absolue) * * @param x,y nouvelle position */ protected void setPosition(ViewSimple v, double x, double y) { // Positionnement d'un objet n'ayant que des positions x,y natives if (raj == Double.NaN) { this.x = x; this.y = v.getPRefDimension().height - y; } xv[v.n] = x; yv[v.n] = y; setCoord(v); }
/** * Projection de la source => calcul (x,y). * * @param proj la projection a utiliser */ protected void projection(ViewSimple v) { Projection proj; Coord c = new Coord(); // S'il n'y a pas de calibration, on prend les x,y natifs if ((plan != null && plan.hasXYorig) || !Projection.isOk(proj = v.getProj())) { xv[v.n] = x - 0.5; yv[v.n] = v.getPRefDimension().height - y + 0.5; // Sinon on calcule les xy en fonction des coord. ra,de } else { // Calcul initial d'un objet n'ayant des des positions xy natives if (raj == Double.NaN && xv[v.n] != 0) setCoord(v, proj); c.al = raj; c.del = dej; proj.getXY(c); xv[v.n] = c.x; yv[v.n] = c.y; } }
/** * Creation d'un objet graphique (methode generalisee) * * @param plan plan d'appartenance de la ligne * @param x,y position XY * @param raj,dej position RA,DEC * @param methode masque de bits pour indiquer quels sont les champs qu'on doit mettre a jour : XY * : la position (x,y) dans les coordonnees de l'image RADE : la position RA,DEC RADE_COMPUTE * : la position RA,DEC est deduite de XY en fonction de l'astrometrie courante XY_COMPUTE : * la position XY est deduite de RA,DEC en fonction de l'astrometrie courante * @param id identificateur associe a l'objet graphique */ protected Position( Plan plan, ViewSimple v, double x, double y, double raj, double dej, int methode, String id) { this.id = id; this.plan = plan; createCacheXYVP(); // On me passe un XY if ((methode & XY) != 0) { if (v != null) { xv[v.n] = x; yv[v.n] = y; } // Pas de calibration astrométrique associée ? if (v == null || v.pref == null || !Projection.isOk(v.getProj())) { this.x = x; this.y = (v == null ? y : v.getPRefDimension().height - y); } // Calcul des coordonnées correspondantes ? else if ((methode & RADE_COMPUTE) != 0) { setCoord(v); } } // On me passe des coord. if ((methode & RADE) != 0) { this.raj = raj; this.dej = dej; if ((methode & XY_COMPUTE) != 0) { try { projection(v); } catch (Exception e) { } } } }