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

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


  }


  @Test public void testShape3() {
    assertTrue(group.getShapeAt(3) instanceof IBezierCurve);
    final IBezierCurve bez = (IBezierCurve) group.getShapeAt(3);
    assertEquals(2, bez.getNbPoints());
    assertEquals(460., bez.getPtAt(0).getX(),0.0001);
    assertEquals(180., bez.getPtAt(0).getY(),0.0001);
    assertEquals(580., bez.getPtAt(1).getX(),0.0001);
    assertEquals(180., bez.getPtAt(1).getY(),0.0001);
    assertEquals(480., bez.getFirstCtrlPtAt(0).getX(),0.0001);
    assertEquals(220., bez.getFirstCtrlPtAt(0).getY(),0.0001);
    assertEquals(440., bez.getSecondCtrlPtAt(0).getX(),0.0001);
    assertEquals(140., bez.getSecondCtrlPtAt(0).getY(),0.0001);
    assertEquals(560., bez.getFirstCtrlPtAt(1).getX(),0.0001);
    assertEquals(220., bez.getFirstCtrlPtAt(1).getY(),0.0001);
    assertEquals(600., bez.getSecondCtrlPtAt(1).getX(),0.0001);
    assertEquals(140., bez.getSecondCtrlPtAt(1).getY(),0.0001);
    assertEquals(0., bez.getRotationAngle(),0.0001);
    assertFalse(bez.hasShadow());
    assertFalse(bez.hasDbleBord());
    assertEquals(2., bez.getThickness(),0.0001);
    assertEquals(LineStyle.SOLID, bez.getLineStyle());
    assertFalse(bez.isClosed());
    assertEquals(BorderPos.INTO, bez.getBordersPosition());
    assertEquals(FillingStyle.NONE, bez.getFillingStyle());
    assertEquals(ArrowStyle.NONE, bez.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_ARROW, bez.getArrowStyle(-1));
    assertEquals(0., bez.getArrowAt(-1).getArrowInset(), 0.00001);
    assertEquals(5.65, bez.getArrowAt(-1).getArrowSizeDim(), 0.01);
    assertEquals(2.0, bez.getArrowAt(-1).getArrowSizeNum(), 0.00001);
    assertEquals(1.4, bez.getArrowAt(-1).getArrowLength(), 0.00001);
  }
View Full Code Here


  }


  @Test public void testShape26() {
    assertTrue(group.getShapeAt(26) instanceof IBezierCurve);
    IBezierCurve pol = (IBezierCurve) group.getShapeAt(26);

    assertEquals(Color.BLACK, pol.getLineColour());
    assertEquals(2, pol.getNbPoints());
    assertFalse(pol.hasDbleBord());
    assertEquals(2., pol.getThickness(),0.0001);
    assertEquals(111., pol.getPtAt(0).getX(), 0.00001);
    assertEquals(166.7561896, pol.getPtAt(0).getY(), 0.00001);
    assertEquals(115., pol.getPtAt(1).getX(), 0.00001);
    assertEquals(40., pol.getPtAt(1).getY(), 0.00001);
    assertEquals(89., pol.getFirstCtrlPtAt(0).getX(), 0.00001);
    assertEquals(138.688747, pol.getFirstCtrlPtAt(0).getY(), 0.00001);
    assertEquals(85., pol.getFirstCtrlPtAt(1).getX(), 0.00001);
    assertEquals(59.013428, pol.getFirstCtrlPtAt(1).getY(), 0.00001);
    assertEquals(0., pol.getRotationAngle(),0.0001);
    assertEquals(LineStyle.SOLID, pol.getLineStyle());
    assertFalse(pol.hasShadow());
    assertEquals(FillingStyle.NONE, pol.getFillingStyle());
    assertEquals(ArrowStyle.NONE, pol.getArrowAt(0).getArrowStyle());
    assertEquals(ArrowStyle.RIGHT_ARROW, pol.getArrowAt(-1).getArrowStyle());
    assertEquals(0., pol.getArrowAt(-1).getArrowInset(), 0.00001);
    assertEquals(2.65, pol.getArrowAt(-1).getArrowSizeDim(), 0.01);
    assertEquals(2.0, pol.getArrowAt(-1).getArrowSizeNum(), 0.00001);
    assertEquals(1.4, pol.getArrowAt(-1).getArrowLength(), 0.00001);
  }
View Full Code Here

  }


  @Test
  public void testConstructors() {
    IBezierCurve curve = ShapeFactory.createBezierCurve();

    assertNotNull(curve);
    assertEquals(0, curve.getPoints().size());
    assertEquals(0, curve.getFirstCtrlPts().size());
    assertEquals(0, curve.getSecondCtrlPts().size());
    assertEquals(2, curve.getNbArrows());
  }
View Full Code Here

    assertEquals(2, curve.getNbArrows());
  }

  @Test
  public void testConstructors2() {
    IBezierCurve curve = ShapeFactory.createBezierCurve(
        ShapeFactory.createPoint(100, 200),
        ShapeFactory.createPoint(300, 400));

    assertNotNull(curve);
    assertEquals(2, curve.getPoints().size());
    HelperTest.assertEqualsDouble(100., curve.getPoints().get(0).getX());
    HelperTest.assertEqualsDouble(200., curve.getPoints().get(0).getY());
    HelperTest.assertEqualsDouble(300., curve.getPoints().get(1).getX());
    HelperTest.assertEqualsDouble(400., curve.getPoints().get(1).getY());
    assertEquals(2, curve.getFirstCtrlPts().size());
    assertEquals(2, curve.getSecondCtrlPts().size());
    assertEquals(2, curve.getNbArrows());
  }
