home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / awt / geom / AreaIterator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.4 KB  |  92 lines

  1. package java.awt.geom;
  2.  
  3. import java.util.NoSuchElementException;
  4. import java.util.Vector;
  5. import sun.awt.geom.Curve;
  6.  
  7. class AreaIterator implements PathIterator {
  8.    private AffineTransform transform;
  9.    private Vector curves;
  10.    private int index;
  11.    private Curve prevcurve;
  12.    private Curve thiscurve;
  13.  
  14.    public AreaIterator(Vector var1, AffineTransform var2) {
  15.       this.curves = var1;
  16.       this.transform = var2;
  17.       if (var1.size() >= 1) {
  18.          this.thiscurve = (Curve)var1.get(0);
  19.       }
  20.  
  21.    }
  22.  
  23.    public int getWindingRule() {
  24.       return 1;
  25.    }
  26.  
  27.    public boolean isDone() {
  28.       return this.prevcurve == null && this.thiscurve == null;
  29.    }
  30.  
  31.    public void next() {
  32.       if (this.prevcurve != null) {
  33.          this.prevcurve = null;
  34.       } else {
  35.          this.prevcurve = this.thiscurve;
  36.          ++this.index;
  37.          if (this.index < this.curves.size()) {
  38.             this.thiscurve = (Curve)this.curves.get(this.index);
  39.             if (this.thiscurve.getOrder() != 0 && this.prevcurve.getX1() == this.thiscurve.getX0() && this.prevcurve.getY1() == this.thiscurve.getY0()) {
  40.                this.prevcurve = null;
  41.             }
  42.          } else {
  43.             this.thiscurve = null;
  44.          }
  45.       }
  46.  
  47.    }
  48.  
  49.    public int currentSegment(float[] var1) {
  50.       double[] var2 = new double[6];
  51.       int var3 = this.currentSegment(var2);
  52.       int var4 = var3 == 4 ? 0 : (var3 == 2 ? 2 : (var3 == 3 ? 3 : 1));
  53.  
  54.       for(int var5 = 0; var5 < var4 * 2; ++var5) {
  55.          var1[var5] = (float)var2[var5];
  56.       }
  57.  
  58.       return var3;
  59.    }
  60.  
  61.    public int currentSegment(double[] var1) {
  62.       int var2;
  63.       int var3;
  64.       if (this.prevcurve != null) {
  65.          if (this.thiscurve == null || this.thiscurve.getOrder() == 0) {
  66.             return 4;
  67.          }
  68.  
  69.          var1[0] = this.thiscurve.getX0();
  70.          var1[1] = this.thiscurve.getY0();
  71.          var2 = 1;
  72.          var3 = 1;
  73.       } else {
  74.          if (this.thiscurve == null) {
  75.             throw new NoSuchElementException("area iterator out of bounds");
  76.          }
  77.  
  78.          var2 = this.thiscurve.getSegment(var1);
  79.          var3 = this.thiscurve.getOrder();
  80.          if (var3 == 0) {
  81.             var3 = 1;
  82.          }
  83.       }
  84.  
  85.       if (this.transform != null) {
  86.          this.transform.transform(var1, 0, var1, 0, var3);
  87.       }
  88.  
  89.       return var2;
  90.    }
  91. }
  92.