Package plotter

Examples of plotter.CountingGraphics


      @Override
      public Shape createStrokedShape(Shape p) {
        return s.createStrokedShape(p);
      }
    });
    CountingGraphics g = paint(new Rectangle(25, 25, 50, 2));
    LineChecker c = new LineChecker();
    c.require(49, 0, 49, 199);
    c.check(g.getLines());
  }
View Full Code Here


  private CountingGraphics paint(Shape clip) throws InterruptedException, InvocationTargetException {
    final JFrame frame = new JFrame();
    frame.getContentPane().add(plot);
    BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_3BYTE_BGR);
    final Graphics2D imageG = image.createGraphics();
    final CountingGraphics g = new CountingGraphics(imageG);
    try {
      if(clip != null) {
        g.setClip(clip);
      }
      SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
          try {
View Full Code Here


  public void testPaintX() throws InterruptedException, InvocationTargetException {
    XYAxis axis = createAxis(XYDimension.X);
    axis.setStartMargin(10);
    CountingGraphics g = paint(axis);
    assertEquals(12, g.getPointCount());

    LineChecker c = new LineChecker();

    // main line
    c.require(10, 0, 199, 0);

    // major tick marks
    c.require(10, 0, 10, 5);
    c.require(110, 0, 110, 5);
    c.require(210, 0, 210, 5);

    // minor tick marks
    c.require(20, 0, 20, 3);
    c.require(30, 0, 30, 3);

    c.check(g.getLines());
  }
View Full Code Here


  public void testPaintXNoStartMargin() throws InterruptedException, InvocationTargetException {
    XYAxis axis = createAxis(XYDimension.X);
    axis.setStartMargin(0);
    CountingGraphics g = paint(axis);
    assertEquals(12, g.getPointCount());

    LineChecker c = new LineChecker();

    // main line
    c.require(0, 0, 199, 0);

    // major tick marks
    c.require(0, 0, 0, 5);
    c.require(100, 0, 100, 5);
    c.require(200, 0, 200, 5);

    // minor tick marks
    c.require(10, 0, 10, 3);
    c.require(20, 0, 20, 3);

    c.check(g.getLines());
  }
View Full Code Here


  public void testPaintY() throws InterruptedException, InvocationTargetException {
    XYAxis axis = createAxis(XYDimension.Y);
    axis.setStartMargin(10);
    CountingGraphics g = paint(axis);
    assertEquals(12, g.getPointCount());

    LineChecker c = new LineChecker();

    // main line
    c.require(199, 189, 199, 0);

    // major tick marks
    c.require(194, 189, 199, 189);
    c.require(194, 89, 199, 89);
    c.require(194, -11, 199, -11);

    // minor tick marks
    c.require(196, 179, 199, 179);
    c.require(196, 169, 199, 169);

    c.check(g.getLines());
  }
View Full Code Here


  public void testPaintYNoStartMargin() throws InterruptedException, InvocationTargetException {
    XYAxis axis = createAxis(XYDimension.Y);
    axis.setStartMargin(0);
    CountingGraphics g = paint(axis);
    assertEquals(12, g.getPointCount());

    LineChecker c = new LineChecker();

    // main line
    c.require(199, 199, 199, 0);

    // major tick marks
    c.require(194, 199, 199, 199);
    c.require(194, 99, 199, 99);
    c.require(194, -1, 199, -1);

    // minor tick marks
    c.require(196, 189, 199, 189);
    c.require(196, 179, 199, 179);

    c.check(g.getLines());
  }
View Full Code Here

    add(.1, .1);
    add(.2, .2);
    add(.5, Double.NaN);
    add(.8, .8);
    add(.9, .9);
    CountingGraphics g = paint();
    assertEquals(4, g.getPointCount());

    LineChecker c = new LineChecker();
    c.require(19, 180, 39, 160);
    c.require(159, 40, 179, 20);
    c.check(g.getLines());
  }
View Full Code Here

  public void testPaintSimpleStep() throws InterruptedException, InvocationTargetException {
    line.setLineMode(LineMode.STEP_YX);
    add(.1, .1);
    add(.9, .9);
    CountingGraphics g = paint();
    assertEquals(3, g.getPointCount());

    LineChecker c = new LineChecker();
    c.require(19, 180, 19, 20);
    c.require(19, 20, 179, 20);
    c.check(g.getLines());
  }
View Full Code Here

  public void testPaintLeadingNaNStep() throws InterruptedException, InvocationTargetException {
    line.setLineMode(LineMode.STEP_YX);
    add(.05, Double.NaN);
    add(.1, .1);
    add(.9, .9);
    CountingGraphics g = paint();
    assertEquals(3, g.getPointCount());

    LineChecker c = new LineChecker();
    c.require(19, 180, 19, 20);
    c.require(19, 20, 179, 20);
    c.check(g.getLines());
  }
View Full Code Here

  public void testPaintTrailingNaNStep() throws InterruptedException, InvocationTargetException {
    line.setLineMode(LineMode.STEP_YX);
    add(.1, .1);
    add(.9, .9);
    add(.95, Double.NaN);
    CountingGraphics g = paint();
    assertEquals(3, g.getPointCount());

    LineChecker c = new LineChecker();
    c.require(19, 180, 19, 20);
    c.require(19, 20, 179, 20);
    c.check(g.getLines());
  }
View Full Code Here

TOP

Related Classes of plotter.CountingGraphics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.