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