コード例 #1
0
        public CRailwayProject(CRailwayScene s)
        {
            mScene           = s;
            ProfessionalName = "铁路工程";
            mProjectID       = 1;
            mProjectName     = "新建济青高速铁路工程";
            mSegmentName     = "山东高速集团";
            mSerialNo        = "XXXX";
            mStartDKCode     = "DK";
            mEndDKCode       = "DK";

            mMileage_Start = 0;
            mMileage_Mid   = 158000;
            mMileage_End   = 316000;

            Mileage_Start_Ds = CRailwayLineList.CombiDKCode(mStartDKCode, mMileage_Start);
            //Mileage_Mid_Ds = Mileage_Mid_Des;
            Mileage_End_Ds = CRailwayLineList.CombiDKCode(mEndDKCode, mMileage_End);
            mLength        = Math.Abs(mMileage_End - mMileage_Start);
            mUpdateTime    = DateTime.Now;
            // FIXME 应该进行统计
            mfx = new List <CFXProj>();
            //mfx.Add(new CFXProj(0,"桥梁",1000));
            //mfx.Add(new CFXProj(1, "路基", 10000));
            //mfx.Add(new CFXProj(2, "隧道", 10000));
        }
コード例 #2
0
ファイル: CRailwayFirm.cs プロジェクト: xuyanning/JQGis
        public CRailwayFirm(CRailwayScene s, int num, int fid, string fname, double x, double y, string firmType, string presentation, string fileName)
        {
            mScene    = s;
            mFirmType = firmType;
            mFirmName = fname;

            mNumStaff = num;
            mFirmID   = fid;
            //mSNo = sNo;
            //mUpdateTime = dt;
            mPresentation  = presentation;
            mLongitude_Mid = x;
            mLatitude_Mid  = y;

            //if (fname.StartsWith("11标"))
            //    Console.WriteLine(fname + x + "\t" + y);
            mLine = CRailwayLineList.getMileagebyGPS(x, y, out mMileage_Mid, out mDis, out misInside);
            //mDKCode = mLine.mDKCode;
            double dis;

            mScene.mMainPath.getPathMileagebyGPS(x, y, out mMainMileage, out dis);

            mLabelImage = fileName;
            if (mDis < 8000)
            {
                mHotSpot = new CHotSpot(mLine.mDKCode, mMileage_Mid, mLongitude_Mid, mLatitude_Mid, 100, mMainMileage, mDis, "Firm", this);
            }
            else
            {
                mHotSpot = null;
            }
        }
コード例 #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     //if (gRWScene == null)
     //gRWScene = new CRailwayScene(@"C:\GISData\jiqing\gisDB.db", "JQMIS.CN");
     //gRWScene.savePierLocal(@"C:\GISData\jiqing\gisdb.db");
     //CRailwayLineList.CreateLinelistFromExcel(@"d:\chain0616.xlsx");
     CRailwayLineList.CreateLinelistFromSqlite(@"C:\GISData\jiqing\gisdb.db");
     CRailwayLineList.createFloydPath();
 }
コード例 #4
0
ファイル: FormDataTools.cs プロジェクト: xuyanning/JQGis
        private void button2_Click(object sender, EventArgs e)
        {
            //if (gRWScene == null)
            //gRWScene = new CRailwayScene(@"C:\GISData\jiqing\gisDB.db", "JQMIS.CN");
            //gRWScene.savePierLocal(@"C:\GISData\jiqing\gisdb.db");

            btnHeight.Enabled = false;
            //CRailwayLineList.CreateLinelistFromSqlite(@"C:\GISData\jiqing\gisdb.db");
            CRailwayLineList.CreateLinelistFromExcel(@"C:\GISData\Common\chainInfo.xlsx");
            CRailwayLineList.createFloydPath(@"C:\GISData\Common\pd.xlsx");

            Console.WriteLine("subline计算完毕");
            btnHeight.Enabled = true;
        }
コード例 #5
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];
        }
