Exemple #1
0
        /// <summary>
        /// Find current section for new Route/Direction
        /// </summary>
        /// <param name="strRoute"></param>
        /// <param name="strDirection"></param>
        /// <param name="imageObject"></param>
        public void UpdateRouteDirection(String strRoute, String strDirection, ImageObject imageObject)
        {
            bool below = true;
            bool above = true;

            m_listSections = GlobalDatabaseOperations.GetSections(strRoute, strDirection, this.NetworkID);

            if (m_listSections.Count != 0)
            {
                SectionObject minBeginSection = m_listSections[0];
                SectionObject maxEndSection   = m_listSections[0];


                //Search this list to find which section
                foreach (SectionObject so in m_listSections)
                {
                    if (imageObject.Milepost >= so.BeginStation && imageObject.Milepost <= so.EndStation)
                    {
                        this.CurrentSection = so;
                    }
                    else if (imageObject.Milepost < so.BeginStation)
                    {
                        above = false;
                    }
                    else if (imageObject.Milepost > so.EndStation)
                    {
                        below = false;
                    }

                    if (so.BeginStation < minBeginSection.BeginStation)
                    {
                        minBeginSection = so;
                    }
                    if (so.EndStation > maxEndSection.EndStation)
                    {
                        maxEndSection = so;
                    }
                }

                if (this.CurrentSection == null)                        //didn't find a match
                {
                    if (above)
                    {
                        this.CurrentSection = maxEndSection;
                    }

                    if (below)
                    {
                        this.CurrentSection = minBeginSection;
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Find current section for new Route/Direction
        /// </summary>
        /// <param name="strRoute"></param>
        /// <param name="strDirection"></param>
        /// <param name="imageObject"></param>
        public void UpdateFacilitySection(String strFacility, String strSection, ImageObject imageObject)
        {
            m_listSections = GlobalDatabaseOperations.GetSections(strFacility, this.NetworkID);

            if (imageObject != null)
            {
                //Search this list to find which section
                foreach (SectionObject so in m_listSections)
                {
                    if (imageObject.Section == so.Section)
                    {
                        this.CurrentSection = so;
                    }
                }
            }
            else
            {
                if (m_listSections.Count > 0)
                {
                    this.CurrentSection = m_listSections[0];
                }
            }
        }