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 @Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) { public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point(); Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) { if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(parallelLine.getStartPosition(), parallelLine.getParallelValue()); point.setLocation(getStartPosition(), getParallelValue());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) { } else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(parallelLine.getEndPosition(), parallelLine.getParallelValue()); point.setLocation(getEndPosition(), getParallelValue());
} }
return point; return point;
} }
@ -35,10 +35,10 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
@Override @Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) { public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point(); Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) { if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(getStartPosition(), parallelLine.getParallelValue()); point.setLocation(parallelLine.getStartPosition(), getParallelValue());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) { } else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(getEndPosition(), parallelLine.getParallelValue()); point.setLocation(parallelLine.getEndPosition(), getParallelValue());
} }
return point; 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) { private void drawExtendedLine(Graphics g, AbstractFormParallelLine[] nearestSides) {
if (isNeedExtendedLine(nearestSides)) { if (isNeedExtendedLine(nearestSides)) {
int startX = (int) nearestSides[0].getExtendedLineStartPoint(nearestSides[1]).getX(); int startX = (int) nearestSides[1].getExtendedLineStartPoint(nearestSides[0]).getX();
int startY = (int) nearestSides[0].getExtendedLineStartPoint(nearestSides[1]).getY(); int startY = (int) nearestSides[1].getExtendedLineStartPoint(nearestSides[0]).getY();
int endX = (int) nearestSides[0].getExtendedLineEndPoint(nearestSides[1]).getX(); int endX = (int) nearestSides[1].getExtendedLineEndPoint(nearestSides[0]).getX();
int endY = (int) nearestSides[0].getExtendedLineEndPoint(nearestSides[1]).getY(); int endY = (int) nearestSides[1].getExtendedLineEndPoint(nearestSides[0]).getY();
drawExtendedLine(g, startX, startY, endX, endY); 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 @Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) { public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point(); Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) { if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getStartPosition()); point.setLocation(getParallelValue(), getStartPosition());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) { } else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getEndPosition()); point.setLocation(getParallelValue(), getEndPosition());
} }
return point; return point;
} }
@ -35,10 +35,10 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
@Override @Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) { public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point(); Point point = new Point();
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) { if (parallelLine.isVerticalCenterLineBeforeTheParallelLine(this)) {
point.setLocation(parallelLine.getParallelValue(), getStartPosition()); point.setLocation(getParallelValue(), parallelLine.getStartPosition());
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) { } else if (parallelLine.isVerticalCenterLineBehindTheParallelLine(this)) {
point.setLocation(parallelLine.getParallelValue(), getEndPosition()); point.setLocation(getParallelValue(), parallelLine.getEndPosition());
} }
return point; return point;
} }

Loading…
Cancel
Save