Ejemplo n.º 1
0
 public Position()
 {
     this.latitude = 0;
     this.longitude = 0;
     this.altitude = 0;
     this.altitude_units = AltitudeUnits.Feet;
     this.angle_units = AngleUnits.Degrees;
 }
Ejemplo n.º 2
0
 public Position(AngleUnits angles, AltitudeUnits alts)
 {
     this.latitude = 0;
     this.longitude = 0;
     this.altitude = 0;
     this.altitude_units = alts;
     this.angle_units = angles;
 }
Ejemplo n.º 3
0
 public Angle(double value, AngleUnits units)
 {
     switch (units)
     {
         case AngleUnits.DEGREES:
             this._value = Globals.Deg2Rad(value);
             break;
         default:
             this._value = Globals.NormalizeRads(value);
             break;
     }
 }
Ejemplo n.º 4
0
 internal double GetAngle(AngleUnits units)
 {
     switch (units)
     {
         case AngleUnits.Radians:
             return AsRad;
         case AngleUnits.Grads:
             return AsGrad;
         case AngleUnits.Degrees:
             return AsDeg;
         default:
             throw new Exception("Unsupported AngleUnits: " + units.ToString());
     }
 }
        public ThunderBolt(string portName, AngleUnits au, AltitudeUnits tu, OutputPort activityLed)
        {
            _activityLed = activityLed;
            PacketQueue = new FixedSizedQueue(10);

            PacketProcessing = new Thread(new ThreadStart(worker_thread));

            position = new Position(au, tu);
            last_position = new Position(au, tu);
            m_port = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One);
            m_port.DataReceived += new SerialDataReceivedEventHandler(m_port_DataReceived);
            m_port.ErrorReceived += new SerialErrorReceivedEventHandler(m_port_ErrorReceived);
            for (int i = 0; i < 32; i++)
                Satellites[i] = new SatInfo();
        }
Ejemplo n.º 6
0
        public string ToString(AngleUnits units)
        {
            double val = 0.0;
            string suffix = "";
            switch (units)
            {
                case AngleUnits.DEGREES:
                    val = this.Degrees;
                    suffix = " deg";
                    break;
                default:
                    val = this.Rads;
                    suffix = " rad";
                    break;
            }

            string s = val.ToString("#.00000000") + suffix;

            return s;
        }
Ejemplo n.º 7
0
 internal void SetAngle(double value, AngleUnits units)
 {
     switch (units)
     {
         case AngleUnits.Radians:
             AsRad = value;
             break;
         case AngleUnits.Grads:
             AsGrad = value;
             break;
         case AngleUnits.Degrees:
             AsDeg = value;
             break;
         default:
             throw new Exception("Unsupported AngleUnits: " + units.ToString());
     }
 }
Ejemplo n.º 8
0
 public string ToString(AngleUnits units)
 {
     return ToString(units, null, DegreesFormat.DegMinSec);
 }
Ejemplo n.º 9
0
 public Angle(double value, AngleUnits units)
 {
     Value = 0.0;
     SetAngle(value, units);
 }
Ejemplo n.º 10
0
        public string ToString(AngleUnits units, string precision, DegreesFormat degFormat)
        {
            switch (units)
            {
                case AngleUnits.Radians:
                    return this.AsRad.ToString(precision);

                case AngleUnits.Grads:
                    return this.AsGrad.ToString(precision);

                case AngleUnits.Degrees:
                    return ToDegreesString(degFormat, precision);
            }
            return this.Value.ToString(precision);
        }
Ejemplo n.º 11
0
 public static Angle FromString(string s, AngleUnits units)
 {
     Angle res = new Angle();
     switch (units)
     {
         case AngleUnits.Radians:
             res.AsRad = s.ToDouble();
             break;
         case AngleUnits.Grads:
             res.AsGrad = s.ToDouble();
             break;
         case AngleUnits.Degrees:
             res.AsDeg = ConvertDegText(s);
             break;
         default:
             throw new Exception("Angle.FormString(). Not supported units: " + units.ToString());
     }
     return res;
 }