Commit 93caee51 authored by Kaitlyn's avatar Kaitlyn
Browse files

Removed get radius code from AstroMath.

parent 1623f7d0
Loading
Loading
Loading
Loading
+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"];
  }

  /**
@@ -32,7 +19,7 @@ export default class AstroMath {
   * @return {double} The Major radius value.
   */
  getMajorRadius() {
    return this.dMajorRadius;
    return this.majorRadius;
  }

  /**
@@ -42,7 +29,7 @@ export default class AstroMath {
   * @return {double} The Minor radius value.
   */
  getMinorRadius() {
    return this.dMinorRadius;
    return this.minorRadius;
  }

  /**
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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 = "---.---";