public void InitFixData(string fixedCitFile, string fixedIdfFile = null, bool diffFileName = false)
        {
            List <ChannelDefinition> channelDefinition = _citProcess.GetChannelDefinitionList(fixedCitFile);

            for (int i = 0; i < FixParams.Count; i++)
            {
                FixParams[i].ChannelID = channelDefinition.Where(p => p.sNameEn == FixParams[i].ChannelName).ToList()[0].sID;
            }
            FileInformation citFile = _citProcess.GetFileInformation(fixedCitFile);

            _fixedData.Clear();

            string idfFIle = fixedCitFile.Replace(".cit", ".idf");

            if (diffFileName)
            {
                idfFIle = fixedIdfFile;
            }

            IndexOperator indexOperator = new IndexOperator();

            if (File.Exists(idfFIle))
            {
                indexOperator.IndexFilePath = idfFIle;
                UserFixedTable fixTable = new UserFixedTable(indexOperator, citFile.iKmInc);
                if (fixTable.MarkedPoints.Count > 0)
                {
                    foreach (var point in fixTable.MarkedPoints)
                    {
                        //左半边数据点个数,包括中间点
                        List <FixPoint> fixPoint         = new List <FixPoint>();
                        int             leftFixedCount   = FixedSamplingCount + 1;
                        long            leftStartPostion = _citProcess.GetAppointFileEndPostion(fixedCitFile, point.FilePointer, -1 * leftFixedCount);
                        long            realLeftCount    = _citProcess.GetSampleCountByRange(fixedCitFile, leftStartPostion, point.FilePointer);
                        long            rightEndPostion  = _citProcess.GetAppointFileEndPostion(fixedCitFile, point.FilePointer, FixedSamplingCount);
                        long            realRightCount   = _citProcess.GetSampleCountByRange(fixedCitFile, point.FilePointer, rightEndPostion);
                        Milestone       mile             = _citProcess.GetAppointMilestone(fixedCitFile, point.FilePointer);
                        foreach (var item in FixParams)
                        {
                            FixPoint fixP = new FixPoint();
                            fixP.FixPostion = leftFixedCount;
                            double[] data = _citProcess.GetOneChannelDataInRange(fixedCitFile, item.ChannelID, leftStartPostion, ((int)(realLeftCount + realRightCount)));
                            fixP.Points          = data;
                            fixP.ChannelID       = item.ChannelID;
                            fixP.OriginalMileage = mile.GetMeter();
                            fixPoint.Add(fixP);
                        }
                        _fixedData.Add(point, fixPoint);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据修正后的里程点得到文件中的原始偏移量
        /// </summary>
        /// <param name="mileStone">修正后的里程(米)</param>
        /// <returns>原始偏移量</returns>
        public Milestone CalcMilestoneByFixedMilestone(float mileStone)
        {
            Milestone mstone = new Milestone();

            if (_fixData != null && _fixData.Count > 0)
            {
                for (int i = 0; i < _fixData.Count; i++)
                {
                    if (mileStone >= _fixData[i].MarkedStartPoint.UserSetMileage &&
                        mileStone <= FixData[i].MarkedEndPoint.UserSetMileage)
                    {
                        float diff        = mileStone - _fixData[i].MarkedStartPoint.UserSetMileage;
                        int   sampleCount = (int)(diff / _fixData[i].SampleRate) + 1;
                        //targetPosion = _citProcess.GetAppointEndPostion(_citFilePath, _fixData[i].MarkedStartPoint.FilePointer, sampleCount);
                        mstone = _citProcess.GetAppointMilestone(_citFilePath, _fixData[i].MarkedStartPoint.FilePointer, sampleCount);
                        break;
                    }
                }
            }
            return(mstone);
        }
        public void GetChannelData(string citFilePath, long startPos, long endPos, int[] sTQIItemIndex)
        {
            List <double[]> datas = citProcess.GetAllChannelDataInRange(citFilePath, startPos, endPos);

            TQIClass  tqi       = new TQIClass();
            Milestone milestone = citProcess.GetAppointMilestone(citFilePath, startPos);

            tqi.iKM    = Convert.ToInt32(milestone.mKm);
            tqi.iMeter = milestone.mMeter;
            tqi.zgd    = GetTQIValue(datas[sTQIItemIndex[0]]);

            tqi.ygd = GetTQIValue(datas[sTQIItemIndex[1]]);
            tqi.zgx = GetTQIValue(datas[sTQIItemIndex[2]]);
            tqi.ygx = GetTQIValue(datas[sTQIItemIndex[3]]);
            tqi.gj  = GetTQIValue(datas[sTQIItemIndex[4]]);
            tqi.sp  = GetTQIValue(datas[sTQIItemIndex[5]]);
            tqi.sjk = GetTQIValue(datas[sTQIItemIndex[6]]);
            tqi.hj  = GetTQIValue(datas[sTQIItemIndex[7]]);
            tqi.cj  = GetTQIValue(datas[sTQIItemIndex[8]]);

            //tqi.pjsd=

            tqilist.Add(tqi);
        }