Пример #1
0
        /// <summary>
        /// Write's the specified entity to the text file
        /// </summary>
        /// <param name="entity"></param>
        public void OutputEntity(IAgEntity entity)
        {
            DateTime utcNow = DateTime.UtcNow;
            int      millisecondSinceLastWrite = (int)(utcNow - m_timeLastWrite).TotalMilliseconds;

            m_timeLastWrite = utcNow;

            OutputSettings settings;

            if (!m_settings.TryGetValue(entity.ID, out settings))
            {
                settings = new OutputSettings(Affiliation.Friendly, "SFAPMF----*****");
            }

            AgPointEntity pointEntity = entity as AgPointEntity;
            StringBuilder entry       = new StringBuilder();

            entry.Append(pointEntity.DisplayName);
            entry.Append(" ");
            entry.Append(Math.Round(pointEntity.Position.Latitude, 6));
            entry.Append(" ");
            entry.Append(Math.Round(pointEntity.Position.Longitude, 6));
            entry.Append(" ");
            entry.Append(Math.Round(pointEntity.Position.Altitude, 6));
            entry.Append(" ");
            entry.Append(settings.Affiliation);
            entry.Append(" ");
            entry.Append(settings.Symbology);
            entry.Append(" ");
            entry.Append(millisecondSinceLastWrite);

            m_textWriter.WriteLine(entry.ToString());
        }
Пример #2
0
        /// <summary>
        /// Called by the RT3 engine to determine if the provided entity
        /// belongs in this query.
        /// </summary>
        /// <param name="Entity">The entity to be matched against.</param>
        /// <returns>True if the entity matches this query criteria, false otherwise.</returns>
        public bool IsMatch(IAgEntity Entity)
        {
            bool Result = false;

            IAgPointEntity Point = Entity as IAgPointEntity;

            if (Point != null && Point.Position != null)
            {
                Result = (Point.Position.Altitude >= m_minimumAltitude) && (Point.Position.Altitude <= m_maximumAltitude);
            }

            IAgPolylineEntity Poly = Entity as IAgPolylineEntity;

            if (Poly != null && Poly.Positions != null)
            {
                foreach (IAgEntityPosition Position in Poly.Positions)
                {
                    Result = (Position.Altitude >= m_minimumAltitude) && (Position.Altitude <= m_maximumAltitude);
                    if (Result)
                    {
                        break;
                    }
                }
            }

            return(Result);
        }