Пример #1
0
  public void update(Point2D center, Dimension2D dim) {
    moveTo1.setX(center.getX() - 10);
    moveTo1.setY(center.getY());

    lineTo1.setX(center.getX() + 10);
    lineTo1.setY(center.getY());

    moveTo2.setX(center.getX());
    moveTo2.setY(center.getY() - 10);

    lineTo2.setX(center.getX());
    lineTo2.setY(center.getY() + 10);
  }
Пример #2
0
  public ObservableList<PathElement> pathChanger(
      ObservableList<PathElement> elements, double angle) {
    MoveTo moveTo = (MoveTo) elements.get(0);
    LineTo lineToSecond = (LineTo) elements.get(1);
    LineTo lineToThird = (LineTo) elements.get(2);
    LineTo lineToFourth = (LineTo) elements.get(3);
    LineTo lineToFifth = (LineTo) elements.get(4);
    LineTo lineToSixth = (LineTo) elements.get(5);
    LineTo lineToSeventh = (LineTo) elements.get(6);
    LineTo lineToEighth = (LineTo) elements.get(7);

    double x = moveTo.getX();
    double y = moveTo.getY();
    double[] res = rotationCoordinates(new double[] {x, y}, angle);

    moveTo.setX(res[0]);
    moveTo.setY(res[1]);

    x = lineToSecond.getX();
    y = lineToSecond.getY();

    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSecond.setX(res[0]);
    lineToSecond.setY(res[1]);

    x = lineToThird.getX();
    y = lineToThird.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToThird.setX(res[0]);
    lineToThird.setY(res[1]);

    x = lineToFourth.getX();
    y = lineToFourth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToFourth.setX(res[0]);
    lineToFourth.setY(res[1]);

    x = lineToFifth.getX();
    y = lineToFifth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToFifth.setX(res[0]);
    lineToFifth.setY(res[1]);

    x = lineToSixth.getX();
    y = lineToSixth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSixth.setX(res[0]);
    lineToSixth.setY(res[1]);

    x = lineToSeventh.getX();
    y = lineToSeventh.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSeventh.setX(res[0]);
    lineToSeventh.setY(res[1]);

    x = lineToEighth.getX();
    y = lineToEighth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToEighth.setX(res[0]);
    lineToEighth.setY(res[1]);

    elements.remove(0, 8);
    elements.add(0, moveTo);
    elements.add(1, lineToSecond);
    elements.add(2, lineToThird);
    elements.add(3, lineToFourth);
    elements.add(4, lineToFifth);
    elements.add(5, lineToSixth);
    elements.add(6, lineToSeventh);
    elements.add(7, lineToEighth);
    return elements;
  }