| 1 |
|
| 2 |
package org.freehep.graphicsio.cgm; |
| 3 |
|
| 4 |
import java.awt.geom.Point2D; |
| 5 |
import java.awt.geom.Rectangle2D; |
| 6 |
import java.io.IOException; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
public class Rectangle extends CGMTag { |
| 16 |
|
| 17 |
private Rectangle2D rectangle; |
| 18 |
|
| 19 |
public Rectangle() { |
| 20 |
super(4, 11, 1); |
| 21 |
} |
| 22 |
|
| 23 |
public Rectangle(Rectangle2D rectangle) { |
| 24 |
this(); |
| 25 |
this.rectangle = rectangle; |
| 26 |
} |
| 27 |
|
| 28 |
public void write(int tagID, CGMOutputStream cgm) throws IOException { |
| 29 |
cgm.writePoint(new Point2D.Double(rectangle.getMinX(), rectangle |
| 30 |
.getMinY())); |
| 31 |
cgm.writePoint(new Point2D.Double(rectangle.getMaxX(), rectangle |
| 32 |
.getMaxY())); |
| 33 |
} |
| 34 |
|
| 35 |
public void write(int tagID, CGMWriter cgm) throws IOException { |
| 36 |
cgm.print("RECT "); |
| 37 |
cgm.writePoint(new Point2D.Double(rectangle.getMinX(), rectangle |
| 38 |
.getMinY())); |
| 39 |
cgm.print(", "); |
| 40 |
cgm.writePoint(new Point2D.Double(rectangle.getMaxX(), rectangle |
| 41 |
.getMaxY())); |
| 42 |
} |
| 43 |
} |