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

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


  }


  @Test public void testShape1() {
    assertTrue(group.getShapeAt(1) instanceof IPolygon);
    IPolygon pol = (IPolygon) group.getShapeAt(1);

    assertEquals(Color.BLACK, pol.getLineColour());
    assertEquals(5, pol.getNbPoints());
    assertFalse(pol.hasDbleBord());
    assertEquals(1., pol.getThickness(),0.0001);
    assertEquals(108.499829, pol.getPtAt(0).getX(), 0.00001);
    assertEquals(23.96374, pol.getPtAt(0).getY(), 0.00001);
    assertEquals(108.499829, pol.getPtAt(1).getX(), 0.00001);
    assertEquals(120.05512, pol.getPtAt(1).getY(), 0.00001);
    assertEquals(200.82894, pol.getPtAt(2).getX(), 0.00001);
    assertEquals(120.05512, pol.getPtAt(2).getY(), 0.00001);
    assertEquals(200.82894, pol.getPtAt(3).getX(), 0.00001);
    assertEquals(62.400297, pol.getPtAt(3).getY(), 0.00001);
    assertEquals(174.44919, pol.getPtAt(4).getX(), 0.00001);
    assertEquals(23.963746, pol.getPtAt(4).getY(), 0.00001);
    assertEquals(0., pol.getRotationAngle(),0.0001);
    assertEquals(LineStyle.SOLID, pol.getLineStyle());
    assertFalse(pol.hasShadow());
    assertEquals(FillingStyle.PLAIN, pol.getFillingStyle());
    assertEquals(new Color(210, 230, 254), pol.getFillingCol());
  }
View Full Code Here


  @Test
  public void testConstructor() {
    IPoint pt1   = ShapeFactory.createPoint(1, 1);
    IPoint pt2   = ShapeFactory.createPoint(2, 2);
    IPolygon pol = ShapeFactory.createPolygon(pt1, pt2);

    pol = ShapeFactory.createPolygon(pt1, pt2);
    assertEquals(pt1, pol.getPtAt(0));
    assertEquals(pt2, pol.getPtAt(-1));

    pol = ShapeFactory.createPolygon();
    pol = ShapeFactory.createPolygon();
    pol = ShapeFactory.createPolygon();
View Full Code Here

import org.junit.Test;

public class TestParsingPspolygon extends TestParsingShape {
  @Test
  public void test2Coordinates() throws ParseException {
    IPolygon line =  (IPolygon)parser.parsePSTCode("\\"+getCommandName()+"(5,10)(15,20)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, line.getNbPoints());
    assertEquals(0., line.getPtAt(0).getX(), 0.0001);
    assertEquals(0., line.getPtAt(0).getY(), 0.0001);
    assertEquals(5.*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-10.*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertEquals(15.*IShape.PPC, line.getPtAt(2).getX(), 0.0001);
    assertEquals(-20.*IShape.PPC, line.getPtAt(2).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here



  @Test
  public void testCoordinatesPt() throws ParseException {
    IPolygon line =  (IPolygon)parser.parsePSTCode("\\"+getCommandName()+"(35pt,20pt)(10pt,5pt)(-10pt,-5pt)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, line.getNbPoints());
    assertEquals(35.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(0).getY(), 0.0001);
    assertEquals(10.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-5.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(1).getY(), 0.0001);
    assertEquals(-10.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(2).getX(), 0.0001);
    assertEquals(5.*IShape.PPC/PSTricksConstants.CM_VAL_PT, line.getPtAt(2).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testCoordinatesMm() throws ParseException {
    IPolygon line =  (IPolygon)parser.parsePSTCode("\\"+getCommandName()+"(350mm,200mm)(10mm, 30.3mm)(-10mm, -30.3mm)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(3, line.getNbPoints());
    assertEquals(35.*IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20.*IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(1.*IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-3.03*IShape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertEquals(-1.*IShape.PPC, line.getPtAt(2).getX(), 0.0001);
    assertEquals(3.03*IShape.PPC, line.getPtAt(2).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


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

  }


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

  }


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



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

TOP

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

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.