| 1 |
|
| 2 |
package org.freehep.graphicsio.cgm; |
| 3 |
|
| 4 |
import java.awt.geom.Point2D; |
| 5 |
import java.io.IOException; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 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 |
|
| 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 |
} |