예제 #1
0
    public static SexagesimalAngle FromDouble(double angleInDegrees)
    {
        //ensure the value will fall within the primary range [-180.0..+180.0]
        while (angleInDegrees < -180.0)
        {
            angleInDegrees += 360.0;
        }
        while (angleInDegrees > 180.0)
        {
            angleInDegrees -= 360.0;
        }
        var result = new SexagesimalAngle();

        //switch the value to positive
        result.IsNegative = angleInDegrees < 0;
        angleInDegrees    = Math.Abs(angleInDegrees);
        //gets the degree
        result.Degrees = (int)Math.Floor(angleInDegrees);
        var delta = angleInDegrees - result.Degrees;
        //gets minutes and seconds
        var seconds = (int)Math.Floor(3600.0 * delta);

        result.Seconds = seconds % 60;
        result.Minutes = (int)Math.Floor(seconds / 60.0);
        delta          = delta * 3600.0 - seconds;
        //gets fractions
        result.Milliseconds = (int)(1000.0 * delta);
        return(result);
    }
예제 #2
0
        private async Task QueryAxisPosition(IMountInfo mountInfo, MountAxis axis)
        {
            byte[] command = this._commonCommandBuilder.BuildGetAxisPositionCommand(axis);

            byte[] response = await this.SendRecieveCommand(mountInfo.WifiMount, command).ConfigureAwait(false);

            if (!base.ValidateResponse(response))
            {
                return;
            }

            double steps = this._commonCommandParser.ParseAxisPositionResponse(response);

            mountInfo.MountState.AxisPositions[(int)axis] = Conversion.StepToAngle(mountInfo.MountState.StepCoefficients[(int)axis].FactorStepToRad, steps);

            mountInfo.MountState.AxisSexagesimalAngles[(int)axis] = SexagesimalAngle.FromDouble(Maths.RadToDeg(mountInfo.MountState.AxisPositions[(int)axis]));
        }
예제 #3
0
        public void UpdateInfo(DashCamFileInfo gps, int pointIdx)
        {
            if (pointIdx >= 0)
            {
                GpsPointData inf = gps[pointIdx];

                compass.Direction = inf.Course;

                txtSpeed.Text = "Speed: " + inf.SpeedMph.ToString("0.0 mph");
                txtLat.Text   = "Lattitude:  " + SexagesimalAngle.ToString(inf.Latitude);
                txtLon.Text   = "Longtitude: " + SexagesimalAngle.ToString(inf.Longitude);
                txtTime.Text  = inf.FixTime.AddHours(gps.TimeZone).ToString("yyyy/MM/dd HH:mm:ss");
            }
            else
            {
                compass.Direction = 0;

                txtSpeed.Text = "Speed: N/A";
                txtLat.Text   = "...";
                txtLon.Text   = "...";
                txtTime.Text  = "...";
            }
        }
예제 #4
0
 public static SqlSexagesimalAngle Parse(SqlString s)
 {
     return(s.IsNull ? Null : new SqlSexagesimalAngle(SexagesimalAngle.Parse(s.Value, CultureInfo.InvariantCulture)));
 }
예제 #5
0
 public SqlSexagesimalAngle(SexagesimalAngle angle)
 {
     _value = angle;
 }