|
|
@ -630,15 +630,17 @@ public class QuestionService implements IQuestionService { |
|
|
|
public int line; |
|
|
|
/** 第几个点 */ |
|
|
|
public int point; |
|
|
|
public int x; |
|
|
|
public int y; |
|
|
|
|
|
|
|
public PointPosition(){} |
|
|
|
public PointPosition(int value, int line, int point) { |
|
|
|
public PointPosition(int value, int line, int point, int x, int y) { |
|
|
|
this.value = value; |
|
|
|
this.line = line; |
|
|
|
this.point = point; |
|
|
|
} |
|
|
|
|
|
|
|
public void change(int value, int line, int point) { |
|
|
|
public void change(int value, int line, int point, int x, int y) { |
|
|
|
this.value = value; |
|
|
|
this.line = line; |
|
|
|
this.point = point; |
|
|
@ -724,11 +726,11 @@ public class QuestionService implements IQuestionService { |
|
|
|
int x = Integer.parseInt(split1[0]); |
|
|
|
int y = Integer.parseInt(split1[1]); |
|
|
|
if (!hadValue) { |
|
|
|
minX = new PointPosition(x, i, j); |
|
|
|
maxX = new PointPosition(x, i, j); |
|
|
|
minY = new PointPosition(y, i, j); |
|
|
|
minX = new PointPosition(x, i, j, x, y); |
|
|
|
maxX = new PointPosition(x, i, j, x, y); |
|
|
|
minY = new PointPosition(y, i, j, x, y); |
|
|
|
|
|
|
|
maxY = new PointPosition(y, i, j); |
|
|
|
maxY = new PointPosition(y, i, j, x, y); |
|
|
|
|
|
|
|
hadValue = true; |
|
|
|
continue; |
|
|
@ -736,15 +738,15 @@ public class QuestionService implements IQuestionService { |
|
|
|
|
|
|
|
// 最大最小横坐标
|
|
|
|
if (minX.value > x) { |
|
|
|
minX.change(x,i,j); |
|
|
|
minX.change(x,i,j, x, y); |
|
|
|
} else if (maxX.value < x) { |
|
|
|
maxX.change(x,i,j); |
|
|
|
maxX.change(x,i,j, x, y); |
|
|
|
} |
|
|
|
// 最大最小纵坐标
|
|
|
|
if (minY.value > y) { |
|
|
|
minY.change(y,i,j); |
|
|
|
minY.change(y,i,j, x, y); |
|
|
|
} else if (maxY.value < y) { |
|
|
|
maxY.change(y,i,j); |
|
|
|
maxY.change(y,i,j, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -818,32 +820,39 @@ public class QuestionService implements IQuestionService { |
|
|
|
parameter.setReflectOnTime(reflectOnTime); |
|
|
|
// 落笔总时长
|
|
|
|
parameter.setPaintTime(paintTime); |
|
|
|
//计算中心
|
|
|
|
|
|
|
|
// 计算原点(画板中心) 画板是否为canvas的一半
|
|
|
|
int canvasHeight = htPatientCanvas.getCanvasHeight(); |
|
|
|
int canvasWidth = htPatientCanvas.getCanvasWidth(); |
|
|
|
boolean half = question.getOperateType() == Constant.Ht.Operation.PAINT_HALF || |
|
|
|
question.getOperateType() == Constant.Ht.Operation.PAINT_HALF_IMG; |
|
|
|
int centerX = half ? (canvasWidth / 2 + 30) / 2 : canvasWidth / 2; |
|
|
|
int centerY = canvasHeight / 2; |
|
|
|
|
|
|
|
//计算图形中心
|
|
|
|
int x = (maxX.value + minX.value) / 2; |
|
|
|
int y = (maxY.value + minY.value) / 2; |
|
|
|
String centreCoordinate = x + "," + y; |
|
|
|
parameter.setCentreCoordinate(centreCoordinate); |
|
|
|
parameter.setShowCentreCoordinate((x-centerX) + "," + (y-centerY)); |
|
|
|
// TODO 重心
|
|
|
|
parameter.setBarycenterCoordinate(centreCoordinate); |
|
|
|
//最小长方形面积
|
|
|
|
double acreage = (maxX.value - minX.value) * (maxY.value - minY.value); |
|
|
|
parameter.setMinRectangleAcreage(acreage); |
|
|
|
|
|
|
|
// 计算四个边界点构成的长方形距离画板重心的距离
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 四个边界点 + 最小圆面积 四舍五入 sqrt
|
|
|
|
int radiusSqrt = setFourPoint(canvasPoints, minX, maxX, minY, maxY, x, y); |
|
|
|
parameter.setMinCircleAcreage(new BigDecimal(Math.PI * radiusSqrt).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
// 计算四个边界点构成的长方形距离画板重心的距离
|
|
|
|
int canvasHeight = htPatientCanvas.getCanvasHeight(); |
|
|
|
int canvasWidth = htPatientCanvas.getCanvasWidth(); |
|
|
|
|
|
|
|
// 画板是否为canvas的一半
|
|
|
|
boolean half = question.getOperateType() == Constant.Ht.Operation.PAINT_HALF || |
|
|
|
question.getOperateType() == Constant.Ht.Operation.PAINT_HALF_IMG; |
|
|
|
int centerX = half ? (canvasWidth / 2 + 30) / 2 : canvasWidth / 2; |
|
|
|
int centerY = canvasHeight / 2; |
|
|
|
parameter.setTopLength(Math.abs(minY.value - centerY)); |
|
|
|
parameter.setBottomLength(Math.abs(maxY.value - centerY)); |
|
|
|
parameter.setLeftLength(Math.abs(minX.value - centerX)); |
|
|
|
parameter.setRightLength(Math.abs(maxX.value - centerX)); |
|
|
|
parameter.setTop(new QuestionVo.Coordinate(minY.x - centerX, minY.y - centerY)); |
|
|
|
parameter.setBottom(new QuestionVo.Coordinate(maxY.x - centerX, maxY.y - centerY)); |
|
|
|
parameter.setLeft(new QuestionVo.Coordinate(minX.x - centerX, minX.y - centerY)); |
|
|
|
parameter.setRight(new QuestionVo.Coordinate(maxX.x - centerX, maxX.y - centerY)); |
|
|
|
|
|
|
|
//平均长度
|
|
|
|
BigDecimal aveLength = BigDecimal.valueOf(totalLength / canvasPoints.size()).setScale(2, RoundingMode.HALF_UP); |
|
|
@ -867,7 +876,7 @@ public class QuestionService implements IQuestionService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置 四个特殊点 |
|
|
|
* 设置 四个特殊点,计算中心点、四个特殊点相对原点(画板中心)的距离 计算点到中心点距离的平方的最大值 |
|
|
|
* @param canvasPoints 记录 |
|
|
|
* @param minX 最左点 |
|
|
|
* @param maxX 最右点 |
|
|
|