Browse Source

REPORT-54885 优化获取延长线方法的实现

feature/10.0
方磊 3 years ago
parent
commit
122fa10b8c
  1. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormHorizontalParallelLine.java
  2. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  3. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormVerticalParallelLine.java

16
designer-form/src/main/java/com/fr/design/mainframe/FormHorizontalParallelLine.java

@ -24,10 +24,10 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getStartPosition(), parallelLine.getParallelValue());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getEndPosition(), parallelLine.getParallelValue());
if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(getStartPosition(), getParallelValue());
} else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(getEndPosition(), getParallelValue());
}
return point;
}
@ -35,10 +35,10 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(getStartPosition(), parallelLine.getParallelValue());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(getEndPosition(), parallelLine.getParallelValue());
if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(parallelLine.getStartPosition(), getParallelValue());
} else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(parallelLine.getEndPosition(), getParallelValue());
}
return point;
}

8
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -91,10 +91,10 @@ public class FormSpacingLineDrawer {
private void drawExtendedLine(Graphics g, AbstractFormParallelLine[] nearestSides) {
if (isNeedExtendedLine(nearestSides)) {
int startX = (int) nearestSides[0].getExtendedLineStartPoint(nearestSides[1]).getX();
int startY = (int) nearestSides[0].getExtendedLineStartPoint(nearestSides[1]).getY();
int endX = (int) nearestSides[0].getExtendedLineEndPoint(nearestSides[1]).getX();
int endY = (int) nearestSides[0].getExtendedLineEndPoint(nearestSides[1]).getY();
int startX = (int) nearestSides[1].getExtendedLineStartPoint(nearestSides[0]).getX();
int startY = (int) nearestSides[1].getExtendedLineStartPoint(nearestSides[0]).getY();
int endX = (int) nearestSides[1].getExtendedLineEndPoint(nearestSides[0]).getX();
int endY = (int) nearestSides[1].getExtendedLineEndPoint(nearestSides[0]).getY();
drawExtendedLine(g, startX, startY, endX, endY);
}
}

16
designer-form/src/main/java/com/fr/design/mainframe/FormVerticalParallelLine.java

@ -24,10 +24,10 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getStartPosition());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getEndPosition());
if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(getParallelValue(), getStartPosition());
} else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(getParallelValue(), getEndPosition());
}
return point;
}
@ -35,10 +35,10 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), getStartPosition());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), getEndPosition());
if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(getParallelValue(), parallelLine.getStartPosition());
} else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(getParallelValue(), parallelLine.getEndPosition());
}
return point;
}

Loading…
Cancel
Save