From 821ef73086172840c2e4f5f0a64d9c599b6ecd9a Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Fri, 17 Feb 2017 12:00:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4PMD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/beans/location/MoveUtils.java | 5 +++-- .../src/com/fr/design/mainframe/ConnectorHelper.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/beans/location/MoveUtils.java b/designer_base/src/com/fr/design/beans/location/MoveUtils.java index fcd4f90eee..1e110358ce 100644 --- a/designer_base/src/com/fr/design/beans/location/MoveUtils.java +++ b/designer_base/src/com/fr/design/beans/location/MoveUtils.java @@ -16,6 +16,7 @@ import java.util.ArrayList; public class MoveUtils { public static final int SORPTION_UNIT = 5; + private static final int EQUIDISTANTLINE_UNIT = 4; public static WidgetForbidWindow widgetForbidWindow = new WidgetForbidWindow(); @@ -479,10 +480,10 @@ public class MoveUtils { } private static void processEquidistantLinesList(PlacePointing pEquidistantX, PlacePointing pEquidistantY, Rectangle operatingRectangle){ - EquidistantLine[] equidistantLines1 = new EquidistantLine[4]; + EquidistantLine[] equidistantLines1 = new EquidistantLine[EQUIDISTANTLINE_UNIT]; //先按方向处理,只保留四个方向上距离最近 for(int count = 0; count < equidistantLines.size(); count++){ - for (int direction = 0; direction < 4; direction++){ + for (int direction = 0; direction < EQUIDISTANTLINE_UNIT; direction++){ if(equidistantLines.get(count).getDirection() == (direction + 1)){//direction 1,2,3,4 分别对应top,left,bottom,right if(equidistantLines1[direction] != null && equidistantLines1[direction].getDistance() > equidistantLines.get(count).getDistance() diff --git a/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java b/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java index 0c4bdd2be6..b4d8972818 100644 --- a/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java +++ b/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java @@ -20,7 +20,7 @@ public class ConnectorHelper { public static final int NEAR = 5; private static double ratio = 0.5; // TODO 为了消除魔术数错误,我不清楚这个15代表什么,先这样命名了,原作者看到了请改一下 - private final static int magicNumber1 = 15; + private final static int MAGICNUMBER = 15; private ArrayList drawingPoint; private FormDesigner designer; private boolean drawing; @@ -88,7 +88,7 @@ public class ConnectorHelper { public void createDefalutLine() { if (drawingPoint != null && drawingPoint.size() > 1 - && ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > magicNumber1) { + && ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > MAGICNUMBER) { ((XWAbsoluteLayout) designer.getRootComponent()).addConnector(new Connector().addAll(drawingPoint)); } drawingPoint = null;