From 4221ebadfa15cf8baedb9f3ff4b914478f941554 Mon Sep 17 00:00:00 2001 From: Yehoshua Oliveira Date: Tue, 12 Jan 2021 15:09:20 -0300 Subject: [PATCH] feat: adds epsg code to the Datum interface --- .../skywalker/coordinateconverter/Datum.java | 2 ++ .../skywalker/coordinateconverter/Datums.java | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/br/com/skywalker/coordinateconverter/Datum.java b/src/main/java/br/com/skywalker/coordinateconverter/Datum.java index 6773972..12b40d4 100644 --- a/src/main/java/br/com/skywalker/coordinateconverter/Datum.java +++ b/src/main/java/br/com/skywalker/coordinateconverter/Datum.java @@ -14,6 +14,8 @@ public interface Datum { String name(); + int getEpsgCode(); + default boolean isEqual(Datum other) { return null != other && this.getSemiAxis() == other.getSemiAxis() && diff --git a/src/main/java/br/com/skywalker/coordinateconverter/Datums.java b/src/main/java/br/com/skywalker/coordinateconverter/Datums.java index f8ad5f2..962d35b 100644 --- a/src/main/java/br/com/skywalker/coordinateconverter/Datums.java +++ b/src/main/java/br/com/skywalker/coordinateconverter/Datums.java @@ -2,25 +2,27 @@ public enum Datums implements Datum { - NONE(0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00), - SAD69(6.3781600e+06, 3.35289187e-03, -6.735000e+01, 3.880000e+00, -3.822000e+01), - CorregoAlegre(6.3783880e+06, 3.36700337e-03, -2.060500e+02, 1.682800e+02, -3.820000e+00), - AstroChua(6.3783880e+06, 3.36700337e-03, -1.443500e+02, 2.433700e+02, -3.322000e+01), - WGS84(6.3781370e+06, 3.35281066e-03, 0.000000e+00, 0.000000e+00, 0.000000e+00), - SIRGAS2000(6.3781370e+06, 3.35281068e-03, 0.000000e+00, 0.000000e+00, 0.000000e+00); + NONE(0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0), + SAD69(6.3781600e+06, 3.35289187e-03, -6.735000e+01, 3.880000e+00, -3.822000e+01, 4618), + CorregoAlegre(6.3783880e+06, 3.36700337e-03, -2.060500e+02, 1.682800e+02, -3.820000e+00, 4225), + AstroChua(6.3783880e+06, 3.36700337e-03, -1.443500e+02, 2.433700e+02, -3.322000e+01, 4224), + WGS84(6.3781370e+06, 3.35281066e-03, 0.000000e+00, 0.000000e+00, 0.000000e+00, 4326), + SIRGAS2000(6.3781370e+06, 3.35281068e-03, 0.000000e+00, 0.000000e+00, 0.000000e+00, 4674); private double semiAxis; private double flatness; private double deltaX; private double deltaY; private double deltaZ; + private int epsgCode; - private Datums(double semiAxis, double flatness, double deltaX, double deltaY, double deltaZ) { + private Datums(double semiAxis, double flatness, double deltaX, double deltaY, double deltaZ, int epsgCode) { this.semiAxis = semiAxis; this.flatness = flatness; this.deltaX = deltaX; this.deltaY = deltaY; this.deltaZ = deltaZ; + this.epsgCode = epsgCode; } public double getSemiAxis() { @@ -43,4 +45,7 @@ public double getDeltaZ() { return deltaZ; } + public int getEpsgCode() { + return epsgCode; + } }