/// <summary> /// 获取折线的弯曲森林 /// </summary> /// <param name="cpl">折线</param> /// <param name="pLeftBendForest">折线左边的弯曲森林</param> /// <param name="pRightBendForest">折线右边的弯曲森林</param> /// <param name="strName">留作保存三角网用</param> /// <remarks>创建约束三角网时,并未使用外包多边形作为约束边</remarks> public void MGetBendForest(CParameterVariable pParameterVariable, ref CBendForest pBendForest, string strSide, CParameterInitialize pParameterInitialize) { //List<CPoint> cptlt = pParameterVariable.CPolyline.CptLt; //List<CEdge> CEdgeLt = new List<CEdge>(); //for (int i = 0; i < cptlt.Count - 1; i++) //{ // CEdge pEdge = new CEdge(cptlt[i], cptlt[i + 1]); // CEdgeLt.Add(pEdge); //} //CTriangulator OptCDT = new CTriangulator(); //List<CTriangle> CDTLt = OptCDT.CreateCDT(pParameterVariable); ////for (int i = 0; i < CDTLt.Count; i++) CDTLt[i].TID = i; //到此为止,约束三角形建立完成,各三角形不再发生变化,将各三角形编号 //OptCDT.GetSETriangle(ref CDTLt); //确定共边三角形 //OptCDT.ConfirmTriangleSide(ref CDTLt, CEdgeLt); //确定各三角形位于折线的左右边 //OptCDT.SignTriTypeAll(ref CDTLt); //标记I、II、III、VI类三角形 //pLeftBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, cptlt, "Left"); //pRightBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, cptlt, "Right"); //List<CTriangle> CTriangleLt = new List<CTriangle>(); //for (int i = 0; i < CDTLt.Count; i++) //{ // if (CDTLt[i].strTriType != "I") // { // CTriangleLt.Add(CDTLt[i]); // } //} //CHelpFunc.SaveTriangles(CTriangleLt, pParameterVariable.strName, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); }
/// <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); }
/// <summary> /// 获取折线某一边的弯曲森林 /// </summary> /// <param name="cpl">折线</param> /// <param name="pParameterVariable">变量参数:包含线状要素,需建立CDT的图层,CDT被保存的文件名称</param> /// <param name="pBendForest">待建立的一边的弯曲森林</param> /// <param name="pParameterInitialize">参数</param> /// <param name="strForeSide">弯曲在线状要素的侧边(右侧或左侧),此处将建立另外一侧的弯曲森林</param> /// <remarks>注意:本方法中的CreateCDT将会改变pParameterVariable中的CPolyline</remarks> public void GetSideBendForest(CParameterVariable pParameterVariable, ref CBendForest pBendForest, CParameterInitialize pParameterInitialize, string strForeSide) { CTriangulator OptCDT = new CTriangulator(); CPolyline newcpl = new CPolyline(pParameterVariable.CPolyline.ID, pParameterVariable.CPolyline.CptLt); List <CTriangle> CDTLt = OptCDT.CreateCDT(pParameterVariable.pFeatureLayer, ref newcpl, pParameterVariable.dblVerySmall); pParameterVariable.CPolyline = newcpl; //for (int i = 0; i < CDTLt.Count; i++) CDTLt[i].TID = i; //到此为止,约束三角形建立完成,各三角形不再发生变化,将各三角形编号 OptCDT.GetSETriangle(ref CDTLt, pParameterVariable.dblVerySmall); //确定共边三角形 OptCDT.ConfirmTriangleSide(ref CDTLt, pParameterVariable.CPolyline, pParameterVariable.dblVerySmall); //确定各三角形位于折线的左右边 OptCDT.SignTriTypeAll(ref CDTLt); //标记I、II、III、VI类三角形 if (strForeSide == "Left") { pBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, pParameterVariable.CPolyline.CptLt, "Right", pParameterVariable.dblVerySmall); } else if (strForeSide == "Right") { pBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, pParameterVariable.CPolyline.CptLt, "Left", pParameterVariable.dblVerySmall); } else { MessageBox.Show("GetSideBendForest出现问题!"); } //保存三角网 //List<CTriangle> CTriangleLt = new List<CTriangle>(); //for (int i = 0; i < CDTLt.Count; i++) //{ // if (CDTLt[i].strTriType != "I") // { // CTriangleLt.Add(CDTLt[i]); // } //} //CHelpFunc.SaveTriangles(CTriangleLt, pParameterVariable.strName, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); }
/// <summary> /// 获取折线的弯曲森林 /// </summary> /// <param name="cpl">折线</param> /// <param name="pLeftBendForest">折线左边的弯曲森林</param> /// <param name="pRightBendForest">折线右边的弯曲森林</param> /// <param name="strName">留作保存三角网用</param> /// <remarks>创建约束三角网时,并未使用外包多边形作为约束边 /// 注意:本方法中的CreateCDT将会改变pParameterVariable中的CPolyline</remarks> public void GetBendForest(CParameterVariable pParameterVariable, ref CBendForest pLeftBendForest, ref CBendForest pRightBendForest, CParameterInitialize pParameterInitialize) { //List<CPoint> cptlt = pParameterVariable.CPolyline.CptLt; //List<CEdge> CEdgeLt = new List<CEdge>(); //for (int i = 0; i < cptlt.Count - 1; i++) //{ // CEdge pEdge = new CEdge(cptlt[i], cptlt[i + 1]); // CEdgeLt.Add(pEdge); //} CTriangulator OptCDT = new CTriangulator(); CPolyline newcpl = new CPolyline(pParameterVariable.CPolyline.ID, pParameterVariable.CPolyline.CptLt); List <CTriangle> CDTLt = OptCDT.CreateCDT(pParameterVariable.pFeatureLayer, ref newcpl, pParameterVariable.dblVerySmall); pParameterVariable.CPolyline = newcpl; //for (int i = 0; i < CDTLt.Count; i++) CDTLt[i].TID = i; //到此为止,约束三角形建立完成,各三角形不再发生变化,将各三角形编号 OptCDT.GetSETriangle(ref CDTLt, pParameterVariable.dblVerySmall); //确定共边三角形 OptCDT.ConfirmTriangleSide(ref CDTLt, pParameterVariable.CPolyline, pParameterVariable.dblVerySmall); //确定各三角形位于折线的左右边 OptCDT.SignTriTypeAll(ref CDTLt); //标记I、II、III、VI类三角形 pLeftBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, pParameterVariable.CPolyline.CptLt, "Left", pParameterVariable.dblVerySmall); pRightBendForest = OptCDT.BuildBendForestNeed2(ref CDTLt, pParameterVariable.CPolyline.CptLt, "Right", pParameterVariable.dblVerySmall); //保存三角网 List <CTriangle> CTriangleLt = new List <CTriangle>(); for (int i = 0; i < CDTLt.Count; i++) { if (CDTLt[i].strTriType != "I") { CTriangleLt.Add(CDTLt[i]); } } //CHelpFunc.SaveTriangles(CTriangleLt, pParameterVariable.strName, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl); }
/// <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); }