public Angle(int u, int m, double s, int sign = 1) { if (_isHMS) { //Degrees = sign * ascomutils.HMSToDegrees(string.Format("{0}:{1}:{2}", u, m, s)); Radians = Deg2Rad(sign * ascomutils.HMSToDegrees(string.Format("{0}:{1}:{2}", u, m, s))); } else { //Degrees = sign * ascomutils.DMSToDegrees(string.Format("{0}:{1}:{2}", u, m, s)); Radians = Deg2Rad(sign * ascomutils.DMSToDegrees(string.Format("{0}:{1}:{2}", u, m, s))); } }
private void LongitudeBox_Validating(object sender, CancelEventArgs e) { try { Match m = Regex.Match(LongitudeBox.Text, m_DMSRegex); double value = m.Success ? m_Util.DMSToDegrees(LongitudeBox.Text) : double.Parse(LongitudeBox.Text, NumberStyles.Number, formatProvider); m_LocationProfile.Longitude = value; LongitudeBox.Text = m_Util.DegreesToDMS(value); } catch (Exception) { e.Cancel = true; LongitudeBox.Select(0, LongitudeBox.Text.Length); } }
private RTMLRequestTargetCoordinates getCoordenadas(chase500DataSet.observationsRow rowObs) { RTMLRequestTargetCoordinates targetCoordinates; StringBuilder strRA; StringBuilder strDEC; targetCoordinates = new RTMLRequestTargetCoordinates(); strRA = new StringBuilder(); strDEC = new StringBuilder(); strRA.Append(rowObs.rahh); strRA.Append(":"); strRA.Append(rowObs.ramm); strRA.Append(":"); strRA.Append(rowObs.rass); if (rowObs.decp) { strDEC.Append("+"); } else { strDEC.Append("-"); } strDEC.Append(rowObs.decdd); strDEC.Append(":"); strDEC.Append(rowObs.decmm); strDEC.Append(":"); strDEC.Append(rowObs.decss); ASCOM.Utilities.Util util; util = new ASCOM.Utilities.Util(); targetCoordinates.RightAscension = util.HMSToDegrees(strRA.ToString()); targetCoordinates.Declination = util.DMSToDegrees(strDEC.ToString()); return(targetCoordinates); }