org.jfree.chart.renderer.LookupPaintScale Java Examples

The following examples show how to use org.jfree.chart.renderer.LookupPaintScale. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XYBlockRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYBlockRenderer r1 = new XYBlockRenderer();
    LookupPaintScale scale1 = new LookupPaintScale();
    r1.setPaintScale(scale1);
    XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    scale1.add(0.5, Color.red);
    assertFalse(r1.equals(r2));
    LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
    scale2.add(0.5, Color.red);
    assertTrue(r1.equals(r2));
}
 
Example #2
Source File: XYBlockRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYBlockRenderer r1 = new XYBlockRenderer();
    LookupPaintScale scale1 = new LookupPaintScale();
    r1.setPaintScale(scale1);
    XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    scale1.add(0.5, Color.red);
    assertFalse(r1.equals(r2));
    LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
    scale2.add(0.5, Color.red);
    assertTrue(r1.equals(r2));
}
 
Example #3
Source File: XYBlockRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYBlockRenderer r1 = new XYBlockRenderer();
    LookupPaintScale scale1 = new LookupPaintScale();
    r1.setPaintScale(scale1);
    XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    scale1.add(0.5, Color.red);
    assertFalse(r1.equals(r2));
    LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
    scale2.add(0.5, Color.red);
    assertTrue(r1.equals(r2));
}
 
Example #4
Source File: ChartJFreeChartOutputHeatmap.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
protected static final LookupPaintScale createLUT(final int ncol, final float vmin, final float vmax,
		final Color start, final Color end) {
	final float[][] colors = new float[][] {
			{ start.getRed() / 255f, start.getGreen() / 255f, start.getBlue() / 255f, start.getAlpha() / 255f },
			{ end.getRed() / 255f, end.getGreen() / 255f, end.getBlue() / 255f, end.getAlpha() / 255f } };
	final float[] limits = new float[] { 0, 1 };
	final LookupPaintScale lut = new LookupPaintScale(vmin, vmax, start);
	float val;
	float r, g, b, a;
	for (int j = 0; j < ncol; j++) {
		val = j / (ncol - 0.99f);
		final int i = 0;
		r = colors[i][0] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][0] - colors[i][0]);
		g = colors[i][1] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][1] - colors[i][1]);
		b = colors[i][2] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][2] - colors[i][2]);
		a = colors[i][3] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][3] - colors[i][3]);
		lut.add(val * (vmax - vmin) + vmin, new Color(r, g, b, a));
	}
	return lut;
}
 
Example #5
Source File: XYBlockRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYBlockRenderer r1 = new XYBlockRenderer();
    LookupPaintScale scale1 = new LookupPaintScale();
    r1.setPaintScale(scale1);
    XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    scale1.add(0.5, Color.red);
    assertFalse(r1.equals(r2));
    LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
    scale2.add(0.5, Color.red);
    assertTrue(r1.equals(r2));
}
 
Example #6
Source File: XYBlockRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYBlockRenderer r1 = new XYBlockRenderer();
    LookupPaintScale scale1 = new LookupPaintScale();
    r1.setPaintScale(scale1);
    XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    scale1.add(0.5, Color.red);
    assertFalse(r1.equals(r2));
    LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
    scale2.add(0.5, Color.red);
    assertTrue(r1.equals(r2));
}
 
Example #7
Source File: ChartJFreeChartOutputHeatmap.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected static final LookupPaintScale createLUT(final int ncol, final float vmin, final float vmax,
		final Color start, final Color med, final Color end) {
	final float[][] colors = new float[][] {
			{ start.getRed() / 255f, start.getGreen() / 255f, start.getBlue() / 255f, start.getAlpha() / 255f },
			{ med.getRed() / 255f, med.getGreen() / 255f, med.getBlue() / 255f, med.getAlpha() / 255f },
			{ end.getRed() / 255f, end.getGreen() / 255f, end.getBlue() / 255f, end.getAlpha() / 255f } };
	final float[] limits = new float[] { 0, 0.5f, 1 };
	final LookupPaintScale lut = new LookupPaintScale(vmin, vmax, med);
	float val;
	float r, g, b, a;
	for (int j = 0; j < ncol; j++) {
		val = j / (ncol - 0.99f);
		int i = 0;
		for (i = 0; i < limits.length; i++) {
			if (val < limits[i]) {
				break;
			}
		}
		i = i - 1;
		r = colors[i][0] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][0] - colors[i][0]);
		g = colors[i][1] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][1] - colors[i][1]);
		b = colors[i][2] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][2] - colors[i][2]);
		a = colors[i][3] + (val - limits[i]) / (limits[i + 1] - limits[i]) * (colors[i + 1][3] - colors[i][3]);
		lut.add(val * (vmax - vmin) + vmin, new Color(r, g, b, a));
	}
	return lut;
}
 
