package com.fdkankan.scene.dto; import lombok.Data; import java.util.Objects; /** * @author Xiewj * @date 2021/11/9 */ @Data public class GeoPoint { public GeoPoint() { } public GeoPoint(Double lon, Double lat) { this.lon = lon; this.lat = lat; } public GeoPoint(Double[] point) { if (point != null && point.length != 0) { if (point.length == 1) { this.lon = point[0]; } else { this.lon = point[0]; this.lat = point[1]; } } else { this.lon = 0.0D; this.lat = 0.0D; } } public Double[] getCoordinates() { if(Objects.isNull(this.lon) || Objects.isNull(this.lat) || Objects.isNull(this.alt)){ return new Double[]{}; } return new Double[]{this.lon, this.lat, this.alt}; } public void setCoordinates(Double[] coordinates) { if (coordinates != null && coordinates.length != 0) { if (coordinates.length == 1) { this.lon = coordinates[0]; } else { this.lon = coordinates[0]; this.lat = coordinates[1]; this.alt = coordinates[2]; } } else { this.lon = 0.0D; this.lat = 0.0D; this.alt = 0.0D; } } /* 经度 */ private Double lon; /* 纬度 */ private Double lat; private Double alt; private Double[] location; private Long id; private Long uuid; private int statusIndicator; private boolean pointA; private boolean pointB; }