コード例 #6
0
        public bool getPathMileageByDKCode(string dkcode, double dkmileage, out double pathMileage, out double dis)
        {
            dis = pathMileage = 0;
            bool found = true;

            pathMileage = getPathMileageByDKCode(dkcode, dkmileage);

            // 如果不在路径上,计算gps,根据gps计算到本路径的最近点的里程。
            if (pathMileage < 0)
            {
                double x, y, z, d;
                CRailwayLineList.getGPSbyDKCode(dkcode, dkmileage, out x, out y, out z, out d);
                getPathMileagebyGPS(x, y, out pathMileage, out dis);
                found = false;
            }
            return(found);
        }
コード例 #7
0
        public void AdjustMileage()
        {
            if (mPierList.Count > 0)
            {
                mMileage_Start = mPierList[0].Mileage_Start;
                mStartDKCode   = mPierList[0].DKCode_Start;
                mMileage_End   = mPierList.Last().Mileage_Start;
                mEndDKCode     = mPierList.Last().DKCode_Start;
                mPath          = new CSubPath(CRailwayLineList.gMileageConnection, mStartDKCode, mMileage_Start, mEndDKCode, mMileage_End, 10);
                if (!mPath.hasPath)
                {
                    mIsValid = false;
                    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 = mPath.mLength;

                //mLongitude_Start = mPierList[0].mLongitude_Mid;
                //mLatitude_Start = mPierList[0].mLatitude_Mid;
                //mAltitude_Start = mPierList[0].mAltitude_Mid;
                //mHeading_Start = mPierList[0].mHeading_Mid;

                Mileage_Start_Discription = CRailwayLineList.CombiDKCode(mStartDKCode, mMileage_Start);
                Mileage_End_Discription   = CRailwayLineList.CombiDKCode(mEndDKCode, mMileage_End);
                mLength = Math.Abs(mMileage_End - mMileage_Start);

                //if (mIsValid)
                //{
                //    if (mSpotList != null)
                //        mSpotList.Clear();
                //    else
                //        mSpotList = new List<CHotSpot>();
                //    mSpotList.Add(new CHotSpot(mStartDKCode, mMileage_Start, mLongitude_Start, mLatitude_Start, mAltitude_Start, mMainMileageS, "ContBeam", this));
                //    mSpotList.Add(new CHotSpot(mMidDKCode, mMileage_Mid, mLongitude_Mid, mLatitude_Mid, mAltitude_Mid, mMainMileage, "ContBeam", this));
                //    mSpotList.Add(new CHotSpot(mEndDKCode, mMileage_End, mLongitude_End, mLatitude_End, mAltitude_End, mMainMileageE, "ContBeam", this));
                //}
            }
        }
コード例 #8
0
ファイル: CRailwayDWProject.cs プロジェクト: xuyanning/JQGis
        //public int mType1;
        //public int mType2;
        /// <summary>
        ///
        /// </summary>
        /// <param name="pp"></param>
        /// <param name="SerialNo"></param>
        /// <param name="name"></param>
        /// <param name="startM"></param>
        /// <param name="length"></param>
        /// <param name="dt"></param>
        /// <param name="AvgProgress"></param>
        /// <param name="dkcode"></param>
        public CRailwayDWProj(CRailwayProject pp, int pid, string SerialNo, int dwid, string name, double startM, double length, DateTime dt, bool isFinish, string dkcode)
        {
            mParentProj = pp;
            mParentID   = pid;
            mDWID       = dwid;
            mDWName     = name;
            mSerialNo   = SerialNo;

            mMileage_Start = startM;
            mDKCode_Start  = dkcode;

            mLength = length;

            mFinishTime = dt;
            //mAvgProgress = AvgProgress;
            mIsDone = isFinish;

            mIsValid = CRailwayLineList.getGPSbyDKCode(dkcode, mMileage_Start,
                                                       out mLongitude_Mid, out mLatitude_Mid, out mAltitude_Mid, out mHeading_Mid);
            mIsOnMainPath = mParentProj.mScene.mMainPath.getPathMileageByDKCode(dkcode, mMileage_Start, out mMainMileage, out mdistanceToMainPath);
        }
コード例 #9
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);
        }
