private static void LoadTocbo(CParameterInitialize pParameterInitialize)
        {
            if (pParameterInitialize.cboLayerLt == null)
            {
                return;
            }

            IMap       pm_mapFeature = pParameterInitialize.m_mapFeature;
            IEnumLayer pEnumlayer    = pm_mapFeature.Layers;
            var        astrLayerName = new string[pm_mapFeature.LayerCount];
            int        intIndex      = 0;

            while (intIndex < pm_mapFeature.LayerCount)
            {
                astrLayerName[intIndex] = pEnumlayer.Next().Name;
                intIndex++;
            }

            int intSelect = 0;

            foreach (ComboBox cboLayer in pParameterInitialize.cboLayerLt)
            {
                cboLayer.Items.AddRange(astrLayerName);
                cboLayer.SelectedIndex = intSelect;
                intSelect++;
            }
        }
        /// <summary>
        /// 显示并返回单个插值线段
        /// </summary>
        /// <param name="pDataRecords">数据记录</param>
        /// <param name="dblProp">差值参数</param>
        /// <returns>插值线段</returns>
        public static List <CPolyline> GetAndSaveInterpolation(CDataRecords pDataRecords, double dblProp)
        {
            if (dblProp < 0 || dblProp > 1)
            {
                MessageBox.Show("the parameter t is not acceptable!");
                return(null);
            }

            CMorphingBaseCpl pMorphingBaseCpl   = pDataRecords.ParameterResult.pMorphingBaseCpl;
            List <CPolyline> pInterpolatedCPlLt = pMorphingBaseCpl.GenerateInterpolatedCplLt(dblProp);

            CParameterInitialize pParameterInitialize = pDataRecords.ParameterInitialize;

            CHelpFunc.SaveCPlLt(pInterpolatedCPlLt, pParameterInitialize.strSaveFolderName + "____" + dblProp.ToString(),
                                pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl);

            return(pInterpolatedCPlLt);
        }
        public static List <IFeatureLayer> GetVisibleLayers(CParameterInitialize ParameterInitialize)
        {
            var blnVisibleLt = new List <bool>();
            var m_mapFeature = CHelpFunc.GetAllLayers(ParameterInitialize.m_mapControl, blnVisibleLt);

            var pFLayerLt = new List <IFeatureLayer>(m_mapFeature.LayerCount);

            for (int i = 0; i < m_mapFeature.LayerCount; i++)
            {
                var pFLayer = m_mapFeature.get_Layer(i) as IFeatureLayer;

                if (blnVisibleLt[i] == false)
                {
                    continue;
                }
                else
                {
                    pFLayerLt.Add(pFLayer);
                }
            }

            return(pFLayerLt);
        }
        public static void SetSavePath(CParameterInitialize ParameterInitialize, bool blnCreateFileGdbWorkspace = false)
        {
            //if we have already set a path, then we simply use that path
            if (ParameterInitialize.strMxdPathBackSlash != null)
            {
                return;
            }

            //_strPath, which is different from ParameterInitialize.strPath, is defined in CHelpFunc
            if (_strPath == null)
            {
                SaveFileDialog SFD = new SaveFileDialog();
                SFD.ShowDialog();
                if (SFD.FileName == null || SFD.FileName == "")
                {
                    return;
                }
                _strPath = SFD.FileName;
            }

            string strFileName = _strPath + "\\" + GetTimeStamp();

            //string strFileName = CHelpFunc.strPath + "MorphingResults";

            ParameterInitialize.strMxdPath           = _strPath;
            ParameterInitialize.strMxdPathBackSlash  = _strPath + "\\";
            ParameterInitialize.strSaveFolderName    = System.IO.Path.GetFileNameWithoutExtension(strFileName);
            ParameterInitialize.strSavePath          = strFileName;
            ParameterInitialize.strSavePathBackSlash = strFileName + "\\";
            ParameterInitialize.pWorkspace           = CHelpFunc.OpenWorkspace(strFileName);

            if (blnCreateFileGdbWorkspace == true)
            {
                ParameterInitialize.pFileGdbWorkspace =
                    CreateFileGdbWorkspace(ParameterInitialize.strSavePathBackSlash, "FileGdb");
            }
        }
        //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 FrmOperation(ref CParameterInitialize pParameterInitialize)
 {
     pParameterInitialize.m_mapFeature = CHelpFunc.GetAllLayers(pParameterInitialize.m_mapControl);
     LoadTocbo(pParameterInitialize);
 }