src/org/math/plot/plotObjects/Line.java

00001 package org.math.plot.plotObjects;
00002 
00003 import java.awt.*;
00004 
00005 import org.math.plot.render.*;
00006 
00012 public class Line implements Plotable {
00013 
00014         protected double[][] extrem = new double[2][];
00015 
00016         protected Color color;
00017         
00018         protected Color gradientColor;
00019 
00020         boolean visible = true;
00021 
00022         public Line(Color col, double[] c1, double[] c2) {
00023                 extrem[0] = c1;
00024                 extrem[1] = c2;
00025                 color = col;
00026         }
00027 
00028         public void setColor(Color c) {
00029                 color = c;
00030         }
00031 
00032         public Color getColor() {
00033                 return color;
00034         }
00035 
00036         public void setVisible(boolean v) {
00037                 visible = v;
00038         }
00039 
00040         public boolean getVisible() {
00041                 return visible;
00042         }
00043 
00044         public void plot(AbstractDrawer draw) {
00045                 if (!visible)
00046                         return;
00047 
00048                 draw.setColor(color);
00049                 if (gradientColor!= null)
00050                 draw.setGradient(extrem[0], color, extrem[1], gradientColor);
00051                 draw.drawLine(extrem[0], extrem[1]);
00052                 if (gradientColor!= null)
00053                 draw.resetGradient();
00054         }
00055 
00056         public Color getGradientColor() {
00057                 return gradientColor;
00058         }
00059 
00060         public void setGradientColor(Color c) {
00061                 this.gradientColor = c;
00062         }
00063 }

Generated on Wed Sep 5 21:44:01 2007 for jmathplot by  doxygen 1.5.1