
package org.springblade.business.entity;


import lombok.Data;
import org.springblade.business.utils.MileageUtill;
import org.springblade.business.utils.NumberUtil;

import java.io.Serializable;


@Data
public class Mileage implements Serializable {

	private static final long serialVersionUID = 1L;

	private String projectId;		// projId
	private String notes;		// notes
	private String code;		// 名称

	private Double value=0.0;		// 里程

	private Double x=0.0;		// x
	private Double y=0.0;

	private Double r=0.0;         //半径
	private Integer orderNum=0;     //顺序
	private Integer type=0;     //类型 0 起点  1交点  2终点
	private Double angle=0.0;     //方位角
	private Double corner=0.0;     //转角
	private String swing="右转";     //转向
	private Double ls1=0.0;         //第一缓和线
	private Double ls2=0.0;         //第二缓和线
	private Double l=0.0;           //曲线长
	private Double lc=0.0;          //圆曲线长
	private Double t1=0.0;          //切线长1
	private Double t2=0.0;          //切线长2
	private Double d=0.0;          //切线差
	private Double p1=0.0;          //
	private Double q1=0.0;          //
	private Double p2=0.0;          //
	private Double q2=0.0;          //
	private Double b01=0.0;
	private Double b02=0.0;
	private Double ljd=0.0;       //上个点到该点的长

	private Double zh=0.0;    //直缓点
	private Double zhx=0.0;		// x
	private Double zhy=0.0;
	private Double hy=0.0;    //缓圆点
	private Double yh=0.0;//圆缓点
	private Double hz=0.0;//缓直点
	private Double hzx=0.0;		// x
	private Double hzy=0.0;
	private Double qz=0.0;//曲中点
	private Double dlq=0.0;//   断链前里程
	private Double dlh=0.0;//断链后里程

	private Double b=0.0;//偏移  （只用于显示）
	private Double jj=90.0;//夹角  （只用于显示）
	private String ids;
	private String partNo;		// piand
	private String partId;		// piand

	private String valueup;		// 里程
	private String xup;		// x
	private String yup;
	private String rup;
	private String ls1up;         //第一缓和线
	private String ls2up;         //第二缓和线
	private String dlqup;//   断链前里程
	private String dlhup;//断链后里程



	public Mileage() {}

	public Mileage(Double value, Double x, Double y, Integer orderNum, int type) {
		this.value = value;
		this.x = x;
		this.y = y;
		this.orderNum = orderNum;
		this.type = type;
	}
	public Mileage(String code, Double x, Double y, Double r, int orderNum, Integer type, Double ls1, Double ls2, Double dlq, Double dlh) {
		this.code = code;

		this.x = x;
		this.y = y;
		this.r = r;
		this.orderNum = orderNum;
		this.type = type;
		this.ls1 = ls1;
		this.ls2 = ls2;
		this.dlq = dlq;
		this.dlh = dlh;
	}

	public String getValueStr() {
		return MileageUtill.convertToMileage(value);
	}

	public String getXxStr() {
		return NumberUtil.forcibleFormat(x,3);
	}

	public String getYyStr() {
		return NumberUtil.forcibleFormat(y,3);
	}

	public String getAngleStr() {
		return MileageUtill.convertToSexagesimal(angle);
	}

	public String getCornerStr() {
		return MileageUtill.convertToSexagesimal(corner);
	}

	public int compareTo(Mileage o) {
		return Integer.parseInt(NumberUtil.forcibleFormat(this.value*10-o.getValue()*10,0));
	}
}
