コード例 #1
0
ファイル: CTEProject.cs プロジェクト: liangyulin/railGis
 public CTEPier(string pName, CTEProject parent, double x, double y, double z, double roll, double yaw)
 {
     mPierName     = pName;
     mParentBridge = parent;
     parent.mPierList.Add(this);
     sgX    = x;
     sgY    = y;
     sgZ    = z;
     sgYaw  = yaw;
     sgRoll = roll;
     mMeter = CScene.mMiddleLine.findMeterbyCoor(sgX, sgY);
 }
コード例 #2
0
ファイル: CTEProject.cs プロジェクト: liangyulin/railGis
        public static void LoadTEProFromDB()
        {
            OleDbConnection  conn      = null;
            OleDbDataAdapter myCommand = null;
            DataSet          ds        = null;
            CTEProject       cItem     = null;


            try
            {
                string fileName = @"D:\gisData\xlsx\MNTEProj.xlsx";
                string strConn;
                if (System.IO.Path.GetExtension(fileName) == ".xls")
                {
                    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + ";" + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\"";
                }
                else
                {
                    strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + fileName + ";" + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
                }

                conn = new OleDbConnection(strConn);
                conn.Open();
                myCommand = new OleDbDataAdapter(@"select * from [TEProject$]; ", conn);    //order by Mileage asc
                ds        = new DataSet();
                myCommand.Fill(ds, "table1");

                foreach (DataRow dr in ds.Tables["table1"].Rows)
                {
                    cItem = new CTEProject((string)dr["ProjectType"], (string)dr["ProjectName"],
                                           (string)dr["ProjectModel"], (double)dr["LongitudeS"], (double)dr["LatitudeS"], (double)dr["AltitudeS"],
                                           (double)dr["LongitudeM"], (double)dr["LatitudeM"], (double)dr["AltitudeM"]);

                    mTEProjectList.Add(cItem);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                conn.Close();
            }
        }