Examples of IRectangle


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

    assertEquals(2.*2.*IShape.PPC, dot.getX(), 0.000001);
    assertEquals(-2.*2.*IShape.PPC, dot.getY(), 0.000001);
  }

  @Test public void test_psset_linewidth() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\psset{linewidth=2cm}\\psframe(10,10)").get().getShapeAt(0); //$NON-NLS-1$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*IShape.PPC, rec.getThickness(), 0.0001);
  }
View Full Code Here

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

  }


  @Test
  public void testPsCustomStarCommand() throws ParseException {
    IRectangle rec = (IRectangle) parser.parsePSTCode("\\"+getCommandName()+"*{%\n\\psframe(2,2)\n}").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue(rec.isFilled());
    assertEquals(0, PSTParser.errorLogs().size());
  }
View Full Code Here

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

import org.junit.Test;

public class TestParsingPsframe extends TestParsingShape {
  @Test public void test_psset_unit_yunit() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\psset{unit=2,yunit=3}\\"+getCommandName()+"(1,1)(5,5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*IShape.PPC, rec.getX(), 0.000001);
    assertEquals(-2.*3.*IShape.PPC, rec.getY(), 0.000001);
    assertEquals(2.*4.*IShape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2.*4.*3.*IShape.PPC, rec.getHeight(), 0.000001);
  }
View Full Code Here

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

    assertEquals(2.*4.*IShape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2.*4.*3.*IShape.PPC, rec.getHeight(), 0.000001);
  }

  @Test public void test_psset_unit_xunit() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\psset{unit=2,xunit=3}\\"+getCommandName()+"(1,1)(5,5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*3.*IShape.PPC, rec.getX(), 0.000001);
    assertEquals(-2.*IShape.PPC, rec.getY(), 0.000001);
    assertEquals(2.*4.*3.*IShape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2.*4.*IShape.PPC, rec.getHeight(), 0.000001);
  }
View Full Code Here

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

      final double positionx = shape.getPosition().getX();
      final double positiony = shape.getPosition().getY();
      final double xMax = positionx+gridEndx*IShape.PPC;
      final double yMax = positiony-gridEndy*IShape.PPC;
      final IPoint pos  = ShapeFactory.createPoint(positionx, gridEndy>0 ? yMax : positiony);
      final IRectangle r= ShapeFactory.createRectangle(pos, Math.abs(pos.getX()-(gridEndx>0 ? xMax : positionx)),
                                    Math.abs(pos.getY()-positiony));

      r.setBordersPosition(BorderPos.MID);
      r.setLineColour(shape.getLineColour());
      r.setLineStyle(shape.getLineStyle());
      r.setThickness(shape.getThickness());
      elt.appendChild(new LRectangleSVGGenerator(r).toSVG(document));
    }
  }
View Full Code Here

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

    assertEquals(2.*4.*3.*IShape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2.*4.*IShape.PPC, rec.getHeight(), 0.000001);
  }

  @Test public void test_psset_unit() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\psset{unit=2}\\"+getCommandName()+"(1,1)(5,5)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue(PSTParser.errorLogs().isEmpty());
    assertEquals(2.*IShape.PPC, rec.getX(), 0.000001);
    assertEquals(-2.*IShape.PPC, rec.getY(), 0.000001);
    assertEquals(2.*4.*IShape.PPC, rec.getWidth(), 0.000001);
    assertEquals(2.*4.*IShape.PPC, rec.getHeight(), 0.000001);
  }
View Full Code Here

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



  @Test
  public void testParamFramearc() throws ParseException {
    IRectangle sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=0]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0., sh.getLineArc(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
    sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=1]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(1., sh.getLineArc(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
    sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=0.5]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0.5, sh.getLineArc(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
    sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=0.2, framearc=0.3]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0.3, sh.getLineArc(), 0.00001);
    assertTrue(PSTParser.errorLogs().isEmpty());
    sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=-1]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertFalse(PSTParser.errorLogs().isEmpty());
    PSTParser.errorLogs().clear();
    sh = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"[framearc=0.5cm]"+getBasicCoordinates()).get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

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

  }


  @Test
  public void testCoordinatesPt() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(0,0)(35pt,20pt)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0., rec.getPosition().getX(), 0.001);
    assertEquals(0., rec.getPosition().getY(), 0.001);
    assertEquals(35.*IShape.PPC/PSTricksConstants.CM_VAL_PT, rec.getWidth(), 0.001);
    assertEquals(20.*IShape.PPC/PSTricksConstants.CM_VAL_PT, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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

  }


  @Test
  public void testCoordinatesMm() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(0,0)(350mm,200mm)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0., rec.getPosition().getX(), 0.001);
    assertEquals(0., rec.getPosition().getY(), 0.001);
    assertEquals(35.*IShape.PPC, rec.getWidth(), 0.001);
    assertEquals(20.*IShape.PPC, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here

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

  }


  @Test
  public void testCoordinatesInch() throws ParseException {
    IRectangle rec = (IRectangle)parser.parsePSTCode("\\"+getCommandName()+"(0,0)(35in,20in)").get().getShapeAt(0); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals(0., rec.getPosition().getX(), 0.001);
    assertEquals(0., rec.getPosition().getY(), 0.001);
    assertEquals(35.*IShape.PPC/2.54, rec.getWidth(), 0.001);
    assertEquals(20.*IShape.PPC/2.54, rec.getHeight(), 0.001);
    assertTrue(PSTParser.errorLogs().isEmpty());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.