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

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


  }


  @Override@Test
  public void testUpdateGeneralPathOutside() {
    ISquaredShape model = getShape();
    Path2D path;
    PathIterator pi;
    double[] coords = new double[6];
    final double thickness = 3.;
    List<Double> xs = new ArrayList<>();
    List<Double> ys = new ArrayList<>();
    double width = 100;

    model.setPosition(-10, 20);
    model.setWidth(width);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.OUT);
    view.update();
    path = view.getPath();

    pi = path.getPathIterator(null);
    assertEquals(PathIterator.SEG_MOVETO, pi.currentSegment(coords));
View Full Code Here


  }


  @Override@Test
  public void testContains1() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.INTO);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.contains(null));
    assertFalse(view.contains(ShapeFactory.createPoint(Double.NaN, 0)));
    assertFalse(view.contains(ShapeFactory.createPoint(0, Double.NaN)));
View Full Code Here

  }


  @Override@Test
  public void testContains2() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.INTO);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.contains(Double.NaN, 0));
    assertFalse(view.contains(0, Double.NaN));
    assertFalse(view.contains(Double.POSITIVE_INFINITY, 0));
View Full Code Here

  }


  @Test@Override
  public void testIntersects() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.INTO);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.intersects(null));
    assertFalse(view.intersects(new Rectangle2D.Double(Double.NaN, -25, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(15, -10, Double.NaN, 10)));
View Full Code Here



  @Test
  public void testIntersectsInto() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.INTO);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.intersects(new Rectangle2D.Double(15, -20, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(110, -25, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(15, -10, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(0, -20, 10, 10)));

    assertTrue(view.intersects(new Rectangle2D.Double(15, -21, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(109, -25, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(15, -29, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(1, -25, 10, 10)));

    assertFalse(view.intersects(new Rectangle2D.Double(14, -26, 92, 2)));
    model.setFilled(true);
    assertTrue(view.intersects(new Rectangle2D.Double(14, -26, 92, 2)));
  }
View Full Code Here

  }


  @Test
  public void testIntersectsOut() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.OUT);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.intersects(new Rectangle2D.Double(15, -43, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(113, -25, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(15, -17, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(-3, -25, 10, 10)));

    assertTrue(view.intersects(new Rectangle2D.Double(15, -42, 100, 100)));
    assertTrue(view.intersects(new Rectangle2D.Double(112, -25, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(15, -18, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(-2, -25, 10, 10)));

    assertFalse(view.intersects(new Rectangle2D.Double(10, -30, 100, 10)));
    model.setFilled(true);
    assertTrue(view.intersects(new Rectangle2D.Double(10, -30, 100, 10)));
  }
View Full Code Here



  @Test
  public void testIntersectsMiddle() {
    ISquaredShape model = getShape();
    final double thickness = 3.;

    model.setPosition(10, -20);
    model.setWidth(100);
    model.setThickness(thickness);
    model.setBordersPosition(BorderPos.MID);
    model.setHasDbleBord(false);
    view.update();

    assertFalse(view.intersects(new Rectangle2D.Double(15, -42, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(112, -25, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(15, -18, 10, 10)));
    assertFalse(view.intersects(new Rectangle2D.Double(-2, -25, 10, 10)));

    assertTrue(view.intersects(new Rectangle2D.Double(15, -41, 100, 100)));
    assertTrue(view.intersects(new Rectangle2D.Double(111, -25, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(15, -19, 10, 10)));
    assertTrue(view.intersects(new Rectangle2D.Double(-1, -25, 10, 10)));

    assertFalse(view.intersects(new Rectangle2D.Double(12, -28, 96, 6)));
    model.setFilled(true);
    assertTrue(view.intersects(new Rectangle2D.Double(12, -28, 96, 6)));
  }
View Full Code Here



  @Override@Test
  public void testUpdateDblePathInside() {
    ISquaredShape model = getShape();
    Path2D path;
    PathIterator pi;
    double[] coords = new double[6];
    final double thickness = 3.;
    final double dble = 1.;
    List<Double> xs = new ArrayList<>();
    List<Double> ys = new ArrayList<>();
    double width = 100;

    model.setPosition(-10, 20);
    model.setWidth(width);
    model.setThickness(thickness);
    model.setDbleBordSep(dble);
    model.setBordersPosition(BorderPos.INTO);
    model.setHasDbleBord(true);
    view.update();
    path = view.getPath();

    pi = path.getPathIterator(null);
    assertEquals(PathIterator.SEG_MOVETO, pi.currentSegment(coords));
View Full Code Here

  }


  @Override@Test
  public void testUpdateDblePathMiddle() {
    ISquaredShape model = getShape();
    Path2D path;
    PathIterator pi;
    double[] coords = new double[6];
    final double thickness = 3.;
    final double dble = 1.;
    List<Double> xs = new ArrayList<>();
    List<Double> ys = new ArrayList<>();
    double width = 100;

    model.setPosition(-10, 20);
    model.setWidth(width);
    model.setThickness(thickness);
    model.setDbleBordSep(dble);
    model.setBordersPosition(BorderPos.MID);
    model.setHasDbleBord(true);
    view.update();
    path = view.getPath();

    pi = path.getPathIterator(null);
    assertEquals(PathIterator.SEG_MOVETO, pi.currentSegment(coords));
View Full Code Here

  }


  @Override@Test
  public void testUpdateDblePathOutside() {
    ISquaredShape model = getShape();
    Path2D path;
    PathIterator pi;
    double[] coords = new double[6];
    final double thickness = 3.;
    final double dble = 1.;
    List<Double> xs = new ArrayList<>();
    List<Double> ys = new ArrayList<>();
    double width = 100;

    model.setPosition(-10, 20);
    model.setWidth(width);
    model.setThickness(thickness);
    model.setDbleBordSep(dble);
    model.setBordersPosition(BorderPos.OUT);
    model.setHasDbleBord(true);
    view.update();
    path = view.getPath();

    pi = path.getPathIterator(null);
    assertEquals(PathIterator.SEG_MOVETO, pi.currentSegment(coords));
View Full Code Here

TOP

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

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.