| 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 EllipticalArc extends Ellipse { |
| 15 |
|
| 16 |
protected Point2D delta0, delta1; |
| 17 |
|
| 18 |
public EllipticalArc() { |
| 19 |
super(4, 18, 1); |
| 20 |
} |
| 21 |
|
| 22 |
public EllipticalArc(Point2D p, Point2D c1, Point2D c2, Point2D delta0, |
| 23 |
Point2D delta1) { |
| 24 |
this(); |
| 25 |
this.p = p; |
| 26 |
this.c1 = c1; |
| 27 |
this.c2 = c2; |
| 28 |
this.delta0 = delta0; |
| 29 |
this.delta1 = delta1; |
| 30 |
} |
| 31 |
|
| 32 |
protected EllipticalArc(int elementClass, int elementID, int version) { |
| 33 |
super(elementClass, elementID, version); |
| 34 |
} |
| 35 |
|
| 36 |
public void write(int tagID, CGMOutputStream cgm) throws IOException { |
| 37 |
super.write(tagID, cgm); |
| 38 |
|
| 39 |
cgm.writeVDC(delta0.getX()); |
| 40 |
cgm.writeVDC(delta0.getY()); |
| 41 |
cgm.writeVDC(delta1.getX()); |
| 42 |
cgm.writeVDC(delta1.getY()); |
| 43 |
} |
| 44 |
|
| 45 |
public void write(int tagID, CGMWriter cgm) throws IOException { |
| 46 |
cgm.print("ELLIPARC "); |
| 47 |
writeEllipseSpec(cgm); |
| 48 |
writeArcBounds(cgm); |
| 49 |
} |
| 50 |
|
| 51 |
protected void writeArcBounds(CGMWriter cgm) throws IOException { |
| 52 |
cgm.print(" "); |
| 53 |
cgm.writePoint(delta0); |
| 54 |
cgm.print(", "); |
| 55 |
cgm.writePoint(delta1); |
| 56 |
} |
| 57 |
} |