Skip to content

Commit

Permalink
feat: adds epsg code to the Datum interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ioxua committed Jan 12, 2021
1 parent a2c742f commit 4221eba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/main/java/br/com/skywalker/coordinateconverter/Datum.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public interface Datum {

String name();

int getEpsgCode();

default boolean isEqual(Datum other) {
return null != other &&
this.getSemiAxis() == other.getSemiAxis() &&
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/br/com/skywalker/coordinateconverter/Datums.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -43,4 +45,7 @@ public double getDeltaZ() {
return deltaZ;
}

public int getEpsgCode() {
return epsgCode;
}
}

0 comments on commit 4221eba

Please # to comment.