/// <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; } }