/// <summary> /// 计算结束里程 /// </summary> private void CalcCitEndMileStone() { if (_fixData != null && _fixData.Count > 0) { long markedEndPostion = _fixData[_fixData.Count - 1].MarkedEndPoint.FilePointer; long[] points = _citProcess.GetPositons(_citFilePath); long sampleCount = _citProcess.GetSampleCountByRange(_citFilePath, markedEndPostion, points[1]); MileStoneFixData data = new MileStoneFixData(); data.MarkedStartPoint = _fixData[_fixData.Count - 1].MarkedEndPoint; data.SamplePointCount = sampleCount; data.SampleRate = _meanSampleRate; UserMarkedPoint markedEndPoint = new UserMarkedPoint(); markedEndPoint.FilePointer = points[1]; //if (_citFileInfo.iKmInc == 1) //{ // markedEndPoint.UserSetMileage = data.MarkedStartPoint.UserSetMileage - (data.SamplePointCount - 1) * data.SampleRate; //} //else //{ // markedEndPoint.UserSetMileage = data.MarkedStartPoint.UserSetMileage + (data.SamplePointCount - 1) * data.SampleRate; //} markedEndPoint.UserSetMileage = data.MarkedStartPoint.UserSetMileage + (data.SamplePointCount - 1) * data.SampleRate; data.MarkedEndPoint = markedEndPoint; data.RealDistance = data.MarkedEndPoint.UserSetMileage - data.MarkedStartPoint.UserSetMileage; _fixData.Add(data); } }
/// <summary> /// 读取里程修正表 /// </summary> public void ReadMilestoneFixTable() { string cmdText = "select * from IndexSta order by id"; DataTable dt = _indexOperator.Query(cmdText); if (dt != null && dt.Rows.Count > 0) { _fixData = new List <MileStoneFixData>(); for (int i = 0; i < dt.Rows.Count; i++) { MileStoneFixData data = new MileStoneFixData(); data.ID = dt.Rows[i]["Id"].ToString(); data.MarkedStartPoint = new UserMarkedPoint(); data.MarkedStartPoint.FilePointer = long.Parse(dt.Rows[i]["StartPoint"].ToString()); data.MarkedStartPoint.UserSetMileage = float.Parse(dt.Rows[i]["StartMeter"].ToString()); data.MarkedEndPoint = new UserMarkedPoint(); data.MarkedEndPoint.FilePointer = long.Parse(dt.Rows[i]["EndPoint"].ToString()); data.MarkedEndPoint.UserSetMileage = float.Parse(dt.Rows[i]["EndMeter"].ToString()); data.SamplePointCount = long.Parse(dt.Rows[i]["ContainsPoint"].ToString()); data.RealDistance = Math.Abs(data.MarkedEndPoint.UserSetMileage - data.MarkedStartPoint.UserSetMileage); data.SampleRate = data.RealDistance / (data.SamplePointCount - 1); if (i == 0 || i == dt.Rows.Count - 1) { data.Chains = new List <LongChain>(); } else { data.Chains = _longChainTable.GetChains(data.MarkedStartPoint.UserSetMileage, data.MarkedStartPoint.UserSetMileage); } _fixData.Add(data); } } }
/// <summary> /// 根据两个点,获取长短链 /// </summary> private void CollectLongChainsBtwMarkedPoints() { if (IsVaild()) { for (int i = 0; i < _userFixedTable.MarkedPoints.Count - 1; i++) { UserMarkedPoint startPoint = _userFixedTable.MarkedPoints[i]; UserMarkedPoint endPoint = _userFixedTable.MarkedPoints[i + 1]; List <LongChain> longChains = _longChainTable.GetChains(startPoint.UserSetMileage, endPoint.UserSetMileage); MileStoneFixData data = new MileStoneFixData(); data.MarkedStartPoint = startPoint; data.MarkedEndPoint = endPoint; data.Chains = longChains; _fixData.Add(data); } } else { throw new InvalidOperationException("标记点必须为偶数!"); } }