Ejemplo n.º 1
0
 public void createExcelData(double[] m, double[] z, StreamWriter sw)
 {
     //for (int i = 0; i < m.Length -1; i++)
     //{
     //    if (m[i + 1] - m[i] < 1)
     //        Console.WriteLine(i+" error");
     //}
     double[] x = CubicSpline.Compute(meter.Length, meter, longitude, m);
     double[] y = CubicSpline.Compute(meter.Length, meter, latitude, m);
     if (mIsReverse)
     {
         for (int i = 0; i < m.Length; i++)
         {
             sw.WriteLine((mStart - m[i]) + "\t" + x[i] + "\t" + y[i] + "\t" + z[i] + "\t" + mIndex);
         }
     }
     else
     {
         for (int i = 0; i < m.Length; i++)
         {
             sw.WriteLine((mStart + m[i]) + "\t" + x[i] + "\t" + y[i] + "\t" + z[i] + "\t" + mIndex);
         }
     }
     sw.Close();
 }
Ejemplo n.º 2
0
 //
 // 获取线路的一部分,
 //输入参数:里程采样点meterSample及数目count
 //输出参数:里程采样点的经纬度、高度坐标以及朝向
 //
 public void getSubLine(int count, double[] meterSample, out double[] x, out double[] y, out double[] z, out double[] dir)
 {
     x = y = z = dir = null;
     for (int i = 0; i < count; i++)
     {
         meterSample[i] = Math.Abs(meterSample[i] - mStart);
     }
     x   = CubicSpline.Compute(mPointNum, meter, longitude, meterSample);
     y   = CubicSpline.Compute(mPointNum, meter, latitude, meterSample);
     z   = CubicSpline.Compute(mPointNum, meter, altitude, meterSample);
     dir = CubicSpline.Compute(mPointNum, meter, heading, meterSample);
 }
Ejemplo n.º 3
0
        public string mDKCode;    // "DK" "DIK"
        //        public double[]
        public CRailwayLine(string dkcode, double fromM, double toM, bool isA, int num, double[] m, double[] x, double[] y, double[] z)
        {
            mStart = fromM;
            mEnd   = toM;
            if (mStart < mEnd)
            {
                mIsReverse = false;
            }
            else
            {
                mIsReverse = true;
            }
            mDKCode      = dkcode;
            mIsAuxiliary = isA;
            //mFromID = fromID;
            //mToID = toID;

            mLength   = m[num - 1] - m[0];
            mPointNum = (int)((mLength - 0.05) / 10) + 2;  //FIXME 误差
            meter     = new double[mPointNum];

            meter[0]             = m[0];
            meter[mPointNum - 1] = m[num - 1];
            //for (int j = 0; j < num - 1; j++)
            //    if (m[j] >= m[j+ 1])
            //        Console.WriteLine("mileage error " + m[j] + "\t" + m[j+1]);

            for (int i = 1; i < mPointNum - 1; i++)
            {
                meter[i] = meter[i - 1] + 10;
            }

            longitude = CubicSpline.Compute(num, m, x, meter);
            latitude  = CubicSpline.Compute(num, m, y, meter);
            altitude  = CubicSpline.Compute(num, m, z, meter);

            CoordinateConverter.LatLonToYawList(mPointNum, latitude, longitude, out utmX, out utmY, out heading);
        }