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

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


    shape.setSubGridWidth(24);
    shape.setSubGridDiv(32);
    shape.setXLabelSouth(false);
    shape.setYLabelWest(false);

    IGrid g2 = (IGrid)shape.duplicate();

    assertEquals(g2.getGridDots(), shape.getGridDots());
    assertEquals(g2.getSubGridDiv(), shape.getSubGridDiv());
    assertEquals(g2.getGridLabelsColour(), shape.getGridLabelsColour());
    assertEquals(g2.getSubGridColour(), shape.getSubGridColour());
    HelperTest.assertEqualsDouble(g2.getUnit(), shape.getUnit());
    HelperTest.assertEqualsDouble(g2.getGridWidth(), shape.getGridWidth());
    HelperTest.assertEqualsDouble(g2.getSubGridWidth(), shape.getSubGridWidth());
    assertEquals(g2.getSubGridDiv(), shape.getSubGridDiv());
    assertFalse(g2.isXLabelSouth());
    assertFalse(g2.isYLabelWest());
  }
View Full Code Here


  }


  @Test
  public void testHasHatchingsWithUnstylableShape() {
    IGrid grid = ShapeFactory.createGrid(ShapeFactory.createPoint());

    // The test is useful only if the shape is not stylable.
    assertFalse(grid.isInteriorStylable());

    shape.addShape(grid);

    assertFalse(shape.hasHatchings());
    grid.setFillingStyle(FillingStyle.CLINES_PLAIN);
    assertFalse(shape.hasHatchings());

    IRectangle rec1 = ShapeFactory.createRectangle();
    shape.addShape(rec1);
    assertFalse(shape.hasHatchings());
View Full Code Here


  @Override
  @Test
  public void testSetHasGradient() {
    IGrid grid = ShapeFactory.createGrid(ShapeFactory.createPoint());

    // The test is useful only if the shape is not stylable.
    assertFalse(grid.isInteriorStylable());

    shape.addShape(grid);

    assertFalse(shape.hasGradient());
    grid.setFillingStyle(FillingStyle.GRAD);
    assertFalse(shape.hasGradient());

    IRectangle rec1 = ShapeFactory.createRectangle();
    shape.addShape(rec1);
    assertFalse(shape.hasGradient());
View Full Code Here

public class TestParsingPsBegin extends TestPSTParser {

  @Test
  public void testPspictureWithGridAndShapesBasic() throws ParseException {
    IGroup group = parser.parsePSTCode("\\pspicture(0,0)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\endpspicture").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    IRectangle rec1 = (IRectangle)group.getShapeAt(1);
    IRectangle rec2 = (IRectangle)group.getShapeAt(2);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(0., grid.getPosition().getX(), 0.001);
    assertEquals(0., grid.getPosition().getY(), 0.001);
    assertEquals(0., rec1.getPosition().getX(), 0.001);
    assertEquals(0., rec1.getPosition().getY(), 0.001);
    assertEquals(IShape.PPC, rec2.getPosition().getX(), 0.001);
    assertEquals(-(double)IShape.PPC, rec2.getPosition().getY(), 0.001);
  }
View Full Code Here

  }
 
  @Test
  public void testPspictureWithGridAndShapesComplex() throws ParseException {
    IGroup group = parser.parsePSTCode("\\pspicture(-3,-3)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\endpspicture").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    IRectangle rec1 = (IRectangle)group.getShapeAt(1);
    IRectangle rec2 = (IRectangle)group.getShapeAt(2);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(0.0, grid.getPosition().getX(), 0.001);
    assertEquals(0.0, grid.getPosition().getY(), 0.001);
    assertEquals(0., rec1.getPosition().getX(), 0.001);
    assertEquals(0., rec1.getPosition().getY(), 0.001);
    assertEquals(IShape.PPC, rec2.getPosition().getX(), 0.001);
    assertEquals(-(double)IShape.PPC, rec2.getPosition().getY(), 0.001);
  }
View Full Code Here

 
  @Test
  public void testPspictureWithGrid() throws ParseException {
    IGroup group = parser.parsePSTCode("\\pspicture\\psgrid\\endpspicture").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(10., grid.getGridMaxX(), 0.001);
    assertEquals(10., grid.getGridMaxY(), 0.001);
    assertEquals(0., grid.getGridMinY(), 0.001);
    assertEquals(0., grid.getGridMinX(), 0.001);
  }
View Full Code Here

 
 
  @Test
  public void testBeginPsPictureWithGrid() throws ParseException {
    IGroup group = parser.parsePSTCode("\\begin{pspicture}\\psgrid\\end{pspicture}").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(10., grid.getGridMaxX(), 0.001);
    assertEquals(10., grid.getGridMaxY(), 0.001);
    assertEquals(0., grid.getGridMinY(), 0.001);
    assertEquals(0., grid.getGridMinX(), 0.001);
  }
View Full Code Here

  }
 
  @Test
  public void testBeginPsPictureWithGridAndShapesBasic() throws ParseException {
    IGroup group = parser.parsePSTCode("\\begin{pspicture}(0,0)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\end{pspicture}").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    IRectangle rec1 = (IRectangle)group.getShapeAt(1);
    IRectangle rec2 = (IRectangle)group.getShapeAt(2);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(0., grid.getPosition().getX(), 0.001);
    assertEquals(0., grid.getPosition().getY(), 0.001);
    assertEquals(0., rec1.getPosition().getX(), 0.001);
    assertEquals(0., rec1.getPosition().getY(), 0.001);
    assertEquals(IShape.PPC, rec2.getPosition().getX(), 0.001);
    assertEquals(-(double)IShape.PPC, rec2.getPosition().getY(), 0.001);
  }
View Full Code Here


  @Test
  public void testBeginPsPictureWithGridAndShapesComplex() throws ParseException {
    IGroup group = parser.parsePSTCode("\\begin{pspicture}(-3,-3)(2,2)\n\\psgrid\n\\psframe(0,0)(2,2)\n\\psframe(1,1)(3,3)\n\\end{pspicture}").get(); //$NON-NLS-1$
    IGrid grid = (IGrid)group.getShapeAt(0);
    IRectangle rec1 = (IRectangle)group.getShapeAt(1);
    IRectangle rec2 = (IRectangle)group.getShapeAt(2);
    assertTrue(PSTParser.errorLogs().isEmpty());

    assertEquals(0.0, grid.getPosition().getX(), 0.001);
    assertEquals(0.0, grid.getPosition().getY(), 0.001);
    assertEquals(0., rec1.getPosition().getX(), 0.001);
    assertEquals(0., rec1.getPosition().getY(), 0.001);
    assertEquals(IShape.PPC, rec2.getPosition().getX(), 0.001);
    assertEquals(-(double)IShape.PPC, rec2.getPosition().getY(), 0.001);
  }
View Full Code Here

TOP

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

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.