/// <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文件路径无效或为空!");
            }
        }
        /// <summary>
        /// 根据索引导出CIT文件
        /// </summary>
        /// <param name="filePath">cit文件路径</param>
        /// <param name="startMileage">开始里程(公里)</param>
        /// <param name="endMileage">结束里程(公里)</param>
        /// <returns>成功:返回导出路径,失败:空字符串</returns>
        public string ExportCITFileAndIndexData(string filePath, double startMileage, double endMileage)
        {
            string destFile = filePath + "\\" +
                              Path.GetFileNameWithoutExtension(CitFilePath) + "_" +
                              startMileage.ToString() + "-" + endMileage.ToString() + ".cit";

            if (_citFile.iKmInc == 1 && startMileage < endMileage)
            {
                double change = startMileage;
                startMileage = endMileage;
                endMileage   = change;
            }
            if (_citFile != null && MileageFix.FixData.Count > 0)
            {
                if (_citFile.iKmInc == 0)
                {
                    if (startMileage >= MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000 ||
                        endMileage <= MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                    {
                        return("");
                    }
                    if (startMileage < (MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000))
                    {
                        startMileage = (MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000);
                    }
                    if (endMileage > MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000)
                    {
                        endMileage = MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000;
                    }
                }
                else if (_citFile.iKmInc == 1)
                {
                    if (endMileage >= MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000 ||
                        startMileage <= MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                    {
                        return("");
                    }
                    if (startMileage > MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                    {
                        startMileage = MileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000;
                    }
                    if (endMileage < MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000)
                    {
                        endMileage = MileageFix.FixData[MileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000;
                    }
                }
                Milestone startStone = new Milestone();
                Milestone endStone   = new Milestone();
                startStone = MileageFix.CalcMilestoneByFixedMilestone((float)startMileage * 1000);
                endStone   = MileageFix.CalcMilestoneByFixedMilestone((float)endMileage * 1000);
                if (startStone.mFilePosition != -1 && endStone.mFileEndPostion != -1)
                {
                    if (!Directory.Exists(filePath))
                    {
                        Directory.CreateDirectory(filePath);
                    }

                    List <double[]>          channelData           = CitFileProcess.GetAllChannelDataInRange(_citFilePath, startStone.mFilePosition, endStone.mFileEndPostion);
                    List <ChannelDefinition> channelDefinitionList = CitFileProcess.GetChannelDefinitionList(_citFilePath);
                    if (CitFileProcess.WriteCitFile(destFile, CitFile, channelDefinitionList, "", channelData))
                    {
                        CitFileProcess.SetKmFrom(destFile, (float)startStone.GetMeter() / 1000);
                        CitFileProcess.SetKmTo(destFile, (float)endStone.GetMeter() / 1000);
                        string    indexFile   = destFile.Replace(".cit", ".idf");
                        IOperator newOperator = new IndexOperator();
                        newOperator.IndexFilePath = indexFile;
                        //IndexOperator.CreateDB(indexFile);
                        long fileHead = FileDataOffset.GetSamplePointStartOffset(channelData.Count, 4);
                        AddNewIndexData(destFile, newOperator, fileHead, startStone.mFilePosition, endStone.mFileEndPostion, channelData.Count);
                        AddInvaildData(newOperator, fileHead, startStone.mFilePosition, endStone.mFileEndPostion, channelData.Count);
                        return(destFile);
                    }
                    return("");
                }
                return("");
            }
            else
            {
                return(ExportOnlyCITFile(destFile, startMileage, endMileage));
            }
        }
        /// <summary>
        /// 导出CIT文件
        /// </summary>
        /// <param name="filePath">文件路径</param>
        /// <param name="filePath">导出路径</param>
        /// <param name="startMileage">起始里程(单位:米)</param>
        /// <param name="endMileage">结束里程(单位:米)</param>
        /// <returns></returns>
        public string ExportOnlyCITFile(string filePath, double startMileage, double endMileage)
        {
            try
            {
                if (_citFile != null)
                {
                    long startPostion = -1;
                    long endPostion   = -1;

                    startPostion = CitFileProcess.GetCurrentPositionByMilestone(_citFilePath, (float)startMileage, true);
                    endPostion   = CitFileProcess.GetCurrentPositionByMilestone(_citFilePath, (float)endMileage, true);

                    if (startPostion == -1 || endPostion == -1)
                    {
                        return("");
                    }

                    if (CitFileProcess.WriteCitFile(filePath, _citFile, CitFileProcess.GetChannelDefinitionList(_citFilePath), ""))
                    {
                        if (startPostion > endPostion)
                        {
                            long temp = startPostion;
                            startPostion = endPostion;
                            endPostion   = temp;
                        }
                        long sampleCount  = CitFileProcess.GetSampleCountByRange(_citFilePath, startPostion, endPostion);
                        int  sampleNumber = 5000;

                        if (sampleCount > sampleNumber)
                        {
                            long pageCount = (sampleCount / sampleNumber);

                            long pageEndPostion = 0;
                            for (int i = 0; i < pageCount; i++)
                            {
                                List <double[]> channelData = CitFileProcess.GetAllChannelDataInRange(_citFilePath, startPostion, sampleNumber, ref pageEndPostion);
                                startPostion = pageEndPostion;
                                CitFileProcess.WriteCitChannelData(filePath, channelData);
                            }

                            if (pageEndPostion < endPostion)
                            {
                                List <double[]> channelData = CitFileProcess.GetAllChannelDataInRange(_citFilePath, startPostion, endPostion);
                                CitFileProcess.WriteCitChannelData(filePath, channelData);
                            }
                        }
                        else
                        {
                            List <double[]> channelData = CitFileProcess.GetAllChannelDataInRange(_citFilePath, startPostion, endPostion);
                            CitFileProcess.WriteCitChannelData(filePath, channelData);
                        }
                        if (CitFileProcess.SetKmFrom(filePath, (float)startMileage / 1000) &&
                            CitFileProcess.SetKmTo(filePath, (float)endMileage / 1000))
                        {
                            return(filePath);
                        }
                    }
                }
                return(string.Empty);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }