Back to index

wims  3.65+svn20090927
pointlibre.java
Go to the documentation of this file.
00001 // pointlibre.java - 28/11/98
00002 
00003 package geo ;
00004 
00005 import java.awt.Graphics ;
00006 
00012 public class pointlibre extends pt
00013 { public int Xp, Yp ;
00014   public boolean deplace ;
00015 
00021   public pointlibre (int X, int Y, String Nom, Repere R)
00022   { super (X, Y, Nom, R) ; Xp = X ; Yp = Y ; deplace = false ; }
00023 
00029   public pointlibre (double x, double y, String Nom, Repere R)
00030   { super (x, y, Nom, R) ; Xp = X ; Yp = Y ; deplace = false; }
00031 
00037   public boolean zone (int X, int Y)
00038   { if (deplace = (X >=  this.X - 2) && (X <= this.X + 2) && (Y >= this.Y - 2) && (Y <= this.Y + 2))
00039     Xp = this.X ; Yp = this.Y ;
00040     return deplace ; }
00041 
00048   public void bouge (int X, int Y)
00049   { if (deplace && R.affiche (X, Y)) { this.X = X ; x = R.Abs (X) ;
00050                                        this.Y = Y ; y = R.Ord (Y) ;
00051                                      }
00052   }
00053 
00059   public void efface (Graphics g)
00060   { if (defini && deplace)
00061       { g.fillRect (Xp - 2, Yp - 2, 5, 5) ;
00062         if (Nom.length () != 0) g.drawString (Nom, Xp + 3, Yp - 3) ;
00063         Xp = X ; Yp = Y ;
00064       }
00065   }
00066 
00071  public void point ()
00072  { majXY () ; Xp = X ; Yp = Y ; }
00073 
00074 }
00075