Debian Codegraph @

freehep-graphicsio-cgm/src/main/java/org/freehep/graphicsio/cgm/CircularArcCentre.java

raw symbols SCIP
1 // Copyright 2001, FreeHEP.
2 package org.freehep.graphicsio.cgm;
3
4 import java.awt.geom.Point2D;
5 import java.io.IOException;
6
7 /**
8 * CircularArcCentre TAG.
9 *
10 * @author Mark Donszelmann
11 * @author Charles Loomis
12 * @version $Id: freehep-graphicsio-cgm/src/main/java/org/freehep/graphicsio/cgm/CircularArcCentre.java 278fac7cefaa 2005/12/05 04:00:43 duns $
13 */
14 public class CircularArcCentre extends CGMTag {
15
16 protected Point2D p, dps, dpe;
17
18 protected double radius;
19
20 public CircularArcCentre() {
21 super(4, 15, 1);
22 }
23
24 public CircularArcCentre(Point2D p, Point2D dps, Point2D dpe, double radius) {
25 this();
26 this.p = p;
27 this.dps = dps;
28 this.dpe = dpe;
29 this.radius = radius;
30 }
31
32 protected CircularArcCentre(int elementClass, int elementID, int version) {
33 super(elementClass, elementID, version);
34 }
35
36 public void write(int tagID, CGMOutputStream cgm) throws IOException {
37 // FIXME: should these be points?
38 cgm.writePoint(p);
39 cgm.writeVDC(dps.getX());
40 cgm.writeVDC(dps.getY());
41 cgm.writeVDC(dpe.getX());
42 cgm.writeVDC(dpe.getY());
43 cgm.writeVDC(radius);
44 }
45
46 public void write(int tagID, CGMWriter cgm) throws IOException {
47 cgm.print("ARCCTR ");
48 writeArcSpec(cgm);
49 }
50
51 protected void writeArcSpec(CGMWriter cgm) throws IOException {
52 cgm.writePoint(p);
53 cgm.print(", ");
54 cgm.writePoint(dps);
55 cgm.print(", ");
56 cgm.writePoint(dpe);
57 }
58 }