Package net.sf.latexdraw.glib.models.interfaces.shape

Examples of net.sf.latexdraw.glib.models.interfaces.shape.IPolyline


  }


  @Test
  public void testCoordinatesInch() throws ParseException {
    IPolyline line =  (IPolyline)parser.parsePSTCode("\\"+getCommandName()+"(35in,20in)(1.2in,0.2in)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(35.*IShape.PPC/2.54, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20.*IShape.PPC/2.54, line.getPtAt(0).getY(), 0.0001);
    assertEquals(1.2*IShape.PPC/2.54, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-0.2*IShape.PPC/2.54, line.getPtAt(1).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here


  }


  @Test
  public void testCoordinatesCm() throws ParseException {
    IPolyline line =  (IPolyline)parser.parsePSTCode("\\"+getCommandName()+"(35cm,20cm)(1.2cm,2cm)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(35.*IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20.*IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(1.2*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-2.*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testFloatSigns() throws ParseException {
    IPolyline line =  (IPolyline)parser.parsePSTCode("\\"+getCommandName()+"(+++35.5,--50.5)(--+12, -1)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(35.5*IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-50.5*IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(12.*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(1.*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here



  @Test
  public void testCoordinatesFloat2() throws ParseException {
    IPolyline line =  (IPolyline)parser.parsePSTCode("\\"+getCommandName()+"(35.5,50.5)(12, 1)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(35.5*IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-50.5*IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(12.*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-1.*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

import org.junit.Test;

public class TestParsingPsline extends TestParsingShape {
  @Test public void testBugTwoSameArrows() throws ParseException {
    IPolyline sh = (IPolyline)parser.parsePSTCode("\\psline{<-<}(-0.1,-0.2)(2,5)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(sh.getArrowAt(0).getArrowStyle(), IArrow.ArrowStyle.LEFT_ARROW);
    assertEquals(sh.getArrowAt(1).getArrowStyle(), IArrow.ArrowStyle.LEFT_ARROW);
    assertTrue(sh.getArrowAt(0)!=sh.getArrowAt(1));
  }
View Full Code Here

    assertTrue(sh.getArrowAt(0)!=sh.getArrowAt(1));
  }


  @Test public void testUnit() throws ParseException {
    IPolyline sh = (IPolyline)parser.parsePSTCode("\\psset{unit=2}\\psline[linewidth=0.3,linestyle=dashed](2,3)(1cm,2cm)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*2.*IShape.PPC, sh.getPtAt(0).getX(), 0.0001);
    assertEquals(-3.*2.*IShape.PPC, sh.getPtAt(0).getY(), 0.0001);
    assertEquals(IShape.PPC, sh.getPtAt(1).getX(), 0.0001);
    assertEquals(-2.*IShape.PPC, sh.getPtAt(1).getY(), 0.0001);
  }
View Full Code Here

  }


  @Test
  public void testMoreThanTwoPointsCoordinates() throws ParseException {
    IPolyline line =  (IPolyline)parser.parsePSTCode("\\"+getCommandName()+"(5,10)(6, 7) (1, 2) % foo \n(3, \t4)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(4, line.getNbPoints());
    assertEquals(5.*IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-10.*IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(6.*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-7.*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertEquals(1.*IShape.PPC, line.getPtAt(2).getX(), 0.0001);
    assertEquals(-2.*IShape.PPC, line.getPtAt(2).getY(), 0.0001);
    assertEquals(3.*IShape.PPC, line.getPtAt(3).getX(), 0.0001);
    assertEquals(-4.*IShape.PPC, line.getPtAt(3).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testDbleArrowLeftDbleArrowRight() throws ParseException {
    IPolyline line = (IPolyline)parser.parsePSTCode("\\psline{<<->>}(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertEquals(ArrowStyle.LEFT_DBLE_ARROW, line.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_DBLE_ARROW, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testNoneNone() throws ParseException {
    IPolyline line = (IPolyline)parser.parsePSTCode("\\psline{-}(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertEquals(ArrowStyle.NONE, line.getArrowStyle(0));
    assertEquals(ArrowStyle.NONE, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testArrowheadRightArrowheadLeft() throws ParseException {
    IPolyline line = (IPolyline)parser.parsePSTCode("\\psline{>-<}(1,1)").get().getShapeAt(0); //$NON-NLS-1$
    assertEquals(ArrowStyle.RIGHT_ARROW, line.getArrowStyle(0));
    assertEquals(ArrowStyle.LEFT_ARROW, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.glib.models.interfaces.shape.IPolyline

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.