1 package net.sf.openrocket.gui.figureelements;
4 import java.awt.geom.Area;
5 import java.awt.geom.Ellipse2D;
6 import java.awt.geom.Rectangle2D;
9 * A mark indicating the position of the center of gravity. It is a blue circle with every
10 * second quarter filled with blue.
12 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
15 public class CGCaret extends Caret {
16 private static final float RADIUS = 7;
18 private static Area caret = null;
21 * Create a new CGCaret at the specified coordinates.
23 public CGCaret(double x, double y) {
28 * Returns the Area corresponding to the caret. The Area object is created only once,
29 * after which the object is cloned for new copies.
32 protected Area getCaret() {
34 return (Area)caret.clone();
37 Ellipse2D.Float e = new Ellipse2D.Float(-RADIUS,-RADIUS,2*RADIUS,2*RADIUS);
41 a = new Area(new Rectangle2D.Float(-RADIUS,-RADIUS,RADIUS,RADIUS));
43 a = new Area(new Rectangle2D.Float(0,0,RADIUS,RADIUS));
46 a = new Area(new Ellipse2D.Float(-RADIUS,-RADIUS,2*RADIUS,2*RADIUS));
47 a.subtract(new Area(new Ellipse2D.Float(-RADIUS*0.9f,-RADIUS*0.9f,
48 2*0.9f*RADIUS,2*0.9f*RADIUS)));
51 return (Area) caret.clone();
55 * Return the color of the caret (blue).
58 protected Color getColor() {