/// <summary>对于一对对应河网,进一步找对应河流,同时记录对应支流对应交汇点</summary> /// <param name="CBSRiverNetLt">大比例尺表达河网</param> /// <param name="CSSRiverNetLt">小比例尺表达河网</param> /// <param name="pParameterThreshold">阈值参数</param> /// <returns>对应河网列</returns> /// <remarks>对应河流的数据记录在对应河网</remarks> public void FindCorrespondRiverLt(CCorrespondRiverNet pCorrespondRiverNet, CParameterThreshold pParameterThreshold) { List <CCorrespondRiver> pCorrespondRiverLt = new List <CCorrespondRiver>(); //仅记录成功匹配的河流对 if (pCorrespondRiverNet.blnCorr == true) { //递归找到对应河流,同时记录对应支流对应交汇点 RecursiveFindCorrespondRiverLt(ref pCorrespondRiverLt, pCorrespondRiverNet.CBSRiverNet.CMasterStream, pCorrespondRiverNet.CSSRiverNet.CMasterStream, pParameterThreshold); } pCorrespondRiverNet.CCorrespondRiverLt = pCorrespondRiverLt; }
/// <summary>处理上一级河流有对应河流的情况</summary> /// <param name="pCorrespondRiverNet">对应河网数据</param> /// <param name="pParameterThreshold">阈值参数</param> /// <remarks>RecursiveDWExistCorr:RecursiveDealWithExistCorrepondenceRiver</remarks> private void RecursiveDWExistCorrCut(CCorrespondRiverNet pCorrespondRiverNet, CParameterThreshold pParameterThreshold, CRiver pBSRiver) { if (pBSRiver.CCorrRiver != null) { _OptMRL.DWExistCorr(pCorrespondRiverNet, pParameterThreshold, pBSRiver); //处理当前河流的支流 for (int i = 0; i < pBSRiver.CTributaryLt.Count; i++) { RecursiveDWExistCorrCut(pCorrespondRiverNet, pParameterThreshold, pBSRiver.CTributaryLt[i]); } } }
/// <summary>建立河网间的对应河流的对应特征点关系(不包括没有对应河流的情况)</summary> /// <param name="pCorrespondRiverNet">对应河网数据</param> /// <param name="pParameterThreshold">阈值参数</param> /// <remarks>判断方法:相交缓冲区多边形面积的两倍除以两缓冲区面积之和</remarks> private void BuildCorrespondence(CCorrespondRiverNet pCorrespondRiverNet, CParameterThreshold pParameterThreshold) { CRiverNet pBSRiverNet = pCorrespondRiverNet.CBSRiverNet; CRiverNet pSSRiverNet = pCorrespondRiverNet.CSSRiverNet; pCorrespondRiverNet.CResultPtLtLt = new List <List <CPoint> >(); double dblLengthSumRatio = pBSRiverNet.CMasterStream.pPolyline.Length / pSSRiverNet.CMasterStream.pPolyline.Length; pParameterThreshold.dblLengthSumRatio = dblLengthSumRatio; //注意:不管主干流存不存在对应河流,都从此处开始,因为不存在对应河流则在此函数中自动不作处理 RecursiveDWExistCorrCut(pCorrespondRiverNet, pParameterThreshold, pBSRiverNet.CMasterStream); }
/// <summary>处理上一级河流没有对应河流的情况</summary> /// <param name="pCorrespondRiverNet">对应河网数据</param> /// <param name="pBSRiver">当前大比例尺表达河流</param> /// <param name="dblMainReductionRatio">上一级河流缩减比率</param> /// <remarks>RecursiveDWNotExistCorr:RecursiveDealWithNotExistCorrepondenceRiver</remarks> private void RecursiveDWNotExistCorr(CCorrespondRiverNet pCorrespondRiverNet, CRiver pBSRiver, double dblMainReductionRatio) { CRiver pMainStream = pBSRiver.CMainStream; IPoint intersectipt = pBSRiver.pPolyline.ToPoint; double dblFromStartLength = CGeoFunc.CalDistanceFromStartPoint((IPolyline5)pMainStream, intersectipt, false); double dblCurrentReductionRatio = pMainStream.pPolyline.Length / dblFromStartLength; pBSRiver.dblReductionRatio = dblCurrentReductionRatio * dblMainReductionRatio; //pCorrespondRiverNet.CResultRiverLt.Add(pBSRiver); //处理当前河流的支流 for (int i = 0; i < pBSRiver.CTributaryLt.Count; i++) { RecursiveDWNotExistCorr(pCorrespondRiverNet, pBSRiver.CTributaryLt[i], pBSRiver.dblReductionRatio); } }
/// <summary>找到对应河网</summary> /// <param name="CBSRiverNetLt">大比例尺表达河网</param> /// <param name="CSSRiverNetLt">小比例尺表达河网</param> /// <param name="pParameterThreshold">阈值参数</param> /// <returns>对应河网列</returns> /// <remarks></remarks> public List <CCorrespondRiverNet> FindCorrespondRiverNetLt(List <CRiverNet> CBSRiverNetLt, List <CRiverNet> CSSRiverNetLt, CParameterThreshold pParameterThreshold) { //数据准备 List <CRiverNet> pBSRiverNetLt = new List <CRiverNet>(); pBSRiverNetLt.AddRange(CBSRiverNetLt); List <CRiverNet> pSSRiverNetLt = new List <CRiverNet>(); pSSRiverNetLt.AddRange(CSSRiverNetLt); //建立对应河网关系 List <CCorrespondRiverNet> CCorrespondRiverNetLt = new List <CCorrespondRiverNet>(); for (int i = 0; i < pBSRiverNetLt.Count; i++) { bool blnIsOverlap = false; //通过计算主干流是否重叠来判断两河网是否为同一河网的不同比例尺表达 for (int j = 0; j < pSSRiverNetLt.Count; j++) { blnIsOverlap = CGeoFunc.IsOverlap(pBSRiverNetLt[i].CMasterStream, pSSRiverNetLt[j].CMasterStream, pParameterThreshold.dblOverlapRatio); if (blnIsOverlap == true) { //建立河网对应关系 pBSRiverNetLt[i].CCorrRiverNet = pSSRiverNetLt[j]; pSSRiverNetLt[j].CCorrRiverNet = pBSRiverNetLt[i]; CCorrespondRiverNet pCorrespondRiverNet = new CCorrespondRiverNet(pBSRiverNetLt[i], pSSRiverNetLt[j]); pCorrespondRiverNet.blnCorr = true; CCorrespondRiverNetLt.Add(pCorrespondRiverNet); pSSRiverNetLt.RemoveAt(j); break; } } if (blnIsOverlap == false) { pBSRiverNetLt[i].CCorrRiverNet = null; CCorrespondRiverNet pCorrespondRiverNet = new CCorrespondRiverNet(pBSRiverNetLt[i], null); pCorrespondRiverNet.blnCorr = false; CCorrespondRiverNetLt.Add(pCorrespondRiverNet); } } return(CCorrespondRiverNetLt); }
/// <summary>处理上一级河流有对应河流的情况</summary> /// <param name="pCorrespondRiverNet">对应河网数据</param> /// <param name="dblLengthSumRatio">小比例尺表达河流</param> /// <param name="pParameterThreshold">阈值参数</param> /// <remarks>RecursiveDWExistCorr:RecursiveDealWithExistCorrepondenceRiver /// 注意:不管主干流存不存在对应河流,都从此处开始,因为不存在对应河流则在此函数中自动转入处理不存在对应河流的函数</remarks> public void RecursiveDWExistCorr(CCorrespondRiverNet pCorrespondRiverNet, CParameterThreshold pParameterThreshold, CRiver pBSRiver) { if (pBSRiver.CCorrRiver != null) { DWExistCorr(pCorrespondRiverNet, pParameterThreshold, pBSRiver); //处理当前河流的支流 for (int i = 0; i < pBSRiver.CTributaryLt.Count; i++) { RecursiveDWExistCorr(pCorrespondRiverNet, pParameterThreshold, pBSRiver.CTributaryLt[i]); } } else { pBSRiver.dblReductionRatio = 1; //pCorrespondRiverNet.CResultRiverLt.Add(pBSRiver); //处理当前河流的支流 for (int i = 0; i < pBSRiver.CTributaryLt.Count; i++) { RecursiveDWNotExistCorr(pCorrespondRiverNet, pBSRiver.CTributaryLt[i], 1); } } }
/// <summary>处理上一级河流有对应河流的情况</summary> /// <param name="pCorrespondRiverNet">对应河网数据</param> /// <param name="dblLengthSumRatio">小比例尺表达河流</param> /// <param name="pParameterThreshold">阈值参数</param> /// <remarks>DWExistCorr:DealWithExistCorrepondenceRiver /// 河流的对应特征点结果存储在它们自己的“pBSRiver.CResultPtLt中”; /// 此外pCorrespondRiverNet.CResultPtLtLt则存储了对应河网中各河流的对应特征点结果</remarks> public void DWExistCorr(CCorrespondRiverNet pCorrespondRiverNet, CParameterThreshold pParameterThreshold, CRiver pBSRiver) { //pBSRiver.CResultPtLt = new List<CPoint>(); //CRiver pSSRiver = pBSRiver.CCorrRiver; //CMPBDP OptMPBDP = new CMPBDP(); //if ((pBSRiver.CCorrTriJunctionPtLt != null) && // (pBSRiver.CCorrTriJunctionPtLt.Count != 0) && // (pBSRiver.CCorrTriJunctionPtLt.Count == pSSRiver.CCorrTriJunctionPtLt.Count)) //{ // //数据准备 // List<CPoint> pBSCorrTriJunctionPtLt = new List<CPoint>(); // pBSCorrTriJunctionPtLt.Add(pBSRiver.CptLt[0]); // pBSCorrTriJunctionPtLt.AddRange(pBSRiver.CCorrTriJunctionPtLt); // pBSCorrTriJunctionPtLt.Add(pBSRiver.CptLt[pBSRiver.CptLt.Count - 1]); // List<CPoint> pSSCorrTriJunctionPtLt = new List<CPoint>(); // pSSCorrTriJunctionPtLt.Add(pSSRiver.CptLt[0]); // pSSCorrTriJunctionPtLt.AddRange(pSSRiver.CCorrTriJunctionPtLt); // pSSCorrTriJunctionPtLt.Add(pSSRiver.CptLt[pSSRiver.CptLt.Count - 1]); // List<CPolyline> pBSsubcpllt = new List<CPolyline>(); // List<CPolyline> pSSsubcpllt = new List<CPolyline>(); // for (int i = 0; i < pBSCorrTriJunctionPtLt.Count - 1; i++) // { // CPolyline pBSsubcpl = pBSRiver.GetSubPolyline(pBSCorrTriJunctionPtLt[i], pBSCorrTriJunctionPtLt[i + 1]); // CPolyline pSSsubcpl = pSSRiver.GetSubPolyline(pSSCorrTriJunctionPtLt[i], pSSCorrTriJunctionPtLt[i + 1]); // MessageBox.Show("CMRL.cs: Row499 is needed to be improved"); // //OptMPBDP.DivideCplForDP(pBSsubcpl); // //OptMPBDP.DivideCplForDP(pSSsubcpl); // pBSsubcpllt.Add(pBSsubcpl); // pSSsubcpllt.Add(pSSsubcpl); // } // CAlgorithmsHelper pAlgorithmsHelper = new CAlgorithmsHelper(); // CParameterThreshold ParameterThreshold = new CParameterThreshold(); // //double dblSumLength = frcpl.pPolyline.Length + tocpl.pPolyline.Length; // CTranslation pTranslation = new CTranslation(); // double dblMin = double.MaxValue; // int intIndex = 0; // for (int i = 0; i < 25; i++) // { // ParameterThreshold.dblDLengthBound = pParameterThreshold.dblLengthSumRatio * (1 - 0.02 * i); // ParameterThreshold.dblULengthBound = pParameterThreshold.dblLengthSumRatio / (1 - 0.02 * i); // List<CPoint> ResultPtLt = new List<CPoint>(); // for (int j = 0; j < pBSsubcpllt.Count; j++) // { // //进行弯曲匹配,提取对应线段 // C5.LinkedList<CCorrSegment> CorrespondSegmentLk = new C5.LinkedList<CCorrSegment>(); // MessageBox.Show("CMRL.cs: Row523 is needed to be improved"); // //OptMPBDP.SubPolylineMatch(pBSsubcpllt[j], pSSsubcpllt[j], ParameterThreshold, ref CorrespondSegmentLk); // //按指定方式对对应线段进行点匹配,提取对应点 // ResultPtLt.AddRange(pAlgorithmsHelper.BuildPointCorrespondence(CorrespondSegmentLk, "Linear")); // if ((j > 0) && (i < pBSsubcpllt.Count - 1)) // { //考虑到线段相接处的顶点被两次求解对应点,最好删除一对对应点 // ResultPtLt.RemoveAt(ResultPtLt.Count - 1); // } // } // double dblTranslation = pTranslation.CalTranslation(ResultPtLt); // if (dblTranslation < dblMin) // { // intIndex = i; // dblMin = dblTranslation; // } // } // //求出最佳解 // ParameterThreshold.dblDLengthBound = pParameterThreshold.dblLengthSumRatio * (1 - 0.02 * intIndex); // ParameterThreshold.dblULengthBound = pParameterThreshold.dblLengthSumRatio / (1 - 0.02 * intIndex); // List<CPoint> pResultPtLt = new List<CPoint>(); // for (int j = 0; j < pBSsubcpllt.Count; j++) // { // //进行弯曲匹配,提取对应线段 // C5.LinkedList<CCorrSegment> CorrespondSegmentLk = new C5.LinkedList<CCorrSegment>(); // MessageBox.Show("CMRL.cs: Row551 is needed to be improved"); // //OptMPBDP.SubPolylineMatch(pBSsubcpllt[j], pSSsubcpllt[j], ParameterThreshold, ref CorrespondSegmentLk); // //按指定方式对对应线段进行点匹配,提取对应点 // pResultPtLt.AddRange(pAlgorithmsHelper.BuildPointCorrespondence(CorrespondSegmentLk, "Linear")); // if ((j > 0) && (j < pBSsubcpllt.Count - 1)) // { //考虑到线段相接处的顶点被两次求解对应点,最好删除一对对应点 // pResultPtLt.RemoveAt(pResultPtLt.Count - 1); // } // } // pBSRiver.CResultPtLt = pResultPtLt; // pCorrespondRiverNet.CResultPtLtLt.Add(pResultPtLt); //} //else //{ // CPolyline pBScpl = new CPolyline(pBSRiver); // CPolyline pSScpl = new CPolyline(pSSRiver); // MessageBox.Show("CMRL.cs: Row570 is needed to be improved"); // //pBSRiver.CResultPtLt = OptMPBDP.DWByDP(pBScpl, pSScpl, pParameterThreshold.dblLengthSumRatio, "Linear"); // pCorrespondRiverNet.CResultPtLtLt.Add(pBSRiver.CResultPtLt); //} }