Loading app/src/js/AstroMath.js +8 −21 Original line number Diff line number Diff line import { MY_JSON_MAPS } from "./layers"; /** * @class AstroMath * @classdesc A helper class that can be used by any mapping application, not just Leaflet, to calculate different * longitude and latitude domains and ranges for a specific target. * It uses a JSON file in the background to store the targets and their associated radii. * @param {String} targetName - the name of the specific target. * @param {String} targetName - The name of the specific target. * @param {Dictionary} radii - The radii of the target in the form {"a": , "c": } */ export default class AstroMath { constructor(targetName) { constructor(targetName, radii) { this.targetName = targetName; let targets = MY_JSON_MAPS["targets"]; for (let i = 0; i < targets.length; i++) { let currentTarget = targets[i]; if ( currentTarget["name"].toLowerCase() == this.targetName.toLowerCase() ) { this.dMajorRadius = parseFloat(currentTarget["aaxisradius"] * 1000); this.dMinorRadius = parseFloat(currentTarget["caxisradius"] * 1000); break; } } this.majorRadius = radii["a"]; this.minorRadius = radii["c"]; } /** Loading @@ -32,7 +19,7 @@ export default class AstroMath { * @return {double} The Major radius value. */ getMajorRadius() { return this.dMajorRadius; return this.majorRadius; } /** Loading @@ -42,7 +29,7 @@ export default class AstroMath { * @return {double} The Minor radius value. */ getMinorRadius() { return this.dMinorRadius; return this.minorRadius; } /** Loading Loading @@ -80,7 +67,7 @@ export default class AstroMath { let convertedLatitude = 0; convertedLatitude = this.toRadians(lat); convertedLatitude = Math.atan( (this.dMajorRadius / this.dMinorRadius) ** 2 * Math.tan(convertedLatitude) (this.majorRadius / this.minorRadius) ** 2 * Math.tan(convertedLatitude) ); convertedLatitude = this.toDegrees(convertedLatitude); Loading app/src/js/MousePosition.js +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ export default L.Control.MousePosition = L.Control.extend({ this.isLatTypeOcentric = true; this.isLonDirEast = true; this.astroMath = new AstroMath(map.target()); this.astroMath = new AstroMath(map.target(), map.radii()); this.lonDisplayElement = L.DomUtil.get("lonCoordinateDisplay"); this.latDisplayElement = L.DomUtil.get("latCoordinateDisplay"); this.lonDisplayElement.innerHTML = "---.---"; Loading Loading
app/src/js/AstroMath.js +8 −21 Original line number Diff line number Diff line import { MY_JSON_MAPS } from "./layers"; /** * @class AstroMath * @classdesc A helper class that can be used by any mapping application, not just Leaflet, to calculate different * longitude and latitude domains and ranges for a specific target. * It uses a JSON file in the background to store the targets and their associated radii. * @param {String} targetName - the name of the specific target. * @param {String} targetName - The name of the specific target. * @param {Dictionary} radii - The radii of the target in the form {"a": , "c": } */ export default class AstroMath { constructor(targetName) { constructor(targetName, radii) { this.targetName = targetName; let targets = MY_JSON_MAPS["targets"]; for (let i = 0; i < targets.length; i++) { let currentTarget = targets[i]; if ( currentTarget["name"].toLowerCase() == this.targetName.toLowerCase() ) { this.dMajorRadius = parseFloat(currentTarget["aaxisradius"] * 1000); this.dMinorRadius = parseFloat(currentTarget["caxisradius"] * 1000); break; } } this.majorRadius = radii["a"]; this.minorRadius = radii["c"]; } /** Loading @@ -32,7 +19,7 @@ export default class AstroMath { * @return {double} The Major radius value. */ getMajorRadius() { return this.dMajorRadius; return this.majorRadius; } /** Loading @@ -42,7 +29,7 @@ export default class AstroMath { * @return {double} The Minor radius value. */ getMinorRadius() { return this.dMinorRadius; return this.minorRadius; } /** Loading Loading @@ -80,7 +67,7 @@ export default class AstroMath { let convertedLatitude = 0; convertedLatitude = this.toRadians(lat); convertedLatitude = Math.atan( (this.dMajorRadius / this.dMinorRadius) ** 2 * Math.tan(convertedLatitude) (this.majorRadius / this.minorRadius) ** 2 * Math.tan(convertedLatitude) ); convertedLatitude = this.toDegrees(convertedLatitude); Loading
app/src/js/MousePosition.js +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ export default L.Control.MousePosition = L.Control.extend({ this.isLatTypeOcentric = true; this.isLonDirEast = true; this.astroMath = new AstroMath(map.target()); this.astroMath = new AstroMath(map.target(), map.radii()); this.lonDisplayElement = L.DomUtil.get("lonCoordinateDisplay"); this.latDisplayElement = L.DomUtil.get("latCoordinateDisplay"); this.lonDisplayElement.innerHTML = "---.---"; Loading