1 41 42 package org.jfree.chart.renderer.xy; 43 44 import java.awt.Color ; 45 import java.awt.Graphics2D ; 46 import java.awt.Paint ; 47 import java.awt.Shape ; 48 import java.io.Serializable ; 49 50 import org.jfree.chart.Effect3D; 51 import org.jfree.chart.event.RendererChangeEvent; 52 53 57 public class XYLine3DRenderer extends XYLineAndShapeRenderer 58 implements Effect3D, Serializable { 59 60 61 private static final long serialVersionUID = 588933208243446087L; 62 63 64 public static final double DEFAULT_X_OFFSET = 12.0; 65 66 67 public static final double DEFAULT_Y_OFFSET = 8.0; 68 69 70 public static final Paint DEFAULT_WALL_PAINT = new Color (0xDD, 0xDD, 0xDD); 71 72 73 private double xOffset; 74 75 76 private double yOffset; 77 78 79 private transient Paint wallPaint; 80 81 84 public XYLine3DRenderer() { 85 this.wallPaint = DEFAULT_WALL_PAINT; 86 this.xOffset = DEFAULT_X_OFFSET; 87 this.yOffset = DEFAULT_Y_OFFSET; 88 } 89 90 95 public double getXOffset() { 96 return this.xOffset; 97 } 98 99 104 public double getYOffset() { 105 return this.yOffset; 106 } 107 108 114 public void setXOffset(double xOffset) { 115 this.xOffset = xOffset; 116 notifyListeners(new RendererChangeEvent(this)); 117 } 118 119 125 public void setYOffset(double yOffset) { 126 this.yOffset = yOffset; 127 notifyListeners(new RendererChangeEvent(this)); 128 } 129 130 136 public Paint getWallPaint() { 137 return this.wallPaint; 138 } 139 140 146 public void setWallPaint(Paint paint) { 147 this.wallPaint = paint; 148 notifyListeners(new RendererChangeEvent(this)); 149 } 150 151 158 public int getPassCount() { 159 return 3; 160 } 161 162 169 protected boolean isLinePass(int pass) { 170 return pass == 0 || pass == 1; 171 } 172 173 180 protected boolean isItemPass(int pass) { 181 return pass == 2; 182 } 183 184 191 protected boolean isShadowPass (int pass) { 192 return pass == 0; 193 } 194 195 204 protected void drawFirstPassShape(Graphics2D g2, 205 int pass, 206 int series, 207 int item, 208 Shape shape) { 209 if (isShadowPass(pass)) { 210 if (getWallPaint() != null) { 211 g2.setStroke(getItemStroke(series, item)); 212 g2.setPaint(getWallPaint()); 213 g2.translate(getXOffset(), getYOffset()); 214 g2.draw(shape); 215 g2.translate(-getXOffset(), -getYOffset()); 216 } 217 } 218 else { 219 super.drawFirstPassShape(g2, pass, series, item, shape); 221 } 222 } 223 224 } 225 | Popular Tags |