1 44 45 package org.jfree.chart.needle; 46 47 import java.awt.Graphics2D ; 48 import java.awt.Shape ; 49 import java.awt.geom.Line2D ; 50 import java.awt.geom.Point2D ; 51 import java.awt.geom.Rectangle2D ; 52 import java.io.Serializable ; 53 54 59 public class LineNeedle extends MeterNeedle implements Serializable { 60 61 62 private static final long serialVersionUID = 6215321387896748945L; 63 64 72 protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, 73 Point2D rotate, double angle) { 74 75 Line2D shape = new Line2D.Double (); 76 77 double x = plotArea.getMinX() + (plotArea.getWidth() / 2); 78 shape.setLine(x, plotArea.getMinY(), x, plotArea.getMaxY()); 79 80 Shape s = shape; 81 82 if ((rotate != null) && (angle != 0)) { 83 getTransform().setToRotation(angle, rotate.getX(), rotate.getY()); 85 s = getTransform().createTransformedShape(s); 86 } 87 88 defaultDisplay(g2, s); 89 90 } 91 92 99 public boolean equals(Object object) { 100 if (object == null) { 101 return false; 102 } 103 if (object == this) { 104 return true; 105 } 106 if (super.equals(object) && object instanceof LineNeedle) { 107 return true; 108 } 109 return false; 110 } 111 112 } 113 114 | Popular Tags |