コード例 #10
0
        /// <summary>
        /// 按照工点聚类,单位工程显示第一个
        /// </summary>
        /// <returns></returns>
        public static void clusterConsFromWebByProj(CRailwayScene s, string dbFile, List <ConsLocation> ls, List <CHotSpot> ls2, string fromDate = null, string toDate = null, bool fromLocal = true)
        {
            //double cx, cy;
            double tx, ty, tz, td;

            CRailwayLine rl;
            double       mileage, dis, gm;
            bool         isInside;

            //string fromD = DateTime.Now.AddDays(-7).ToShortDateString();
            //string toD = DateTime.Now.ToShortDateString();

            //dt2.Columns.Add("ProjectName", typeof(string));
            //dt2.Columns.Add("DwName", typeof(string));
            //dt2.Columns.Add("Longitude", typeof(double));
            //dt2.Columns.Add("Latitude", typeof(double));
            //dt2.Columns.Add("StaffNum", typeof(int));
            // 2016-05-06 00:00:00Z
            //DataTable dt = CServerWrapper.findClusterConsByPDW(DateTime.Now.AddDays(-7).Date.ToString("u"));
            //DataTable dt = CServerWrapper.findClusterConsByPDW(fromDate, toDate);
            if (ls == null)
            {
                ls = new List <ConsLocation>();
            }
            else
            {
                ls.Clear();
            }

            if (ls2 == null)
            {
                ls2 = new List <CHotSpot>();
            }
            else
            {
                ls2.Clear();
            }

            DataTable dt = null;

            if (fromLocal)
            {
                string localPath = dbFile;
                dt = DatabaseWrapper.ExecuteDataTable(dbFile, @"SELECT * from ConsInfo ;");
            }
            else if (CServerWrapper.isConnected)
            {
                dt = CServerWrapper.findClusterConsByProj(fromDate, toDate);
            }

            if (dt == null)
            {
                return;
            }

            foreach (DataRow dr in dt.Rows)
            {
                //GPSAdjust.bd_decrypt(Convert.ToDouble(dr["Latitude"]), Convert.ToDouble(dr["Longitude"]), out cy, out cx);

                rl = CRailwayLineList.getMileagebyGPS(Convert.ToDouble(dr["Longitude"]), Convert.ToDouble(dr["Latitude"]), out mileage, out dis, out isInside);
                CRailwayLineList.getGPSbyDKCode(rl.mDKCode, mileage, out tx, out ty, out tz, out td);
                s.mMainPath.getPathMileageByDKCode(rl.mDKCode, mileage, out gm, out dis);
                //FIXME xyn 加入两次,比较实际坐标和火星坐标的差别
                //ConsLocation cl = new ConsLocation("Mars" + dr["ProjectName"].ToString(), dr["DwName"].ToString(), Convert.ToDouble(dr["Longitude"]), Convert.ToDouble(dr["Latitude"]), //tx, ty,
                //    fromDate.Substring(0, 11), toDate.Substring(0, 11), Convert.ToInt32(dr["StaffNum"]));
                //ls.Add(cl);
                ConsLocation cl = new ConsLocation(dr["ProjectName"].ToString(), dr["DwName"].ToString(), Convert.ToDouble(dr["Longitude"]), Convert.ToDouble(dr["Latitude"]),
                                                   fromDate, toDate, Convert.ToInt32(dr["StaffNum"]));
                ls.Add(cl);


                ls2.Add(new CHotSpot(rl.mDKCode, mileage, tx, ty, tz, gm, dis, "Cons", cl));
                //            ls.Add(new ConsLocation(dr["ProjectName"].ToString(), dr["DwName"].ToString(), Convert.ToDouble(dr["Longitude"]), Convert.ToDouble(dr["Latitude"]),
                //fromDate.Substring(0, 11), toDate.Substring(0, 11), Convert.ToInt32(dr["StaffNum"])));
            }

            //new StaticCluster().clusterProcess();
        }
コード例 #11
0
ファイル: FormDataTools.cs プロジェクト: xuyanning/JQGis
        private void button2_Click_1(object sender, EventArgs e)
        {
            double x, y, z;

            CRailwayLineList.getGPSbyDKCodeFromDB("DK", 10000, out x, out y, out z);
        }
