/// <summary>
        /// 导出Integral指标值
        /// </summary>
        /// <param name="pParameterResultToExcel">需保存的数据</param>
        /// <param name="pWorksheet">Excel的Sheet</param>
        private static void ExportIntegralEvaluation(CParameterResult pParameterResultToExcel, ref Worksheet pWorksheet, ref ToolStripProgressBar tspbMain)
        {
            ////为应付Excel的bug,加入以下两行代码
            //System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
            //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            pWorksheet.Cells[1, 1] = "FrID";
            pWorksheet.Cells[1, 2] = "FrX";
            pWorksheet.Cells[1, 3] = "FrY";
            pWorksheet.Cells[1, 4] = "ToID";
            pWorksheet.Cells[1, 5] = "ToX";
            pWorksheet.Cells[1, 6] = "ToY";
            pWorksheet.Cells[1, 7] = "Integral";
            pWorksheet.Cells[1, 8] = "SumIntegral";

            int intRowCount = pParameterResultToExcel.FromPtLt.Count;

            for (int i = 0; i < intRowCount; i++)
            {
                pWorksheet.Cells[i + 2, 1] = pParameterResultToExcel.FromPtLt[i].ID;
                pWorksheet.Cells[i + 2, 2] = pParameterResultToExcel.FromPtLt[i].X;
                pWorksheet.Cells[i + 2, 3] = pParameterResultToExcel.FromPtLt[i].Y;
                pWorksheet.Cells[i + 2, 4] = pParameterResultToExcel.ToPtLt[i].ID;
                pWorksheet.Cells[i + 2, 5] = pParameterResultToExcel.ToPtLt[i].X;
                pWorksheet.Cells[i + 2, 6] = pParameterResultToExcel.ToPtLt[i].Y;
                pWorksheet.Cells[i + 2, 7] = pParameterResultToExcel.dblIntegralLt[i];
                pWorksheet.Cells[i + 2, 8] = pParameterResultToExcel.dblSumIntegralLt[i];

                tspbMain.Value = (i + 1) * 100 / (intRowCount);
            }
        }
        //public static Worksheet GetWorksheetFromPath(string strEntireFileName = null)
        //{


        //}


        #region ExportEvaluationToExcel for ResultPtLt
        /// <summary>
        /// 将指标值导出到Excel中
        /// </summary>
        /// <param name="pParameterResultToExcel">指标结果信息</param>
        /// <param name="strSavePath">保存路径</param>
        /// <remarks>导出时,Excel显示的指标信息为到该点时的指标信息</remarks>
        public static void ExportEvaluationToExcel(CParameterResult pParameterResultToExcel, CParameterInitialize pParameterInitialize, string strSuffix)
        {
            ////为应付Excel的bug,加入以下两行代码
            //System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
            //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            StatusStrip          ststMain    = pParameterInitialize.ststMain;
            ToolStripStatusLabel tsslTime    = pParameterInitialize.tsslTime;
            ToolStripStatusLabel tsslMessage = pParameterInitialize.tsslMessage;
            ToolStripProgressBar tspbMain    = pParameterInitialize.tspbMain;

            tsslMessage.Text = "正在将指标值导出到Excel...";
            ststMain.Refresh();
            long lngStartTime = System.Environment.TickCount;

            Excel.Application pExcelAPP = new Excel.Application();
            pExcelAPP.Visible = false;
            Workbook  pWorkBook   = pExcelAPP.Workbooks.Add(true);
            Worksheet pWorksheet  = pWorkBook.Worksheets[1] as Worksheet;
            string    strSavePath = pParameterInitialize.strSavePath;
            string    strfilename = System.IO.Path.GetFileNameWithoutExtension(strSavePath);

            switch (pParameterResultToExcel.strEvaluationMethod)
            {
            case "Integral":
            {
                ExportIntegralEvaluation(pParameterResultToExcel, ref pWorksheet, ref tspbMain);
                strfilename = strfilename + "Integral";
                break;
            }

            case "Translation":
            {
                ExportTranslationEvaluation(pParameterResultToExcel, ref pWorksheet, ref tspbMain);
                strfilename = strfilename + "Translation";
                break;
            }

            case "Deflection":
            {
                ExportTranslationEvaluation(pParameterResultToExcel, ref pWorksheet, ref tspbMain);
                strfilename = strfilename + "Deflection";
                break;
            }

            default: throw new ArgumentException("调用的评价指标值导出方法不存在!");
            }


            pWorksheet.Columns.AutoFit();
            pExcelAPP.DisplayAlerts = false;
            pWorkBook.SaveAs(strSavePath + "\\" + strfilename + strSuffix, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            pExcelAPP.Quit();

            long lngEndTime = System.Environment.TickCount;
            long lngTime    = lngEndTime - lngStartTime;

            tsslTime.Text    = "导出运行时间:" + Convert.ToString(lngTime) + "ms"; //显示运行时间
            tsslMessage.Text = "详细信息已导出到Excel!";
        }
        //public static void ExportEvaluationToExcel(CDataRecords pDataRecords, string strSuffix)
        //{
        //    CParameterInitialize pParameterInitialize = pDataRecords.ParameterInitialize;
        //    CParameterResult pParameterResult = pDataRecords.ParameterResult;

        //    StatusStrip ststMain = pParameterInitialize.ststMain;
        //    ToolStripStatusLabel tsslTime = pParameterInitialize.tsslTime;
        //    ToolStripStatusLabel tsslMessage = pParameterInitialize.tsslMessage;
        //    ToolStripProgressBar tspbMain = pParameterInitialize.tspbMain;
        //    tsslMessage.Text = "正在将指标值导出到Excel...";
        //    ststMain.Refresh();
        //    long lngStartTime = System.Environment.TickCount;

        //    Excel.Application pExcelAPP = new Excel.Application();
        //    pExcelAPP.Visible = false;
        //    Workbook pWorkBook = pExcelAPP.Workbooks.Add(true);
        //    Worksheet pWorksheet = pWorkBook.Worksheets[1] as Worksheet;
        //    string strSavePath = pParameterInitialize.strSavePath;
        //    string strfilename = System.IO.Path.GetFileNameWithoutExtension(strSavePath);
        //    switch (pParameterResult.strEvaluationMethod)
        //    {
        //        case "Integral":
        //            {
        //                ExportIntegralEvaluation(pParameterResult, ref pWorksheet, ref tspbMain);
        //                strfilename = strfilename + "Integral";
        //                break;
        //            }
        //        case "Translation":
        //            {
        //                ExportTranslationEvaluation(pParameterResult, ref pWorksheet, ref tspbMain);
        //                strfilename = strfilename + "Translation";
        //                break;
        //            }
        //        case "Deflection":
        //            {
        //                ExportTranslationEvaluation(pParameterResult, ref pWorksheet, ref tspbMain);
        //                strfilename = strfilename + "Deflection";
        //                break;
        //            }
        //        default: throw new ArgumentException("调用的评价指标值导出方法不存在!");
        //    }


        //    pWorksheet.Columns.AutoFit();
        //    pExcelAPP.DisplayAlerts = false;
        //    pWorkBook.SaveAs(strSavePath + "\\" + strfilename + strSuffix, AccessMode: XlSaveAsAccessMode.xlNoChange);
        //    pExcelAPP.Quit();

        //    long lngEndTime = System.Environment.TickCount;
        //    long lngTime = lngEndTime - lngStartTime;
        //    tsslTime.Text = "导出运行时间:" + Convert.ToString(lngTime) + "ms";  //显示运行时间
        //    tsslMessage.Text = "详细信息已导出到Excel!";
        //}


        public static void ExportEvaluationToExcelCorr(CParameterResult pParameterResult,
                                                       string strPath, string strSuffix = null)
        {
            string strEvaluationMethod = pParameterResult.enumEvaluationMethod.ToString();
            string strfilename         = System.IO.Path.GetFileNameWithoutExtension(strPath);

            List <List <CCorrCpts> > CorrCptsLtLt         = pParameterResult.pMorphingBase.CorrCptsLtLt;
            List <List <double> >    dblEvaluationLtLt    = pParameterResult.pEvaluation.dblEvaluationLtLt;
            List <List <double> >    dblSumEvaluationLtLt = pParameterResult.pEvaluation.dblSumEvaluationLtLt;

            for (int i = 0; i < CorrCptsLtLt.Count; i++)
            {
                string strEntireFileName = strPath + "\\" + strfilename + strEvaluationMethod +
                                           CHelpFunc.JudgeAndAddZero(i, 4) + "__" + dblSumEvaluationLtLt[i].Last().ToString();

                //it's better if we can output a file with ".xlsx", but that causes problems
                var sw = new StreamWriter(strEntireFileName + ".xls", false, Encoding.GetEncoding(-0));

                string strColNames =
                    "FrID\t" + "FrX\t" + "FrY\t" + "ToID\t" + "ToX\t" + "ToY\t" + "MoveID\t" + "MoveX\t" + "MoveY\t"
                    + strEvaluationMethod + "\t" + "Sum" + strEvaluationMethod;
                sw.WriteLine(strColNames);

                int intJ = 0;
                foreach (CCorrCpts CorrCpt in CorrCptsLtLt[i])
                {
                    string strTemp = CorrCpt.FrCpt.ID.ToString() + "\t"
                                     + CorrCpt.FrCpt.X.ToString() + "\t"
                                     + CorrCpt.FrCpt.Y.ToString() + "\t"
                                     + CorrCpt.ToCpt.ID.ToString() + "\t"
                                     + CorrCpt.ToCpt.X.ToString() + "\t"
                                     + CorrCpt.ToCpt.Y.ToString() + "\t"
                                     + CorrCpt.pMoveVector.ID.ToString() + "\t"
                                     + CorrCpt.pMoveVector.X.ToString() + "\t"
                                     + CorrCpt.pMoveVector.Y.ToString() + "\t"
                                     + dblEvaluationLtLt[i][intJ].ToString() + "\t"
                                     + dblSumEvaluationLtLt[i][intJ].ToString();
                    sw.WriteLine(strTemp);
                    intJ++;
                }
                sw.Close();
            }


            //output the last values
            var dblSumEvaluationLt = new List <double>(dblSumEvaluationLtLt.Count);

            for (int i = 0; i < dblSumEvaluationLtLt.Count; i++)
            {
                dblSumEvaluationLt.Add(dblSumEvaluationLtLt[i].Last());
            }
            ExportDataltToExcel(dblSumEvaluationLt, "SumEachFeature", strPath);

            //KillExcel();
        }
        ///// <summary>
        ///// 输出系数矩阵A
        ///// </summary>
        ///// <param name="maxData">系数矩阵A(注意:该矩阵从第0行到第i行为对角矩阵,i行之后为全矩阵</param>
        ///// <param name="strName">文件名称</param>
        ///// <param name="strSavePath">保存路径</param>
        ///// <remarks>二维矩阵</remarks>
        //public static void ExportDataToExcelA(VBMatrix maxData, string strName, string strSavePath)
        //{
        //    //为应付Excel的bug,加入以下两行代码
        //    //System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
        //    //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

        //    Excel.Application pExcelAPP = new Excel.Application();
        //    pExcelAPP.Visible = false;
        //    Workbook pWorkBook = pExcelAPP.Workbooks.Add(true);
        //    Worksheet pWorksheet = pWorkBook.Worksheets[1] as Worksheet;
        //    string strfilename = System.IO.Path.GetFileNameWithoutExtension(strSavePath);
        //    strfilename = strfilename + strName;

        //    int intRowCount = maxData.Row;
        //    int intColCount = maxData.Col;

        //    for (int i = 0; i < intColCount; i++)
        //    {
        //        pWorksheet.Cells[i + 1, i + 1] = maxData[i, i];
        //    }

        //    for (int i = intColCount; i < intRowCount; i++)
        //    {
        //        for (int j = 0; j < intColCount; j++)
        //        {
        //            pWorksheet.Cells[i + 1, j + 1] = maxData[i, j];
        //        }
        //    }

        //    pWorksheet.Columns.AutoFit();
        //    pExcelAPP.DisplayAlerts = false;
        //    pWorkBook.SaveAs(strSavePath + "\\" + strfilename, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
        //    pExcelAPP.Quit();
        //    //KillExcel();
        //}

        ///// <summary>
        ///// 输出权重矩阵P(注意:P为对角矩阵)
        ///// </summary>
        ///// <param name="maxData">权重矩阵P(注意:P为对角矩阵)</param>
        ///// <param name="strName">文件名称</param>
        ///// <param name="strSavePath">保存路径</param>
        ///// <remarks>二维矩阵</remarks>
        //public static void ExportDataToExcelP(VBMatrix maxData, string strName, string strSavePath)
        //{
        //    //为应付Excel的bug,加入以下两行代码
        //    //System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
        //    //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

        //    Excel.Application pExcelAPP = new Excel.Application();
        //    pExcelAPP.Visible = false;
        //    Workbook pWorkBook = pExcelAPP.Workbooks.Add(true);
        //    Worksheet pWorksheet = pWorkBook.Worksheets[1] as Worksheet;
        //    string strfilename = System.IO.Path.GetFileNameWithoutExtension(strSavePath);
        //    strfilename = strfilename + strName;

        //    int intRowCount = maxData.Row;
        //    int intColCount = maxData.Col;

        //    for (int i = 0; i < intRowCount; i++)
        //    {
        //        pWorksheet.Cells[i + 1, i + 1] = maxData[i, i];

        //    }

        //    pWorksheet.Columns.AutoFit();
        //    pExcelAPP.DisplayAlerts = false;
        //    pWorkBook.SaveAs(strSavePath + "\\" + strfilename, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
        //    pExcelAPP.Quit();
        //    //KillExcel();
        //}

        ///// <summary>
        ///// insert a data into an existed excel file at specified cell
        ///// </summary>
        ///// <param name="strPath">the path of the file</param>
        //public static void InsertData(string strPath, int intRow, int intCol, double dblData)
        //{
        //    Excel.Application pExcelAPP = new Excel.Application();
        //    pExcelAPP.Visible = false;
        //    Workbook pWorkBook = pExcelAPP.Workbooks.Open(strPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
        //    Worksheet pWorksheet = pWorkBook.Worksheets[1] as Worksheet;

        //    pWorksheet.Cells[intRow, intCol] = dblData;

        //    pExcelAPP.DisplayAlerts = false;
        //    pWorkBook.Save();
        //    pExcelAPP.Quit();
        //    //KillExcel();
        //}

        /// <summary>
        /// 从Excel中读入数据
        /// </summary>
        /// <param name="strPath">文件路径</param>
        /// <returns>pParameterResult:较大比例尺线状要素上、较小比例尺线状要素、对应点列</returns>
        public static CParameterResult InputDataResultPtLt(string strPath, bool blnReverse = false)
        {
            Excel.Application pExcelAPP = new Excel.Application();
            pExcelAPP.Visible = false;
            Workbook  pWorkBook  = pExcelAPP.Workbooks.Open(strPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            Worksheet pWorksheet = pWorkBook.Worksheets[1] as Worksheet;

            List <CCorrCpts> pCorrCptsLt = new List <CCorrCpts>();
            List <CPoint>    frcptlt     = new List <CPoint>();
            List <CPoint>    tocptlt     = new List <CPoint>();
            int intRow = pWorksheet.UsedRange.Rows.Count;

            System.Array values = (System.Array)pWorksheet.UsedRange.Formula;
            for (int i = 0; i < intRow - 1; i++)
            {
                CPoint frcpt = new CPoint(Convert.ToInt32(values.GetValue(i + 2, 1)), Convert.ToDouble(values.GetValue(i + 2, 2)), Convert.ToDouble(values.GetValue(i + 2, 3)));
                CPoint tocpt = new CPoint(Convert.ToInt32(values.GetValue(i + 2, 4)), Convert.ToDouble(values.GetValue(i + 2, 5)), Convert.ToDouble(values.GetValue(i + 2, 6)));

                if (blnReverse == true)
                {
                    CHelpFunc.Swap(frcpt, tocpt);
                }

                if ((frcpt.ID != -1) && (tocpt.ID != -1))
                {
                    frcpt.isCtrl = true;
                    tocpt.isCtrl = true;
                }
                frcpt.CorrespondingPtLt = new List <CPoint>();
                frcpt.CorrespondingPtLt.Add(tocpt);
                frcptlt.Add(frcpt);
                tocptlt.Add(tocpt);
                CCorrCpts pCorrCpts = new CCorrCpts(frcpt, tocpt);
                pCorrCptsLt.Add(pCorrCpts);
            }
            pExcelAPP.Quit();

            //删除重复点,以生成frcpl
            for (int i = frcptlt.Count - 2; i >= 0; i--)
            {
                if (frcptlt[i].Equals2D(frcptlt[i + 1]))
                {
                    frcptlt.RemoveAt(i + 1);
                }
            }

            //删除重复点,以生成tocpl
            for (int i = tocptlt.Count - 2; i >= 0; i--)
            {
                if (tocptlt[i].Equals2D(tocptlt[i + 1]))
                {
                    tocptlt.RemoveAt(i + 1);
                }
            }

            //生成结果
            CPolyline        frcpl            = new CPolyline(0, frcptlt);
            CPolyline        tocpl            = new CPolyline(1, tocptlt);
            CParameterResult pParameterResult = new CParameterResult();

            pParameterResult.FromCpl = frcpl;
            pParameterResult.ToCpl   = tocpl;
            double dblfr = frcpl.pPolyline.Length;
            double dblto = tocpl.pPolyline.Length;

            pParameterResult.CCorrCptsLt = pCorrCptsLt;
            //pParameterResult.CResultPtLt = ResultPtLt;

            return(pParameterResult);
        }