View Full Code Here

import org.junit.Test;

public class TestParsingPSbezier extends TestParsingShape {
  @Test public void testSimpleBezierCurve() throws ParseException {
    IBezierCurve bc = (IBezierCurve)parser.parsePSTCode(
        "\\psbezier[linewidth=0.02](1.3918242,0.7584497)(2.0668242,0.95844966)(4.3168244,0.95844966)(4.991824,0.7584497)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(bc.getPtAt(0).getY(), bc.getPtAt(1).getY(), 0.001);
    assertEquals(bc.getFirstCtrlPtAt(0).getY(), bc.getFirstCtrlPtAt(1).getY(), 0.001);
    assertFalse(bc.isFilled());
  }
View Full Code Here

    assertFalse(bc.isFilled());
  }

  @Test
  public void testParamArrowsArrowsNoneNone() throws ParseException {
    IBezierCurve line = (IBezierCurve)parser.parsePSTCode("\\"+getCommandName()+"[arrows=<->]{-}(1,2)(3,4)(5,6)(7,8)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(ArrowStyle.NONE, line.getArrowStyle(0));
    assertEquals(ArrowStyle.NONE, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

    assertTrue(PSTParser.errorLogs().isEmpty());
  }

  @Test
  public void testParamBarInSqureBracket() throws ParseException {
    IBezierCurve line = (IBezierCurve)parser.parsePSTCode("\\"+getCommandName()+"{|-]}(1,2)(3,4)(5,6)(7,8)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(ArrowStyle.BAR_IN, line.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_SQUARE_BRACKET, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void testParamArrowsArrows() throws ParseException {
    IBezierCurve line = (IBezierCurve)parser.parsePSTCode("\\"+getCommandName()+"[arrows=<->](1,2)(3,4)(5,6)(7,8)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(ArrowStyle.LEFT_ARROW, line.getArrowStyle(0));
    assertEquals(ArrowStyle.RIGHT_ARROW, line.getArrowStyle(1));
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void test9Coordinates() throws ParseException {
    IBezierCurve bc =  (IBezierCurve)parser.parsePSTCode("\\"+getCommandName()+"(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)(13,14)(15,16)(17,18)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(4, bc.getNbPoints());
    assertEquals(0., bc.getPtAt(0).getX(), 0.0001);
    assertEquals(0., bc.getPtAt(0).getY(), 0.0001);
    assertEquals(5.*IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
    assertEquals(-6.*IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
    assertEquals(11.*IShape.PPC, bc.getPtAt(2).getX(), 0.0001);
    assertEquals(-12.*IShape.PPC, bc.getPtAt(2).getY(), 0.0001);
    assertEquals(17.*IShape.PPC, bc.getPtAt(3).getX(), 0.0001);
    assertEquals(-18.*IShape.PPC, bc.getPtAt(3).getY(), 0.0001);
    assertEquals(-1.*IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
    assertEquals(2.*IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
    assertEquals(7.*IShape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-8.*IShape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
    assertEquals(13.*IShape.PPC, bc.getSecondCtrlPtAt(2).getX(), 0.0001);
    assertEquals(-14.*IShape.PPC, bc.getSecondCtrlPtAt(2).getY(), 0.0001);
    assertEquals(3.*IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-4.*IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
    assertEquals(9.*IShape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
    assertEquals(-10.*IShape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
    assertEquals(15.*IShape.PPC, bc.getFirstCtrlPtAt(3).getX(), 0.0001);
    assertEquals(-16.*IShape.PPC, bc.getFirstCtrlPtAt(3).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

  }


  @Test
  public void test10Coordinates() throws ParseException {
    IBezierCurve bc =  (IBezierCurve)parser.parsePSTCode("\\"+getCommandName()+"(5,10)(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)(13,14)(15,16)(17,18)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(4, bc.getNbPoints());
    assertEquals(5.*IShape.PPC, bc.getPtAt(0).getX(), 0.0001);
    assertEquals(-10.*IShape.PPC, bc.getPtAt(0).getY(), 0.0001);
    assertEquals(5.*IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
    assertEquals(-6.*IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
    assertEquals(11.*IShape.PPC, bc.getPtAt(2).getX(), 0.0001);
    assertEquals(-12.*IShape.PPC, bc.getPtAt(2).getY(), 0.0001);
    assertEquals(17.*IShape.PPC, bc.getPtAt(3).getX(), 0.0001);
    assertEquals(-18.*IShape.PPC, bc.getPtAt(3).getY(), 0.0001);
    assertEquals(9.*IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
    assertEquals(-18.*IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
    assertEquals(7.*IShape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-8.*IShape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
    assertEquals(13.*IShape.PPC, bc.getSecondCtrlPtAt(2).getX(), 0.0001);
    assertEquals(-14.*IShape.PPC, bc.getSecondCtrlPtAt(2).getY(), 0.0001);
    assertEquals(3.*IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
    assertEquals(-4.*IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
    assertEquals(9.*IShape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
    assertEquals(-10.*IShape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
    assertEquals(15.*IShape.PPC, bc.getFirstCtrlPtAt(3).getX(), 0.0001);
    assertEquals(-16.*IShape.PPC, bc.getFirstCtrlPtAt(3).getY(), 0.0001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

TOP

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

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.