/**
   * set lat and lon by using GK coordinates
   *
   * @param strEasting Easting component
   * @param strNorthing Northing component
   */
  public void set(String strEasting, String strNorthing) {
    GkPoint gk =
        new GkPoint(
            Common.parseDouble(strEasting), Common.parseDouble(strNorthing), GkPoint.GERMAN_GK);

    this.latDec = TransformCoordinates.germanGkToWgs84(gk).latDec;
    this.lonDec = TransformCoordinates.germanGkToWgs84(gk).lonDec;
    this.utmValid = false;
  }
  /**
   * set lat and lon by using UTM coordinates
   *
   * @param strZone UTM-zone, e.g. 32U
   * @param strNorthing Northing component
   * @param strEasting Easting component
   */
  public void set(String strZone, String strNorthing, String strEasting) {
    LatLonPoint ll = new LatLonPoint();

    utm.zone_letter = strZone.charAt(strZone.length() - 1);
    utm.zone_number = Convert.toInt(strZone.substring(0, strZone.length() - 1));
    utm.northing = (float) Common.parseDouble(strNorthing);
    utm.easting = (float) Common.parseDouble(strEasting);

    ll = utm.toLatLonPoint(); // returns null if unvalit UTM-coordinates
    if (ll != null) {
      this.utmValid = true;
      this.latDec = ll.getLatitude();
      this.lonDec = ll.getLongitude();
    } else {
      this.latDec = 91;
      this.lonDec = 361;
    }
  }
 /**
  * Returns the string representation of the CWPoint Formats DD, DMM (same as CW), DMS, UTM
  *
  * @return string representation of CWPoint
  */
 public String toString(int format) {
   if (!isValid()) return MyLocale.getMsg(999, "not set");
   switch (format) {
     case DD:
       return getNSLetter()
           + " "
           + STRreplace.replace(getLatDeg(format), "-", "")
           + "° "
           + getEWLetter()
           + " "
           + STRreplace.replace(getLonDeg(format), "-", "")
           + "°";
     case CW:
       format = DMM;
       return getNSLetter()
           + " "
           + getLatDeg(format)
           + "° "
           + getLatMin(format)
           + " "
           + getEWLetter()
           + " "
           + getLonDeg(format)
           + "° "
           + getLonMin(format);
     case DMM:
       return getNSLetter()
           + " "
           + getLatDeg(format)
           + "° "
           + getLatMin(format)
           + " "
           + getEWLetter()
           + " "
           + getLonDeg(format)
           + "° "
           + getLonMin(format);
     case DMS:
       return getNSLetter()
           + " "
           + getLatDeg(format)
           + "° "
           + getLatMin(format)
           + "\' "
           + getLatSec(format)
           + "\" "
           + getEWLetter()
           + " "
           + getLonDeg(format)
           + "° "
           + getLonMin(format)
           + "\' "
           + getLonSec(format)
           + "\"";
     case UTM:
       return getUTMZone() + " E " + getUTMEasting() + " N " + getUTMNorthing();
     case LON_LAT:
       return Common.DoubleToString(lonDec, 8) + "," + Common.DoubleToString(latDec, 8);
     case LAT_LON:
       return Common.DoubleToString(latDec, 8) + "," + Common.DoubleToString(lonDec, 8);
     case GK:
       return getGermanGkCoordinates();
     default:
       return "Unknown Format: " + format;
   }
 }
  /**
   * set lat and lon
   *
   * @param strLatNS "N" or "S"
   * @param strLatDeg Degrees of Latitude
   * @param strLatMin Minutes of Latitude
   * @param strLatSec Seconds of Latitude
   * @param strLonEW "E" or "W"
   * @param strLonDeg Degrees of Longitude
   * @param strLonMin Minutes of Longitude
   * @param strLonSec Seconds of Longitude
   * @param format Format: DD, DMM, DMS
   */
  public void set(
      String strLatNS,
      String strLatDeg,
      String strLatMin,
      String strLatSec,
      String strLonEW,
      String strLonDeg,
      String strLonMin,
      String strLonSec,
      int format) {
    switch (format) {
      case DD:
        this.latDec = Common.parseDouble(strLatDeg);
        this.lonDec = Common.parseDouble(strLonDeg);
        break;
      case DMM:
        this.latDec =
            Math.abs(Common.parseDouble(strLatDeg))
                + Math.abs((Common.parseDouble(strLatMin) / 60));
        this.lonDec =
            Math.abs(Common.parseDouble(strLonDeg))
                + Math.abs((Common.parseDouble(strLonMin) / 60));
        break;
      case DMS:
        this.latDec =
            Math.abs(Common.parseDouble(strLatDeg))
                + Math.abs((Common.parseDouble(strLatMin) / 60))
                + Math.abs((Common.parseDouble(strLatSec) / 3600));
        this.lonDec =
            Math.abs(Common.parseDouble(strLonDeg))
                + Math.abs((Common.parseDouble(strLonMin) / 60))
                + Math.abs((Common.parseDouble(strLonSec) / 3600));
        break;

      default:
        this.latDec = 91;
        this.lonDec = 361;
    }
    // makeValid();
    // To avoid changing sign twice if we have something like W -34.2345
    if (strLatNS.trim().equals("S") && this.latDec > 0) this.latDec *= -1;
    if (strLonEW.trim().equals("W") && this.lonDec > 0) this.lonDec *= -1;
    this.utmValid = false;
  }