1 44 45 package org.jfree.chart.needle; 46 47 import java.awt.Graphics2D ; 48 import java.awt.geom.Arc2D ; 49 import java.awt.geom.GeneralPath ; 50 import java.awt.geom.Point2D ; 51 import java.awt.geom.Rectangle2D ; 52 import java.io.Serializable ; 53 54 60 public class ShipNeedle extends MeterNeedle implements Serializable { 61 62 63 private static final long serialVersionUID = 149554868169435612L; 64 65 73 protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, 74 Point2D rotate, double angle) { 75 76 GeneralPath shape = new GeneralPath (); 77 shape.append(new Arc2D.Double ( 78 -9.0, -7.0, 10, 14, 0.0, 25.5, Arc2D.OPEN), true 79 ); 80 shape.append(new Arc2D.Double ( 81 0.0, -7.0, 10, 14, 154.5, 25.5, Arc2D.OPEN), true 82 ); 83 shape.closePath(); 84 getTransform().setToTranslation(plotArea.getMinX(), plotArea.getMaxY()); 85 getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3); 86 shape.transform(getTransform()); 87 88 if ((rotate != null) && (angle != 0)) { 89 getTransform().setToRotation(angle, rotate.getX(), rotate.getY()); 91 shape.transform(getTransform()); 92 } 93 94 defaultDisplay(g2, shape); 95 } 96 97 104 public boolean equals(Object object) { 105 if (object == null) { 106 return false; 107 } 108 if (object == this) { 109 return true; 110 } 111 if (super.equals(object) && object instanceof ShipNeedle) { 112 return true; 113 } 114 return false; 115 } 116 117 } 118 119 | Popular Tags |