Esempio n. 1
0
        protected void CutSection_ForRealVehC(int startpointnum, int endpointnum, Veh_VehM_Global.StartendCheck startend_Check, String FromVehCSection, DataTable dataTable, int directionOfThisSection, ref String[] ToVehSevtion, ref int tempcount_1, int sectionCountnum)
        {
            int tempsection = 0;
            int startnum    = 0;
            int endnum      = 0;

            /*
             * Find the exact section row.
             */
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                if (FromVehCSection == (string)dataTable.Rows[i][0])
                {
                    tempsection = i;
                    break;
                }
            }
            string segmentnum = (string)dataTable.Rows[tempsection][3];

            /*
             * Keep the VehSection on it;
             */
            if (startend_Check == Veh_VehM_Global.StartendCheck.startpoint)
            {
                startnum = startpointnum;
                if (sectionCountnum == 1)
                {
                    if (endpointnum == 0 && startnum != 0)
                    {
                        endnum = Int32.Parse(segmentnum);
                    }
                    else
                    {
                        endnum = endpointnum;
                    }
                }
                else if (sectionCountnum > 1)
                {
                    endnum = Int32.Parse(segmentnum); //the segment number;
                }
            }
            else if (startend_Check == Veh_VehM_Global.StartendCheck.endpoint)
            {
                startnum = 0;
                endnum   = endpointnum;
                if (endnum == 0)                      //due to the endpoint can't be 0 , it represent that this section should be all count.
                {
                    endnum = Int32.Parse(segmentnum); //the segment number;
                }
            }
            else if (startend_Check == Veh_VehM_Global.StartendCheck.None)
            {
                startnum = 0;
                endnum   = Int32.Parse(segmentnum); //the segment number;
            }
            Enterthesection(startnum, endnum, directionOfThisSection, segmentnum, ref ToVehSevtion, ref tempcount_1, dataTable, tempsection);
        }
Esempio n. 2
0
        protected String[] TransSections_ForRealVehC(String[] FromVehCSections, String[] FromVehCAddresses, out int store_startLength, ref int [] reserve_direction_list)
        {
            string forward_reverse = "";
            int    tempcount       = 0;

            Veh_VehM_Global.StartendCheck startendCheck = Veh_VehM_Global.StartendCheck.None;
            int startpointnum          = 0;
            int endpointnum            = 0;
            int directionOfThisSection = 0;

            store_startLength = 0;
            String[] tempSections  = new string[500];
            String[] ToOHTSections = null;
            int      sectionnum    = FromVehCSections.Count();

            int[] restore_the_direction = GetDirection4Sections(FromVehCSections, FromVehCAddresses);
            reserve_direction_list = restore_the_direction;
            DataTable datable4VehMAP = new ReadCsv()._ReadParamsFromVhSectionData(CsvGlobal.VehC2VehMap);

            DefineStartEndPoint(ref startpointnum, ref endpointnum, FromVehCAddresses, datable4VehMAP, restore_the_direction, sectionnum, out store_startLength);
            if (Veh_VehM_Global.fakeMap != true)
            {
                for (int i = 0; i < FromVehCSections.Count(); i++)
                {
                    if (i == 0)
                    {
                        startendCheck = Veh_VehM_Global.StartendCheck.startpoint;
                    }
                    else if (i == FromVehCSections.Count() - 1)
                    {
                        startendCheck = Veh_VehM_Global.StartendCheck.endpoint;
                    }
                    else
                    {
                        startendCheck = Veh_VehM_Global.StartendCheck.None;
                    }
                    directionOfThisSection = restore_the_direction[i];
                    CutSection_ForRealVehC(startpointnum, endpointnum, startendCheck, FromVehCSections[i], datable4VehMAP, directionOfThisSection, ref tempSections, ref tempcount, FromVehCSections.Count());
                }
            }
            ToOHTSections = new string[tempcount];
            for (int i = 0; i < tempcount; i++)
            {
                ToOHTSections[i] = tempSections[i];
            }
            return(ToOHTSections);
        }