Commit 03253f08 authored by lizhichao's avatar lizhichao

1

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