Example #8
Source File: XYShapeRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #9
Source File: XYShapeRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #10
Source File: LookupPaintScaleTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the other constructor.
 */
public void testConstructor2() {
    LookupPaintScale s = new LookupPaintScale(1.0, 2.0, Color.red);
    assertEquals(1.0, s.getLowerBound(), EPSILON);
    assertEquals(2.0, s.getUpperBound(), EPSILON);
    assertEquals(Color.red, s.getDefaultPaint());
}
 
Example #11
Source File: LookupPaintScaleTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the other constructor.
 */
public void testConstructor2() {
    LookupPaintScale s = new LookupPaintScale(1.0, 2.0, Color.red);
    assertEquals(1.0, s.getLowerBound(), EPSILON);
    assertEquals(2.0, s.getUpperBound(), EPSILON);
    assertEquals(Color.red, s.getDefaultPaint());
}
 
Example #12
Source File: XYShapeRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #13
Source File: XYShapeRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #14
Source File: XYShapeRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #15
Source File: XYShapeRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #16
Source File: XYShapeRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #17
Source File: XYShapeRendererTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #18
Source File: XYShapeRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #19
Source File: XYShapeRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #20
Source File: XYShapeRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #21
Source File: XYShapeRenderer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new <code>XYShapeRenderer</code> instance with default
 * attributes.
 */
public XYShapeRenderer() {
    this.paintScale = new LookupPaintScale();
    this.useFillPaint = false;
    this.drawOutlines = false;
    this.useOutlinePaint = true;
    this.guideLinesVisible = false;
    this.guideLinePaint = Color.darkGray;
    this.guideLineStroke = new BasicStroke();
    setBaseShape(new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    setAutoPopulateSeriesShape(false);
}
 
Example #22
Source File: XYShapeRendererTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYShapeRenderer r1 = new XYShapeRenderer();
    XYShapeRenderer r2 = new XYShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertFalse(r1.equals(r2));
    r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white));
    assertTrue(r1.equals(r2));

    r1.setDrawOutlines(true);
    assertFalse(r1.equals(r2));
    r2.setDrawOutlines(true);
    assertTrue(r1.equals(r2));

    r1.setUseOutlinePaint(false);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(false);
    assertTrue(r1.equals(r2));

    r1.setUseFillPaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseFillPaint(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinesVisible(true);
    assertFalse(r1.equals(r2));
    r2.setGuideLinesVisible(true);
    assertTrue(r1.equals(r2));

    r1.setGuideLinePaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setGuideLinePaint(Color.red);
    assertTrue(r1.equals(r2));

}
 
Example #23
Source File: XYBlockRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new <code>XYBlockRenderer</code> instance with default
 * attributes.
 */
public XYBlockRenderer() {
    updateOffsets();
    this.paintScale = new LookupPaintScale();
}
 
Example #24
Source File: XYBlockRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new <code>XYBlockRenderer</code> instance with default
 * attributes.
 */
public XYBlockRenderer() {
    updateOffsets();
    this.paintScale = new LookupPaintScale();
}
 
Example #25
Source File: XYBlockRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new <code>XYBlockRenderer</code> instance with default
 * attributes.
 */
public XYBlockRenderer() {
    updateOffsets();
    this.paintScale = new LookupPaintScale();
}
 
Example #26
Source File: PaintScaleLegendTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    
    // default instances
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(), 
            new NumberAxis("X"));
    PaintScaleLegend l2 = new PaintScaleLegend(new GrayPaintScale(), 
            new NumberAxis("X"));
    assertTrue(l1.equals(l2));
    assertTrue(l2.equals(l1));
    
    // paintScale
    l1.setScale(new LookupPaintScale());
    assertFalse(l1.equals(l2));
    l2.setScale(new LookupPaintScale());
    assertTrue(l1.equals(l2));
    
    // axis
    l1.setAxis(new NumberAxis("Axis 2"));
    assertFalse(l1.equals(l2));
    l2.setAxis(new NumberAxis("Axis 2"));
    assertTrue(l1.equals(l2));
    
    // axisLocation
    l1.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertFalse(l1.equals(l2));
    l2.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertTrue(l1.equals(l2));
    
    // axisOffset
    l1.setAxisOffset(99.0);
    assertFalse(l1.equals(l2));
    l2.setAxisOffset(99.0);
    assertTrue(l1.equals(l2));
    
    // stripWidth
    l1.setStripWidth(99.0);
    assertFalse(l1.equals(l2));
    l2.setStripWidth(99.0);
    assertTrue(l1.equals(l2));
    
    // stripOutlineVisible
    l1.setStripOutlineVisible(!l1.isStripOutlineVisible());
    assertFalse(l1.equals(l2));
    l2.setStripOutlineVisible(l1.isStripOutlineVisible());
    assertTrue(l1.equals(l2));
    
    // stripOutlinePaint
    l1.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));
    
    // stripOutlineStroke
    l1.setStripOutlineStroke(new BasicStroke(1.1f));
    assertFalse(l1.equals(l2));
    l2.setStripOutlineStroke(new BasicStroke(1.1f));
    assertTrue(l1.equals(l2));
    
    // backgroundPaint
    l1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));
        
}
 
Example #27
Source File: LookupPaintScaleTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the default constructor.
 */
public void testConstructor1() {
    LookupPaintScale s = new LookupPaintScale();
    assertEquals(0.0, s.getLowerBound(), EPSILON);
    assertEquals(1.0, s.getUpperBound(), EPSILON);
}
 
Example #28
Source File: LookupPaintScaleTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some general checks for the lookup table.
 */
public void testGeneral() {
    
    LookupPaintScale s = new LookupPaintScale(0.0, 100.0, Color.black);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.black, s.getPaint(50.0));
    assertEquals(Color.black, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(50.0, Color.blue);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.blue, s.getPaint(50.0));
    assertEquals(Color.blue, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(50.0, Color.red);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(25.0, Color.green);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.red, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
    
    s.add(75.0, Color.yellow);
    assertEquals(Color.black, s.getPaint(-1.0));
    assertEquals(Color.black, s.getPaint(0.0));
    assertEquals(Color.green, s.getPaint(25.0));
    assertEquals(Color.red, s.getPaint(50.0));
    assertEquals(Color.yellow, s.getPaint(75.0));
    assertEquals(Color.yellow, s.getPaint(100.0));
    assertEquals(Color.black, s.getPaint(101.0));
}
 
Example #29
Source File: XYBlockRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new <code>XYBlockRenderer</code> instance with default 
 * attributes.
 */
public XYBlockRenderer() {
    updateOffsets();
    this.paintScale = new LookupPaintScale();
}
 
Example #30
Source File: PaintScaleLegendTest.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {

    // default instances
    PaintScaleLegend l1 = new PaintScaleLegend(new GrayPaintScale(),
            new NumberAxis("X"));
    PaintScaleLegend l2 = new PaintScaleLegend(new GrayPaintScale(),
            new NumberAxis("X"));
    assertTrue(l1.equals(l2));
    assertTrue(l2.equals(l1));

    // paintScale
    l1.setScale(new LookupPaintScale());
    assertFalse(l1.equals(l2));
    l2.setScale(new LookupPaintScale());
    assertTrue(l1.equals(l2));

    // axis
    l1.setAxis(new NumberAxis("Axis 2"));
    assertFalse(l1.equals(l2));
    l2.setAxis(new NumberAxis("Axis 2"));
    assertTrue(l1.equals(l2));

    // axisLocation
    l1.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertFalse(l1.equals(l2));
    l2.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    assertTrue(l1.equals(l2));

    // axisOffset
    l1.setAxisOffset(99.0);
    assertFalse(l1.equals(l2));
    l2.setAxisOffset(99.0);
    assertTrue(l1.equals(l2));

    // stripWidth
    l1.setStripWidth(99.0);
    assertFalse(l1.equals(l2));
    l2.setStripWidth(99.0);
    assertTrue(l1.equals(l2));

    // stripOutlineVisible
    l1.setStripOutlineVisible(!l1.isStripOutlineVisible());
    assertFalse(l1.equals(l2));
    l2.setStripOutlineVisible(l1.isStripOutlineVisible());
    assertTrue(l1.equals(l2));

    // stripOutlinePaint
    l1.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setStripOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));

    // stripOutlineStroke
    l1.setStripOutlineStroke(new BasicStroke(1.1f));
    assertFalse(l1.equals(l2));
    l2.setStripOutlineStroke(new BasicStroke(1.1f));
    assertTrue(l1.equals(l2));

    // backgroundPaint
    l1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertFalse(l1.equals(l2));
    l2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    assertTrue(l1.equals(l2));

    l1.setSubdivisionCount(99);
    assertFalse(l1.equals(l2));
    l2.setSubdivisionCount(99);
    assertTrue(l1.equals(l2));

}