Browse Source

REPORT-54885 优化方法命名

feature/10.0
方磊 3 years ago
parent
commit
3e65344d93
  1. 8
      designer-form/src/main/java/com/fr/design/mainframe/AbstractFormParallelLine.java
  2. 12
      designer-form/src/main/java/com/fr/design/mainframe/FormHorizontalParallelLine.java
  3. 10
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  4. 12
      designer-form/src/main/java/com/fr/design/mainframe/FormVerticalParallelLine.java

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

@ -17,15 +17,15 @@ public abstract class AbstractFormParallelLine {
return (startPosition + endPosition) / 2;
}
abstract public Point getCenterPerpendicularLineStartPoint();
abstract public Point getStartPointOnVerticalCenterLine();
abstract public Point getCenterPerpendicularLineEndPoint(int parallelValue);
abstract public Point getEndPointOnVerticalCenterLine(int parallelValue);
public boolean isBeforeParallelLine(AbstractFormParallelLine parallelLine) {
public boolean isVerticalCenterLineBeforeTheParallelLine(AbstractFormParallelLine parallelLine) {
return this.getCenterPosition() < parallelLine.getStartPosition();
}
public boolean isBehindParallelLine(AbstractFormParallelLine parallelLine) {
public boolean isVerticalCenterLineBehindTheParallelLine(AbstractFormParallelLine parallelLine) {
return this.getCenterPosition() > parallelLine.getEndPosition();
}

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

@ -8,14 +8,14 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
}
@Override
public Point getCenterPerpendicularLineStartPoint() {
public Point getStartPointOnVerticalCenterLine() {
Point point = new Point();
point.setLocation(getCenterPosition(), parallelValue);
return point;
}
@Override
public Point getCenterPerpendicularLineEndPoint(int parallelValue) {
public Point getEndPointOnVerticalCenterLine(int parallelValue) {
Point point = new Point();
point.setLocation(getCenterPosition(), parallelValue);
return point;
@ -24,9 +24,9 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isBeforeParallelLine(parallelLine)) {
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getStartPosition(), parallelLine.getParallelValue());
} else if (isBehindParallelLine(parallelLine)) {
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getEndPosition(), parallelLine.getParallelValue());
}
return point;
@ -35,9 +35,9 @@ public class FormHorizontalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isBeforeParallelLine(parallelLine)) {
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(getStartPosition(), parallelLine.getParallelValue());
} else if (isBehindParallelLine(parallelLine)) {
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(getEndPosition(), parallelLine.getParallelValue());
}
return point;

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

@ -73,10 +73,10 @@ public class FormSpacingLineDrawer {
return;
}
int startX = (int) nearestSides[0].getCenterPerpendicularLineStartPoint().getX();
int startY = (int) nearestSides[0].getCenterPerpendicularLineStartPoint().getY();
int endX = (int) nearestSides[0].getCenterPerpendicularLineEndPoint(nearestSides[1].getParallelValue()).getX();
int endY = (int) nearestSides[0].getCenterPerpendicularLineEndPoint(nearestSides[1].getParallelValue()).getY();
int startX = (int) nearestSides[0].getStartPointOnVerticalCenterLine().getX();
int startY = (int) nearestSides[0].getStartPointOnVerticalCenterLine().getY();
int endX = (int) nearestSides[0].getEndPointOnVerticalCenterLine(nearestSides[1].getParallelValue()).getX();
int endY = (int) nearestSides[0].getEndPointOnVerticalCenterLine(nearestSides[1].getParallelValue()).getY();
drawSpacingLine(g, startX, startY, endX, endY);
drawSpacingText(g, String.valueOf(gap), (startX + endX) / 2, (startY + endY) / 2);
@ -140,7 +140,7 @@ public class FormSpacingLineDrawer {
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
return nearestSides[0].isBeforeParallelLine(nearestSides[1]) || nearestSides[0].isBehindParallelLine(nearestSides[1]);
return nearestSides[0].isVerticalCenterLineBeforeTheParallelLine(nearestSides[1]) || nearestSides[0].isVerticalCenterLineBehindTheParallelLine(nearestSides[1]);
}
private boolean isSelectedRootPane() {

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

@ -8,14 +8,14 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
}
@Override
public Point getCenterPerpendicularLineStartPoint() {
public Point getStartPointOnVerticalCenterLine() {
Point point = new Point();
point.setLocation(parallelValue, getCenterPosition());
return point;
}
@Override
public Point getCenterPerpendicularLineEndPoint(int parallelValue) {
public Point getEndPointOnVerticalCenterLine(int parallelValue) {
Point point = new Point();
point.setLocation(parallelValue, getCenterPosition());
return point;
@ -24,9 +24,9 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineStartPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isBeforeParallelLine(parallelLine)) {
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getStartPosition());
} else if (isBehindParallelLine(parallelLine)) {
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), parallelLine.getEndPosition());
}
return point;
@ -35,9 +35,9 @@ public class FormVerticalParallelLine extends AbstractFormParallelLine {
@Override
public Point getExtendedLineEndPoint(AbstractFormParallelLine parallelLine) {
Point point = new Point();
if (isBeforeParallelLine(parallelLine)) {
if (isVerticalCenterLineBeforeTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), getStartPosition());
} else if (isBehindParallelLine(parallelLine)) {
} else if (isVerticalCenterLineBehindTheParallelLine(parallelLine)) {
point.setLocation(parallelLine.getParallelValue(), getEndPosition());
}
return point;

Loading…
Cancel
Save