コード例 #12
0
        /// <summary>
        /// 生成子路径
        /// </summary>
        /// <param name="g">寻径的floyd图</param>
        /// <param name="DKlist">路径上的dkcode列表,至少2个</param>
        /// <param name="milelist">路径上的里程列表,至少2个</param>
        /// <param name="stepm">细分里程间隔</param>
        private void CreateSubPathFromNodeList(MGraph g, List <string> DKlist, List <double> milelist, double stepm)
        {
            if (DKlist == null || DKlist.Count < 2)
            {
                return;
            }
            mFromDK      = DKlist.First();
            mToDK        = DKlist.Last();
            mFromMileage = milelist.First();
            mToMileage   = milelist.Last();
            mStepM       = stepm;
            mLength      = 0;
            List <PathNode> ls = new List <PathNode>();
            // 路径节点,0,2,4,6下标为链路编号,1,3,5,7等标注正序还是逆序,0-正序,1-逆序
            List <int>   idls = null;
            CRailwayLine tmpLine;

            //存放所有路径上的链路编号
            int[] rlls = new int[DKlist.Count];

            for (int i = 0; i < DKlist.Count; i++)
            {
                tmpLine = CRailwayLineList.getRailwayLineByDKCode(DKlist[i], milelist[i]);
                if (tmpLine == null)
                {
                    return;
                }
                rlls[i] = tmpLine.mIndex;
            }


            // 路径节点,0,2,4,6下标为路径编号,1,3,5,7等标注正序还是逆序,0-正序,1-逆序
            idls = ShortestPathFloyd.getNavPath(rlls, g);
            if (idls == null)
            {
                Console.WriteLine(DKlist[0] + "等路径不存在");
                return;
            }
            if (DKlist.Count == 2 && rlls[0] == rlls[1])  // 起点和终点在同一个链路中
            {
                CRailwayLine rl = CRailwayLineList.getRailwayLineByIndex(idls[0]);
                mLength = Math.Abs(milelist[0] - milelist.Last());
                //if (idls[1] == 0)
                ls.Add(new PathNode(rl, milelist[0], milelist.Last(), false));
                //else
                //    ls.Add(new PathNode(rl, milelist.Last(), milelist[0], true));
            }
            else if (idls.Count > 2)
            {
                mLength     = 0;
                mNodeLength = new double[idls.Count / 2];
                // path中的第一条链
                CRailwayLine rl = CRailwayLineList.getRailwayLineByIndex(idls[0]);
                if (idls[1] == 0)
                {
                    ls.Add(new PathNode(rl, milelist[0], rl.mEnd, false));
                    mLength += Math.Abs(milelist[0] - rl.mEnd);
                }
                else
                {
                    ls.Add(new PathNode(rl, milelist[0], rl.mStart, true));
                    mLength += Math.Abs(milelist[0] - rl.mStart);
                }
                mNodeLength[0] = mLength;
                if (idls.Count > 2)
                {
                    // path的中间链
                    for (int i = 1; i < idls.Count / 2 - 1; i++)
                    {
                        rl = CRailwayLineList.getRailwayLineByIndex(idls[2 * i]);
                        if (idls[2 * i + 1] == 0)
                        {
                            ls.Add(new PathNode(rl, rl.mStart, rl.mEnd, false));
                        }
                        else
                        {
                            ls.Add(new PathNode(rl, rl.mEnd, rl.mStart, true));
                        }
                        mLength       += Math.Abs(rl.mLength);
                        mNodeLength[i] = mLength;
                    }

                    // path的最后一条链
                    rl = CRailwayLineList.getRailwayLineByIndex(idls[idls.Count - 2]);
                    if (idls.Last() == 0)
                    {
                        ls.Add(new PathNode(rl, rl.mStart, milelist.Last(), false));
                        mLength += Math.Abs(rl.mStart - milelist.Last());
                    }
                    else
                    {
                        ls.Add(new PathNode(rl, rl.mEnd, milelist.Last(), true));
                        mLength += Math.Abs(rl.mEnd - milelist.Last());
                    }
                    mNodeLength[mNodeLength.Length - 1] = mLength;
                }
            }

            mPathNodeList = ls;

            hasPath = mPathNodeList.Count > 0 && mLength > 1;

            if (hasPath)
            {
                createSubLine();
            }
        }