Exemplo n.º 1
0
 public MilestoneFix(string citFilePath, IOperator indexOperator)
 {
     _indexOperator  = indexOperator;
     _citProcess     = new CITFileProcess();
     _citFilePath    = citFilePath;
     _citFileInfo    = _citProcess.GetFileInformation(citFilePath);
     _longChainTable = new LongChainTable(_citFileInfo.sTrackCode, _citFileInfo.iKmInc, _citFileInfo.iDir);
     _userFixedTable = new UserFixedTable(indexOperator, _citFileInfo.iKmInc);
     _fixData        = new List <MileStoneFixData>();
 }
 /// <summary>
 /// 所有的里程
 /// </summary>
 //private List<Milestone> _allStone = new List<Milestone>();
 #endregion
 /// <summary>
 /// 初始化
 /// </summary>
 public WavefromData()
 {
     CitFileProcess        = new CITFileProcess();
     _invaildDataManager   = new InvalidDataManager();
     _labelInfoDataManager = new LabelInfoManager();
     _mileList             = new MilestoneList();
     ChannelList           = new List <ChannelsClass>();
     LayerConfig           = new LayerConfigData();
     ChanneDefinitionList  = new List <ChannelDefinition>();
     IndexOperator         = new IndexOperator();
 }
        static void Main(string[] args)
        {
            string citpath = @"H:\工作文件汇总\铁科院\程序\车载加速度\数据文件\CitData_170413050607_GJGX\CitData_170413050607_GJGX.cit";

            CITFileProcess cithelper      = new CITFileProcess();
            var            fileInfomation = cithelper.GetFileInformation(citpath);

            var channelList = cithelper.GetChannelDefinitionList(citpath);

            var channelData = cithelper.GetAllMileStone(citpath);

            var type        = cithelper.GetDataType(citpath);
            var DataVersion = cithelper.GetDataVersion(citpath);

            var date = cithelper.GetDate(citpath);
        }
Exemplo n.º 4
0
 private void Geo2CitConvertForm_Load(object sender, EventArgs e)
 {
     try
     {
         _geoHelper  = new GeoFileHelper();
         _citProcess = new CITFileProcess();
         InitDicTrainCodeAndConfigPath();
         LoadLineDir();
         LoadLineName();
         LoadTrainCode();
         LoadLineCodeAndName();
     }
     catch (Exception ex)
     {
         MyLogger.LogError("初始化Geo转cit时失败", ex);
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 接口函数:无效数据滤除---处理多个通道数据
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="sAddFileName"></param>
        /// <returns></returns>
        private bool GetDataInfoMulti(string FileName, int pointCount, string sAddFileName)
        {
            // CIT文件相关操作类
            CITFileProcess cfprocess = new CITFileProcess();

            // 通道定义相关操作类
            ChannelDefinitionList cdlist = new ChannelDefinitionList();

            //matlab算法
            PreproceingDeviationClass pdc = new PreproceingDeviationClass();

            //获取文件信息
            FileInformation fileinfo = new FileInformation();

            try
            {
                long[] position = cfprocess.GetPositons(FileName);
                long   startPos = position[0]; //开始位置、结束位置
                long   endPos   = position[1];

                cdlist.channelDefinitionList = cfprocess.GetChannelDefinitionList(FileName);

                //分段读取方法////////////////////

                long totleSample = cfprocess.GetTotalSampleCount(FileName);
                //循环次数
                int count = Convert.ToInt32(totleSample / pointCount);
                //是否有余点
                int residue = Convert.ToInt32(totleSample % pointCount);

                bool iszero = false;
                //是否执行一次
                if (count == 0)
                {
                    iszero = true;
                }
                //如果有余数循环次数加1
                if (residue > 0)
                {
                    count++;
                }

                for (int z = 0; z < count; z++)
                {
                    if (iszero)
                    {
                        endPos = cfprocess.GetAppointEndPostion(FileName, startPos, residue);
                    }
                    else
                    {
                        if (residue == 0)
                        {
                            endPos = cfprocess.GetAppointEndPostion(FileName, startPos, pointCount);
                        }
                        else
                        {
                            if (z == (count - 1))
                            {
                                endPos = cfprocess.GetAppointEndPostion(FileName, startPos, residue);
                            }
                            else
                            {
                                endPos = cfprocess.GetAppointEndPostion(FileName, startPos, pointCount);
                            }
                        }
                    }

                    //分段读取方法////////////////////

                    //根据里程list获取里程数组
                    List <Milestone> dualmilelist = cfprocess.GetMileStoneByRange(FileName, startPos, endPos);
                    double[]         tt           = new double[dualmilelist.Count];
                    for (int i = 0; i < dualmilelist.Count; i++)
                    {
                        double obj = dualmilelist[i].GetMeter() / 1000;
                        tt[i] = obj;
                    }

                    double[] wvelo      = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("Speed", "速度"), startPos, endPos);
                    double[] L_Prof_SC  = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("L_Prof_SC", "左高低_中波"), startPos, endPos);
                    double[] R_Prof_SC  = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("R_Prof_SC", "右高低_中波"), startPos, endPos);
                    double[] L_Align_SC = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("L_Align_SC", "左轨向_中波"), startPos, endPos);
                    double[] R_Align_SC = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("R_Align_SC", "右轨向_中波"), startPos, endPos);
                    double[] Gage       = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("Gage", "轨距"), startPos, endPos);
                    double[] Crosslevel = cfprocess.GetOneChannelDataInRange(FileName, cdlist.GetChannelIdByName("Crosslevel", "水平"), startPos, endPos);

                    int      tmpChannelNumber = cdlist.GetChannelIdByName("Gage_L", "单边轨距左");
                    double[] Gage_L           = null;
                    if (tmpChannelNumber == -1)
                    {
                        Gage_L = new double[wvelo.Length];
                    }
                    else
                    {
                        Gage_L = cfprocess.GetOneChannelDataInRange(FileName, tmpChannelNumber, startPos, endPos);
                    }

                    tmpChannelNumber = cdlist.GetChannelIdByName("Gage_R", "单边轨距右");
                    double[] Gage_R = null;
                    if (tmpChannelNumber == -1)
                    {
                        Gage_R = new double[wvelo.Length];
                    }
                    else
                    {
                        Gage_R = cfprocess.GetOneChannelDataInRange(FileName, tmpChannelNumber, startPos, endPos);
                    }

                    DataProcessing dp = new DataProcessing();
                    //调用刘博士的算法---处理多个通道
                    dp.preProcess(tt, L_Prof_SC, R_Prof_SC, L_Align_SC, R_Align_SC, Gage, Crosslevel, wvelo, Gage_L, Gage_R, FileName, sAddFileName, "自动标识", true);

                    //分段读取方法////////////////////
                    startPos = endPos;
                }
                //分段读取方法////////////////////
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
            }
            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 向idf文件中写入
        /// </summary>
        /// <param name="citFilePath">cit文件路径----->来自里程快速校正中的选择cit文件的按钮</param
        /// <param name="numericUpDown1">跳变允许值----->来自里程快速校正中的  跳变容许值</param>
        /// <param name="innerdbpath">内部数据库-----></param>
        private string _writeIdf(String citFilePath, int numericUpDown1, string innerdbpath)
        {
            //String idfFileName = Path.GetFileNameWithoutExtension(citFilePath) + ".idf";

            //String idfFilePath = Path.Combine(Path.GetDirectoryName(citFilePath), idfFileName);

            //if (!File.Exists(idfFilePath))
            //{
            //    //MessageBox.Show("找不到波形索引文件!");
            //    Console.WriteLine("找不到波形索引文件!");
            //    return;
            //}

            //公共方法
            ResultInfo resultInfo = new ResultInfo();

            //读取cit文件
            List <AutoIndex> autoIndexClsList = _readCit(citFilePath, numericUpDown1);

            String idfFileName = Path.GetFileNameWithoutExtension(citFilePath) + "_MileageFix" + ".idf";

            String idfFilePath = Path.Combine(Path.GetDirectoryName(citFilePath), idfFileName);

            //设置附带数据库路径和链接字符串,流程修正使用
            InnerFileOperator.InnerFilePath   = innerdbpath;
            InnerFileOperator.InnerConnString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Jet OLEDB:Database Password = iicdc; ";
            //InnerFileOperator.InnerConnString = "provider=Microsoft.Ace.OLEDB.12.0;extended properties=excel 12.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Extended Properties=Excel 12.0:Database Password = iicdc; ";

            try
            {
                _op = new IndexOperator();
                _op.IndexFilePath = idfFilePath;
                CITFileProcess  cit        = new CITFileProcess();
                FileInformation fileforma  = cit.GetFileInformation(citFilePath);
                UserFixedTable  fixedTable = new UserFixedTable(_op, fileforma.iKmInc);
                fixedTable.Clear();
                for (int i = 0; i < autoIndexClsList.Count; i++)
                {
                    float           mile        = autoIndexClsList[i].km_current + autoIndexClsList[i].meter_current;
                    UserMarkedPoint markedPoint = new UserMarkedPoint();
                    markedPoint.ID             = (i + 1).ToString();
                    markedPoint.FilePointer    = autoIndexClsList[i].milePos;
                    markedPoint.UserSetMileage = mile;
                    fixedTable.MarkedPoints.Add(markedPoint);
                }
                fixedTable.Save();

                try
                {
                    MilestoneFix fix = new MilestoneFix(citFilePath, _op);
                    fix.RunFixingAlgorithm();
                    fix.SaveMilestoneFixTable();

                    resultInfo.flag = 1;
                    resultInfo.msg  = "";
                    resultInfo.data = idfFilePath;
                }
                catch (Exception ex)
                {
                    resultInfo.flag = 0;
                    resultInfo.msg  = ex.Message;
                }
            }
            catch (Exception ex)
            {
                resultInfo.flag = 0;
                resultInfo.msg  = ex.Message;
            }

            return(JsonConvert.SerializeObject(resultInfo));
        }