Introduce MapGrid and MapDatum enums
- Added `MapGrid` enum to define grid types and associated projection methods. - Added `MapDatum` enum to represent geodetic datums with relevant parameters and calculations.
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
package dev.coph.flightscore.backend.map;
|
||||||
|
|
||||||
|
public enum MapDatum {
|
||||||
|
WGS84("World Geodetic System 1984", 6378137.0, 298.257223563, 0.0, 0.0),
|
||||||
|
ETRS89("European Terrestrial Reference System 1989", 6378137.0, 298.257222101, 0.0, 0.0),
|
||||||
|
NAD83("North American Datum 1983", 6378137.0, 298.257222101, 0.0, 0.0),
|
||||||
|
CH1903("Swiss MN03", 6377397.155, 299.1528128, 600000.0, 200000.0),
|
||||||
|
CH1903_PLUS("Swiss MN95", 6377397.155, 299.1528128, 2600000.0, 1200000.0),
|
||||||
|
OGB1936("OSGB 1936 / British National Grid", 6377563.396, 299.3249646, 400000.0, -100000.0),
|
||||||
|
LKS94("Lithuania 1994", 6378137.0, 298.257222101, 500000.0, 0.0),
|
||||||
|
SWEREF99("Swedish Reference Frame 1999", 6378137.0, 298.257222101, 150000.0, 0.0),
|
||||||
|
TWD67("Taiwan Datum 1967", 6378160.0, 298.25, 250000.0, 0.0),
|
||||||
|
TWD97("Taiwan Datum 1997", 6378137.0, 298.257222101, 250000.0, 0.0),
|
||||||
|
AGD1966("Australian Geodetic Datum 1966", 6378160.0, 298.25, 500000.0, 10000000.0),
|
||||||
|
ED50("European Datum 1950", 6378388.0, 297.0, 500000.0, 0.0);
|
||||||
|
|
||||||
|
private final String displayName;
|
||||||
|
private final double semiMajorAxis;
|
||||||
|
private final double inverseFlattening;
|
||||||
|
private final double falseEasting;
|
||||||
|
private final double falseNorthing;
|
||||||
|
|
||||||
|
MapDatum(String displayName, double semiMajorAxis, double inverseFlattening, double falseEasting, double falseNorthing) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
this.semiMajorAxis = semiMajorAxis;
|
||||||
|
this.inverseFlattening = inverseFlattening;
|
||||||
|
this.falseEasting = falseEasting;
|
||||||
|
this.falseNorthing = falseNorthing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double semiMajorAxis() {
|
||||||
|
return semiMajorAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double inverseFlattening() {
|
||||||
|
return inverseFlattening;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double falseEasting() {
|
||||||
|
return falseEasting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double falseNorthing() {
|
||||||
|
return falseNorthing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double flattening() {
|
||||||
|
return 1.0 / inverseFlattening;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double semiMinorAxis() {
|
||||||
|
return semiMajorAxis * (1.0 - flattening());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.coph.flightscore.backend.map;
|
||||||
|
|
||||||
|
public enum MapGrid {
|
||||||
|
LAT_LONG("Lat/Long", "Geographic"),
|
||||||
|
UTM("Universal Transverse Mercator", "Transverse Mercator"),
|
||||||
|
SWISS_GRID("Swiss Grid", "Oblique Mercator"),
|
||||||
|
BRITISH_NATIONAL_GRID("British National Grid", "Transverse Mercator"),
|
||||||
|
LITHUANIA_TM("Lithuania TM", "Transverse Mercator"),
|
||||||
|
SWEREF_99_TM("SWEREF 99 TM", "Transverse Mercator"),
|
||||||
|
TWD67_TM2("TWD67 TM2", "Transverse Mercator"),
|
||||||
|
TWD97_TM2("TWD97 TM2", "Transverse Mercator"),
|
||||||
|
BNG_OGB_7("BNG OGB-7", "Transverse Mercator"),
|
||||||
|
BNG_OGB_M("BNG OGB-M", "Transverse Mercator");
|
||||||
|
|
||||||
|
private final String displayName;
|
||||||
|
private final String projectionType;
|
||||||
|
|
||||||
|
MapGrid(String displayName, String projectionType) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
this.projectionType = projectionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String projectionType() {
|
||||||
|
return projectionType;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user