package com.yssh.entity; import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; import com.fasterxml.jackson.annotation.JsonIgnore; import com.yssh.utils.CalculateUtils; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.ToString; @ToString public class DistanceSuYuan implements Serializable, Comparable { private static final long serialVersionUID = -115407591473808022L; private String name; private String vocsName; private double vocsValue; private String id; @JsonIgnore private Integer x; @JsonIgnore private Integer y; @JsonIgnore private double u; @JsonIgnore private double v; @JsonIgnore private String addr; private double windSpeed; private double windDirection; private double lon; private double lat; public DistanceSuYuan() { } public DistanceSuYuan(String name, String vocsName, double vocsValue, String id, Integer x, Integer y, double u, double v, String addr, double windSpeed, double windDirection, double lon, double lat) { this.name = name; this.vocsName = vocsName; this.vocsValue = vocsValue; this.id = id; this.x = x; this.y = y; this.u = u; this.v = v; this.addr = addr; this.windSpeed = windSpeed; this.windDirection = windDirection; this.lon = lon; this.lat = lat; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Integer getX() { return x; } public void setX(Integer x) { this.x = x; } public Integer getY() { return y; } public void setY(Integer y) { this.y = y; } public double getLon() { return CalculateUtils.getLon(x, y); } public double getLat() { return CalculateUtils.getLat(x, y); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getVocsName() { return vocsName; } public void setVocsName(String vocsName) { this.vocsName = vocsName; } public double getVocsValue() { return vocsValue; } public void setVocsValue(double vocsValue) { this.vocsValue = vocsValue; } public void setU(double u) { this.u = u; } public void setV(double v) { this.v = v; } public double getWindSpeed() { return new BigDecimal(CalculateUtils.getWindSpeed(v, u)).setScale(2, RoundingMode.HALF_UP).doubleValue(); } public double getWindDirection() { return new BigDecimal(CalculateUtils.getWindDirection(v, u)).setScale(2, RoundingMode.HALF_UP).doubleValue(); } @Override public int compareTo(DistanceSuYuan o) { if (vocsValue > o.getVocsValue()) { return -1; } else if (vocsValue == o.getVocsValue()) { return 0; } return 1; } public double getU() { return u; } public double getV() { return v; } public void setWindSpeed(double windSpeed) { this.windSpeed = windSpeed; } public void setWindDirection(double windDirection) { this.windDirection = windDirection; } public void setLon(double lon) { this.lon = lon; } public void setLat(double lat) { this.lat = lat; } public String getAddr() { return addr; } public void setAddr(String addr) { this.addr = addr; } }