View Javadoc

1   // Copyright 2002, FreeHEP.
2   package org.freehep.graphicsio.emf.gdi;
3   
4   import java.awt.Point;
5   import java.io.IOException;
6   
7   import org.freehep.graphicsio.emf.EMFInputStream;
8   import org.freehep.graphicsio.emf.EMFOutputStream;
9   import org.freehep.graphicsio.emf.EMFTag;
10  
11  /**
12   * AngleArc TAG.
13   * 
14   * @author Mark Donszelmann
15   * @version $Id: AngleArc.java 10367 2007-01-22 19:26:48Z duns $
16   */
17  public class AngleArc extends EMFTag {
18  
19      private Point center;
20  
21      private int radius;
22  
23      private float startAngle, sweepAngle;
24  
25      public AngleArc() {
26          super(41, 1);
27      }
28  
29      public AngleArc(Point center, int radius, float startAngle, float sweepAngle) {
30          this();
31          this.center = center;
32          this.radius = radius;
33          this.startAngle = startAngle;
34          this.sweepAngle = sweepAngle;
35      }
36  
37      public EMFTag read(int tagID, EMFInputStream emf, int len)
38              throws IOException {
39  
40          return new AngleArc(
41              emf.readPOINTL(),
42              emf.readDWORD(), emf.readFLOAT(),
43              emf.readFLOAT());
44      }
45  
46      public void write(int tagID, EMFOutputStream emf) throws IOException {
47          emf.writePOINTL(center);
48          emf.writeDWORD(radius);
49          emf.writeFLOAT(startAngle);
50          emf.writeFLOAT(sweepAngle);
51      }
52  
53      public String toString() {
54          return super.toString() +
55              "\n  center: " + center +
56              "\n  radius: " + radius +
57              "\n  startAngle: " + startAngle +
58              "\n  sweepAngle: " + sweepAngle;
59      }
60  }