private void DWSingleAtBd(List <CAtBd> pSgAtBdLt, List <CAtBd> pBSAtBdLt, CParameterThreshold ParameterThreshold) { FindFrcpt2AndTocpt2Grid(pSgAtBdLt, pBSAtBdLt, ParameterThreshold); for (int i = 0; i < pSgAtBdLt.Count; i++) { pSgAtBdLt[i].SetVirtualPolyline(); //_pDPSimplify.DivideCplByDP(pSgAtBdLt[i] as CPolyline, pSgAtBdLt[i].pVirtualPolyline); } }
/// <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; }
private void RecursiveBendMatch(CBend pFromBend, CBend pToBend, ref List <CCorrespondBend> pCorrespondBendLt, CParameterThreshold ParameterThreshold, CParameterInitialize pParameterInitialize) { if (pFromBend.CLeftBend == null || pToBend.CLeftBend == null) { return; } double dblRatioLL = pFromBend.CLeftBend.pBaseLine.Length / pToBend.CLeftBend.pBaseLine.Length; double dblRatioRR = pFromBend.CRightBend.pBaseLine.Length / pToBend.CRightBend.pBaseLine.Length; MessageBox.Show("CRIBS: need to be improved!"); double dblAngleDiffLL = pFromBend.CLeftBend.pBaseLine.Angle - pToBend.CLeftBend.pBaseLine.Angle; double dblAngleDiffRR = pFromBend.CRightBend.pBaseLine.Angle - pToBend.CRightBend.pBaseLine.Angle; if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLL <= ParameterThreshold.dblULengthBound) && (dblRatioRR >= ParameterThreshold.dblDLengthBound) && (dblRatioRR <= ParameterThreshold.dblULengthBound) && (Math.Abs(dblAngleDiffLL) <= ParameterThreshold.dblAngleBound) && (dblAngleDiffRR <= ParameterThreshold.dblULengthBound)) { //左右弯曲分别对应 CCorrespondBend pLeftCorrespondBend = new CCorrespondBend(pFromBend.CLeftBend, pToBend.CLeftBend); CCorrespondBend pRightCorrespondBend = new CCorrespondBend(pFromBend.CRightBend, pToBend.CRightBend); pCorrespondBendLt.Add(pLeftCorrespondBend); pCorrespondBendLt.Add(pRightCorrespondBend); //*******************************// List <CCorrespondBend> pRIBSLeftCorrespondBendLt = RBS(pLeftCorrespondBend, ParameterThreshold, pParameterInitialize); pCorrespondBendLt.AddRange(pRIBSLeftCorrespondBendLt); List <CCorrespondBend> pRIBSRightCorrespondBendLt = RBS(pRightCorrespondBend, ParameterThreshold, pParameterInitialize); pCorrespondBendLt.AddRange(pRIBSRightCorrespondBendLt); //继续往下遍历 RecursiveBendMatch(pFromBend.CLeftBend, pToBend.CLeftBend, ref pCorrespondBendLt, ParameterThreshold, pParameterInitialize); RecursiveBendMatch(pFromBend.CRightBend, pToBend.CRightBend, ref pCorrespondBendLt, ParameterThreshold, pParameterInitialize); } else //此步必不可少,作用还是很明显的 { double dblRatioLR = pFromBend.CLeftBend.pBaseLine.Length / pToBend.CRightBend.pBaseLine.Length; double dblRatioRL = pFromBend.CRightBend.pBaseLine.Length / pToBend.CLeftBend.pBaseLine.Length; if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLR >= ParameterThreshold.dblDLengthBound)) { RecursiveBendMatch(pFromBend.CLeftBend, pToBend, ref pCorrespondBendLt, ParameterThreshold, pParameterInitialize); } if ((dblRatioRL >= ParameterThreshold.dblDLengthBound) && (dblRatioRR >= ParameterThreshold.dblDLengthBound)) { RecursiveBendMatch(pFromBend.CRightBend, pToBend, ref pCorrespondBendLt, ParameterThreshold, pParameterInitialize); } } }
/// <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="CPlLt">线数据</param> /// <param name="pParameterThreshold">阈值参数</param> /// <returns>河网列</returns> public List <CRiverNet> BuildRiverNetLt(List <CPolyline> CPlLt, CParameterThreshold pParameterThreshold) { double dblVerySmall = CConstants.dblVerySmallCoord; //根据线数据生成河流数据 List <CRiver> CAllRiverLt = new List <CRiver>(); for (int i = 0; i < CPlLt.Count; i++) { CRiver pRiver = new CRiver(i, CPlLt[i], dblVerySmall); CAllRiverLt.Add(pRiver); } CreateRiverRelationship(ref CAllRiverLt); //创建各河流间的干支关系 List <CRiverNet> pRiverNetLt = CreateRiverNetLt(CAllRiverLt, dblVerySmall); // 创建河网 return(pRiverNetLt); }
/// <summary> /// 递归调用弯曲结构 /// </summary> /// <param name="CCorrespondBend">对应弯曲</param> /// <param name="ParameterThreshold">阈值参数</param> /// <param name="pRightBendForest">折线右边的弯曲森林</param> /// <param name="strName">留作保存三角网用</param> /// <remarks></remarks> public List <CCorrespondBend> RBS(CCorrespondBend pCorrespondBend, CParameterThreshold ParameterThreshold, CParameterInitialize pParameterInitialize) { string strSide = pCorrespondBend.CFromBend.strSide; CPolyline subfrcpl = new CPolyline(0, pCorrespondBend.CFromBend.CptLt); CPolyline subtocpl = new CPolyline(0, pCorrespondBend.CToBend.CptLt); List <CPoint> subfrchcptlt = _Triangulator.CreateConvexHullEdgeLt2(subfrcpl, CConstants.dblVerySmallCoord); CPolyline subfrchcpl = new CPolyline(0, subfrchcptlt); //大比例尺折线外包多边形线段 List <CPoint> subtochcptlt = _Triangulator.CreateConvexHullEdgeLt2(subtocpl, CConstants.dblVerySmallCoord); CPolyline subtochcpl = new CPolyline(0, subtochcptlt); //小比例尺折线外包多边形线段 //添加数据生成图层,以便于利用AE中的功能 List <CPolyline> subfrcpllt = new List <CPolyline>(); subfrcpllt.Add(subfrcpl); subfrcpllt.Add(subfrchcpl); List <CPolyline> subtocpllt = new List <CPolyline>(); subtocpllt.Add(subtocpl); subtocpllt.Add(subtochcpl); IFeatureLayer pBSFLayer = CHelpFunc.SaveCPlLt(subfrcpllt, "subfrcpl" + _dblCDTNum, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); IFeatureLayer pSSFLayer = CHelpFunc.SaveCPlLt(subtocpllt, "subtocpl" + _dblCDTNum, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); CParameterVariable pParameterVariableFrom = new CParameterVariable(subfrcpl, "subFromCDT" + _dblCDTNum, pBSFLayer, CConstants.dblVerySmallCoord); CParameterVariable pParameterVariableTo = new CParameterVariable(subtocpl, "subToCDT" + _dblCDTNum, pSSFLayer, CConstants.dblVerySmallCoord); _dblCDTNum = _dblCDTNum + 1; CMPBBSL OptMPBBSL = new CMPBBSL(); //建立CDT并获取弯曲森林 CBendForest FromBendForest = new CBendForest(); GetSideBendForest(pParameterVariableFrom, ref FromBendForest, pParameterInitialize, strSide); CBendForest ToBendForest = new CBendForest(); GetSideBendForest(pParameterVariableTo, ref ToBendForest, pParameterInitialize, strSide); //弯曲树匹配,寻找对应独立弯曲 List <CCorrespondBend> IndependCorrespondBendLt = BendTreeMatch(FromBendForest, ToBendForest, ParameterThreshold, pParameterInitialize); //弯曲匹配,寻找对应弯曲 List <CCorrespondBend> CorrespondBendLt = BendMatch(IndependCorrespondBendLt, ParameterThreshold, pParameterInitialize); return(CorrespondBendLt); }
private void ConfirmSgPt(List <CAtBd> pSgAtBdLt, double dblRatioofPtNum, CParameterThreshold ParameterThreshold) { //int intSgInnerPtNum = 0; //List<CPoint> SgEndPtLt = new List<CPoint>(pSgAtBdLt.Count *2); //for (int i = 0; i < pSgAtBdLt.Count; i++) //{ // intSgInnerPtNum += (pSgAtBdLt[i].CptLt.Count-2); // if (pSgAtBdLt[i].Frcpt2 ==null ) // { // SgEndPtLt.Add(pSgAtBdLt[i].CptLt[0]); // } // if (pSgAtBdLt[i].Tocpt2 == null) // { // SgEndPtLt.Add(pSgAtBdLt[i].CptLt[pSgAtBdLt[i].CptLt.Count - 1]); // } //} //C5.LinkedList<CCorrCpts> CorrCptsLt = CGeoFunc.LookingForNeighboursByGrids(SgEndPtLt, CConstants.dblVerySmall); //int intSgIntersection = CGeoFunc.GetNumofIntersections(CorrCptsLt); ////do we need this?******************************************************************************* ////int intAloneEnds = CGeoFunc.GetNumofAloneEnds(EndPtLt, CorrCptsLt); ////int intRealPtNum = intInnerPtNum + intSgIntersection + intAloneEnds; //int intSgRealPtNum = intSgInnerPtNum + intSgIntersection; //intSgRealPtNum doesn't count the points on the BSCpls //int intRemainPtNum = Convert.ToInt32(Convert.ToDouble(intSgRealPtNum) / dblRatioofPtNum); //int intDeletePtNum = intSgRealPtNum-intRemainPtNum; //double dblTDis = CDPSimplify.CalTDisByDeletePtNum(pSgAtBdLt, intSgInnerPtNum, intDeletePtNum); //for (int i = 0; i < pSgAtBdLt.Count; i++) //{ // _pDPSimplify.ConfirmMoveInfo(pSgAtBdLt[i] as CPolyline, pSgAtBdLt[i].pVirtualPolyline, dblTDis); //} }
/// <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); } } }
private void DWCorrAtBd(List <CAtBd> pBSAtBdLt, List <CAtBd> pSSAtBdLt, CParameterThreshold ParameterThreshold) { CLinearInterpolationA pLinearInterpolation = new CLinearInterpolationA(); for (int i = 0; i < pBSAtBdLt.Count; i++) { CPolyline frcpl = pBSAtBdLt[i] as CPolyline; CPolyline tocpl = pSSAtBdLt[i] as CPolyline; //CHelpFunc.PreviousWork(ref frcpl, ref tocpl); pBSAtBdLt[i].CResultPtLt = pLinearInterpolation.CLI(frcpl, tocpl); ////By DP Algorithm //_pDPSimplify.DivideCplByDP(pBSAtBdLt[i] as CPolyline, pBSAtBdLt[i].pVirtualPolyline); //_pDPSimplify.DivideCplByDP(pSSAtBdLt[i] as CPolyline, pSSAtBdLt[i].pVirtualPolyline); //C5.LinkedList<CCorrSegment> CorrespondSegmentLk = new C5.LinkedList<CCorrSegment>(); //SubPolylineMatchLA(pBSAtBdLt[i] as CPolyline, pBSAtBdLt[i].pVirtualPolyline, pSSAtBdLt[i] as CPolyline, pSSAtBdLt[i].pVirtualPolyline, ParameterThreshold, ref CorrespondSegmentLk); ////linear interpolation //pBSAtBdLt[i].CResultPtLt = pAlgorithmsHelper.BuildPointCorrespondence(CorrespondSegmentLk, "Linear"); } }
/// <summary>依据线数据建立河网列(包括建立干支关系,添加各支流成员)</summary> /// <param name="CPlLt">线数据</param> /// <param name="pParameterThreshold">阈值参数</param> /// <returns>河网列</returns> public List <CRiverNet> BuildRiverNetLt(List <CPolyline> CPlLt, CParameterThreshold pParameterThreshold, ref long lngTime) { double dblVerySmall = CConstants.dblVerySmallCoord; double dblBuffer = pParameterThreshold.dblBuffer; //根据线数据生成河流数据 long lngStartTime = System.Environment.TickCount; List <CRiver> CAllRiverLt = new List <CRiver>(); for (int i = 0; i < CPlLt.Count; i++) { CRiver pRiver = new CRiver(i, CPlLt[i], dblBuffer, dblVerySmall); CAllRiverLt.Add(pRiver); } long lngEndTime = System.Environment.TickCount; lngTime = lngEndTime - lngStartTime; CreateRiverRelationship(ref CAllRiverLt); //创建各河流间的干支关系 List <CRiverNet> pRiverNetLt = CreateRiverNetLt(CAllRiverLt, dblVerySmall); // 创建河网 return(pRiverNetLt); }
/// <summary> /// 弯曲匹配(全局等同搜索) /// </summary> /// <param name="pFromBendSlt">大比例尺弯曲列表</param> /// <param name="pToBendSlt">小比例尺弯曲列表</param> /// <param name="dblRatioBound">比例阈值</param> /// <returns>对应弯曲列表</returns> /// <remarks></remarks> private List <CCorrespondBend> IndependBendMatch(SortedDictionary <double, CBend> pFromBendSlt, SortedDictionary <double, CBend> pToBendSlt, CParameterThreshold ParameterThreshold) { //清理弯曲的对应弯曲列表 foreach (CBend pBend in pFromBendSlt.Values) { pBend.pCorrespondBendLt.Clear(); } foreach (CBend pBend in pToBendSlt.Values) { pBend.pCorrespondBendLt.Clear(); } //搜索符合要求的对应弯曲 List <CCorrespondBend> pCorrespondBendLt = new List <CCorrespondBend>(); int intLastMatchj = 0; //该值并不作精确要求,仅为中间搜索点的估算值 for (int i = 0; i < pFromBendSlt.Values.Count; i++) { CBend pfrbend = pFromBendSlt.ElementAt(i).Value; for (int j = 0; j < pToBendSlt.Values.Count; j++) { CBend ptobend = pToBendSlt.ElementAt(i).Value; double dblAngleDiff = pfrbend.pBaseLine.Angle - ptobend.pBaseLine.Angle; double dblLengthRatio = pfrbend.pBaseLine.Length / ptobend.pBaseLine.Length; if ((Math.Abs(dblAngleDiff) <= ParameterThreshold.dblAngleBound) && (dblLengthRatio >= ParameterThreshold.dblDLengthBound) && (dblLengthRatio <= ParameterThreshold.dblULengthBound)) { CCorrespondBend pCorrespondBend = new CCorrespondBend(pfrbend, ptobend); pCorrespondBendLt.Add(pCorrespondBend); } } } return(pCorrespondBendLt); }
/// <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]); } } }
//private void FindFrcpt2AndTocpt2SweepLine(List<CAtBd> pSgAtBdLt, List<CAtBd> pBSAtBdLt, CParameterThreshold ParameterThreshold) //{ // double dblVerySmall = ParameterThreshold.dblVerySmall; // int intGIDCount = 0; // SortedSet<CPoint> EventQueueYGID = new SortedSet<CPoint>(new CCptYGIDReverseCompare()); // for (int i = 0; i < pSgAtBdLt.Count; i++) // { // CPoint cpt0 = pSgAtBdLt[i].CptLt[0]; // CPoint cptlast = pSgAtBdLt[i].CptLt[pSgAtBdLt[i].CptLt.Count - 1]; // cpt0.LID = i; // cpt0.GID = intGIDCount; // cpt0.strBelong = "Sg"; // EventQueueYGID.Add(cpt0); // intGIDCount++; // cptlast.LID = i; // cptlast.GID = intGIDCount; // cptlast.strBelong = "Sg"; // EventQueueYGID.Add(cptlast); // intGIDCount++; // } // for (int i = 0; i < pBSAtBdLt.Count; i++) // { // foreach (CPoint cpt in pBSAtBdLt[i].CptLt) // { // cpt.GID = intGIDCount; // cpt.LID = i; // cpt.strBelong = "BS"; // //BSCptLt.Add(cpt); // intGIDCount++; // //make two copies // CPoint ucpt = new CPoint(cpt.ID, cpt.X, cpt.Y + dblVerySmall); // ucpt.GID = intGIDCount; // ucpt.LID = cpt.LID; // ucpt.strBelong = cpt.strBelong; // ucpt.strSweepStatus = "Up"; // ucpt.CorrespondingPt = cpt; // EventQueueYGID.Add(ucpt); // intGIDCount++; // CPoint dcpt = new CPoint(cpt.ID, cpt.X, cpt.Y - dblVerySmall); // dcpt.GID = intGIDCount; // dcpt.LID = cpt.LID; // dcpt.strBelong = cpt.strBelong; // dcpt.strSweepStatus = "Down"; // dcpt.CorrespondingPt = cpt; // EventQueueYGID.Add(dcpt); // intGIDCount++; // } // } // //sweep // SortedSet<CPoint> StripCPtXGID = new SortedSet<CPoint>(new CCptXGIDCompare()); // //double dblSweepY = EventQueueYTD.ElementAt(0).Key.Y; // foreach (CPoint cpt in EventQueueYGID) // { // if (cpt.strBelong == "BS") // { // if (cpt.strSweepStatus == "Up") // { // StripCPtXGID.Add(cpt.CorrespondingPt); // } // else if (cpt.strSweepStatus == "Down") // { // StripCPtXGID.Remove(cpt.CorrespondingPt); // } // } // else // { // CPoint frcpt = new CPoint(-1, -1, cpt.X - dblVerySmall, cpt.Y); // CPoint tocpt = new CPoint(intGIDCount, intGIDCount, cpt.X + dblVerySmall, cpt.Y); // SortedSet<CPoint> StripView = StripCPtXGID.GetViewBetween(frcpt, tocpt); // foreach (CPoint cptview in StripView) // { // if (cpt.ID == 0) // { // pSgAtBdLt[cpt.LID].Frcpt2 = cptview; // } // else // { // pSgAtBdLt[cpt.LID].Tocpt2 = cptview; // } // break; // we only need one // } // frcpt = null; // tocpt = null; // } // } //} //private void FindFrcpt2AndTocpt2Grid(List<CAtBd> pSgAtBdLt, List<CAtBd> pBSAtBdLt, CParameterThreshold ParameterThreshold) //{ // List<CPolyline> SgCPlLt = CHelpFunc.GetCplLtFromAtBdLt(pSgAtBdLt); // List<CPolyline> BScpllt = CHelpFunc.GetCplLtFromAtBdLt(pBSAtBdLt); // IEnvelope pSgEnvelope = CHelpFunc.GetEnvelope(SgCPlLt); // IEnvelope pBSEnvelope = CHelpFunc.GetEnvelope(BScpllt); // IEnvelope pUnionEnvelope = new EnvelopeClass(); // pUnionEnvelope.XMin = Math.Min(pSgEnvelope.XMin, pBSEnvelope.XMin); // pUnionEnvelope.YMin = Math.Min(pSgEnvelope.YMin, pBSEnvelope.YMin); // pUnionEnvelope.XMax = Math.Max(pSgEnvelope.XMax, pBSEnvelope.XMax); // pUnionEnvelope.YMax = Math.Max(pSgEnvelope.YMax, pBSEnvelope.YMax); // int intSgPtNum = SgCPlLt.Count * 2; // int intBSPtNum = CHelpFunc.SumPointsNumber(BScpllt); // int intMaxPtNum = Math.Max(intSgPtNum, intBSPtNum); // int intRowColCount = Convert.ToInt32(Math.Sqrt(Convert.ToDouble(intMaxPtNum))); // double dblWidth = Math.Max((pUnionEnvelope.XMax - pUnionEnvelope.XMin) / Convert.ToDouble(intRowColCount), CConstants.dblVerySmall); // double dblHeight = Math.Max((pUnionEnvelope.YMax - pUnionEnvelope.YMin) / Convert.ToDouble(intRowColCount), CConstants.dblVerySmall); // intRowColCount++; //+1, so that the bordered point can be covered // C5.LinkedList<CPoint>[,] aSgCptLkGrid = new C5.LinkedList<CPoint>[intRowColCount, intRowColCount]; // C5.LinkedList<CPoint>[,] aBSCptLkGrid = new C5.LinkedList<CPoint>[intRowColCount, intRowColCount]; // for (int i = 0; i < intRowColCount; i++) // { // for (int j = 0; j < intRowColCount; j++) // { // aSgCptLkGrid[i, j] = new C5.LinkedList<CPoint>(); // aBSCptLkGrid[i, j] = new C5.LinkedList<CPoint>(); // } // } // //Fill points in Grids // for (int i = 0; i < pSgAtBdLt.Count; i++) // { // List<CPoint> cptlt = pSgAtBdLt[i].CptLt; // cptlt[0].BelongedCPolyline = pSgAtBdLt[i] as CPolyline; // cptlt[cptlt.Count - 1].BelongedCPolyline = pSgAtBdLt[i] as CPolyline; // CHelpFunc.FillCptinGrid(cptlt[0], dblWidth, dblHeight, pUnionEnvelope, aSgCptLkGrid); // CHelpFunc.FillCptinGrid(cptlt[cptlt.Count - 1], dblWidth, dblHeight, pUnionEnvelope, aSgCptLkGrid); // } // for (int i = 0; i < pBSAtBdLt.Count; i++) // { // List<CPoint> cptlt = pBSAtBdLt[i].CptLt; // foreach (CPoint cpt in cptlt) // { // cpt.LID = i; // CHelpFunc.FillCptinGrid(cpt, dblWidth, dblHeight, pUnionEnvelope, aBSCptLkGrid); // } // } // for (int i = 0; i < intRowColCount; i++) // { // for (int j = 0; j < intRowColCount; j++) // { // //the first column // int intJ = j - 1; // if (intJ >= 0) // { // //Lower // if (i - 1 >= 0) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i - 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // //Midle // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // //Upper // if (i + 1 < intRowColCount) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i + 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // } // //the second column // intJ = j; // //Lower // if (i - 1 >= 0) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i - 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // //Midle // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // //Upper // if (i + 1 < intRowColCount) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i + 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // //the third column // intJ = j + 1; // if (intJ < intRowColCount) // { // //Lower // if (i - 1 >= 0) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i - 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // //Midle // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // //Upper // if (i + 1 < intRowColCount) // { // LookingForNeighboursInGrid(ref aSgCptLkGrid[i, j], aBSCptLkGrid[i + 1, intJ], pSgAtBdLt, pBSAtBdLt, CConstants.dblVerySmall); // } // } // } // } //} //private void LookingForNeighboursInGrid(ref C5.LinkedList<CPoint> SgCptLkGrid, C5.LinkedList<CPoint> BSCptLkGrid, List<CAtBd> pSgAtBdLt, List<CAtBd> pBSAtBdLt, double dblVerySmall) //{ // foreach (CPoint Sgcpt in SgCptLkGrid) // { // if (Sgcpt.CorrespondingPt == null) // { // foreach (CPoint BScpt in BSCptLkGrid) // { // if (Sgcpt.Equals2D(BScpt, dblVerySmall) == true) // { // Sgcpt.CorrespondingPt = BScpt; // if (Sgcpt.ID == 0) // { // //Sgcpt. // pSgAtBdLt[Sgcpt.LID].Frcpt2 = BScpt; // //pSgAtBdLt[Sgcpt.LID].pFrAtBd = pBSAtBdLt[BScpt.LID]; // } // else // { // pSgAtBdLt[Sgcpt.LID].Tocpt2 = BScpt; // //pSgAtBdLt[Sgcpt.LID].pToAtBd = pBSAtBdLt[BScpt.LID]; // } // break; // we only need one // } // } // } // } //} #endregion /// <summary> /// /// </summary> /// <param name="pBSAtBdLt"></param> /// <param name="pSSAtBdLt"></param> /// <param name="ParameterThreshold"></param> /// <remarks>the number of Administrative Boundaries in pBSAtBdLt and that in pSSAtBdLt are the same.Besides, the topological structrues are the same</remarks> private double CalRatioofPtNum(List <CAtBd> pBSAtBdLt, List <CAtBd> pSSAtBdLt, CParameterThreshold ParameterThreshold) { int intBSInnerPtNum = 0; int intSSInnerPtNum = 0; List <CPoint> BSEndPtLt = new List <CPoint>(pBSAtBdLt.Count * 2); //List<CPoint> SSEndPtLt = new List<CPoint>(); for (int i = 0; i < pBSAtBdLt.Count; i++) { intBSInnerPtNum += (pBSAtBdLt[i].CptLt.Count - 2); intSSInnerPtNum += (pSSAtBdLt[i].CptLt.Count - 2); BSEndPtLt.Add(pBSAtBdLt[i].CptLt[0]); BSEndPtLt.Add(pBSAtBdLt[i].CptLt[pBSAtBdLt[i].CptLt.Count - 1]); } var CorrCptsLt = CGeoFunc.LookingForNeighboursByGrids(BSEndPtLt, CConstants.dblVerySmallCoord); int intIntersection = CGeoFunc.GetNumofIntersections(CorrCptsLt); //do we need this?******************************************************************************* //int intAloneEnds = CGeoFunc.GetNumofAloneEnds(EndPtLt, CorrCptsLt); //int intRealPtNum = intInnerPtNum + intSgIntersection + intAloneEnds; //notice that there are the same intersections of the larger-scale polylines and the smaller-scale polylines int intBSRealPtNum = intBSInnerPtNum + intIntersection; int intSSRealPtNum = intSSInnerPtNum + intIntersection; double dblRatioofPtNum = Convert.ToDouble(intBSRealPtNum) / Convert.ToDouble(intSSRealPtNum); return(dblRatioofPtNum); }
private void FindFrcpt2AndTocpt2Grid(List <CAtBd> pSgAtBdLt, List <CAtBd> pBSAtBdLt, CParameterThreshold ParameterThreshold) { //SgCptLt for pSgAtBdLt List <CPoint> SgCptLt = new List <CPoint>(pSgAtBdLt.Count * 2); foreach (CAtBd pAtBd in pSgAtBdLt) { CPoint cpt0 = pAtBd.CptLt[0]; cpt0.BelongedObject = pAtBd; CPoint cptlast = pAtBd.CptLt[pAtBd.CptLt.Count - 1]; cptlast.BelongedObject = pAtBd; SgCptLt.Add(cpt0); SgCptLt.Add(cptlast); } //BSCptLt for pBSAtBdLt int intCount = 0; foreach (CAtBd pAtBd in pBSAtBdLt) { intCount += pAtBd.CptLt.Count; } List <CPoint> BSCptLt = new List <CPoint>(intCount); foreach (CAtBd pAtBd in pBSAtBdLt) { foreach (CPoint cpt in pAtBd.CptLt) { //cpt.BelongedObject = pAtBd; BSCptLt.Add(cpt); } } //LookingForNeighboursByGrids var CorrCptsLt = CGeoFunc.LookingForNeighboursByGrids(SgCptLt, BSCptLt, CConstants.dblVerySmallCoord); //FindFrcpt2AndTocpt2 foreach (CCorrCpts CorrCpt in CorrCptsLt) { CorrCpt.FrCpt.isTraversed = false; } foreach (CCorrCpts CorrCpt in CorrCptsLt) { CPoint frcpt = CorrCpt.FrCpt; if (frcpt.isTraversed == false) //we only need one { CAtBd pAtBd = frcpt.BelongedObject as CAtBd; if (frcpt.ID == 0) { pAtBd.Frcpt2 = CorrCpt.ToCpt; } else { pAtBd.Tocpt2 = CorrCpt.ToCpt; } frcpt.isTraversed = true; } } }
/// <summary> /// 弯曲匹配(全局等同搜索) /// </summary> /// <param name="pFromBendSlt">大比例尺弯曲列表</param> /// <param name="pToBendSlt">小比例尺弯曲列表</param> /// <param name="dblRatioBound">比例阈值</param> /// <returns>对应弯曲列表</returns> /// <remarks></remarks> private List <CCorrespondBend> IndependBendMatch2(SortedDictionary <double, CBend> pFromBendSlt, SortedDictionary <double, CBend> pToBendSlt, CParameterThreshold ParameterThreshold) { //清理弯曲的对应弯曲列表 foreach (CBend pBend in pFromBendSlt.Values) { pBend.pCorrespondBendLt.Clear(); } foreach (CBend pBend in pToBendSlt.Values) { pBend.pCorrespondBendLt.Clear(); } //搜索符合要求的对应弯曲 List <CCorrespondBend> pCorrespondBendLt = new List <CCorrespondBend>(); int intI = 0; int intJ = 0; while (intI < pFromBendSlt.Count && intJ < pToBendSlt.Count) { CBend pfrbend = pFromBendSlt.ElementAt(intI).Value; CBend ptobend = pToBendSlt.ElementAt(intJ).Value; double dblRatioLengthi = pfrbend.Length / ParameterThreshold.dblFrLength; double dblRatioLengthj = ptobend.Length / ParameterThreshold.dblToLength; double dblStartDiff = pfrbend.dblStartRL - ptobend.dblStartRL; double dblEndDiff = pfrbend.dblEndRL - ptobend.dblEndRL; //计算相对位置差阈值 double dblRatioBound; if (dblRatioLengthi <= dblRatioLengthj) { dblRatioBound = 0.5 * dblRatioLengthi; } else { dblRatioBound = 0.5 * dblRatioLengthj; } double dblLengthRatio = pfrbend.pBaseLine.Length / ptobend.pBaseLine.Length; if ((Math.Abs(dblStartDiff) < dblRatioBound) && (Math.Abs(dblEndDiff) < dblRatioBound) && (dblLengthRatio >= ParameterThreshold.dblDLengthBound) && (dblLengthRatio <= ParameterThreshold.dblULengthBound)) { CCorrespondBend pCorrespondBend = new CCorrespondBend(pFromBendSlt.ElementAt(intI).Value, pToBendSlt.ElementAt(intJ).Value); pCorrespondBendLt.Add(pCorrespondBend); intI++; intJ++; } else { if ((ptobend.dblEndRL - pfrbend.dblStartRL) > (0.5 * dblRatioLengthi)) { intI++; } if ((pfrbend.dblEndRL - ptobend.dblStartRL) > (0.5 * dblRatioLengthj)) { intJ++; } } } //int intLastMatchj = 0; //该值并不作精确要求,仅为中间搜索点的估算值 //for (int i = 0; i < pFromBendSlt.Values.Count; i++) //{ // CBend pfrbend = pFromBendSlt.Values[i]; // double dblRatioLengthi = pfrbend.Length / ParameterThreshold.dblFrLength; // //int dblTempMatchj = 0; // //为了节省时间,从中间向两边搜索 // //以intLastMatchj为基准前进搜索 // for (int j = intLastMatchj; j < pToBendSlt.Values.Count; j++) // { // CBend ptobend = pToBendSlt.Values[j]; // double dblRatioLengthj = ptobend.Length / ParameterThreshold.dblToLength; // double dblStartDiff = pfrbend.dblStartRL - ptobend.dblStartRL; // double dblEndDiff = pfrbend.dblEndRL - ptobend.dblEndRL; // double dblAngleDiff = pfrbend.pBaseLine.Angle - ptobend.pBaseLine.Angle; // //计算相对位置差阈值 // double dblRatioBoundj; // if (dblRatioLengthi >= dblRatioLengthj) // { // dblRatioBoundj = 0.25 * dblRatioLengthi; // } // else // { // dblRatioBoundj = 0.25 * dblRatioLengthj; // } // if (dblStartDiff < (-dblRatioBoundj)) // { // break; //如果已经超出一定范围,则没必要再向后搜索了 // } // double dblLengthRatio = pfrbend.pBaseLine.Length / ptobend.pBaseLine.Length; // if ((Math.Abs(dblStartDiff) <= dblRatioBoundj) && (Math.Abs(dblEndDiff) <= dblRatioBoundj) && (Math.Abs(dblAngleDiff) <= ParameterThreshold.dblAngleBound) // && (dblLengthRatio >= ParameterThreshold.dblDLengthBound) && (dblLengthRatio <= ParameterThreshold.dblULengthBound)) // { // CCorrespondBend pCorrespondBend = new CCorrespondBend(pFromBendSlt.Values[i], pToBendSlt.Values[j]); // pCorrespondBendLt.Add(pCorrespondBend); // intLastMatchj = j; // } // } //} return(pCorrespondBendLt); }
public List <CCorrSegment> UnionBSCPl(ref List <CPolyline> pSSCPlLt, ref List <CPolyline> BSAttentionCPlLt, ref List <CPolyline> SSAttentionCPlLt, CParameterThreshold pParameterThreshold) { //for (int i = 0; i < pSSCPlLt.Count; i++) //{ // if (pSSCPlLt[i].CorrCGeoLt.Count == 0) // { // SSAttentionCPlLt.Add(pSSCPlLt[i]); // } // else // //if (pSSCPlLt[i].CorrCPlLt.Count == 1) // { // List<CPolyline> CorrCPlLt = new List<CPolyline>(); // CorrCPlLt.AddRange(pSSCPlLt[i].CorrCGeoLt); // CPolyline pUnionPolyline = CorrCPlLt[0].CopyCpl(); // CorrCPlLt.RemoveAt(0); // bool isSuccessful = true; // while (CorrCPlLt.Count > 0) // { // bool isUnioned = false; // for (int j = 0; j < CorrCPlLt.Count; j++) // { // pUnionPolyline.UnionCpl(CorrCPlLt[j], ref isUnioned); // if (isUnioned == true) // { // CorrCPlLt.RemoveAt(j); // break; // } // } // if (isUnioned == false) // { // isSuccessful = false; // break; // } // } // double dblRatio = pUnionPolyline.pBaseLine.dblLength / pSSCPlLt[i].pBaseLine.dblLength; // if (dblRatio < pParameterThreshold.dblDLengthBound || dblRatio > pParameterThreshold.dblULengthBound) // { // isSuccessful = false; // } // if (isSuccessful == false) // { // BSAttentionCPlLt.AddRange(pSSCPlLt[i].CorrCGeoLt); // SSAttentionCPlLt.Add(pSSCPlLt[i]); // } // else // { // pSSCPlLt[i].CorrCGeo = pUnionPolyline; // } // } //} //List<CCorrSegment> pCorrCplLt = new List<CCorrSegment>(); //for (int i = 0; i < pSSCPlLt.Count; i++) //{ // if (pSSCPlLt[i].CorrCGeo != null && pSSCPlLt[i] != null) // { // CCorrSegment pCorrCpl = new CCorrSegment(pSSCPlLt[i].CorrCGeo, pSSCPlLt[i]); // pCorrCplLt.Add(pCorrCpl); // } //} //return pCorrCplLt; return(null); }
public void MatchingPolyline1(ref List <CPolyline> pLSCPlLt, ref List <CPolyline> pSSCPlLt, ref List <CPolyline> BSAttentionCPlLt, ref List <CPolyline> SSAttentionCPlLt, CParameterThreshold pParameterThreshold) { //for (int i = 0; i < pLSCPlLt.Count; i++) //{ // pLSCPlLt[i].CreateBuffer(pParameterThreshold.dblBuffer / 3); // pLSCPlLt[i].CorrCGeoLt = new List<CGeoBase> new List<CPolyline>(); //} //for (int i = 0; i < pSSCPlLt.Count; i++) //{ // pSSCPlLt[i].CreateBuffer(pParameterThreshold.dblBuffer / 3); // pSSCPlLt[i].CorrCGeoLt = new List<CPolyline>(); //} //List<CPolyline> pLSCPlLt1 = new List<CPolyline>(); //for (int i = 0; i < pLSCPlLt.Count; i++) //{ // //if (pLSCPlLt[i].dblLength < 2 * pParameterThreshold.dblBuffer) // //{ // // //BSAttentionCPlLt.Add(pLSCPlLt[i]); // // ////pSingleCPlLt.Add(pLSCPlLt[i]); // // //continue; // //} // //else // //{ // SortedList<double, CCorrCplInfo> pCorrCplInfoSLt = new SortedList<double, CCorrCplInfo>(new CCmpDbl()); // double dblBSBufferArea = pLSCPlLt[i].dblBufferArea; // for (int j = 0; j < pSSCPlLt.Count; j++) // { // double dblOverlapArea = CGeoFunc.CalOverlapArea(pLSCPlLt[i].pBufferGeo, pSSCPlLt[j].pBufferGeo); // double dblOverlapRatio = dblOverlapArea / dblBSBufferArea; // CCorrCplInfo pCorrCplInfo = new CCorrCplInfo(pSSCPlLt[j], dblOverlapRatio, dblOverlapArea); // pCorrCplInfoSLt.Add(dblOverlapRatio, pCorrCplInfo); // } // int intCount = 0; // for (int j = pCorrCplInfoSLt.Count - 1; j >= 0; j--) // { // if (pCorrCplInfoSLt.Values[j].dblOverlapRatio > 0.5) // { // intCount++; // } // else // { // break; // } // } // if (intCount == 0) // { // //pSingleCPlLt.Add(pLSCPlLt[i]); // } // else // //if (intCount == 1) // { // CCorrCplInfo pCorrCplInfo2 = pCorrCplInfoSLt.Values[pCorrCplInfoSLt.Count - 1]; // pLSCPlLt[i].CorrCGeoLt.Add(pCorrCplInfo2.pCorrCpl); // pCorrCplInfo2.pCorrCpl.CorrCGeoLt.Add(pLSCPlLt[i]); // } // //else // //{ // // BSAttentionCPlLt.Add(pLSCPlLt[i]); // // //pSingleCPlLt.Add(pLSCPlLt[i]); // //} //} }
private void RecursiveBendMatch(CBend pFromBend, CBend pToBend, ref List <CCorrespondBend> pCorrespondBendLt, CParameterThreshold ParameterThreshold) { if (pFromBend.CLeftBend == null || pToBend.CLeftBend == null) { return; } double dblRatioLL = pFromBend.CLeftBend.pBaseLine.Length / pToBend.CLeftBend.pBaseLine.Length; double dblRatioRR = pFromBend.CRightBend.pBaseLine.Length / pToBend.CRightBend.pBaseLine.Length; //double dblRatioAPAP = (pFromBend.CLeftBend.Length + pFromBend.CRightBend.Length) / (pToBend.CLeftBend.Length + pToBend.CRightBend.Length); //double dblRatioLA = pFromBend.CLeftBend.Length / pToBend.Length; //double dblRatioRA = pFromBend.CRightBend.Length / pToBend.Length; if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLL <= ParameterThreshold.dblULengthBound) && (dblRatioRR >= ParameterThreshold.dblDLengthBound) && (dblRatioRR <= ParameterThreshold.dblULengthBound)) { //左右弯曲分别对应 CCorrespondBend pLeftCorrespondBend = new CCorrespondBend(pFromBend.CLeftBend, pToBend.CLeftBend); CCorrespondBend pRightCorrespondBend = new CCorrespondBend(pFromBend.CRightBend, pToBend.CRightBend); pCorrespondBendLt.Add(pLeftCorrespondBend); pCorrespondBendLt.Add(pRightCorrespondBend); //继续往下遍历 RecursiveBendMatch(pFromBend.CLeftBend, pToBend.CLeftBend, ref pCorrespondBendLt, ParameterThreshold); RecursiveBendMatch(pFromBend.CRightBend, pToBend.CRightBend, ref pCorrespondBendLt, ParameterThreshold); } else //此步必不可少,作用还是很明显的 { double dblRatioLR = pFromBend.CLeftBend.pBaseLine.Length / pToBend.CRightBend.pBaseLine.Length; double dblRatioRL = pFromBend.CRightBend.pBaseLine.Length / pToBend.CLeftBend.pBaseLine.Length; if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLR >= ParameterThreshold.dblDLengthBound)) { RecursiveBendMatch(pFromBend.CLeftBend, pToBend, ref pCorrespondBendLt, ParameterThreshold); } if ((dblRatioRL >= ParameterThreshold.dblDLengthBound) && (dblRatioRR >= ParameterThreshold.dblDLengthBound)) { RecursiveBendMatch(pFromBend.CRightBend, pToBend, ref pCorrespondBendLt, ParameterThreshold); } } }
/// <summary> /// 弯曲匹配 /// </summary> /// <param name="pFromBendSlt">大比例尺弯曲列表</param> /// <param name="pToBendSlt">小比例尺弯曲列表</param> /// <param name="dblRatioBound">比例阈值</param> /// <returns>对应弯曲列表</returns> /// <remarks></remarks> private List <CCorrespondBend> IndependBendMatch(SortedDictionary <double, CBend> pFromBendSlt, SortedDictionary <double, CBend> pToBendSlt, CParameterThreshold ParameterThreshold, CParameterInitialize pParameterInitialize) { //清理弯曲的对应弯曲列表 for (int i = 0; i < pFromBendSlt.Count; i++) { pFromBendSlt.ElementAt(i).Value.pCorrespondBendLt.Clear(); } for (int i = 0; i < pToBendSlt.Count; i++) { pToBendSlt.ElementAt(i).Value.pCorrespondBendLt.Clear(); } //搜索符合要求的对应弯曲 List <CCorrespondBend> pCorrespondBendLt = new List <CCorrespondBend>(); int intLastMatchj = 0; //该值并不作精确要求,仅为中间搜索点的估算值 for (int i = 0; i < pFromBendSlt.Values.Count; i++) { CBend pfrbend = pFromBendSlt.ElementAt(i).Value; double dblRatioLengthi = pfrbend.Length / ParameterThreshold.dblFrLength; //int dblTempMatchj = 0; //为了节省时间,从中间向两边搜索 //以intLastMatchj为基准前进搜索 for (int j = intLastMatchj; j < pToBendSlt.Values.Count; j++) { CBend ptobend = pToBendSlt.ElementAt(i).Value; double dblRatioLengthj = ptobend.Length / ParameterThreshold.dblToLength; double dblStartDiff = pfrbend.dblStartRL - ptobend.dblStartRL; double dblEndDiff = pfrbend.dblEndRL - ptobend.dblEndRL; double dblAngleDiff = pfrbend.pBaseLine.Angle - ptobend.pBaseLine.Angle; //计算相对位置差阈值 double dblRatioBoundj; if (dblRatioLengthi >= dblRatioLengthj) { dblRatioBoundj = 0.25 * dblRatioLengthi; } else { dblRatioBoundj = 0.25 * dblRatioLengthj; } if (dblStartDiff < (-dblRatioBoundj)) { break; //如果已经超出一定范围,则没必要再向后搜索了 } double dblLengthRatio = pfrbend.pBaseLine.Length / ptobend.pBaseLine.Length; if ((Math.Abs(dblStartDiff) <= dblRatioBoundj) && (Math.Abs(dblEndDiff) <= dblRatioBoundj) && (Math.Abs(dblAngleDiff) <= ParameterThreshold.dblAngleBound) && (dblLengthRatio >= ParameterThreshold.dblDLengthBound) && (dblLengthRatio <= ParameterThreshold.dblULengthBound)) { CCorrespondBend pCorrespondBend = new CCorrespondBend(pFromBendSlt.ElementAt(i).Value, pToBendSlt.ElementAt(i).Value); pCorrespondBendLt.Add(pCorrespondBend); //*******************************// List <CCorrespondBend> pRIBSCorrespondBendLt = RBS(pCorrespondBend, ParameterThreshold, pParameterInitialize); pCorrespondBendLt.AddRange(pRIBSCorrespondBendLt); intLastMatchj = j; } } } return(pCorrespondBendLt); }
//基于弯曲的Morphing方法 public C5.LinkedList <CCorrSegment> DWByRIBSMorphing(CParameterInitialize pParameterInitialize, CParameterThreshold ParameterThreshold) { //CParameterInitialize ParameterInitialize = pParameterInitialize; //CMPBBSL OptMPBBSL = new CMPBBSL(); //CPolyline frcpl = _FromCpl; //CPolyline tocpl = _ToCpl; //double dblVerySmall = ParameterThreshold.dblVerySmall; ////*******为什么不调用"OptMPBBSL.DWByMPBBSL" ? ////*******因为这里的弯曲匹配方法(独立弯曲、子弯曲)不一样,增加了新的重建三角网的内容 //List<CPoint> frchcptlt = _Triangulator.CreateConvexHullEdgeLt2(frcpl, dblVerySmall); //CPolyline frchcpl = new CPolyline(0, frchcptlt); //大比例尺折线外包多边形线段 //List<CPoint> tochcptlt = _Triangulator.CreateConvexHullEdgeLt2(tocpl, dblVerySmall); //CPolyline tochcpl = new CPolyline(0, tochcptlt); //小比例尺折线外包多边形线段 ////添加约束数据生成图层,以便于利用AE中的功能(ct:constraint) //List<CPolyline> frctcpllt = new List<CPolyline>(); frctcpllt.Add(frcpl); frctcpllt.Add(frchcpl); //List<CPolyline> toctcpllt = new List<CPolyline>(); toctcpllt.Add(tocpl); toctcpllt.Add(tochcpl); //IFeatureLayer pBSFLayer = CHelpFunc.SaveCPlLt(frctcpllt, "frctcpllt" + _dblCDTNum, ParameterInitialize.pWorkspace, ParameterInitialize.m_mapControl); //IFeatureLayer pSSFLayer = CHelpFunc.SaveCPlLt(toctcpllt, "toctcpllt" + _dblCDTNum, ParameterInitialize.pWorkspace, ParameterInitialize.m_mapControl); ////建立CDT并获取弯曲森林 //CBendForest FromLeftBendForest = new CBendForest(); //CBendForest FromRightBendForest = new CBendForest(); //CParameterVariable pParameterVariableFrom = new CParameterVariable(frcpl, "FromCDT" + _dblCDTNum, ParameterInitialize.pBSFLayer, dblVerySmall); //OptMPBBSL.GetBendForest(pParameterVariableFrom, ref FromLeftBendForest, ref FromRightBendForest, ParameterInitialize); //CBendForest ToLeftBendForest = new CBendForest(); //CBendForest ToRightBendForest = new CBendForest(); //CParameterVariable pParameterVariableTo = new CParameterVariable(tocpl, "ToCDT" + _dblCDTNum, ParameterInitialize.pSSFLayer, dblVerySmall); //OptMPBBSL.GetBendForest(pParameterVariableTo, ref ToLeftBendForest, ref ToRightBendForest, ParameterInitialize); //_dblCDTNum = _dblCDTNum + 1; ////弯曲树匹配,寻找对应独立弯曲 //List<CCorrespondBend> IndependCorrespondBendLt = new List<CCorrespondBend>(); //IndependCorrespondBendLt.AddRange(BendTreeMatch(FromLeftBendForest, ToLeftBendForest, ParameterThreshold, ParameterInitialize)); //IndependCorrespondBendLt.AddRange(BendTreeMatch(FromRightBendForest, ToRightBendForest, ParameterThreshold, ParameterInitialize)); ////弯曲匹配,寻找对应弯曲 //List<CCorrespondBend> CorrespondBendLt = BendMatch(IndependCorrespondBendLt, ParameterThreshold, ParameterInitialize); ////提取对应线段 //C5.LinkedList<CCorrSegment> pComplexCorrespondSegmentLk = CHelpFunc.DetectCorrespondSegment(frcpl, tocpl, CorrespondBendLt); //return pComplexCorrespondSegmentLk; return(null); }
/// <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>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); //} }
/// <summary>递归找到对应河流,同时记录对应支流对应交汇点</summary> /// <param name="CCorrespondRiverLt">对应河流记录列</param> /// <param name="pBSRiver">大比例尺表达河流</param> /// <param name="pSSRiver">小比例尺表达河流</param> /// <param name="pParameterThreshold">阈值参数</param> /// <remarks ></remarks> private void RecursiveFindCorrespondRiverLt(ref List <CCorrespondRiver> CCorrespondRiverLt, CRiver pBSRiver, CRiver pSSRiver, CParameterThreshold pParameterThreshold) { //建立河流对应关系 pBSRiver.CCorrRiver = pSSRiver; pSSRiver.CCorrRiver = pBSRiver; CCorrespondRiver pCorrespondRiver = new CCorrespondRiver(pSSRiver, pBSRiver); pCorrespondRiver.blnCorr = true; CCorrespondRiverLt.Add(pCorrespondRiver); //如果小比例尺表达河流分支不存在 if (pSSRiver.CTributaryLt == null) { return; } //数据准备 pBSRiver.CCorrTriJunctionPtLt = new List <CPoint>(); pSSRiver.CCorrTriJunctionPtLt = new List <CPoint>(); List <CRiver> pBSTributaryLt = pBSRiver.CTributaryLt; List <CRiver> pSSTributaryLt = new List <CRiver>(); pSSTributaryLt.AddRange(pSSRiver.CTributaryLt); //遍历寻找对应河流 for (int i = 0; i < pBSTributaryLt.Count; i++) { bool blnIsOverlap = false; for (int j = 0; j < pSSTributaryLt.Count; j++) { blnIsOverlap = CGeoFunc.IsOverlap(pBSTributaryLt[i], pSSTributaryLt[j], pParameterThreshold.dblOverlapRatio); //判断两河流是否重叠 if (blnIsOverlap == true) { pBSRiver.CCorrTriJunctionPtLt.Add(pBSTributaryLt[i].Tocpt2); pSSRiver.CCorrTriJunctionPtLt.Add(pSSTributaryLt[j].Tocpt2); RecursiveFindCorrespondRiverLt(ref CCorrespondRiverLt, pBSTributaryLt[i], pSSTributaryLt[j], pParameterThreshold); //递归找到对应河流 pSSTributaryLt.RemoveAt(j); break; } } } //记录对应交汇点的目的是有助于将原河流进行对应分割以提高精度 //大多数情况下,交汇点都是“三叉路口”,此时数组"CCorrTriJunctionPtLt"中不会有重合点 //但当交汇点为“四、五甚至更多叉路口”时,数组"CCorrTriJunctionPtLt"中有重合点,应只保留其中一个点 for (int i = pBSRiver.CCorrTriJunctionPtLt.Count - 1; i > 0; i--) { if (pBSRiver.CCorrTriJunctionPtLt[i].Equals2D(pBSRiver.CCorrTriJunctionPtLt[i - 1])) { pBSRiver.CCorrTriJunctionPtLt.RemoveAt(i); pSSRiver.CCorrTriJunctionPtLt.RemoveAt(i); } } }
/// <summary> /// 进行弯曲匹配,提取对应线段 /// </summary> /// <param name="CFromBendForest">大比例尺弯曲森林</param> /// <param name="CToBendForest">小比例尺弯曲森林</param> /// <param name="ParameterThreshold">参数容器</param> /// <param name="CorrespondSegmentLk">对应线段列</param> /// <remarks>弯曲树匹配和孩子弯曲匹配都由本函数来执行 /// 注意:此处的弯曲树匹配及弯曲匹配与"MPBBSL"中有所不同,此处增加了递归识别独立弯曲</remarks> public List <CCorrespondBend> BendTreeMatch(CBendForest CFromBendForest, CBendForest CToBendForest, CParameterThreshold ParameterThreshold, CParameterInitialize pParameterInitialize) { //大比例尺独立弯曲 SortedDictionary <double, CBend> pFromIndependBendSlt = new SortedDictionary <double, CBend>(new CCmpDbl()); for (int i = 0; i < CFromBendForest.Count; i++) { pFromIndependBendSlt.Add(CFromBendForest.ElementAt(i).Value.dblStartRL, CFromBendForest.ElementAt(i).Value); } //小比例尺独立弯曲 SortedDictionary <double, CBend> pToIndependBendSlt = new SortedDictionary <double, CBend>(new CCmpDbl()); for (int i = 0; i < CToBendForest.Count; i++) { pToIndependBendSlt.Add(CToBendForest.ElementAt(i).Value.dblStartRL, CToBendForest.ElementAt(i).Value); } //获取对应弯曲 List <CCorrespondBend> pIndependCorrespondBendLt = IndependBendMatch(pFromIndependBendSlt, pToIndependBendSlt, ParameterThreshold, pParameterInitialize); return(pIndependCorrespondBendLt); }
public List <CCorrespondBend> MBendMatch(List <CCorrespondBend> pIndependCorrespondBendLt, CParameterThreshold ParameterThreshold, string strSide) { //List<CCorrespondBend> pCorrespondBendLt = new List<CCorrespondBend>(); //pCorrespondBendLt.AddRange(pIndependCorrespondBendLt); //for (int i = 0; i < pIndependCorrespondBendLt.Count; i++) //{ // RecursiveBendMatch(pIndependCorrespondBendLt[i].CFromBend, pIndependCorrespondBendLt[i].CToBend, ref pCorrespondBendLt, ParameterThreshold); //} //return pCorrespondBendLt; return(null); }
public List <CCorrespondBend> BendMatch(List <CCorrespondBend> pIndependCorrespondBendLt, CParameterThreshold ParameterThreshold, CParameterInitialize pParameterInitialize) { List <CCorrespondBend> pCorrespondBendLt = new List <CCorrespondBend>(); pCorrespondBendLt.AddRange(pIndependCorrespondBendLt); for (int i = 0; i < pIndependCorrespondBendLt.Count; i++) { RecursiveBendMatch(pIndependCorrespondBendLt[i].CFromBend, pIndependCorrespondBendLt[i].CToBend, ref pCorrespondBendLt, ParameterThreshold, pParameterInitialize); } return(pCorrespondBendLt); }
private void RecursiveMBendMatch(CBend pFromBend, CBend pToBend, ref List <CCorrespondBend> pCorrespondBendLt, CParameterThreshold ParameterThreshold) { ////建立CDT并获取弯曲森林 //CBendForest FromLeftBendForest = new CBendForest(); //CBendForest FromRightBendForest = new CBendForest(); //CParameterVariable pParameterVariableFrom = new CParameterVariable(frcpl, "FromCDT", ParameterInitialize.pBSFLayer, dblVerySmall); //OptMPBBSL.GetBendForest(pParameterVariableFrom, ref FromLeftBendForest, ref FromRightBendForest, ParameterInitialize); //CBendForest ToLeftBendForest = new CBendForest(); //CBendForest ToRightBendForest = new CBendForest(); //CParameterVariable pParameterVariableTo = new CParameterVariable(tocpl, "ToCDT", ParameterInitialize.pSSFLayer, dblVerySmall); //OptMPBBSL.GetBendForest(pParameterVariableTo, ref ToLeftBendForest, ref ToRightBendForest, ParameterInitialize); ////整理弯曲森林,获得弯曲数组 //SortedList<double, CBend> FromLeftBendSlt = OptMPBBSL.NeatenBendForest(frcpl, FromLeftBendForest); //SortedList<double, CBend> FromRightBendSlt = OptMPBBSL.NeatenBendForest(frcpl, FromRightBendForest); //SortedList<double, CBend> ToLeftBendSlt = OptMPBBSL.NeatenBendForest(tocpl, ToLeftBendForest); //SortedList<double, CBend> ToRightBendSlt = OptMPBBSL.NeatenBendForest(tocpl, ToRightBendForest); //if (pFromBend.CLeftBend == null || pToBend.CLeftBend == null) //{ // return; //} //double dblRatioLL = pFromBend.CLeftBend.pBaseLine.Length / pToBend.CLeftBend.pBaseLine.Length; //double dblRatioRR = pFromBend.CRightBend.pBaseLine.Length / pToBend.CRightBend.pBaseLine.Length; //if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLL <= ParameterThreshold.dblULengthBound) && // (dblRatioRR >= ParameterThreshold.dblDLengthBound) && (dblRatioRR <= ParameterThreshold.dblULengthBound)) //{ // //左右弯曲分别对应 // CCorrespondBend pLeftCorrespondBend = new CCorrespondBend(pFromBend.CLeftBend, pToBend.CLeftBend); // CCorrespondBend pRightCorrespondBend = new CCorrespondBend(pFromBend.CRightBend, pToBend.CRightBend); // pCorrespondBendLt.Add(pLeftCorrespondBend); // pCorrespondBendLt.Add(pRightCorrespondBend); // //继续往下遍历 // RecursiveBendMatch(pFromBend.CLeftBend, pToBend.CLeftBend, ref pCorrespondBendLt, ParameterThreshold); // RecursiveBendMatch(pFromBend.CRightBend, pToBend.CRightBend, ref pCorrespondBendLt, ParameterThreshold); //} }
/// <summary>找对应河流</summary> /// <param name="CBSRiverLt">大比例尺表达河流</param> /// <param name="CSSRiverLt">小比例尺表达河流</param> /// <param name="pParameterThreshold">阈值参数</param> /// <returns>对应河流列</returns> /// <remarks>对应河流的数据记录在对应河网</remarks> private List <CCorrespondRiver> FindCorrespondRiverLt(List <CRiver> CBSRiverLt, List <CRiver> CSSRiverLt, CParameterThreshold pParameterThreshold) { List <CCorrespondRiver> pCorrespondRiverLt = new List <CCorrespondRiver>(); for (int i = 0; i < CBSRiverLt.Count; i++) { for (int j = 0; j < CSSRiverLt.Count; j++) { bool blnIsOverlap = CGeoFunc.IsOverlap(CBSRiverLt[i], CSSRiverLt[j], pParameterThreshold.dblOverlapRatio); if (blnIsOverlap == true) { CBSRiverLt[i].CCorrRiver = CSSRiverLt[j]; CSSRiverLt[j].CCorrRiver = CBSRiverLt[i]; CCorrespondRiver pCorrespondRiver = new CCorrespondRiver(CBSRiverLt[i], CSSRiverLt[j]); pCorrespondRiverLt.Add(pCorrespondRiver); CSSRiverLt.RemoveAt(j); break; } } } return(pCorrespondRiverLt); }
/// <summary> /// 用基于弯曲的Morphing方法进行处理 /// </summary> /// <param name="pParameterInitialize">参数</param> /// <param name="pParameterVariableFrom">有关大比例尺折线的参数变量,主要储存了大比例尺线要素、文件保存时的名字、大比例尺图层和极小值</param> /// <param name="pParameterVariableTo">有关小比例尺折线的参数变量,主要储存了:小比例尺线要素、文件保存时的名字、小比例尺图层和极小值</param> /// <param name="ParameterThreshold">阈值参数,主要储存了:大、小比例尺线要素长度,弯曲基线比阈值范围</param> /// <remarks>创建约束三角网时,已使用外包多边形作为约束边</remarks> public LinkedList <CCorrSegment> DWByMPBBSL(CParameterInitialize pParameterInitialize, CParameterVariable pParameterVariableFrom, CParameterVariable pParameterVariableTo, CParameterThreshold ParameterThreshold) { CPolyline frcpl = pParameterVariableFrom.CPolyline; frcpl.SetPolyline(); CPolyline tocpl = pParameterVariableTo.CPolyline; tocpl.SetPolyline(); List <CPoint> frchcptlt = _Triangulator.CreateConvexHullEdgeLt2(frcpl, pParameterVariableFrom.dblVerySmall); CPolyline frchcpl = new CPolyline(0, frchcptlt); //大比例尺折线外包多边形线段 frchcpl.SetPolyline(); List <CPoint> tochcptlt = _Triangulator.CreateConvexHullEdgeLt2(tocpl, pParameterVariableFrom.dblVerySmall); CPolyline tochcpl = new CPolyline(0, tochcptlt); //小比例尺折线外包多边形线段 tochcpl.SetPolyline(); //添加约束数据生成图层,以便于利用AE中的功能(ct:constraint) List <CPolyline> frctcpllt = new List <CPolyline>(); frctcpllt.Add(frcpl); frctcpllt.Add(frchcpl); List <CPolyline> toctcpllt = new List <CPolyline>(); toctcpllt.Add(tocpl); toctcpllt.Add(tochcpl); IFeatureLayer pBSFLayer = CHelpFunc.SaveCPlLt(frctcpllt, "frctcpllt", pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); IFeatureLayer pSSFLayer = CHelpFunc.SaveCPlLt(toctcpllt, "toctcpllt", pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); pParameterVariableFrom.pFeatureLayer = pBSFLayer; pParameterVariableTo.pFeatureLayer = pSSFLayer; //建立CDT并获取弯曲森林 CBendForest FromLeftBendForest = new CBendForest(); CBendForest FromRightBendForest = new CBendForest(); GetBendForest(pParameterVariableFrom, ref FromLeftBendForest, ref FromRightBendForest, pParameterInitialize); CBendForest ToLeftBendForest = new CBendForest(); CBendForest ToRightBendForest = new CBendForest(); GetBendForest(pParameterVariableTo, ref ToLeftBendForest, ref ToRightBendForest, pParameterInitialize); //弯曲树匹配,寻找对应独立弯曲 List <CCorrespondBend> IndependCorrespondBendLt = new List <CCorrespondBend>(); IndependCorrespondBendLt.AddRange(BendTreeMatch(FromLeftBendForest, ToLeftBendForest, ParameterThreshold)); IndependCorrespondBendLt.AddRange(BendTreeMatch(FromRightBendForest, ToRightBendForest, ParameterThreshold)); //弯曲匹配,寻找对应弯曲 List <CCorrespondBend> CorrespondBendLt = BendMatch(IndependCorrespondBendLt, ParameterThreshold); //提取对应线段 LinkedList <CCorrSegment> CorrespondSegmentLk = CHelpFunc.DetectCorrespondSegment(frcpl, tocpl, CorrespondBendLt); //CHelpFunc.PreviousWorkCSeLt(ref CorrespondSegmentLk); return(CorrespondSegmentLk); }