/// <summary>
        /// 根据采样个数获取对应位置
        /// </summary>
        /// <param name="sampleCount">采样点个数</param>
        /// <param name="isReviseValue">是否进行偏移</param>
        /// <returns>采样点的位置</returns>
        public long GetAppointEndPostion(int sampleCount)
        {
            long endPos = 0;

            if (File.Exists(_citFilePath))
            {
                //int sampleCount = GetScrollValueToSampleNum(scrollValue);
                long[] postions = CitFileProcess.GetPositons(_citFilePath);
                //int sampleNum = GetScrollValueToSampleNum(scrollValue);
                if (LayerConfig.IsReverse)
                {
                    if (sampleCount == 0)
                    {
                        endPos = postions[1];
                    }
                    else
                    {
                        endPos = CitFileProcess.GetAppointEndPostion(_citFilePath, postions[1], sampleCount * -1);
                    }
                }
                else
                {
                    if (sampleCount == 0)
                    {
                        endPos = postions[0];
                    }
                    else
                    {
                        endPos = CitFileProcess.GetAppointEndPostion(_citFilePath, postions[0], sampleCount);
                    }
                }

                //if (isReviseValue)
                //{
                //    if (LayerConfig.IsReverse)
                //    {
                //        endPos -= ReviseValue * _citFile.iChannelNumber * 2;
                //    }
                //    else
                //    {
                //        endPos += ReviseValue * _citFile.iChannelNumber * 2;
                //    }
                //}
            }
            return(endPos);
        }
        public List <Milestone> GetRangeMileage(int totalSmapleCount)
        {
            List <Milestone> rangeMileage = new List <Milestone>(WaveformDataCount);
            long             endPostion   = -1;

            long[] postions = CitFileProcess.GetPositons(_citFilePath);
            long   postion  = CitFileProcess.GetAppointEndPostion(CitFilePath, postions[0], totalSmapleCount);

            rangeMileage = CitFileProcess.GetMileStoneByRange(CitFilePath, postion, WaveformDataCount, ref endPostion);
            if (IsLoadIndex)
            {
                if (MileageFix.FixData.Count > 0)
                {
                    rangeMileage = MileageFix.GetMileageReviseData(rangeMileage);
                }
                else
                {
                    IsLoadIndex = false;
                }
            }
            return(rangeMileage);
        }
 /// <summary>
 /// 根据采样点获取目标点
 /// </summary>
 /// <param name="sampleCount"></param>
 /// <returns></returns>
 public long GetPostionBySamapleCount(int sampleCount)
 {
     long[] postion = CitFileProcess.GetPositons(_citFilePath);
     return(CitFileProcess.GetAppointEndPostion(_citFilePath, postion[0], sampleCount));
 }
        /// <summary>
        /// 根据起始位置加载波形数据
        /// </summary>
        /// <param name="startPostion">起始点</param>
        public void GetWaveformData(long startPostion)
        {
            if (File.Exists(_citFilePath))
            {
                long   endPos       = 0;
                long   startPos     = 0;
                long   realStartPos = 0;
                long[] postions     = CitFileProcess.GetPositons(_citFilePath);
                startPos = startPostion;
                if (LayerConfig.IsReverse)
                {
                    startPos -= ReviseValue * _citFile.iChannelNumber * 2;
                }
                else
                {
                    startPos += ReviseValue * _citFile.iChannelNumber * 2;
                }
                realStartPos = startPos;
                int pointCount = 0;
                if (startPos < postions[0])
                {
                    while (startPos < postions[0] && pointCount < WaveformDataCount)
                    {
                        startPos += _citFile.iChannelNumber * 2;
                        pointCount++;
                    }
                    pointCount = WaveformDataCount - pointCount;
                }
                else if (startPos > postions[1])
                {
                    while (startPos > postions[1] && pointCount < WaveformDataCount)
                    {
                        startPos -= _citFile.iChannelNumber * 2;
                        pointCount++;
                    }
                    pointCount = WaveformDataCount - pointCount;
                }
                else
                {
                    pointCount = WaveformDataCount;
                }
                if (LayerConfig.IsReverse)
                {
                    pointCount = pointCount * -1;
                }


                CurrentPostion = startPos;
                endPos         = CitFileProcess.GetAppointEndPostion(_citFilePath, startPos, pointCount);
                List <double[]> data = null;

                if (LayerConfig.IsReverse)
                {
                    data = CitFileProcess.GetAllChannelDataInRange(_citFilePath, endPos, startPos);
                    MileList.milestoneList = CitFileProcess.GetMileStoneByRange(_citFilePath, endPos, startPos);
                }
                else
                {
                    data = CitFileProcess.GetAllChannelDataInRange(_citFilePath, startPos, endPos);
                    MileList.milestoneList = CitFileProcess.GetMileStoneByRange(_citFilePath, startPos, endPos);
                }

                if (IsLoadIndex)
                {
                    MileList.milestoneList = MileageFix.GetMileageReviseData(MileList.milestoneList);
                }
                data.RemoveAt(0);
                data.RemoveAt(0);
                if (ChannelList.Count > 0)
                {
                    for (int i = 0; i < data.Count; i++)

                    {
                        if (ChannelList.Count > i)
                        {
                            ChannelList[i].Data = new double[WaveformDataCount];
                            if (data[i].Length < WaveformDataCount)
                            {
                                double[] temp = new double[data[i].Length];
                                Array.Copy(data[i], temp, data[i].Length);
                                data[i] = new double[WaveformDataCount];
                                if (realStartPos < postions[0])
                                {
                                    Array.Copy(temp, 0, data[i], WaveformDataCount - temp.Length, temp.Length);
                                }
                                else
                                {
                                    Array.Copy(temp, data[i], temp.Length);
                                }
                            }
                            if (LayerConfig.IsReverse)
                            {
                                Array.Reverse(data[i]);
                            }
                            Array.Copy(data[i], ChannelList[i].Data, WaveformDataCount);
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (MileList.milestoneList.Count < WaveformDataCount)
                    {
                        int count = WaveformDataCount - MileList.milestoneList.Count;
                        for (int i = 0; i < count; i++)
                        {
                            if (realStartPos < postions[0])
                            {
                                MileList.milestoneList.Insert(0, new Milestone()
                                {
                                    mKm = 0, mMeter = 0
                                });
                            }
                            else
                            {
                                MileList.milestoneList.Add(new Milestone()
                                {
                                    mKm = 0, mMeter = 0
                                });
                            }
                        }
                    }
                    if (LayerConfig.IsReverse)
                    {
                        MileList.milestoneList.Reverse();
                    }
                }
            }
            else
            {
                throw new InvalidDataException("CIT文件路径无效或为空!");
            }
        }