Esempio n. 1
0
        public void initHeightCurve(string pdPath = @"C:\GISData\Common\pd.xlsx")
        {
            DataTable dt1;
            string    code;
            double    mileage;
            //double dis;
            int count;
            int i = 0;

            dt1       = ExcelWrapper.LoadDataTableFromExcel(pdPath, @"select mileage, altitude, radius from [sheet1$] order by id");
            count     = dt1.Rows.Count;
            dkmileage = new string[count];
            m         = new double[count];
            h         = new double[count];
            r         = new double[count];
            i1        = new double[count];
            i2        = new double[count];
            sm        = new double[count];
            em        = new double[count];

            //CSubPath path = new CSubPath(CRailwayLineList.gMileage, "DK", 299000, "右改DK", 17600, 10);
            //path.outputPathInfo();
            foreach (DataRow dr in dt1.Rows)
            {
                dkmileage[i] = dr["mileage"].ToString();
                CRailwayLineList.parseDKCode(dkmileage[i], out code, out mileage);
                m[i] = getPathMileageByDKCode(code, mileage);
                if (m[i] >= 0)
                {
                    h[i] = Convert.ToDouble(dr["altitude"]);
                    r[i] = Convert.ToDouble(dr["radius"]);
                }
                else
                {
                    Console.WriteLine(dkmileage[i] + "不存在");
                }
                i++;
            }
            for (i = 1; i < m.Length - 1; i++)
            {
                heightCurveParams(i);
            }
            sm[0]            = 0;
            em[0]            = 0;
            sm[m.Length - 1] = em[m.Length - 1] = m[m.Length - 1];
        }
Esempio n. 2
0
        /// <summary>
        /// 利用dkcode 与 里程初始化,潜在问题,要求在同一个链中,dkcode一致,目前数据库中的里程描述description不正确
        /// </summary>
        /// <param name="s"></param>
        /// <param name="SerialNo"></param>
        /// <param name="projID"></param>
        /// <param name="profName"></param>
        /// <param name="ProjectName"></param>
        /// <param name="SegmentName"></param>
        /// <param name="DKCode"></param>
        /// <param name="Mileage_Start"></param>
        /// <param name="Mileage_Mid"></param>
        /// <param name="Mileage_End"></param>
        /// <param name="dt"></param>
        /// <param name="AvgProgress"></param>
        /// <param name="dir"></param>
        /// <param name="labelFile"></param>
        /// <param name="length"></param>
        public CRailwayProject(CRailwayScene s, string SerialNo, int projID, int parentID, string profName, string profCode, string ProjectName, string SegmentName,
                               string MStartDes, string MEndDes, double Mileage_Start, double Mileage_End,
                               //string Mileage_Start_Des, string Mileage_Mid_Des, string Mileage_End_Des,
                               DateTime dt, double AvgProgress, double dir, string labelFile, string photoUrl, bool isContBeam = false, DataTable dt1 = null, DataTable dt2 = null)
        {
            double tmp;

            mScene            = s;
            ProfessionalName  = profName;
            mProfessionalCode = profCode;
            mProjectID        = projID;
            mParentID         = parentID;
            mProjectName      = ProjectName;
            mSegmentName      = SegmentName;
            mSerialNo         = SerialNo;
            mIsValid          = CRailwayLineList.parseDKCode(MStartDes, out mStartDKCode, out tmp); // should be Mileage_Start
            mIsValid         &= CRailwayLineList.parseDKCode(MEndDes, out mEndDKCode, out tmp);     // should be Mileage_End
            if (!mIsValid)
            {
                LogHelper.WriteLog(mProjectName + "里程错误:" + MStartDes + "\t" + MEndDes);
            }
            //if (string.IsNullOrEmpty(dkcode2))
            //    mEndDKCode = mStartDKCode;
            //else
            //    mEndDKCode = dkcode2;

            Mileage_Start_Ds = CRailwayLineList.CombiDKCode(mStartDKCode, Mileage_Start);
            //Mileage_Mid_Ds = Mileage_Mid_Des;
            Mileage_End_Ds = CRailwayLineList.CombiDKCode(mEndDKCode, Mileage_End);;

            mMileage_Start = Mileage_Start;
            mMileage_Mid   = 0;
            mMileage_End   = Mileage_End;

            //mIsValid = mScene.mMiddleLines.getGPSbyDKCode(mStartDKCode, mMileage_Mid, out mLongitude_Mid, out mLatitude_Mid, out mAltitude_Mid, out mHeading_Mid);
            //mIsValid = mScene.mMiddleLines.getGPSbyDKCode(mStartDKCode, mMileage_Start, out mLongitude_Start, out mLatitude_Start, out mAltitude_Start, out mHeading_Start);
            //mIsValid &= mScene.mMiddleLines.getGPSbyDKCode(mEndDKCode, mMileage_End, out mLongitude_End, out mLatitude_End, out mAltitude_End, out mHeading_End);


            mUpdateTime = dt;

            mDirection  = dir;
            mLabelImage = labelFile;
            mLength     = Math.Abs(mMileage_End - mMileage_Start); //FIXME 目前是导入,不同DKCode的线路如何求解

            mPhotoUrl = photoUrl;

            if (!isContBeam)
            {
                //mPath = new CSubPath( mStartDKCode, mMileage_Start, mEndDKCode, mMileage_End, 10);
                mPath = new CSubPath(CRailwayLineList.gMileageConnection, mStartDKCode, mMileage_Start, mEndDKCode, mMileage_End, 10);
                if (!mPath.hasPath)
                {
                    mIsValid = false;
//#if DEBUG
//                    Helper.LogHelper.WriteLog(mProjectName +"\t"+ mStartDKCode + mMileage_Start + "\t" + mEndDKCode + mMileage_End);
//#endif
                    return;
                }
                mIsValid      = true;
                mIsOnMainPath = mScene.mMainPath.getPathMileageByDKCode(mStartDKCode, mMileage_Start, out mMainMileageS, out mdistanceToMainPath);
                mScene.mMainPath.getPathMileageByDKCode(mEndDKCode, mMileage_End, out mMainMileageE, out mdistanceToMainPath);
                mPath.getDKCodebyPathMileage(mPath.mLength * 0.5, out mMidDKCode, out mMileage_Mid);
                mScene.mMainPath.getPathMileageByDKCode(mMidDKCode, mMileage_Mid, out mMainMileage, out mdistanceToMainPath);


                mLength = Math.Abs(mPath.mLength);
            }

            initFXProgress(dt1, dt2);
        }