Commit 03253f08 authored by lizhichao's avatar lizhichao

1

parent 6522b5e0
......@@ -28,12 +28,12 @@ public class Test {
/**
* 圆点x轴
*/
private int x;
private double x;
/**
* 圆点y轴
*/
private int y;
private double y;
/**
* 圆点大小
......
......@@ -91,11 +91,11 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
List<TransferCardVo> transferCardVos = transferRelationshipMapper.selectTransferCard();
/**----------------------------------计算中心点位置 开始------------------------------------*/
/**计算中心点方法*/
List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos);
// List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos);
/**----------------------------------计算中心点位置 结束------------------------------------*/
List list=new ArrayList();
int centerPointX = 0;
int centerPointY = 0;
double centerPointX = 0;
double centerPointY = 0;
//重复次数
int repeatFrequency = 0;
//存储所有大圆的四角X Y轴数据
......@@ -104,17 +104,17 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
for (int i=0;i<transferCardVos.size();i++){
//是否重叠
boolean overlap=false;
if (!overlap){
centerPointVoList.get(i).setX(centerPointVoList.get(i).getX()+20);
centerPointVoList.get(i).setY(centerPointVoList.get(i).getY());
}
// if (!overlap){
// centerPointVoList.get(i).setX(centerPointVoList.get(i).getX()+20);
// centerPointVoList.get(i).setY(centerPointVoList.get(i).getY());
// }
//生成颜色
Colour colour=new Colour();
String code=colour.getColour();
Test test=new Test();
test.setId(transferCardVos.get(i).getBankCardNo());
test.setX((int)(Math.random()*5000));
test.setY((int)(Math.random()*5000));
test.setX((float)(Math.random()*5000));
test.setY((float)(Math.random()*5000));
test.setName(transferCardVos.get(i).getName());
test.setColor(code);
centerPointX=test.getX();
......@@ -183,14 +183,14 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
overlap=true;
}else {
for (int p=0;p<i;p++){
int zX = (int) xyMap.get(p + "zX");
int zY = (int) xyMap.get(p + "zY");
int yX = (int) xyMap.get(p + "yX");
int yY = (int) xyMap.get(p + "yY");
int sX = (int) xyMap.get(p + "sX");
int sY = (int) xyMap.get(p + "sY");
int xX = (int) xyMap.get(p + "xX");
int xY = (int) xyMap.get(p + "xY");
double zX = (double) xyMap.get(p + "zX");
double zY = (double) xyMap.get(p + "zY");
double yX = (double) xyMap.get(p + "yX");
double yY = (double) xyMap.get(p + "yY");
double sX = (double) xyMap.get(p + "sX");
double sY = (double) xyMap.get(p + "sY");
double xX = (double) xyMap.get(p + "xX");
double xY = (double) xyMap.get(p + "xY");
if(((zX>(centerPointX-fullCircleRadius)&&zX>(centerPointX+fullCircleRadius)) ||(yX<(centerPointX-fullCircleRadius)&&yX<(centerPointX+fullCircleRadius)))
||
((sY>(centerPointY-fullCircleRadius)&&sY>(centerPointY+fullCircleRadius)) ||(xY<(centerPointY-fullCircleRadius)&&xY<(centerPointY+fullCircleRadius)))){
......@@ -226,15 +226,17 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/**圆圈层数 每循环一次 就是一圈*/
for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=2;
/**圆分成四份 每份多少点数*/
float pointsPerShare = base/4;
float pointsPerShare = base;
/**每份点数 / 90度 算出每个点数的度数*/
float number=90/pointsPerShare;
int eachDegree = (int)Math.ceil(number);
double eachDegree=360/pointsPerShare;
// double eachDegree = (int)Math.ceil(number);
/**小圆半径 点数X距离*/
int circleRadius = (int) (pointsPerShare * distance);
// double circleRadius = (double) (pointsPerShare * distance/4);
double circleRadius=15*y;
/**右下角逐渐递减*/
int lowerRight = 0;
/**左下角逐渐递减*/
......@@ -246,70 +248,27 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
if (base<=total){
for (int t=0;t<base;t++){
Test test1=new Test();
if (t<pointsPerShare){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
test1.setY(centerPointY-a);
test1.setColor(code);
test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
test1.setY(centerPointY-a);
test1.setColor(code);
test1.setSize(pointSize);
lowerRight++;
}else if (t<=pointsPerShare*3){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
test1.setY(centerPointY-a);
test1.setColor(code);
test1.setSize(pointSize);
lowerLeft++;
}else if (t<=pointsPerShare*4){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
test1.setY(centerPointY-a);
test1.setColor(code);
test1.setSize(pointSize);
upperLeft++;
}
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
//算出A角度数 (每份点数-t)* 每点度数
double Adegrees = (double) ((pointsPerShare-t) * eachDegree);
//Y轴
double a= (double) (circleRadius*Math.cos(Adegrees));
//X轴
double b= (double) (circleRadius*Math.sin(Adegrees));
// if(y>=3){
// System.out.println("y:"+y+",角度:"+Adegrees+",Y轴:"+a+",X轴:"+b);
// }
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
test1.setY(centerPointY-a);
test1.setColor(code);
test1.setSize(pointSize);
list.add(test1);
numberCycles++;
}
total=total-base;
base = base+(y*45);
base = base+(40);
continue;
}
if (base>0){
......@@ -319,9 +278,9 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
double a= (double) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
double b= (double) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
......@@ -330,11 +289,11 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
double Adegrees = (double) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
double a= (double) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
double b= (double) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
......@@ -344,11 +303,11 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
lowerRight++;
}else if (t<=pointsPerShare*3){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
double Adegrees = (double) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
double a= (double) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
double b= (double) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
......@@ -358,11 +317,11 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
lowerLeft++;
}else if (t<=pointsPerShare*4){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
double Adegrees = (double) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
double a= (double) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
double b= (double) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX+b);
......@@ -374,7 +333,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
// list.add(test1);
list.add(test1);
numberCycles++;
}
break;
......@@ -1046,4 +1005,14 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}
return new Result(ResultCode.SUCCESS,echartsTrBetweenTwoPersonsVosList);
}
// y:3,角度:121.09090828895569,Y轴:-6.261220312519955,X轴:44.56228360618526
// y:3,角度:117.81818103790283,Y轴:0.38053923723796884,X轴:-44.998390969999384
public static void main(String []args){
double jiao=117.81818103790283;
double a=Math.cos(jiao)*33;
double b=Math.sin(jiao)*33;
System.out.println(a+"-"+b);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment