• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Azimuth类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Azimuth的典型用法代码示例。如果您正苦于以下问题:C# Azimuth类的具体用法?C# Azimuth怎么用?C# Azimuth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Azimuth类属于命名空间,在下文中一共展示了Azimuth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PolarCoordinate

 public PolarCoordinate(float r, double theta, Azimuth origin, PolarCoordinateOrientation orientation)
 {
     _R = r;
     _Theta = new Angle(theta);
     _Origin = origin;
     _Orientation = orientation;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:7,代码来源:PolarCoordinate.cs


示例2: GphdtSentence

        /// <summary>
        /// Creates a GphdtSentence from the specified parameters
        /// </summary>
        /// <param name="heading">The heading.</param>
        /// <remarks></remarks>
        public GphdtSentence(Azimuth heading)
        {
            // Build a sentence
            StringBuilder builder = new StringBuilder(128);

            #region Append the command word

            // Append the command word
            builder.Append("$GPHDT");

            #endregion Append the command word

            // Append a comma
            builder.Append(',');

            #region Append the Heading

            builder.Append(heading.DecimalDegrees);

            #endregion Append the Heading

            // Append a comma
            builder.Append(',');

            #region Append the TRUE

            builder.Append("T");

            #endregion Append the TRUE

            // Set this object's sentence
            SetSentence(builder.ToString());

            // Finally, append the checksum
            AppendChecksum();
        }
开发者ID:Bobfrat,项目名称:RTI,代码行数:41,代码来源:GphdtSentence.cs


示例3: OnSentenceChanged

        /// <summary>
        /// Called when [sentence changed].
        /// </summary>
        /// <remarks></remarks>
        protected override void OnSentenceChanged()
        {
            // Parse the basic sentence information
            base.OnSentenceChanged();

            // Cache the words
            string[] words = Words;
            int wordCount = words.Length;

            // Do we have enough words to make a heading?
            if (wordCount >= 1 && words[0].Length != 0)
            {
                #region Heading

                double heading = 0.0;
                double.TryParse(words[0], out heading);
                _heading = new Azimuth(heading);

                #endregion
            }
        }
开发者ID:Bobfrat,项目名称:RTI,代码行数:25,代码来源:GphdtSentence.cs


示例4: Randomize

        /// <summary>
        /// Randomizes the emulation by changing speed and direction
        /// </summary>
        /// <remarks>
        /// GPS coordinate emulation can be randomized by any number of factors, depending on the emulator type used.
        /// Any emulation can have it's direction and speed randomized within specified tolerances. By default, speed is 
        /// limited to between 0 (low) and 5 (high) meters/second and bearing changes are limited to +/- 45 degrees 
        /// (a 90 degree arc) from North (0) degrees.
        /// </remarks>
        public virtual void Randomize()
        {
            // Flag it so the emulation will use random values
            _isRandom = true;

            // Randomize the speed within range
            _Speed = Speed.FromMetersPerSecond((_seed.NextDouble() * (_speedHigh - _speedLow)) + _speedLow);

            // Randomize the bearing within the arc.
            _Bearing = new Azimuth(_seed.NextDouble() * _bearingArc + (_bearingStart - (_bearingArc * .5))).Normalize();

            // Reset the bearing origin
            _bearingStart = _Bearing.DecimalDegrees;
        }
开发者ID:chinnisuraj1984,项目名称:navigational,代码行数:23,代码来源:Emulator.cs


示例5: Emulator

        protected Emulator(string name)
        {
            _Name = name;

            // Create new buffers for reading and writing
            _ReadBuffer = new List<byte>(_DefaultReadBufferSize);
            _WriteBuffer = new List<byte>(_DefaultWriteBufferSize);

            // Initialize simulated values
            _ReadDataAvailableWaitHandle = new ManualResetEvent(false);
            _WriteDataAvailableWaitHandle = new ManualResetEvent(false);
            _EmulationIntervalWaitHandle = new ManualResetEvent(false);

            // Default timeouts for reading and writing
            _ReadTimeout = _DefaultReadTimeout;
            _WriteTimeout = _DefaultWriteTimeout;
            
            // Simulated values
            _seed = new Random();
            _UtcDateTime = DateTime.UtcNow;
            _CurrentPosition = GeoFramework.Position.Empty;            
            _Altitude = Distance.FromFeet(1000);
            _Route = new List<Position>();
            _Satellites = new List<Satellite>();
            _FixQuality = FixQuality.GpsFix;
            _FixMode = FixMode.Automatic;
            _FixMethod = FixMethod.Fix3D;
            _FixStatus = FixStatus.Fix;
            _HorizontalDop = DilutionOfPrecision.Good;
            _VerticalDop = DilutionOfPrecision.Good;
            _MeanDop = DilutionOfPrecision.Good;

            _Speed = Speed.FromStatuteMilesPerHour(20);
            _speedLow = Speed.FromKilometersPerSecond(10).Value;
            _speedHigh = Speed.FromKilometersPerSecond(25).Value;

            _Bearing = Azimuth.Southwest;
            _bearingStart = _seed.NextDouble() * 360;
            _bearingArc = 10;

        }
开发者ID:chinnisuraj1984,项目名称:navigational,代码行数:41,代码来源:Emulator.cs


示例6: Filter

        /// <summary>
        /// Adds a new observation and applies the filter.
        /// </summary>
        /// <param name="gpsPosition"> The new observation to add to the filter. </param>
        /// <param name="deviceError"> Does not currently affect position averaging. </param>
        /// <param name="horizontalDOP"> Does not currently affect position averaging. </param>
        /// <param name="verticalDOP"> Does not currently affect position averaging. </param>
        /// <param name="bearing"> Does not currently affect position averaging. </param>
        /// <param name="speed"> Does not currently affect position averaging. </param>
        /// <remarks>
        /// This method updates the FilteredLocation property without consideration for SampleCount.
        /// </remarks>
        public override Position3D Filter(Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Azimuth bearing, Speed speed)
        {
            this._samples.Add(gpsPosition);
            this._sampleTimes.Add(DateTime.Now);

            int count = this._samples.Count;
            int timeCount = this._sampleTimes.Count;
            int maxCount = 0;

            // Only average the number of samples specified in the constructor
            while (count > _sampleCount)
            {
                this._samples.RemoveAt(0);
                count--;
                maxCount++;
            }

            // Only 2 times are needed, oldest and most recent.
            // Try to remove as many as were removed from the sample collection.
            while (timeCount > 2 && maxCount > 0)
            {
                this._sampleTimes.RemoveAt(0);
                timeCount--;
            }

            Filter();

            return _filteredPositon;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:41,代码来源:PositionAverageFilter.cs


示例7: GprmcSentence

        /// <summary>
        /// Creates a GprmcSentence from the specified parameters
        /// </summary>
        /// <param name="utcDateTime"></param>
        /// <param name="isFixAcquired"></param>
        /// <param name="position"></param>
        /// <param name="speed"></param>
        /// <param name="bearing"></param>
        /// <param name="magneticVariation"></param>
        public GprmcSentence(DateTime utcDateTime, bool isFixAcquired, Position position, Speed speed, Azimuth bearing, Longitude magneticVariation)
        {
            // Use a string builder to create the sentence text
            StringBuilder builder = new StringBuilder(128);

            /* GPRMC sentences have the following format:
             * 
             * $GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,,*1A
             */

            // Append the command word, $GPRMC
            builder.Append("$GPRMC");

            // Append a comma
            builder.Append(',');

            #region Append the UTC time

            builder.Append(utcDateTime.Hour.ToString("0#", NmeaCultureInfo));
            builder.Append(utcDateTime.Minute.ToString("0#", NmeaCultureInfo));
            builder.Append(utcDateTime.Second.ToString("0#", NmeaCultureInfo));
            builder.Append(".");
            builder.Append(utcDateTime.Millisecond.ToString("00#", NmeaCultureInfo));

            #endregion

            // Append a comma
            builder.Append(',');            

            #region Append the fix status

            // Write fix information
            if (isFixAcquired)
                builder.Append("A");
            else
                builder.Append("V");

            #endregion

            // Append a comma
            builder.Append(',');

            #region Append the position

            // Append latitude in the format HHMM.MMMM. 
            builder.Append(position.Latitude.ToString("HHMM.MMMM,I,", NmeaCultureInfo));
            // Append Longitude in the format HHHMM.MMMM.
            builder.Append(position.Longitude.ToString("HHHMM.MMMM,I,", NmeaCultureInfo));

            #endregion

            // Append the speed (in knots)
            builder.Append(speed.ToKnots().ToString("v.v", NmeaCultureInfo));

            // Append a comma
            builder.Append(',');

            // Append the bearing
            builder.Append(bearing.ToString("d.d", NmeaCultureInfo));

            // Append a comma
            builder.Append(',');

            #region Append the UTC date

            // Append UTC date
            builder.Append(utcDateTime.Day.ToString("0#", NmeaCultureInfo));
            builder.Append(utcDateTime.Month.ToString("0#", NmeaCultureInfo));

            // Append the year (year minus 2000)
            int year = utcDateTime.Year - 2000;
            builder.Append(year.ToString("0#", NmeaCultureInfo));

            #endregion

            // Append a comma
            builder.Append(',');

            // Append magnetic variation
            builder.Append(magneticVariation.ToString("d.d", NmeaCultureInfo));

            // Set this object's sentence
            SetSentence(builder.ToString());

            // Finally, append the checksum
            AppendChecksum();
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:96,代码来源:GprmcSentence.cs


示例8: Filter

 /// <summary>
 /// Returns the position
 /// </summary>
 /// <param name="gpsPosition">The gps Position</param>
 /// <param name="currentDOP">The current dilution of precision</param>
 /// <param name="bearing">the directional azimuth</param>
 /// <param name="speed">the magnitude of the velocity</param>
 /// <returns>A Position sturcture</returns>
 public Position Filter(Position gpsPosition, DilutionOfPrecision currentDOP, Azimuth bearing, Speed speed)
 {
     return Filter(gpsPosition, _currentState.DeviceError, currentDOP, currentDOP, bearing, speed);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:12,代码来源:KalmanFilter.cs


示例9: ToOrientation

 /// <summary>
 /// Returns the current instance adjusted to the specified orientation and
 /// origin.
 /// </summary>
 public PolarCoordinate ToOrientation(Azimuth origin, PolarCoordinateOrientation orientation)
 {
     if (_Orientation.Equals(orientation) && _Origin.Equals(origin))
         return this;
     // Make a copy of the angle
     double NewAngle = Theta.DecimalDegrees;
     // Has the CW/CCW orientation changed?
     if (Orientation != orientation)
         // Yes.  Subtract the angle from 360
         NewAngle = 360 - NewAngle;
     if (Origin != origin)
     {
         // Add the offset to the angle and normalize
         NewAngle -= 360 - origin.DecimalDegrees - Origin.DecimalDegrees;
     }
     // And return the new coordinate
     return new PolarCoordinate(_R, new Angle(NewAngle), origin, orientation);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:22,代码来源:PolarCoordinate.cs


示例10: SetHeading

        /// <summary>
        /// Updates the current direction of heading.
        /// </summary>
        /// <param name="value">The value.</param>
        protected virtual void SetHeading(Azimuth value)
        {
            // If the new value is invalid, ignore it
            if (value.IsInvalid)
                return;

            // Notify of the receipt
            if (HeadingReceived != null)
                HeadingReceived(this, new AzimuthEventArgs(_heading));

            // Change the devices class
            Devices.Heading = _heading;

            // If the value hasn't changed, skiiiip
            if (_heading.Equals(value))
                return;

            // Yes. Set the new value
            _heading = value;

            // Notify of the change
            if (HeadingChanged != null)
                HeadingChanged(this, new AzimuthEventArgs(_heading));
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:28,代码来源:Interpreter.cs


示例11: DoInitialize

 /// <summary>
 /// Does the initialize.
 /// </summary>
 private void DoInitialize()
 {
     _altitude = Distance.Invalid;
     _altitudeAboveEllipsoid = _altitude;
     _bearing = Azimuth.Invalid;
     _heading = Azimuth.Invalid;
     _fixStatus = FixStatus.Unknown;
     _horizontalDop = DilutionOfPrecision.Maximum;
     _magneticVariation = Longitude.Invalid;
     _position = Position.Invalid;
     _speed = Speed.Invalid;
     _meanDop = DilutionOfPrecision.Invalid;
     _verticalDop = DilutionOfPrecision.Invalid;
     if (_satellites != null)
         _satellites.Clear();
 }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:19,代码来源:Interpreter.cs


示例12: OnSentenceChanged

        /// <summary>
        /// Overrides OnSentanceChanged for the GPVTGSentence
        /// </summary>
        protected override void OnSentenceChanged()
        {
            // First, process the basic info for the sentence
            base.OnSentenceChanged();

            // Cache the sentence words
            string[] words = base.Words;
            int wordCount = words.Length;

            /*
             * $GPVTG

                Track Made Good and Ground Speed.

                eg1. $GPVTG,360.0,T,348.7,M,000.0,N,000.0,K*43
                eg2. $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K


                           054.7,T      True track made good
                           034.4,M      Magnetic track made good
                           005.5,N      Ground speed, knots
                           010.2,K      Ground speed, Kilometers per hour


                eg3. $GPVTG,t,T,,,s.ss,N,s.ss,K*hh
                1    = Track made good
                2    = Fixed text 'T' indicates that track made good is relative to true north
                3    = not used
                4    = not used
                5    = Speed over ground in knots
                6    = Fixed text 'N' indicates that speed over ground in in knots
                7    = Speed over ground in kilometers/hour
                8    = Fixed text 'K' indicates that speed over ground is in kilometers/hour

             * 
             * 
             */

            #region Bearing

            if (wordCount >= 1 && words[0].Length != 0)
                _Bearing = Azimuth.Parse(words[0], NmeaCultureInfo);
            else
                _Bearing = Azimuth.Invalid;

            #endregion

            #region Magnetic Variation

            if (wordCount >= 3 && words[2].Length != 0)
                _MagneticVariation = new Longitude(double.Parse(words[2], NmeaCultureInfo) - _Bearing.DecimalDegrees);
            else
                _MagneticVariation = Longitude.Invalid;

            #endregion

            #region Speed

            /* Speed is reported as both knots and KM/H.  We can parse either of the values.
             * First, try to parse knots.  If that fails, parse KM/h.
             */

            if (wordCount > 6 && words[5].Length != 0)
            {
                _Speed = new Speed(
                    // Parse the numeric portion
                    double.Parse(words[5], NmeaCultureInfo),
                    // Use knots 
                    SpeedUnit.Knots);
            }
            else if (wordCount > 8 && words[7].Length != 0)
            {
                _Speed = new Speed(
                    // Parse the numeric portion
                    double.Parse(words[7], NmeaCultureInfo),
                    // Use knots 
                    SpeedUnit.KilometersPerHour);
            }
            else
            {
                // Invalid speed
                _Speed = Speed.Invalid;
            }

            #endregion
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:89,代码来源:GpvtgSentence.cs


示例13: AzimuthEventArgs

		/// <summary>
		/// Creates a new instance containing the specified Azimuth object.
		/// </summary>

		public AzimuthEventArgs(Azimuth angle)
		{
			_Azimuth = angle;
		}
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:8,代码来源:EventArgs.cs


示例14: OnSentenceChanged


//.........这里部分代码省略.........
            if (wordCount >= 9 && words[9].Length != 0)
            {
                _fixMode = words[9] == "A" ? FixMode.Automatic : FixMode.Manual;
            }
            else
            {
                _fixMode = FixMode.Unknown;
            }

            #endregion Fix Mode

            #region Fix Quality

            // Do we have enough data for fix quality?
            if (wordCount >= 10 && words[10].Length != 0)
            {
                switch (int.Parse(words[10], NmeaCultureInfo))
                {
                    case 0:
                        _fixQuality = FixQuality.NoFix;
                        break;
                    case 1:
                        _fixQuality = FixQuality.GpsFix;
                        break;
                    case 2:
                        _fixQuality = FixQuality.DifferentialGpsFix;
                        break;
                    case 3:
                        _fixQuality = FixQuality.PulsePerSecond;
                        break;
                    case 4:
                        _fixQuality = FixQuality.FixedRealTimeKinematic;
                        break;
                    case 5:
                        _fixQuality = FixQuality.FloatRealTimeKinematic;
                        break;
                    case 6:
                        _fixQuality = FixQuality.Estimated;
                        break;
                    case 7:
                        _fixQuality = FixQuality.ManualInput;
                        break;
                    case 8:
                        _fixQuality = FixQuality.Simulated;
                        break;
                    default:
                        _fixQuality = FixQuality.Unknown;
                        break;
                }
            }
            else
            {
                // This fix quality is invalid
                _fixQuality = FixQuality.Unknown;
            }

            #endregion Fix Quality

            #region Bearing

            // Do we have enough data for fix quality?
            if (wordCount >= 13 && words[12].Length != 0)
            {
                _bearing = new Azimuth(words[12], NmeaCultureInfo);
            }
            else
            {
                _bearing = Azimuth.Invalid;
            }

            #endregion Bearing

            #region Speed

            // Do we have enough data for fix quality?
            if (wordCount >= 12 && words[11].Length != 0)
            {
                _speed = Speed.FromKilometersPerHour(double.Parse(words[11], NmeaCultureInfo));
            }
            else
            {
                _speed = Speed.Invalid;
            }

            #endregion Speed

            #region Position Dilution of Precision

            // Do we have enough data for fix quality?
            if (wordCount >= 13 && words[13].Length != 0)
            {
                _positionDop = new DilutionOfPrecision(float.Parse(words[13], NmeaCultureInfo));
            }
            else
            {
                _positionDop = DilutionOfPrecision.Invalid;
            }

            #endregion Position Dilution of Precision
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:101,代码来源:PgrmfSentence.cs


示例15: AzimuthSubtractionTestingStruct

 public AzimuthSubtractionTestingStruct( Double Azimuth1
   , Double Azimuth2
   , Double ExpectedInternal
   , Double ExpectedExternal
   )
 {
     this.Az1 = Azimuth.NewFromDoubleAsDegrees(Azimuth1);
       this.Az2 = Azimuth.NewFromDoubleAsDegrees(Azimuth2);
       this.ExpectedInternal = ExpectedInternal;
       this.ExpectedExternal = ExpectedExternal;
 }
开发者ID:catashd,项目名称:NetVecCad,代码行数:11,代码来源:UnitTestsNVcad.cs


示例16: UpdateState

        /// <summary>
        /// Updates the state.
        /// </summary>
        /// <param name="deviceError">The device error.</param>
        /// <param name="horizontalDOP">The horizontal DOP.</param>
        /// <param name="verticalDOP">The vertical DOP.</param>
        /// <param name="bearing">The bearing.</param>
        /// <param name="speed">The speed.</param>
        /// <param name="z">The z.</param>
        public void UpdateState(Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Azimuth bearing, Speed speed, Position3D z)
        {
            if (_x.IsInvalid)
            {
                Initialize(z);
                return;
            }

            // More insanity
            double fail = horizontalDOP.Value * verticalDOP.Value * deviceError.Value;
            if (fail == 0 || double.IsNaN(fail) || double.IsInfinity(fail))
            {
                throw new ArgumentException(
                    "Covariance values are invalid. Parameters deviceError, horizontalDOP and verticalDOP must be greater than zero.");
            }

            _deviceError = deviceError.Value;
            _horizontalDOP = horizontalDOP.Value;
            _verticalDOP = verticalDOP.Value;

            double hCovariance = _deviceError * _horizontalDOP;
            double vCovariance = _deviceError * _verticalDOP;

            // Setup the observation covariance (measurement error)
            _r = new SquareMatrix3D(
                hCovariance, 0, 0,
                0, hCovariance, 0,
                0, 0, vCovariance);

            #region Process Noise Estimation

            // Get the translation of the last correction
            CartesianPoint subX = _x.ToPosition3D(_ellipsoid)
                .TranslateTo(bearing, speed.ToDistance(_delay), _ellipsoid)
                .ToCartesianPoint();

            // Get the vector of the translation and the last observation
            //CartesianPoint w = (subX - this.z);
            CartesianPoint w =
                new CartesianPoint(
                    Distance.FromMeters(subX.X.Value - _z.X.Value),   // Values are in meters
                    Distance.FromMeters(subX.Y.Value - _z.Y.Value),   // Values are in meters
                    Distance.FromMeters(subX.Z.Value - _z.Z.Value));  // Values are in meters

            // Setup the noise covariance (process error)
            _q = new SquareMatrix3D(
                Math.Abs(w.X.Value), 0, 0,
                0, Math.Abs(w.Y.Value), 0,
                0, 0, Math.Abs(w.Z.Value));

            #endregion Process Noise Estimation

            // Update the observation state
            _z = z.ToCartesianPoint(_ellipsoid);

            #region State vector prediction and covariance

            //s.x = s.A*s.x + s.B*s.u;
            //this.x = this.A * this.x + this.B * this.u;
            CartesianPoint ax = _a.TransformVector(_x);
            CartesianPoint bu = _b.TransformVector(_u);
            _x =
                new CartesianPoint(
                    Distance.FromMeters(ax.X.Value + bu.X.Value),
                    Distance.FromMeters(ax.Y.Value + bu.Y.Value),
                    Distance.FromMeters(ax.Z.Value + bu.Z.Value));

            //s.P = s.A * s.P * s.A' + s.Q;
            _p = _a * _p * SquareMatrix3D.Transpose(_a) + _q;

            #endregion State vector prediction and covariance

            #region Kalman gain factor

            //K = s.P*s.H'*inv(s.H*s.P*s.H'+s.R);
            SquareMatrix3D ht = SquareMatrix3D.Transpose(_h);
            SquareMatrix3D k = _p * ht * SquareMatrix3D.Invert(_h * _p * ht + _r);

            #endregion Kalman gain factor

            #region Observational correction

            //s.x = s.x + K*(s.z-s.H*s.x);
            //this.x = this.x + K * (this.z - this.H * this.x);
            CartesianPoint hx = _h.TransformVector(_x);
            CartesianPoint zHx = new CartesianPoint(
                Distance.FromMeters(_z.X.Value - hx.X.Value),
                Distance.FromMeters(_z.Y.Value - hx.Y.Value),
                Distance.FromMeters(_z.Z.Value - hx.Z.Value));
            CartesianPoint kzHx = k.TransformVector(zHx);
            _x =
//.........这里部分代码省略.........
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:101,代码来源:KalmanFilter.cs


示例17: Filter

 /// <summary>
 /// Return a filtered Position3D from the specified parameters
 /// </summary>
 /// <param name="gpsPosition">The GPS position.</param>
 /// <param name="deviceError">The device error.</param>
 /// <param name="horizontalDOP">The horizontal DOP.</param>
 /// <param name="verticalDOP">The vertical DOP.</param>
 /// <param name="bearing">The bearing.</param>
 /// <param name="speed">The speed.</param>
 /// <returns></returns>
 public abstract Position3D Filter(Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Azimuth bearing, Speed speed);
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:11,代码来源:Filter.cs


示例18: OnSentenceChanged


//.........这里部分代码省略.........

                string utcDateWord = words[8];
                int utcDay = int.Parse(utcDateWord.Substring(0, 2), NmeaCultureInfo);
                int utcMonth = int.Parse(utcDateWord.Substring(2, 2), NmeaCultureInfo);
                int utcYear = int.Parse(utcDateWord.Substring(4, 2), NmeaCultureInfo) + 2000;

                #endregion

                #region Build a UTC date/time

                _UtcDateTime = new DateTime(utcYear, utcMonth, utcDay, utcHours, utcMinutes, utcSeconds, utcMilliseconds, DateTimeKind.Utc);

                #endregion
            }
            else
            {
                // The UTC date/time is invalid
                _UtcDateTime = DateTime.MinValue;
            }

            // Do we have enough data to parse the location?
            if (wordCount >= 6 && words[2].Length != 0 && words[3].Length != 0 && words[4].Length != 0 && words[5].Length != 0)
            {
                #region Parse the latitude

                string latitudeWord = words[2];
                int latitudeHours = int.Parse(latitudeWord.Substring(0, 2), NmeaCultureInfo);
                double latitudeDecimalMinutes = double.Parse(latitudeWord.Substring(2), NmeaCultureInfo);
                LatitudeHemisphere latitudeHemisphere =
                    words[3].Equals("N", StringComparison.Ordinal) ? LatitudeHemisphere.North : LatitudeHemisphere.South;

                #endregion

                #region Parse the longitude

                string longitudeWord = words[4];
                int longitudeHours = int.Parse(longitudeWord.Substring(0, 3), NmeaCultureInfo);
                double longitudeDecimalMinutes = double.Parse(longitudeWord.Substring(3), NmeaCultureInfo);
                LongitudeHemisphere longitudeHemisphere =
                    words[5].Equals("E", StringComparison.Ordinal) ? LongitudeHemisphere.East : LongitudeHemisphere.West;

                #endregion

                #region Build a Position from the latitude and longitude

                _Position = new Position(
                                new Latitude(latitudeHours, latitudeDecimalMinutes, latitudeHemisphere),
                                new Longitude(longitudeHours, longitudeDecimalMinutes, longitudeHemisphere));

                #endregion
            }
            else
            {
                _Position = Position.Invalid;
            }

            // Do we have enough info to process speed?
            if (wordCount >= 7 && words[6].Length != 0)
            {
                #region Speed

                // The speed is the sixth word, expressed in knots                
                _Speed = new Speed(double.Parse(words[6], NmeaCultureInfo), SpeedUnit.Knots);

                #endregion
            }
            else
            {
                // The speed is invalid
                _Speed = Speed.Invalid;
            }

            // do we have enough info to process the bearing?
            if (wordCount >= 8 && words[7].Length != 0)
            {
                #region Bearing

                // The bearing is the seventh word
                _Bearing = new Azimuth(double.Parse(words[7], NmeaCultureInfo));

                #endregion
            }
            else
            {
                // The bearing is invalid
                _Bearing = Azimuth.Invalid;
            }

            // Do we have enough info for magnetic variation?
            if (wordCount >= 10 && words[9].Length != 0)
            {
                // Parse the value
                _MagneticVariation = new Longitude(double.Parse(words[9], NmeaCultureInfo));
            }
            else
            {
                // The magnetic variation is invalid
                _MagneticVariation = Longitude.Invalid;
            }
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:101,代码来源:GprmcSentence.cs


示例19: OnPaintOffScreen

        /// <inheritdocs/>
        protected override void OnPaintOffScreen(PaintEventArgs e)
        {
            PolarGraphics f = CreatePolarGraphics(e.Graphics);

            // What bearing are we drawing?
#if PocketPC
            Azimuth BearingToRender = _Bearing;
#else
            Azimuth bearingToRender = new Azimuth(_valueInterpolator[_interpolationIndex]);
#endif

            // Cache drawing options in order to prevent race conditions during
            // drawing!
            double minorInterval = _minorTickInterval.DecimalDegrees;
            double majorInterval = _majorTickInterval.DecimalDegrees;
            double directionInterval = _directionLabelInterval.DecimalDegrees;
            double angleInterval = _angleLabelInterval.DecimalDegrees;

            // Draw tick marks
            if (minorInterval > 0)
            {
                for (double angle = 0; angle < 360; angle += minorInterval)
                {
                    // And draw a line
                    f.DrawLine(_minorTickPen, new PolarCoordinate(98, angle), new PolarCoordinate(100, angle));
                }
            }
            // Draw tick marks
            if (majorInterval > 0)
            {
                for (double angle = 0; angle < 360; angle += majorInterval)
                {
                    // And draw a line
                    f.DrawLine(_majorTickPen, new PolarCoordinate(95, angle), new PolarCoordinate(100, angle));
                }
            }
            if (directionInterval > 0)
            {
                for (double angle = 0; angle < 360; angle += directionInterval)
                {
                    // And draw a line
                    f.DrawLine(_directionTickPen, new PolarCoordinate(92, angle), new PolarCoordinate(100, angle));
                }
            }
            if (angleInterval > 0)
            {
                for (double angle = 0; angle < 360; angle += angleInterval)
                {
                    // Get the coordinate of the line's start
                    PolarCoordinate start = new PolarCoordinate(60, angle, Azimuth.North, PolarCoordinateOrientation.Clockwise);
#if PocketPC
                    f.DrawCenteredString(((Angle)angle).ToString(_AngleLabelFormat, CultureInfo.CurrentCulture), _AngleLabelFont, _AngleLabelBrush, start);
#else
                    f.DrawRotatedString(((Angle)angle).ToString(_angleLabelFormat, CultureInfo.CurrentCulture), _angleLabelFont, _angleLabelBrush, start);
#endif
                }
            }
            if (directionInterval > 0)
            {
                for (double angle = 0; angle < 360; angle += directionInterval)
                {
                    // Get the coordinate of the line's start
                    PolarCoordinate start = new PolarCoordinate(80, angle, Azimuth.North, PolarCoordinateOrientation.Clockwise);
#if PocketPC
                    f.DrawCenteredString(((Azimuth)angle).ToString("c", CultureInfo.CurrentCulture), _DirectionLabelFont, _DirectionLabelBrush, start);
#else
                    f.DrawRotatedString(((Azimuth)angle).ToString("c", CultureInfo.CurrentCulture), _directionLabelFont, _directionLabelBrush, start);
#endif
                }
            }

            // Draw an ellipse at the center
            f.DrawEllipse(_centerPen, PolarCoordinate.Empty, 10);

            // Now draw the needle shadow
            PolarCoordinate[] needleNorth = _needlePointsNorth.Clone() as PolarCoordinate[];
            PolarCoordinate[] needleSouth = _needlePointsSouth.Clone() as PolarCoordinate[];

            // Adjust the needle to the current bearing
            if (needleNorth != null)
                for (int index = 0; index < needleNorth.Length; index++)
                {
                    needleNorth[index] = needleNorth[index].Rotate(bearingToRender.DecimalDegrees);
                    if (needleSouth != null) needleSouth[index] = needleSouth[index].Rotate(bearingToRender.DecimalDegrees);
                }

#if !PocketPC
            // Now draw a shadow
            f.Graphics.TranslateTransform(_pNeedleShadowSize.Width, _pNeedleShadowSize.Height, MatrixOrder.Append);

            f.FillPolygon(_pNeedleShadowBrush, needleNorth);
            f.FillPolygon(_pNeedleShadowBrush, needleSouth);

            f.Graphics.ResetTransform();
#endif

            f.FillPolygon(_pNorthNeedleBrush, needleNorth);
            f.DrawPolygon(_pNorthNeedlePen, needleNorth);
            f.FillPolygon(_pSouthNeedleBrush, needleSouth);
//.........这里部分代码省略.........
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:101,代码来源:Compass.cs


示例20: Randomize

        public void Randomize(
            Random seed, 
            Speed speedLow, 
            Speed speedHigh, 
            Azimuth bearingStart, 
            Azimuth bearingArc,
            DilutionOfPrecision minHDOP,
            DilutionOfPrecision maxHDOP,
            DilutionOfPrecision minVDOP,
            DilutionOfPrecision maxVDOP)
        {
            base.Randomize(seed, speedLow, speedHigh, bearingStart, bearingArc);

            _minHDOP = minHDOP.Value;
            _maxHDOP = maxHDOP.Value;
            _minVDOP = minVDOP.Value;
            _maxVDOP = maxVDOP.Value;

            SetRandom(true);
        }
开发者ID:ncorreia,项目名称:FoursquareMobile,代码行数:20,代码来源:NmeaEmulator.cs



注:本文中的Azimuth类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AzureOperationResponse类代码示例发布时间:2022-05-24
下一篇:
C# Ayudas.Frm_help_general类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap