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

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


  }


  @Test
  public void testConstructors() {
    final IFreehand fh = ShapeFactory.createFreeHand();
    assertNotNull(fh);
  }
View Full Code Here


  public void testPsCustomFreeHandClose() throws ParseException {
    IGroup group = parser.parsePSTCode("\\pscustom{\\moveto(0.0,2.64)\\lineto(0.19,2.82)\\curveto(0.285,2.91)(1.49,3.16)(2.6,3.32)"+ //$NON-NLS-1$
        "\\curveto(3.71,3.48)(5.625,3.205)(6.43,2.77)\\curveto(7.235,2.335)(8.07,1.135)(8.1,0.37)"+ //$NON-NLS-1$
        "\\curveto(8.13,-0.395)(7.64,-1.63)(7.12,-2.1)\\curveto(6.6,-2.57)(5.45,-3.18)(4.82,-3.32)\\closepath}").get(); //$NON-NLS-1$
    assertEquals(1, group.size());
    IFreehand fh = (IFreehand)group.getShapeAt(0);
    assertEquals(7, fh.getNbPoints());
    assertEquals(0., fh.getPtAt(0).getX(), 0.001);
    assertEquals(-2.64*IShape.PPC, fh.getPtAt(0).getY(), 0.001);
    assertEquals(0.19*IShape.PPC, fh.getPtAt(1).getX(), 0.001);
    assertEquals(-2.82*IShape.PPC, fh.getPtAt(1).getY(), 0.001);
    assertEquals(2.6*IShape.PPC, fh.getPtAt(2).getX(), 0.001);
    assertEquals(-3.32*IShape.PPC, fh.getPtAt(2).getY(), 0.001);
    assertEquals(6.43*IShape.PPC, fh.getPtAt(3).getX(), 0.001);
    assertEquals(-2.77*IShape.PPC, fh.getPtAt(3).getY(), 0.001);
    assertEquals(8.1*IShape.PPC, fh.getPtAt(4).getX(), 0.001);
    assertEquals(-0.37*IShape.PPC, fh.getPtAt(4).getY(), 0.001);
    assertEquals(IFreeHandProp.FreeHandType.CURVES, fh.getType());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

  public void testPsCustomFreeHandOpen() throws ParseException {
    IGroup group = parser.parsePSTCode("\\pscustom{\\moveto(0.0,2.64)\\lineto(0.19,2.82)\\curveto(0.285,2.91)(1.49,3.16)(2.6,3.32)"+ //$NON-NLS-1$
      "\\curveto(3.71,3.48)(5.625,3.205)(6.43,2.77)\\curveto(7.235,2.335)(8.07,1.135)(8.1,0.37)"+ //$NON-NLS-1$
      "\\curveto(8.13,-0.395)(7.64,-1.63)(7.12,-2.1)\\curveto(6.6,-2.57)(5.45,-3.18)(4.82,-3.32)}").get(); //$NON-NLS-1$
    assertEquals(1, group.size());
    IFreehand fh = (IFreehand)group.getShapeAt(0);
    assertEquals(7, fh.getNbPoints());
    assertEquals(0., fh.getPtAt(0).getX(), 0.001);
    assertEquals(-2.64*IShape.PPC, fh.getPtAt(0).getY(), 0.001);
    assertEquals(0.19*IShape.PPC, fh.getPtAt(1).getX(), 0.001);
    assertEquals(-2.82*IShape.PPC, fh.getPtAt(1).getY(), 0.001);
    assertEquals(2.6*IShape.PPC, fh.getPtAt(2).getX(), 0.001);
    assertEquals(-3.32*IShape.PPC, fh.getPtAt(2).getY(), 0.001);
    assertEquals(6.43*IShape.PPC, fh.getPtAt(3).getX(), 0.001);
    assertEquals(-2.77*IShape.PPC, fh.getPtAt(3).getY(), 0.001);
    assertEquals(8.1*IShape.PPC, fh.getPtAt(4).getX(), 0.001);
    assertEquals(-0.37*IShape.PPC, fh.getPtAt(4).getY(), 0.001);
    assertTrue(fh.isOpen());
    assertEquals(IFreeHandProp.FreeHandType.CURVES, fh.getType());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

  @Test
  public void testPsCustomMovetoCurvetoLineTo() throws ParseException {
    IGroup group = parser.parsePSTCode("\\"+getCommandName()+"{%\n\\moveto(1,2)\\curveto(3.1,4.1)(3.2,4.3)(3,4)\\lineto(5,6)}").get(); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1, group.size());
    IFreehand fh = (IFreehand)group.getShapeAt(0);
    assertEquals(3, fh.getNbPoints());
    assertEquals(1.*IShape.PPC, fh.getPtAt(0).getX(), 0.001);
    assertEquals(-2.*IShape.PPC, fh.getPtAt(0).getY(), 0.001);
    assertEquals(3.*IShape.PPC, fh.getPtAt(1).getX(), 0.001);
    assertEquals(-4.*IShape.PPC, fh.getPtAt(1).getY(), 0.001);
    assertEquals(5.*IShape.PPC, fh.getPtAt(2).getX(), 0.001);
    assertEquals(-6.*IShape.PPC, fh.getPtAt(2).getY(), 0.001);
    assertEquals(IFreeHandProp.FreeHandType.LINES, fh.getType());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

  }


  @Test
  public void testPsCustomMovetoCurveto() throws ParseException {
    IFreehand fh = (IFreehand)parser.parsePSTCode("\\"+getCommandName()+"[linewidth=10cm]{%\n\\moveto(1,2)\\curveto(3.1,4.1)(3.2,4.3)(3,4)}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(2, fh.getNbPoints());
    assertEquals(1.*IShape.PPC, fh.getPtAt(0).getX(), 0.001);
    assertEquals(-2.*IShape.PPC, fh.getPtAt(0).getY(), 0.001);
    assertEquals(3.*IShape.PPC, fh.getPtAt(1).getX(), 0.001);
    assertEquals(-4.*IShape.PPC, fh.getPtAt(1).getY(), 0.001);
    assertEquals(IFreeHandProp.FreeHandType.CURVES, fh.getType());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

  }


  @Test
  public void testPsCustomMovetoLineto() throws ParseException {
    IFreehand fh = (IFreehand)parser.parsePSTCode("\\"+getCommandName()+"[linewidth=10cm]{%\n\\moveto(1,2)\\lineto(3,4)}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(2, fh.getNbPoints());
    assertEquals(1.*IShape.PPC, fh.getPtAt(0).getX(), 0.001);
    assertEquals(-2.*IShape.PPC, fh.getPtAt(0).getY(), 0.001);
    assertEquals(3.*IShape.PPC, fh.getPtAt(1).getX(), 0.001);
    assertEquals(-4.*IShape.PPC, fh.getPtAt(1).getY(), 0.001);
    assertEquals(IFreeHandProp.FreeHandType.LINES, fh.getType());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

TOP

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

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.