Exemple #1
0
        /// <summary>
        /// Helper class that updates history trail and model position
        /// </summary>
        protected virtual void updateSubObjects()
        {
            if (IsSurfaceTrack)
            {
                Altitude = 0;
                IsAGL    = true; // force this just in case so we aren't under terrain
            }

            // Save current values
            PosData pos = new PosData();

            pos.lat        = Latitude;
            pos.lon        = Longitude;
            pos.alt        = Altitude;
            pos.spd        = Speed;
            pos.hdg        = Rotation.Degrees;
            pos.sourceTime = m_sourceTime;
            pos.updateTime = m_updateTime;

            try
            {
                m_history.AddFirst(pos);

                if (m_history.Count > MaxPoints)
                {
                    m_history.RemoveLast();
                }

                // Add to line feature
                if (RenderTrail && m_lineFeature == null)
                {
                    m_lineFeature           = new LineFeature(name + "_trail", DrawArgs.CurrentWorldStatic, null, null);
                    m_lineFeature.LineColor = System.Drawing.Color.White;
                    m_lineFeature.MaxPoints = MaxPoints;

                    if (IsAGL)
                    {
                        m_lineFeature.AltitudeMode = AltitudeMode.RelativeToGround;
                    }
                    else
                    {
                        m_lineFeature.AltitudeMode = AltitudeMode.Absolute;
                    }

                    m_lineFeature.Opacity   = 128;
                    m_lineFeature.LineWidth = 3;

                    if (IsSurfaceTrack)
                    {
                        m_lineFeature.Extrude       = false;
                        m_lineFeature.ExtrudeHeight = 0;
                        m_lineFeature.LineWidth     = 1;
                    }
                    else
                    {
                        m_lineFeature.Extrude         = true;
                        m_lineFeature.ExtrudeHeight   = 1;
                        m_lineFeature.LineWidth       = 1;
                        m_lineFeature.ExtrudeToGround = false;
                    }
                }

                if (RenderTrail)
                {
                    m_lineFeature.AddPoint(Longitude, Latitude, Altitude);
                }

                if (RenderModel && m_modelFeature != null)
                {
                    m_modelFeature.Longitude = (float)Longitude;
                    m_modelFeature.Latitude  = (float)Latitude;
                    m_modelFeature.Altitude  = (float)Altitude;

                    float rot = (float)(180 - Rotation.Degrees);
                    if (rot < 0)
                    {
                        rot += 360;
                    }
                    m_modelFeature.RotZ = rot;
                }
            }
            catch
            {
            }
        }