コード例 #1
0
        public override void timerAdd_Tick(object sender, EventArgs e)
        {
            _dblProp = _dblProp + 0.001;
            IMapControl4       m_mapControl = _DataRecords.ParameterInitialize.m_mapControl;
            IGraphicsContainer pGra         = m_mapControl.Map as IGraphicsContainer;

            pGra.DeleteAllElements();

            if (_dblProp > 1)
            {
                timerAdd.Enabled = false;
                _dblProp         = 1;

                pbScale.Value = Convert.ToInt16(100 * _dblProp);
                CPolyline cpl0 = GetTargetcpl(_dblProp);
                CDrawInActiveView.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, cpl0);
                return;
            }
            CPolyline cpl1 = GetTargetcpl(_dblProp);

            pbScale.Value = Convert.ToInt16(100 * _dblProp);



            CDrawInActiveView.ViewPolyline(m_mapControl, cpl1);
        }
コード例 #2
0
        private CPolyline DisplayInterpolation(double dblProp, IMapControl4 m_mapControl)
        {
            List <CCorrCpts> pCorrCptsLt = _DataRecords.ParameterResult.CCorrCptsLt;
            int intPtNum = pCorrCptsLt.Count;

            List <CPoint> newcptlt = new List <CPoint>();
            //先确定最后两个点
            double dblLastX    = (1 - dblProp) * pCorrCptsLt[intPtNum - 1].FrCpt.X + dblProp * pCorrCptsLt[intPtNum - 1].ToCpt.X;
            double dblLastY    = (1 - dblProp) * pCorrCptsLt[intPtNum - 1].FrCpt.Y + dblProp * pCorrCptsLt[intPtNum - 1].ToCpt.Y;
            var    newlastcpt  = new CPoint(intPtNum - 1, dblLastX, dblLastY);
            double dblLast1X   = (1 - dblProp) * pCorrCptsLt[intPtNum - 2].FrCpt.X + dblProp * pCorrCptsLt[intPtNum - 2].ToCpt.X;
            double dblLast1Y   = (1 - dblProp) * pCorrCptsLt[intPtNum - 2].FrCpt.Y + dblProp * pCorrCptsLt[intPtNum - 2].ToCpt.Y;
            var    newlast1cpt = new CPoint(intPtNum - 2, dblLast1X, dblLast1Y);

            newcptlt.Insert(0, newlastcpt);
            newcptlt.Insert(0, newlast1cpt);

            double dblPreAxisAngle = CGeoFunc.CalAxisAngle(newlast1cpt, newlastcpt);   //前一个线段的绝对角

            for (int i = pCorrCptsLt.Count - 3; i >= 0; i--)
            {
                //目标夹角大小
                double dblAngle = (1 - dblProp) * _adblFrAngle[i] + dblProp * _adblToAngle[i];
                //绝对角
                double dblCurAxisAngle = dblPreAxisAngle - dblAngle;      //当前线段的绝对角(0到2*PI)
                if (dblCurAxisAngle >= 2 * Math.PI)
                {
                    dblCurAxisAngle = dblCurAxisAngle - 2 * Math.PI;
                }
                else if (dblCurAxisAngle < 0)
                {
                    dblCurAxisAngle = dblCurAxisAngle + 2 * Math.PI;
                }

                //目标长度
                double dblLength = (1 - dblProp) * _adblFrLength[i] + dblProp * _adblToLength[i];
                //新坐标
                double dblNewX = newcptlt[0].X + dblLength * Math.Cos(dblCurAxisAngle);
                double dblNewY = newcptlt[0].Y + dblLength * Math.Sin(dblCurAxisAngle);
                CPoint newcpt  = new CPoint(i, dblNewX, dblNewY);
                newcptlt.Insert(0, newcpt);
                //更新dblPreAxisAngle(将向量旋转180°)
                if (dblCurAxisAngle >= Math.PI)
                {
                    dblPreAxisAngle = dblCurAxisAngle - Math.PI;
                }
                else
                {
                    dblPreAxisAngle = dblCurAxisAngle + Math.PI;
                }
            }
            CPolyline newcpl = new CPolyline(0, newcptlt);

            IGraphicsContainer pGra = m_mapControl.Map as IGraphicsContainer;

            pGra.DeleteAllElements();
            CDrawInActiveView.ViewPolyline(m_mapControl, newcpl);
            return(newcpl);
        }
