Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }