Exemplo n.º 1
0
        private string _fixCit(string citFilePath, string curveFilePath, string abruptMileFilePath, int fs, double thresh_curve, int pointCount)
        {
            CalculateCorrugationClass calculateCorrugation = new CalculateCorrugationClass();

            var header      = citHelper.GetDataInfoHead(citFilePath);
            var channelList = citHelper.GetDataChannelInfoHead(citFilePath);

            string correctMileFilePath = citFilePath.Substring(0, citFilePath.Length - 4) + "correctMileStone.cit";

            CreateCitHeader(correctMileFilePath, header, channelList);

            long startPos = citHelper.GetSamplePointStartOffset(header.iChannelNumber);
            long endPos   = 0;

            //点位数
            int sampleNum = Convert.ToInt32((citHelper.GetFileLength(citFilePath) - startPos) / (header.iChannelNumber * 2));

            //循环次数
            int count = Convert.ToInt32(sampleNum / pointCount);
            //是否有余点
            int residue = Convert.ToInt32(sampleNum % pointCount);

            bool iszero = false;

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

            double[,] wcCurveData;    //台账曲率
            double[,] abruptMileData; //长短链

            wcCurveData    = GetData(curveFilePath);
            abruptMileData = GetData(abruptMileFilePath);

            //if (count == 0) count = 1;
            for (int k = 0; k < count; k++)
            {
                List <double[]> dataList = null;

                if (iszero)
                {
                    dataList = citHelper.GetAllChannelDataInRange(citFilePath, startPos, residue, ref endPos);
                }
                else
                {
                    if (residue == 0)
                    {
                        dataList = citHelper.GetAllChannelDataInRange(citFilePath, startPos, pointCount, ref endPos);
                    }
                    else
                    {
                        if (k == (count - 1))
                        {
                            dataList = citHelper.GetAllChannelDataInRange(citFilePath, startPos, residue, ref endPos);
                        }
                        else
                        {
                            dataList = citHelper.GetAllChannelDataInRange(citFilePath, startPos, pointCount, ref endPos);
                        }
                    }
                }

                List <double[]> dataList_input = new List <double[]>();
                dataList_input.Add(dataList[0]);
                dataList_input.Add(dataList[1]);
                dataList_input.Add(dataList[7]);

                MWNumericArray array = calculateCorrugation.GetProcessAbnormalDispResultProcess(dataList_input);

                List <double[]> listData = calculateCorrugation.GetProcessAbnormalDispResult(array);


                double[] mileData;
                double[] curveData;//超高

                mileData  = listData[0];
                curveData = listData[1];


                MWNumericArray array2 = calculateCorrugation.GetVerifyKilometerResultProcess(mileData, curveData, wcCurveData, abruptMileData, fs, thresh_curve);

                var correctMileData = calculateCorrugation.GetVerifyKilometerResult(array2);

                double[] kmData = new double[correctMileData.Length];
                double[] mData  = new double[correctMileData.Length];

                for (int i = 0; i < correctMileData.Length; i++)
                {
                    kmData[i] = correctMileData[i] / 1000;
                    mData[i]  = correctMileData[i] % 1000;
                }

                dataList[0] = kmData;
                dataList[1] = mData;

                CreateCitData(correctMileFilePath, dataList);

                startPos = endPos;
            }

            return(correctMileFilePath);
        }