コード例 #3
0
        public override void btnRun_Click(object sender, EventArgs e)
        {
            List <int> intSetoff = new List <int>();

            for (int i = 0; i < _CPolylineLt.Count; i++)
            {
                if (_CPolylineLt[i].CptLt[0].Z > _CPolylineLt[i].CptLt[_CPolylineLt[i].CptLt.Count - 1].Z)
                {
                    CDrawInActiveView.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, _CPolylineLt[i]);
                }
                else
                {
                    intSetoff.Add(_CPolylineLt[i].ID);
                }
            }

            CDrawInActiveView.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, _CPolylineLt[intCount]);
            intCount += 1;
            int kk = 5;

            //以最后两个点为基点
            //_CPolyline = _CPolylineLt[1];
            for (int i = 0; i < _CPolylineLt.Count; i++)
            {
                if (_CPolylineLt[i].ID == 10)
                {
                    _CPolyline = _CPolylineLt[i];
                    break;
                }
            }

            CPolyline cpl = _CPolyline;

            CDrawInActiveView.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, cpl);
            int intPtCount = cpl.CptLt.Count;

            //计算长度初始值(全部计算)
            _adblLength0 = new double[intPtCount - 2];
            for (int i = 0; i < intPtCount - 2; i++)
            {
                _adblLength0[i] = CGeoFunc.CalDis(cpl.CptLt[i], cpl.CptLt[i + 1]);
            }


            //计算角度初始值
            _adblAngle0 = new double[intPtCount - 2];
            for (int i = 0; i < intPtCount - 2; i++)
            {
                _adblAngle0[i] = CGeoFunc.CalAngle_Counterclockwise(cpl.CptLt[i], cpl.CptLt[i + 1], cpl.CptLt[i + 2]);
            }
        }
コード例 #4
0
        private CPolyline DisplayInterpolation(double dblProp, IMapControl4 m_mapControl)
        {
            CPolyline cpl = _pCAL.GetTargetcpl(dblProp);

            IGraphicsContainer pGra = m_mapControl.Map as IGraphicsContainer;

            pGra.DeleteAllElements();
            CDrawInActiveView.ViewPolyline(m_mapControl, cpl);
            //CDrawInActiveView.ViewPolyline(m_mapControl, _DataRecords.ParameterResult.FromCpl);
            //CDrawInActiveView.ViewPolyline(m_mapControl, _DataRecords.ParameterResult.ToCpl);


            return(cpl);
        }
コード例 #5
0
        /// <summary>
        /// 显示并返回单个插值面状要素
        /// </summary>
        /// <param name="pDataRecords">数据记录</param>
        /// <param name="dblProp">差值参数</param>
        /// <returns>面状要素</returns>
        public CPolyline DisplayInterpolation(double dblProp)
        {
            if (dblProp < 0 || dblProp > 1)
            {
                MessageBox.Show("请输入正确参数!");
                return(null);
            }

            CPolyline cpl = GetTargetcpl(dblProp);

            // 清除绘画痕迹
            IMapControl4       m_mapControl = _DataRecords.ParameterInitialize.m_mapControl;
            IGraphicsContainer pGra         = m_mapControl.Map as IGraphicsContainer;

            pGra.DeleteAllElements();
            CDrawInActiveView.ViewPolyline(m_mapControl, cpl);  //显示生成的线段
            return(cpl);
        }
コード例 #6
0
        public override void timerReduce_Tick(object sender, EventArgs e)
        {
            List <CPolyline> cpllt = _DataRecords.ParameterResult.CResultPlLt;

            if (_intI >= 0 && _intI < cpllt.Count)
            {
                pbScale.Value = Convert.ToInt16(100 * _intI / (cpllt.Count - 1));
                IMapControl4       m_mapControl = _DataRecords.ParameterInitialize.m_mapControl;
                IGraphicsContainer pGra         = m_mapControl.Map as IGraphicsContainer;
                pGra.DeleteAllElements();
                CDrawInActiveView.ViewPolyline(m_mapControl, cpllt[_intI]);  //显示生成的线段
                _intI -= 1;
            }
            else if (_intI < 0)
            {
                this.timerReduce.Enabled = false;
                _intI = 0;
            }
            else
            {
                _intI = cpllt.Count - 1;
            }
        }
コード例 #7
0
        /// <summary>
        /// 显示并返回单个插值面状要素
        /// </summary>
        /// <param name="pDataRecords">数据记录</param>
        /// <param name="dblProp">差值参数</param>
        /// <returns>面状要素</returns>
        public CPolyline DisplayInterpolation(double dblProp, CPolyline lastcpl)
        {
            CPolyline cpl = GetTargetcpl(dblProp, lastcpl);

            //_DataRecords.ParameterInitialize.txtT.Text = "   t = " + dblProp.ToString();
            //_DataRecords.ParameterInitialize.txtVtPV.Text ="   VtPV = " + cpl.dblVtPV.ToString();

            //// 清除绘画痕迹
            //IMapControl4 m_mapControl = _DataRecords.ParameterInitialize.m_mapControl;
            //IGraphicsContainer pGra = m_mapControl.Map as IGraphicsContainer;
            //pGra.DeleteAllElements();

            //if (dblProp == 0)
            //{
            //    int tt = 5;
            //}
            //else if (dblProp == 1)
            //{
            //    int ss = 5;
            //}


            ////对线段进行染色
            //for (int i = 0; i < cpl.SubCPlLt.Count; i++)
            //{
            //    double dblColor = 255;
            //    int intColor = Convert.ToInt32((Math.Abs(cpl.SubCPlLt[i].dblLengthV) - _dblMinLengthV) / _dblDiffLengthV * dblColor);
            //    intColor = Math.Abs(intColor);
            //    if (Math.Abs(cpl.SubCPlLt[i].dblLengthV) < _dblTX)
            //    {
            //        cpl.SubCPlLt[i].intGreen = 255;
            //    }

            //    else if (cpl.SubCPlLt[i].dblLengthV > 0)
            //    {
            //        if (intColor <= 255)
            //        {
            //            cpl.SubCPlLt[i].intRed = 255;
            //            cpl.SubCPlLt[i].intGreen = 255 - intColor;
            //            cpl.SubCPlLt[i].intBlue = 255 - intColor;
            //        }
            //        else
            //        {
            //            cpl.SubCPlLt[i].intRed = 255;
            //        }
            //    }
            //    else if (cpl.SubCPlLt[i].dblLengthV < 0)
            //    {
            //        if (intColor <= 255)
            //        {
            //            cpl.SubCPlLt[i].intRed = 255 - intColor;
            //            cpl.SubCPlLt[i].intGreen = 255 - intColor;
            //            cpl.SubCPlLt[i].intBlue = 255;
            //        }
            //        else
            //        {
            //            cpl.SubCPlLt[i].intBlue = 255;
            //        }
            //    }
            //}

            //for (int i = 0; i < cpl.SubCPlLt.Count; i++)
            //{
            //    CPolyline subcpl = cpl.SubCPlLt[i];
            //    CDrawInActiveView.ViewPolylineByRGB(m_mapControl, subcpl, subcpl.intRed, subcpl.intGreen, subcpl.intBlue);  //显示生成的线段
            //}

            ////对缓冲区进行染色
            //for (int i = 1; i < cpl.CptLt.Count -1; i++)
            //{
            //    double dblColor = 255;
            //    int intColor = Convert.ToInt32((Math.Abs(cpl.CptLt [i].dblAngleV ) - _dblMinAngleV) / _dblDiffAngleV * dblColor);
            //    intColor = Math.Abs(intColor);


            //    if (Math .Abs (cpl.CptLt[i].dblAngleV)<_dblTX)
            //    {
            //        cpl.CptLt[i].intGreen = 255;
            //    }
            //    else if (cpl.CptLt[i].dblAngleV > 0)
            //    {
            //        if (intColor <= 255)
            //        {
            //            cpl.CptLt[i].intRed = 255;
            //            cpl.CptLt[i].intGreen = 255 - intColor;
            //            cpl.CptLt[i].intBlue = 255 - intColor;
            //        }
            //        else
            //        {
            //            cpl.CptLt[i].intRed = 255;
            //        }
            //    }
            //    else if (cpl.CptLt[i].dblAngleV < 0)
            //    {
            //        if (intColor <= 255)
            //        {
            //            cpl.CptLt[i].intRed = 255 - intColor;
            //            cpl.CptLt[i].intGreen = 255 - intColor;
            //            cpl.CptLt[i].intBlue = 255;
            //        }
            //        else
            //        {
            //            cpl.CptLt[i].intBlue = 255;
            //        }
            //    }
            //}

            //for (int i = 1; i < cpl.CptLt.Count-1; i++)
            //{
            //    CPoint cpt=cpl.CptLt[i];
            //    CHelpFunc.ViewPolygonGeometryByRGB(m_mapControl, cpt.Buffer(5), cpt.intRed, cpt.intGreen, cpt.intBlue);  //显示缓冲区多边形
            //}

            ////显示线段
            //IActiveView pAv = pGra as IActiveView;
            //pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);



            // 清除绘画痕迹
            IMapControl4       m_mapControl = _DataRecords.ParameterInitialize.m_mapControl;
            IGraphicsContainer pGra         = m_mapControl.Map as IGraphicsContainer;

            pGra.DeleteAllElements();
            CDrawInActiveView.ViewPolyline(m_mapControl, cpl);  //显示生成的线段


            return(cpl);
        }