Ejemplo n.º 1
0
        public void DisplayAtBd(double dblProp)
        {
            CParameterInitialize pParameterInitialize = _ParameterInitialize;
            CParameterResult     pParameterResult     = _ParameterResult;

            if (dblProp < 0 || dblProp > 1)
            {
                MessageBox.Show("请输入正确参数!");
                return;
            }

            //double dblLargerScale = pParameterInitialize.dblLargerScale;
            //double dblSmallerScale = pParameterInitialize.dblSmallerScale;
            //double dblTargetScale = Math.Pow(dblLargerScale, 1 - dblProp) * Math.Pow(dblSmallerScale, dblProp);
            //double dblIgnorableDis = 0.0001 * dblTargetScale / 111319.490793;
            //double dblIgnorableDis = 0.0001 * dblTargetScale / 100000000000;
            //


            var pStopwatch         = Stopwatch.StartNew();
            var normaldisplayCplLt = GenerateInterpolatedCplLt(dblProp);
            var fadeddisplayCplLt  = GenerateInterpolatedCplLt(dblProp, _SgCorrCptsLtLt);

            pStopwatch.Stop();

            var pStopwatchSave = Stopwatch.StartNew();

            CSaveFeature.SaveCplEb(fadeddisplayCplLt, dblProp.ToString() + "_Lower");
            CSaveFeature.SaveCplEb(normaldisplayCplLt, dblProp.ToString() + "_Higher");
            pStopwatchSave.Stop();

            CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds, "Generate", pStopwatchSave.ElapsedMilliseconds, "ToShape");
        }
Ejemplo n.º 2
0
        public void HWPGRNGeneralization()
        {
            //List<CPolyline> CPlLt = _CPlLt;
            //CParameterInitialize pParameterInitialize = _ParameterInitialize;

            //CParameterThreshold pParameterThreshold = new CParameterThreshold();
            //pParameterThreshold.dblVerySmall = CGeoFunc.CalVerySmall(CPlLt);



            //List<CRiverNet> CRiverNetLt = BuildRiverNetLt(CPlLt, pParameterThreshold);     //依据线数据建立河网
            //CalWeightiness(CRiverNetLt, pParameterInitialize);                              //计算河流的重要性


            ////将河网中的河流数据结果提取出来,以河流列的形式存储
            //List<CRiver> CResultRiverLt = new List<CRiver>();
            //for (int i = 0; i < CRiverNetLt.Count; i++)
            //{
            //    CResultRiverLt.AddRange(CRiverNetLt[i].CRiverLt);
            //}
            //CHelpFunc.CalWeightinessUnitary(CResultRiverLt);



            //获取结果,全部记录在_ParameterResult中
            CParameterResult ParameterResult = new CParameterResult();

            //ParameterResult.CResultRiverLt = CResultRiverLt;
            _ParameterResult = ParameterResult;
        }
Ejemplo n.º 3
0
        private void btnRunData_Click(object sender, EventArgs e)
        {
            CParameterResult pParameterResult = _DataRecords.ParameterResult;
            List <CCorrCpts> pCorrCptsLt      = pParameterResult.CCorrCptsLt;
            double           dblSimilarity    = CalSimilarity(pCorrCptsLt, pParameterResult.FromCpl, pParameterResult.ToCpl);

            MessageBox.Show(dblSimilarity.ToString());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// DPSimplify
        /// </summary>
        /// <remarks>one of the three parameters should be a real parameter, and the others are -1</remarks>
        public void DPSimplifyAlreadyDivided(double dblThresholdDis = -1, double dblRemainPointsRatio = -1, double dblRemainPoints = -1, double dblDeleteNum = -1)
        {
            var newcpllt = DPSimplifyWithoutDividing(_CPlLt, dblThresholdDis, dblRemainPointsRatio, dblRemainPoints, dblDeleteNum);

            CParameterResult ParameterResult = new CParameterResult();

            ParameterResult.CResultPlLt = newcpllt;
            _ParameterResult            = ParameterResult;
        }
Ejemplo n.º 5
0
        /// <summary>Calculate Evaluation values for a List<List<CCorrCpts>> which has been recorded in ParameterResult</summary>
        /// <remarks></remarks>
        protected double CalEvaluationCorr()
        {
            CParameterResult ParameterResult = _pDataRecords.ParameterResult;
            double           dblSUM          = CalEvaluationCorr(ParameterResult.pMorphingBase, _dblEvaluationLtLt, _dblSumEvaluationLtLt);

            ParameterResult.pEvaluation = this;

            return(dblSUM);
        }
Ejemplo n.º 6
0
        /// <summary>Calculate translation values for a List<List<CCorrCpts>> which has been recorded in ParameterResult</summary>
        /// <remarks></remarks>
        public double CalTranslationCorr()
        {
            CParameterResult         ParameterResult       = _pDataRecords.ParameterResult;
            List <List <CCorrCpts> > CorrCptsLtLt          = ParameterResult.pMorphingBase.CorrCptsLtLt;
            List <List <double> >    dblTranslationLtLt    = new List <List <double> >(CorrCptsLtLt.Count);
            List <List <double> >    dblSumTranslationLtLt = new List <List <double> >(CorrCptsLtLt.Count);
            double dblSUM = CalTranslationCorr(CorrCptsLtLt, dblTranslationLtLt, dblSumTranslationLtLt);

            ParameterResult.strEvaluationMethod   = "Translation";
            ParameterResult.dblTranslationLtLt    = dblTranslationLtLt;
            ParameterResult.dblSumTranslationLtLt = dblSumTranslationLtLt;

            return(dblSUM);
        }
Ejemplo n.º 7
0
        public void btnRun_Click(object sender, EventArgs e)
        {
            CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize;
            SaveFileDialog       SFD = new SaveFileDialog();

            SFD.ShowDialog();
            if (SFD.FileName == null || SFD.FileName == "")
            {
                return;
            }
            ParameterInitialize.strSavePath = SFD.FileName;
            ParameterInitialize.pWorkspace  = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath);
            //SFD.FileName .
            long lngStartTime = System.Environment.TickCount;

            //Read Datasets
            try
            {
                _pMRL = new CMRL(ParameterInitialize);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }


            _pMRL.MRLMorphing();
            //try
            //{
            //    _pMRL.CreateCDT();
            //    _pMRL.MRLMorphing();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //    return;
            //}
            long lngEndTime = System.Environment.TickCount;
            long lngTime    = lngEndTime - lngStartTime;

            ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngTime) + "ms";  //显示运行时间

            CParameterResult ParameterResult = _pMRL.ParameterResult;

            ParameterResult.lngTime      = lngTime;
            _DataRecords.ParameterResult = ParameterResult;
            //CHelpFuncExcel.KillExcel();
        }
Ejemplo n.º 8
0
        public CParameterResult LIMorphing()
        {
            List <CPolyline> pLSCPlLt = _LSCPlLt;
            List <CPolyline> pSSCPlLt = _SSCPlLt;

            long lngStartTime1 = System.Environment.TickCount;  //lngTime1

            pLSCPlLt.ForEach(cpl => cpl.SetEdgeLengthOnToCpt());
            pSSCPlLt.ForEach(cpl => cpl.SetEdgeLengthOnToCpt());
            long lngTime1 = System.Environment.TickCount - lngStartTime1;  //lngTime1

            double dblX = pSSCPlLt[0].FrCpt.X - pLSCPlLt[0].FrCpt.X;
            double dblY = pSSCPlLt[0].FrCpt.Y - pLSCPlLt[0].FrCpt.Y;
            CPoint StandardVectorCpt = new CPoint(0, dblX, dblY);

            _StandardVectorCpt = StandardVectorCpt;
            double dblStandardLength = CGeoFunc.CalDis(0, 0, dblX, dblY);

            List <List <CCorrCpts> > pCorrCptsLtLt = new List <List <CCorrCpts> >(pLSCPlLt.Count);

            long lngStartTime2 = System.Environment.TickCount;            //lngTime2

            pCorrCptsLtLt = new List <List <CCorrCpts> >(pLSCPlLt.Count); //initialize
            //pCtrlCptLtLt = new List<List<CCorrCpts>>(pLSCPlLt.Count);    //initialize

            for (int i = 0; i < LSCPlLt.Count; i++)
            {
                CLIA pCLIA = new CLIA(LSCPlLt[i], SSCPlLt[i]);
                pCorrCptsLtLt.Add(pCLIA.CLI().ToList());
            }

            long lngTime2 = System.Environment.TickCount - lngStartTime2;                              //lngTime2

            _ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngTime2) + "ms"; //显示运行时间

            CHelpFunc.SaveCorrLine(pCorrCptsLtLt, "Linear", _ParameterInitialize.pWorkspace, _ParameterInitialize.m_mapControl);

            _CorrCptsLtLt = pCorrCptsLtLt;

            //the results will be recorded in _ParameterResult
            CParameterResult ParameterResult = new CParameterResult();

            ParameterResult.pMorphingBase = this as CMorphingBase;
            _ParameterResult = ParameterResult;
            return(ParameterResult);
        }
Ejemplo n.º 9
0
        public override void btnInputResults_Click(object sender, EventArgs e)
        {
            //获取当前选择的点要素图层
            //大比例尺要素图层
            CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize;
            IFeatureLayer        pFLayer             = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(ParameterInitialize.cboLayer.SelectedIndex);

            ParameterInitialize.pFeatureLayer = pFLayer;
            List <CPolyline> cpllt = CHelpFunc.GetCPlLtByFeatureLayer(pFLayer);

            CParameterResult pParameterResult = new CParameterResult();

            pParameterResult.CResultPlLt = cpllt;
            pParameterResult.FromCpl     = cpllt[0];
            pParameterResult.ToCpl       = cpllt[cpllt.Count - 1];

            _DataRecords.ParameterResult = pParameterResult;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// DPSimplify
        /// </summary>
        /// <remarks>one of the three parameters should be a real parameter, and the others are -1</remarks>
        public void DPSimplify(double dblThresholdDis, double dblRemainPointsRatio, double dblRemainPoints, double dblDeleteNum)
        {
            int intRemainPoints    = Convert.ToInt16(dblRemainPoints);
            List <CPolyline> cpllt = _CPlLt;

            //CGeoFunc.CalDistanceParameters<CPolyline, CPolyline>(cpllt);


            _pStopwatch.Start();
            //get threshold
            double dblTDis = CalThresholdDis(dblThresholdDis, dblRemainPointsRatio, dblRemainPoints, dblDeleteNum);

            List <CPolyline> newcpllt = new List <CPolyline>(cpllt.Count);  // the capacity is not so good

            for (int i = 0; i < cpllt.Count; i++)
            {
                Console.WriteLine("polyline number: " + i);
                List <CPoint> cptlt    = cpllt[i].CptLt;
                var           firstcpt = cptlt.First();
                var           last_cpt = cptlt.Last();

                List <CPoint> newcptlt = new List <CPoint>(cptlt.Count); // the capacity is not so good
                newcptlt.Add(firstcpt);                                  //first point
                //middle point
                if (firstcpt.Compare(last_cpt) != 0)                     //Polyline
                {
                    GetNewCptLt(cpllt[i], cpllt[i].pVirtualPolyline, ref newcptlt, dblTDis);
                }
                else  //Polygon
                {
                    RecursivelyGetNewCptLtPG(cpllt[i], cpllt[i].pVirtualPolyline, ref newcptlt, dblTDis, 2);
                }
                newcptlt.Add(last_cpt);  //last point
                CPolyline newcpl = new CPolyline(i, newcptlt);
                newcpllt.Add(newcpl);
            }
            _pStopwatch.Stop();
            _ParameterInitialize.tsslTime.Text = _pStopwatch.ElapsedMilliseconds.ToString();

            CParameterResult ParameterResult = new CParameterResult();

            ParameterResult.CResultPlLt = newcpllt;
            _ParameterResult            = ParameterResult;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// LI方法获取对应点,此函数为LI方法的入口函数(仅对一对对应线段处理的时候从此处调用,因为该函数顾及了线段的第一个顶点)
        /// </summary>
        /// <param name="CFrPolyline">大比例尺线段,可以只有一个顶点</param>
        /// <param name="CToPolyline">小比例尺线段,可以只有一个顶点</param>
        /// <param name="ResultPtLt">结果数组</param>
        /// <remarks></remarks>
        public CParameterResult CLIMulti()
        {
            List <CPolyline> LSCPlLt = _LSCPlLt;
            List <CPolyline> SSCPlLt = _SSCPlLt;

            //List<CLIA> pCLIALt = new List<CLIA>(LSCPlLt.Count);
            List <List <CCorrCpts> > pCorrCptsLtLt = new List <List <CCorrCpts> >(LSCPlLt.Count);

            for (int i = 0; i < LSCPlLt.Count; i++)
            {
                CLIA pCLIA = new CLIA(LSCPlLt[i], SSCPlLt[i]);
                pCorrCptsLtLt.Add(pCLIA.CLI().ToList());
            }
            _CorrCptsLtLt = CorrCptsLtLt;

            //the results will be recorded in _ParameterResult
            CParameterResult ParameterResult = new CParameterResult();

            ParameterResult.pMorphingBaseCpl = this as CMorphingBaseCpl;
            _ParameterResult = ParameterResult;
            return(ParameterResult);
        }
        public void btnRun_Click(object sender, EventArgs e)
        {
            CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize;
            SaveFileDialog       SFD = new SaveFileDialog();

            SFD.ShowDialog();
            ParameterInitialize.strSavePath = SFD.FileName;
            ParameterInitialize.pWorkspace  = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath);

            CMPBDP pMPBDP       = new CMPBDP(ParameterInitialize);
            long   lngStartTime = System.Environment.TickCount;

            pMPBDP.MPBDPMorphing();
            long lngEndTime = System.Environment.TickCount;
            long lngTime    = lngEndTime - lngStartTime;

            ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngTime) + "ms";  //显示运行时间

            CParameterResult ParameterResult = pMPBDP.ParameterResult;

            ParameterResult.lngTime      = lngTime;
            _DataRecords.ParameterResult = ParameterResult;
        }
        public override void btnRun_Click(object sender, EventArgs e)
        {
            CParameterResult pParameterResult = _DataRecords.ParameterResult;
            CLandingTime     pLandingTime     = new CLandingTime(_DataRecords);

            pLandingTime.GetLandingTimeCPlLt();


            for (int i = 0; i < pParameterResult.CInitialPlLt.Count; i++)
            {
                if (pParameterResult.CInitialPlLt[i].ID == 2026)
                {
                    double dblTX = pParameterResult.CInitialPlLt[i].pPolyline.Length / pParameterResult.CInitialPlLt[i].CptLt.Count / 100000;   //计算阈值参数
                    pParameterResult.FromCpl     = pParameterResult.CInitialPlLt[i];
                    pParameterResult.ToCpl       = pParameterResult.CResultPlLt[i];
                    pParameterResult.CCorrCptsLt = pLandingTime.GetCorrCptsLt(pParameterResult.CInitialPlLt[i], pParameterResult.CResultPlLt[i]);
                    _pCAL = new CPAL(_DataRecords, dblTX);
                    break;
                }
            }

            //_dblTX = FromCpl.pPolyline.Length / FromCpl.CptLt .Count  / 1000000;   //计算阈值参数



            CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize;
            SaveFileDialog       SFD = new SaveFileDialog();

            SFD.ShowDialog();
            if (SFD.FileName == null || SFD.FileName == "")
            {
                return;
            }
            ParameterInitialize.strSavePath = SFD.FileName;
            ParameterInitialize.pWorkspace  = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath);
        }
        //public void SubPolylineMatchLA(CPolyline CFrPolyline, CVirtualPolyline CFrVtPl, CPolyline CToPolyline, CVirtualPolyline CToVtPl, CParameterThreshold ParameterThreshold, ref C5.LinkedList<CCorrSegment> CorrespondSegmentLk)
        //{
        //    List<CPoint> frcptlt = CFrPolyline.CptLt;
        //    List<CPoint> tocptlt = CToPolyline.CptLt;

        //    //如果其中一个线段没有孩子,则直接匹配并结束
        //    if (CFrVtPl.CLeftPolyline == null || CToVtPl.CLeftPolyline == null)
        //    {
        //        List<CPoint> frsubcptlt = new List<CPoint>();
        //        for (int i = CFrVtPl.intFrID; i <= CFrVtPl.intToID; i++)
        //        {
        //            frsubcptlt.Add(frcptlt[i]);
        //        }
        //        CPolyline frsubcpl = new CPolyline(CFrVtPl.intFrID, frsubcptlt);

        //        List<CPoint> tosubcptlt = new List<CPoint>();
        //        for (int i = CToVtPl.intFrID; i <= CToVtPl.intToID; i++)
        //        {
        //            tosubcptlt.Add(tocptlt[i]);
        //        }
        //        CPolyline tosubcpl = new CPolyline(CFrVtPl.intFrID, tosubcptlt);

        //        CCorrSegment CorrespondSegment = new CCorrSegment(frsubcpl, tosubcpl);
        //        CorrespondSegmentLk.Add(CorrespondSegment);
        //        return;
        //    }

        //    double dblRatioLL = frcptlt[CFrVtPl.CLeftPolyline.intFrID].DistanceTo(frcptlt[CFrVtPl.CLeftPolyline.intToID]) / tocptlt[CToVtPl.CLeftPolyline.intFrID].DistanceTo(tocptlt[CToVtPl.CLeftPolyline.intToID]);
        //    double dblRatioRR = frcptlt[CFrVtPl.CRightPolyline.intFrID].DistanceTo(frcptlt[CFrVtPl.CRightPolyline.intToID]) / tocptlt[CToVtPl.CRightPolyline.intFrID].DistanceTo(tocptlt[CToVtPl.CRightPolyline.intToID]);

        //    double dblFrDiffLLX = frcptlt[CFrVtPl.CLeftPolyline.intToID].X - frcptlt[CFrVtPl.CLeftPolyline.intFrID].X;
        //    double dblFrDiffLLY = frcptlt[CFrVtPl.CLeftPolyline.intToID].Y - frcptlt[CFrVtPl.CLeftPolyline.intFrID].Y;
        //    double dblToDiffLLX = tocptlt[CToVtPl.CLeftPolyline.intToID].X - tocptlt[CToVtPl.CLeftPolyline.intFrID].X;
        //    double dblToDiffLLY = tocptlt[CToVtPl.CLeftPolyline.intToID].Y - tocptlt[CToVtPl.CLeftPolyline.intFrID].Y;
        //    double dblAngleDiffLL = CGeoFunc.CalAngle_Counterclockwise(dblFrDiffLLX, dblFrDiffLLY, dblToDiffLLX, dblToDiffLLY);

        //    double dblFrDiffRRX = frcptlt[CFrVtPl.CRightPolyline.intToID].X - frcptlt[CFrVtPl.CRightPolyline.intFrID].X;
        //    double dblFrDiffRRY = frcptlt[CFrVtPl.CRightPolyline.intToID].Y - frcptlt[CFrVtPl.CRightPolyline.intFrID].Y;
        //    double dblToDiffRRX = tocptlt[CToVtPl.CRightPolyline.intToID].X - tocptlt[CToVtPl.CRightPolyline.intFrID].X;
        //    double dblToDiffRRY = tocptlt[CToVtPl.CRightPolyline.intToID].Y - tocptlt[CToVtPl.CRightPolyline.intFrID].Y;
        //    double dblAngleDiffRR = CGeoFunc.CalAngle_Counterclockwise(dblFrDiffRRX, dblFrDiffRRY, dblToDiffRRX, dblToDiffRRY);

        //    if ((dblRatioLL >= ParameterThreshold.dblDLengthBound) && (dblRatioLL <= ParameterThreshold.dblULengthBound) &&
        //        (dblRatioRR >= ParameterThreshold.dblDLengthBound) && (dblRatioRR <= ParameterThreshold.dblULengthBound) &&
        //        (Math.Abs(dblAngleDiffLL) <= ParameterThreshold.dblAngleBound) && (dblAngleDiffRR <= ParameterThreshold.dblAngleBound))
        //    {
        //        //相应线段长度相近
        //        SubPolylineMatchLA(CFrPolyline, CFrVtPl.CLeftPolyline, CToPolyline, CToVtPl.CLeftPolyline, ParameterThreshold, ref CorrespondSegmentLk);
        //        SubPolylineMatchLA(CFrPolyline, CFrVtPl.CRightPolyline, CToPolyline, CToVtPl.CRightPolyline, ParameterThreshold, ref CorrespondSegmentLk);
        //    }
        //    else
        //    {
        //        List<CPoint> frsubcptlt = new List<CPoint>();
        //        for (int i = CFrVtPl.intFrID; i <= CFrVtPl.intToID; i++)
        //        {
        //            frsubcptlt.Add(frcptlt[i]);
        //        }
        //        CPolyline frsubcpl = new CPolyline(CFrVtPl.intFrID, frsubcptlt);

        //        List<CPoint> tosubcptlt = new List<CPoint>();
        //        for (int i = CToVtPl.intFrID; i <= CToVtPl.intToID; i++)
        //        {
        //            tosubcptlt.Add(tocptlt[i]);
        //        }
        //        CPolyline tosubcpl = new CPolyline(CFrVtPl.intFrID, tosubcptlt);


        //        CCorrSegment CorrespondSegment = new CCorrSegment(frsubcpl, tosubcpl);
        //        CorrespondSegmentLk.Add(CorrespondSegment);
        //        return;
        //    }
        //}

        #region Display
        public void DisplayAtBd(double dblProp)
        {
            CParameterInitialize pParameterInitialize = _ParameterInitialize;
            CParameterResult     pParameterResult     = _ParameterResult;

            if (dblProp < 0 || dblProp > 1)
            {
                MessageBox.Show("请输入正确参数!");
                return;
            }

            double dblLargerScale  = pParameterInitialize.dblLargerScale;
            double dblSmallerScale = pParameterInitialize.dblSmallerScale;
            double dblTargetScale  = Math.Pow(dblLargerScale, 1 - dblProp) * Math.Pow(dblSmallerScale, dblProp);
            double dblIgnorableDis = 0.0001 * dblTargetScale / 111319.490793;
            //double dblIgnorableDis = 0.0001 * dblTargetScale / 100000000000;
            //
            long             lngTime3           = System.Environment.TickCount;
            List <CPolyline> normaldisplaycpllt = new List <CPolyline>(pParameterResult.CBSAtBdLt.Count);

            for (int i = 0; i < pParameterResult.CBSAtBdLt.Count; i++)
            {
                CPolyline cpl = CGeoFunc.GetTargetcpl(i, pParameterResult.CBSAtBdLt[i].CResultPtLt, dblProp);
                normaldisplaycpllt.Add(cpl);
            }
            pParameterResult.DisplayCPlLt = normaldisplaycpllt;
            long lngInterpolateTime = System.Environment.TickCount - lngTime3;

            //the polylines should be faded out
            List <CPolyline> fadeddisplaycpllt = new List <CPolyline>(pParameterResult.CSgAtBdLt.Count);

            for (int i = 0; i < pParameterResult.CSgAtBdLt.Count; i++)
            {
                CAtBd pAtBd = pParameterResult.CSgAtBdLt[i];
                //List<CPoint> newcptlt = _pDPSimplify.DPCplMorph(pAtBd as CPolyline, dblProp).CptLt;
                List <CPoint> newcptlt = new List <CPoint>();

                //the first point
                if (pAtBd.Frcpt2 == null)
                {
                    newcptlt[0] = pAtBd.CptLt[0];
                }
                else
                {
                    newcptlt[0] = CGeoFunc.GetInbetweenCpt(pAtBd.Frcpt2, pAtBd.Frcpt2.CorrespondingPtLt[0], dblProp, 0);
                    int dblBSCplID = pAtBd.Frcpt2.BelongedCpl.ID;
                    DWIntersect(normaldisplaycpllt[dblBSCplID], ref newcptlt, dblIgnorableDis);
                }

                //the last point
                if (pAtBd.Tocpt2 == null)
                {
                    newcptlt[newcptlt.Count - 1] = pAtBd.CptLt[pAtBd.CptLt.Count - 1];
                }
                else
                {
                    CPoint cptlast = CGeoFunc.GetInbetweenCpt(pAtBd.Tocpt2, pAtBd.Tocpt2.CorrespondingPtLt[0], dblProp, pAtBd.CptLt.Count - 1);
                    newcptlt[newcptlt.Count - 1] = cptlast;
                    CHelpFunc.ReverseCptLt(ref newcptlt);
                    int dblBSCplID = pAtBd.Tocpt2.BelongedCpl.ID;
                    DWIntersect(normaldisplaycpllt[dblBSCplID], ref newcptlt, dblIgnorableDis);
                    CHelpFunc.ReverseCptLt(ref newcptlt);
                }

                CPolyline newcpl = new CPolyline(i, newcptlt);
                fadeddisplaycpllt.Add(newcpl);
            }
            pParameterResult.FadedDisplayCPlLt = fadeddisplaycpllt;

            //// 清除绘画痕迹
            //IMapControl4 m_mapControl = _ParameterInitialize.m_mapControl;
            //IGraphicsContainer pGra = m_mapControl.Map as IGraphicsContainer;
            //pGra.DeleteAllElements();
            for (int i = 0; i < normaldisplaycpllt.Count; i++)
            {
                normaldisplaycpllt[i].SetPolyline();
            }
            for (int i = 0; i < fadeddisplaycpllt.Count; i++)
            {
                fadeddisplaycpllt[i].SetPolyline();
            }

            ////check
            //List<CPolyline> TopCheckCpllt = new List<CPolyline>(normaldisplaycpllt.Count + fadeddisplaycpllt.Count);
            //TopCheckCpllt.AddRange(normaldisplaycpllt);
            //TopCheckCpllt.AddRange(fadeddisplaycpllt);
            //SCG.LinkedList<CCorrSegment> pCorrCplLk;
            //SCG.LinkedList<CPolyline> pSelfIntersectCplLk;
            //bool isCross = CGeoFunc.CheckCross(TopCheckCpllt, out pCorrCplLk);
            //bool isSelfIntersect = CGeoFunc.CheckSelfIntersect(TopCheckCpllt, out pSelfIntersectCplLk);

            //CHelpFunc.SaveCPlLt(normaldisplaycpllt, "City" + pParameterInitialize.strSaveFolder + "_" + dblProp.ToString(), pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl);
            //int intColor = Convert.ToInt16(dblProp * 255);
            //CHelpFunc.SaveCPlLt(fadeddisplaycpllt, CEnumScale.Single + pParameterInitialize.strSaveFolder + "_" + dblProp.ToString(), pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl, intColor, intColor, intColor, 1);

            //CEnvelope pEnvelopeIpe = new CEnvelope(0, 0, 600, 600);
            //CHelpFunc.SaveToIpe(normaldisplaycpllt,  "Ipe" + "_" + dblProp.ToString(), pParameterInitialize.pBSFLayer.AreaOfInterest, pEnvelopeIpe, pParameterInitialize, 0, 0, 0, "normal", true);
            //CHelpFunc.SaveToIpe(fadeddisplaycpllt, "Ipe" + "_" + dblProp.ToString(), pParameterInitialize.pBSFLayer.AreaOfInterest, pEnvelopeIpe, pParameterInitialize, intColor, intColor, intColor, "normal", true);



            //for (int i = 0; i < normaldisplaycpllt.Count; i++)
            //{
            //    CHelpFunc.ViewPolylineByRGB(m_mapControl, normaldisplaycpllt[i], 0, 0, 0, 1);
            //}

            //
            //for (int i = 0; i < fadeddisplaycpllt.Count; i++)
            //{
            //    CHelpFunc.ViewPolylineByRGB(m_mapControl, fadeddisplaycpllt[i], intColor, intColor, intColor, 1);
            //}
            //m_mapControl.ActiveView.Refresh();   //由于在下一步“ViewPolyline”中有刷新的命令,此语句可省略
        }
Ejemplo n.º 15
0
        /// <summary>多个结果的Morphing方法</summary>
        /// <remarks>对于指定的回溯参数K,不断计算增大的结果,直到Translation值稳定</remarks>
        public CParameterResult OptCorMorphing()
        {
            var pParameterInitialize = _ParameterInitialize;

            var pFrCptLtLt      = this.FrCptLtLt;
            var pToCptLtLt      = this.ToCptLtLt;
            var pObjValueLtLtLt = this.ObjValueLtLtLt;

            //var intFieldIndex = pParameterInitialize.pFLayerLt[0].FeatureClass.FindField(pParameterInitialize.txtAttributeOfKnown.Text);
            //try to add an attribute, if this attribute is already existed, then do nothing, otherwise, add this attribute and set value to -1
            //if (intFieldIndex == -1)
            //{
            //    intFieldIndex = CSaveFeature.AddField(pParameterInitialize.pFLayerLt[0].FeatureClass,
            //      esriFieldType.esriFieldTypeDouble, pParameterInitialize.txtAttributeOfKnown.Text);
            //    //CSaveFeature.SetFieldValue(pParameterInitialize.pFLayerLt[0].FeatureClass, intFieldIndex, -1);

            //    this.strFieldNameLtLt[0].Add(pParameterInitialize.txtAttributeOfKnown.Text);
            //    this.esriFieldTypeLtLt[0].Add(esriFieldType.esriFieldTypeDouble);

            //    for (int i = 0; i < pFrCptLtLt.Count; i++)
            //    {
            //        pObjValueLtLtLt[0][i].Add(0);
            //    }
            //}


            int intMaxBackKforI = Convert.ToInt32(pParameterInitialize.txtMaxBackK.Text);
            int intMaxBackKforJ = SetintMaxBackKforJ(pParameterInitialize.cboIntMaxBackKforJ.SelectedIndex, intMaxBackKforI);
            int intMulti        = Convert.ToInt32(pParameterInitialize.txtMulti.Text);
            int intIncrease     = Convert.ToInt32(pParameterInitialize.txtIncrease.Text);

            CConstants.strMethod = pParameterInitialize.cboMorphingMethod.Text;

            //delegation of morphing method
            DlgCreateTable dlgCreateTable = SetDlgCreateTable(pParameterInitialize.cboMorphingMethod.Text);

            _pEvaluation = new CEvaluation(pParameterInitialize.cboEvaluationMethod.SelectedIndex);
            var StandardVectorCpt = SetStandardVectorCpt(pParameterInitialize.cboStandardVector.SelectedIndex,
                                                         pFrCptLtLt[0].First(), pToCptLtLt[0].First());

            long lngStartTime1 = System.Environment.TickCount;  //lngTime1

            Stopwatch pStopwatch1 = Stopwatch.StartNew();

            foreach (var cptlt in pFrCptLtLt)
            {
                CGeoFunc.SetEdgeLengthOnToCpt(cptlt);
            }
            foreach (var cptlt in pToCptLtLt)
            {
                CGeoFunc.SetEdgeLengthOnToCpt(cptlt);
            }
            CGeoFunc.IntegrateStandardVectorCpt(pFrCptLtLt, StandardVectorCpt);

            //generate cptltltlt
            var frcptltltlt = new List <List <List <CPoint> > >(pFrCptLtLt.Count);
            var tocptltltlt = new List <List <List <CPoint> > >(pToCptLtLt.Count);

            SetCptLtLtLt(pParameterInitialize.chkCoincidentPoints.Checked, pFrCptLtLt, pToCptLtLt, ref frcptltltlt, ref tocptltltlt);
            pStopwatch1.Stop();


            long lngTimeSetLength = System.Environment.TickCount - lngStartTime1;  //lngTime1

            var dblDistanceLt = new List <double>(intMulti);
            var dblTimeLt     = new List <double>(intMulti);

            var pCorrCptsLtLt = new List <List <CCorrCpts> >(pFrCptLtLt.Count);  //we only record the last one, when i = intMulti -1
            var pCtrlCptsLtLt = new List <List <CCorrCpts> >(pToCptLtLt.Count);  //we only record the last one, when i = intMulti -1


            for (int i = 0; i < intMulti; i++)
            {
                //Stopwatch pStopwatch2 = Stopwatch.StartNew();
                double dblTotalDistance   = 0;
                long   lngTotalOptCorTime = 0;

                IFeatureCursor pFeatureCursor = pParameterInitialize.pFLayerLt[0].FeatureClass.Search(null, false);
                for (int j = 0; j < pFrCptLtLt.Count; j++)   //for every polyline
                //for (int j = 0; j < 100; j++)
                {
                    Stopwatch pStopwatch2 = Stopwatch.StartNew();
                    double    dblDistance = 0;
                    //double dblComputedDis = Convert.ToDouble(pObjValueLtLtLt[0][j][intFieldIndex]);
                    double dblComputedDis = 0;
                    if (dblComputedDis > 0 && intMaxBackKforI >= (pFrCptLtLt[j].Count - 1) && intMaxBackKforJ >= (pToCptLtLt[j].Count - 1))
                    {
                        dblDistance = dblComputedDis;
                    }
                    else
                    {
                        var frcptltlt = frcptltltlt[j];   //cptltlt are all the points of a polyline
                        var tocptltlt = tocptltltlt[j];

                        var TableLt = new List <CTable>(frcptltlt.Count);

                        Console.WriteLine("intMulti= " + i + ",  Line ID:" + j);

                        for (int k = 0; k < frcptltlt.Count; k++)
                        {
                            //Console.WriteLine("intMulti= " + i + ",  Line ID:" + j + ",  Segment ID:" + k);
                            var Table = dlgCreateTable(frcptltlt[k], tocptltlt[k], intMaxBackKforI, intMaxBackKforJ);
                            dblDistance += Table.dblCost;

                            //Console.WriteLine("cost:  " + dblDistance);
                            TableLt.Add(Table);
                        }
                        dblDistance /= _pEvaluation.dblCorrection;

                        pStopwatch2.Stop();
                        lngTotalOptCorTime += pStopwatch2.ElapsedMilliseconds;

                        CGeoFunc.RemoveStandardVectorCpt(pFrCptLtLt [j], StandardVectorCpt);
                        List <CCorrCpts> CtrlCptsLt;
                        var pCorrCptsLt = GetCorrespondences(TableLt, frcptltlt,
                                                             tocptltlt, pFrCptLtLt[j].Count, pToCptLtLt[j].Count, out CtrlCptsLt);
                        pCorrCptsLtLt.Add(pCorrCptsLt);
                        pCtrlCptsLtLt.Add(CtrlCptsLt);

                        //this will also set MoveVector for CtrlCptsLt
                        //CsfInter0.SaveIGeoEbToLayer(CHelpFunc.MakeEb(1, GenerateInterpolatedIPl(pCorrCptsLt, 0)));
                        //CsfInter1.SaveIGeoEbToLayer(CHelpFunc.MakeEb(1, GenerateInterpolatedIPl(pCorrCptsLt, 1)));
                        //CsfCtrlpl.SaveIGeoEbToLayer(GenerateCorrIPlEb(CtrlCptsLt));
                        //CsfCorrpl.SaveIGeoEbToLayer(GenerateCorrIPlEb(pCorrCptsLt));
                        CHelpFunc.SetMoveVectorForCorrCptsLt(pCorrCptsLt);

                        //if the look-back parameter is larger than the points number of a pair of polylines,
                        //than we don't need to try a larger look-back parameter
                        //Therefore, we record the distance for the two polylines
                        //if (intMaxBackKforI >= (pFrCptLtLt[j].Count - 1) && intMaxBackKforJ >= (pToCptLtLt[j].Count - 1))
                        //{
                        //    pObjValueLtLtLt[0][j][intFieldIndex] = dblDistance;
                        //    for (int l = intFeatureNum; l < pFrCptLtLt.Count; l++)  //find the feature and record it
                        //    {
                        //        IFeature pFeature = pFeatureCursor.NextFeature();
                        //        if (j == l)
                        //        {
                        //            pFeature.set_Value(intFieldIndex, dblDistance);
                        //            pFeature.Store();
                        //            intFeatureNum = j + 1;  //we record the index, so that next time we can start from this index
                        //            break;
                        //        }
                        //    }
                        //}
                        //pExcelSaver.WriteLine(CHelpFunc.MakeEb<object>(5, j,
                        //pLSCPlLt[j].CptLt.Count, pSSCPlLt[j].CptLt.Count, dblDistance, pStopwatch2.ElapsedMilliseconds));
                    }
                    dblTotalDistance += dblDistance;
                }

                dblTimeLt.Add(pStopwatch1.ElapsedMilliseconds + lngTotalOptCorTime);
                dblDistanceLt.Add(dblTotalDistance);
                //pExcelSaver.Close ();
                //CHelpFuncExcel.ExportDataltltToExcel(tablevalueltlt, intMaxBackKforI + "Tableltlt0", pParameterInitialize.strSavePath);
                //保存对应线
                CHelpFuncExcel.ExportDataltToExcel(dblTimeLt, intMaxBackKforI + "Timelt0", pParameterInitialize.strSavePath);
                CHelpFuncExcel.ExportDataltToExcel(dblDistanceLt, intMaxBackKforI + "Distancelt0", pParameterInitialize.strSavePath);

                CHelpFunc.Displaytspb(i + 1, intMulti);
                pParameterInitialize.txtEvaluation.Text = dblDistanceLt.Last().ToString();
                pParameterInitialize.tsslTime.Text      = "Running Time: " + dblTimeLt.Last().ToString();

                intMaxBackKforI = intMaxBackKforI + intIncrease;
                _CorrCptsLtLt   = pCorrCptsLtLt;
            }


            double dblStandardLength = CGeoFunc.CalDis(0, 0, StandardVectorCpt.X, StandardVectorCpt.Y);

            intMaxBackKforI--;
            CHelpFunc.SaveCtrlLine(pCtrlCptsLtLt, intMaxBackKforI + "_" + CConstants.strMethod + "CtrlLine",
                                   dblStandardLength, pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl);
            CHelpFunc.SaveCorrLine(pCorrCptsLtLt, intMaxBackKforI + "_" + CConstants.strMethod + "CorrLine",
                                   pParameterInitialize.pWorkspace, pParameterInitialize.m_mapControl);

            CHelpFunc.SetMoveVectorForCorrCptsLtLt(_CorrCptsLtLt);

            //the results will be recorded in _ParameterResult
            CParameterResult ParameterResult = new CParameterResult();

            ParameterResult.pMorphingBaseCpl = this as CMorphingBaseCpl;
            ParameterResult.pMorphingBase    = this as CMorphingBase;
            _ParameterResult = ParameterResult;
            return(ParameterResult);
        }
Ejemplo n.º 16
0
        /// <summary>计算Translation指标值,并保存输出</summary>
        /// <returns>Translation指标值</returns>
        /// <remarks></remarks>
        public double CalTranslation()
        {
            CParameterResult     ParameterResult     = _pDataRecords.ParameterResult;
            List <CPoint>        resultptlt          = ParameterResult.CResultPtLt;
            CParameterInitialize ParameterInitialize = _pDataRecords.ParameterInitialize;
            StatusStrip          ststMain            = ParameterInitialize.ststMain;
            ToolStripStatusLabel tsslTime            = ParameterInitialize.tsslTime;
            ToolStripStatusLabel tsslMessage         = ParameterInitialize.tsslMessage;
            ToolStripProgressBar tspbMain            = ParameterInitialize.tspbMain;

            tsslMessage.Text = "正在计算Translation...";
            ststMain.Refresh();
            long lngStartTime = System.Environment.TickCount;

            //生成计算Translation指标值的线段
            List <CPoint> CFrPtLtToExcel  = new List <CPoint>();
            List <CPoint> CToPtLtToExcel  = new List <CPoint>();
            List <CPoint> translationptlt = new List <CPoint>();
            int           intptnum        = 0;

            for (int i = 0; i < resultptlt.Count; i++)
            {
                for (int j = 0; j < resultptlt[i].CorrespondingPtLt.Count; j++)
                {
                    double dblX = resultptlt[i].CorrespondingPtLt[j].X - resultptlt[i].X;
                    double dblY = resultptlt[i].CorrespondingPtLt[j].Y - resultptlt[i].Y;
                    CPoint cpt  = new CPoint(intptnum, dblX, dblY);
                    translationptlt.Add(cpt);

                    CFrPtLtToExcel.Add(resultptlt[i]);
                    CToPtLtToExcel.Add(resultptlt[i].CorrespondingPtLt[j]);
                    intptnum = intptnum + 1;
                }
                tspbMain.Value = (i + 1) * 50 / (resultptlt.Count);
            }

            //添加第一个元素
            List <double> dblTranslationLt    = new List <double>();
            List <double> dblSumTranslationLt = new List <double>();

            dblTranslationLt.Add(0);
            dblSumTranslationLt.Add(0);
            double dblSumLenth = 0;

            for (int i = 1; i < translationptlt.Count; i++)
            {
                double dblLength = CGeoFunc.CalDis(translationptlt[i - 1], translationptlt[i]);
                dblTranslationLt.Add(dblLength);
                dblSumLenth = dblSumLenth + dblLength;
                dblSumTranslationLt.Add(dblSumLenth);

                tspbMain.Value = (i + 1) * 50 / (translationptlt.Count) + 50;
            }

            CParameterResult pParameterResultToExcel = new CParameterResult();

            pParameterResultToExcel.strEvaluationMethod = "Translation";
            pParameterResultToExcel.FromPtLt            = CFrPtLtToExcel;
            pParameterResultToExcel.ToPtLt              = CToPtLtToExcel;
            pParameterResultToExcel.TranlationPtLt      = translationptlt;
            pParameterResultToExcel.dblTranslationLt    = dblTranslationLt;
            pParameterResultToExcel.dblSumTranslationLt = dblSumTranslationLt;
            _pDataRecords.ParameterResultToExcel        = pParameterResultToExcel;

            long lngEndTime = System.Environment.TickCount;
            long lngTime    = lngEndTime - lngStartTime;

            tsslTime.Text    = "TranslationRunning Time: " + Convert.ToString(lngTime) + "ms"; //显示运行时间
            tsslMessage.Text = "Translation计算完成!";

            return(dblSumLenth);
        }
Ejemplo n.º 17
0
        /// <summary>计算Translation指标值,并保存输出</summary>
        /// <returns>Translation指标值</returns>
        /// <remarks>further weighted by the ratio</remarks>
        public double CalRatioTranslation()
        {
            //MessageBox.Show("wrong call in ctranslation!");

            CParameterResult     ParameterResult     = _pDataRecords.ParameterResult;
            List <CPoint>        resultptlt          = ParameterResult.CResultPtLt;
            CParameterInitialize ParameterInitialize = _pDataRecords.ParameterInitialize;
            StatusStrip          ststMain            = ParameterInitialize.ststMain;
            ToolStripStatusLabel tsslTime            = ParameterInitialize.tsslTime;
            ToolStripStatusLabel tsslMessage         = ParameterInitialize.tsslMessage;
            ToolStripProgressBar tspbMain            = ParameterInitialize.tspbMain;

            tsslMessage.Text = "正在计算Translation...";
            ststMain.Refresh();
            long lngStartTime = System.Environment.TickCount;

            //生成计算Translation指标值的线段
            List <CPoint> CFrPtLtToExcel  = new List <CPoint>();
            List <CPoint> CToPtLtToExcel  = new List <CPoint>();
            List <CPoint> translationptlt = new List <CPoint>();
            List <double> dblWeightlt     = new List <double>();  //记录相应的权重值(注意:由于程序的需要,再后面的计算中,有意使得dblWeightlt[0]==0)
            double        dblSumLength    = _pDataRecords.ParameterResult.FromCpl.pPolyline.Length + _pDataRecords.ParameterResult.ToCpl.pPolyline.Length;



            int    intptnum  = 0;
            CPoint frlastcpt = resultptlt[0];
            CPoint tolastcpt = resultptlt[0].CorrespondingPtLt[0];

            for (int i = 0; i < resultptlt.Count; i++)
            {
                for (int j = 0; j < resultptlt[i].CorrespondingPtLt.Count; j++)
                {
                    double dblX = resultptlt[i].CorrespondingPtLt[j].X - resultptlt[i].X;
                    double dblY = resultptlt[i].CorrespondingPtLt[j].Y - resultptlt[i].Y;
                    CPoint cpt  = new CPoint(intptnum, dblX, dblY);
                    translationptlt.Add(cpt);

                    double dblLengthi = CGeoFunc.CalDis(resultptlt[i], frlastcpt);                      //计算权重值长度
                    double dblLengthj = CGeoFunc.CalDis(resultptlt[i].CorrespondingPtLt[j], tolastcpt); //计算权重值长度
                    double dblWeight  = (dblLengthi + dblLengthj) / dblSumLength;
                    dblWeightlt.Add(dblWeight);
                    tolastcpt = resultptlt[i].CorrespondingPtLt[j];  //更新tolastcpt

                    CFrPtLtToExcel.Add(resultptlt[i]);
                    CToPtLtToExcel.Add(resultptlt[i].CorrespondingPtLt[j]);
                    intptnum = intptnum + 1;
                }
                frlastcpt      = resultptlt[i]; //更新frlastcpt
                tspbMain.Value = (i + 1) * 50 / (resultptlt.Count);
            }

            //添加第一个元素
            List <double> dblTranslationLt    = new List <double>();
            List <double> dblSumTranslationLt = new List <double>();

            dblTranslationLt.Add(0);
            dblSumTranslationLt.Add(0);
            double dblSumTranslation = 0;

            for (int i = 1; i < translationptlt.Count; i++)
            {
                double dblRatioLength = CGeoFunc.CalDis(translationptlt[i - 1], translationptlt[i]) * dblWeightlt[i];
                dblTranslationLt.Add(dblRatioLength);
                dblSumTranslation = dblSumTranslation + dblRatioLength;
                dblSumTranslationLt.Add(dblSumTranslation);

                tspbMain.Value = (i + 1) * 50 / (translationptlt.Count) + 50;
            }

            CParameterResult pParameterResultToExcel = new CParameterResult();

            pParameterResultToExcel.strEvaluationMethod = "Translation";
            pParameterResultToExcel.FromPtLt            = CFrPtLtToExcel;
            pParameterResultToExcel.ToPtLt              = CToPtLtToExcel;
            pParameterResultToExcel.TranlationPtLt      = translationptlt;
            pParameterResultToExcel.dblTranslationLt    = dblTranslationLt;
            pParameterResultToExcel.dblSumTranslationLt = dblSumTranslationLt;
            _pDataRecords.ParameterResultToExcel        = pParameterResultToExcel;

            long lngEndTime = System.Environment.TickCount;
            long lngTime    = lngEndTime - lngStartTime;

            tsslTime.Text    = "TranslationRunning Time: " + Convert.ToString(lngTime) + "ms"; //显示运行时间
            tsslMessage.Text = "Translation计算完成!";

            return(dblSumTranslation);
            //return 0;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 获取线状要素
        /// </summary>
        /// <param name="pDataRecords">数据记录</param>
        /// <param name="dblProp">插值参数</param>
        /// <returns>在处理面状要素时,本程序将原面状要素的边界切开,按线状要素处理,处理完后再重新生成面状要素</returns>
        public CPolyline GetTargetcpl(double dblProp)
        {
            CParameterResult pParameterResult = _DataRecords.ParameterResult;

            //获取周长
            double dblFrLength = pParameterResult.FromCpl.pPolyline.Length;
            double dblToLength = pParameterResult.ToCpl.pPolyline.Length;


            //确定循环阈值(初始多边形平均边长的千分之一)
            double dblTX = dblFrLength / pParameterResult.FromCpl.CptLt.Count / 1000;

            List <CCorrCpts> pCorrCptsLt = pParameterResult.CCorrCptsLt;   //读取数据后,此处ResultPtLt中的对应点为一一对应
            //pCorrCptsLt[2].FrCpt.isCtrl = false;
            //pCorrCptsLt[2].CorrespondingPtLt[0].FrCpt.isCtrl = false;

            //统计插值点数
            int intKnownNum   = 0;                            //须固定不参与平差的点的数目
            int intUnknownNum = 0;                            //须参与平差的点的数目

            List <int> intKnownLocationLt = new List <int>(); //记录已知点的序号

            //注意:对于该循环,有一个默认条件,即FromCpl的第一个顶点只有一个对应点
            for (int i = 0; i < pCorrCptsLt.Count; i++)
            {
                if (pCorrCptsLt[i].FrCpt.isCtrl == true)
                {
                    intKnownLocationLt.Add(i);
                    intKnownNum += 1;
                }
                else
                {
                    intUnknownNum += 1;
                }
            }
            int intSumNum    = intKnownNum + intUnknownNum;
            int intUnknownXY = intUnknownNum * 2; //每个点都有X、Y坐标
            int intSumXY     = intSumNum * 2;     //每个点都有X、Y坐标

            //找出长度固定的位置(如果一个线段的前后两个点都固定,则该长度固定)
            List <int> intKnownLengthLt = new List <int>();

            for (int i = 0; i < intKnownLocationLt.Count - 1; i++)
            {
                if ((intKnownLocationLt[i + 1] - intKnownLocationLt[i]) == 1)
                {
                    intKnownLengthLt.Add(intKnownLocationLt[i]);
                }
            }
            int intUnknownLength = pCorrCptsLt.Count - 1 - intKnownLengthLt.Count;

            //找出角度固定的位置(如果一个固定顶点的前后两个点都固定,则该角度固定)
            List <int> intKnownAngleLt = new List <int>();

            for (int i = 1; i < intKnownLocationLt.Count - 1; i++)
            {
                if ((intKnownLocationLt[i] - intKnownLocationLt[i - 1]) == 1 && (intKnownLocationLt[i + 1] - intKnownLocationLt[i]) == 1)
                {
                    intKnownAngleLt.Add(intKnownLocationLt[i]);
                }
            }
            int intUnknownAngle = pCorrCptsLt.Count - 2 - intKnownAngleLt.Count;

            int intUnknownXYLengthAngle = intUnknownXY + intUnknownLength + intUnknownAngle;

            //定义权重矩阵
            VBMatrix P = new VBMatrix(intUnknownXYLengthAngle, intUnknownXYLengthAngle);

            for (int i = 0; i < intUnknownXY; i++)
            {
                P[i, i] = 1;
            }
            for (int i = 0; i < intUnknownLength; i++)
            {
                P[intUnknownXY + i, intUnknownXY + i] = 10;
            }
            for (int i = 0; i < intUnknownAngle; i++)
            {
                P[intUnknownXY + intUnknownLength + i, intUnknownXY + intUnknownLength + i] = 100;
            }

            //计算初始值矩阵X0
            VBMatrix X0       = new VBMatrix(intSumXY, 1);
            int      intCount = 0;

            for (int i = 0; i < pCorrCptsLt.Count; i++)
            {
                X0[intCount, 0]     = (1 - dblProp) * pCorrCptsLt[i].FrCpt.X + dblProp * pCorrCptsLt[i].ToCpt.X;
                X0[intCount + 1, 0] = (1 - dblProp) * pCorrCptsLt[i].FrCpt.Y + dblProp * pCorrCptsLt[i].ToCpt.Y;
                intCount           += 2;
            }

            //计算长度初始值(全部计算)
            double[] adblLength0 = new double[intSumNum - 1];
            for (int i = 0; i < pCorrCptsLt.Count - 1; i++)
            {
                double dblfrsublength = Math.Pow((pCorrCptsLt[i + 1].ToCpt.X - pCorrCptsLt[i].ToCpt.X) * (pCorrCptsLt[i + 1].ToCpt.X - pCorrCptsLt[i].ToCpt.X)
                                                 + (pCorrCptsLt[i + 1].ToCpt.Y - pCorrCptsLt[i].ToCpt.Y) * (pCorrCptsLt[i + 1].ToCpt.Y - pCorrCptsLt[i].ToCpt.Y), 0.5);

                double dbltosublength = Math.Pow((pCorrCptsLt[i + 1].ToCpt.X - pCorrCptsLt[i].ToCpt.X) * (pCorrCptsLt[i + 1].ToCpt.X - pCorrCptsLt[i].ToCpt.X)
                                                 + (pCorrCptsLt[i + 1].ToCpt.Y - pCorrCptsLt[i].ToCpt.Y) * (pCorrCptsLt[i + 1].ToCpt.Y - pCorrCptsLt[i].ToCpt.Y), 0.5);
                adblLength0[i] = (1 - dblProp) * dblfrsublength + dblProp * dbltosublength;
            }

            //计算角度初始值(全部计算)
            double[] adblAngle0 = new double[intSumNum - 2];
            for (int i = 0; i < pCorrCptsLt.Count - 2; i++)
            {
                //较大比例尺线状要素上的夹角
                double dblfrAngle = CGeoFunc.CalAngle_Counterclockwise(pCorrCptsLt[i].FrCpt, pCorrCptsLt[i + 1].FrCpt, pCorrCptsLt[i + 2].FrCpt);
                //较小比例尺线状要素上的夹角
                double dbltoAngle = CGeoFunc.CalAngle_Counterclockwise(pCorrCptsLt[i].ToCpt, pCorrCptsLt[i + 1].ToCpt, pCorrCptsLt[i + 2].ToCpt);

                //角度初始值
                adblAngle0[i] = (1 - dblProp) * dblfrAngle + dblProp * dbltoAngle;
            }

            //Xmix里存储了XA和X0的最新混合值
            VBMatrix Xmix = new VBMatrix(intSumXY, 1);

            for (int i = 0; i < X0.Row; i++)
            {
                Xmix[i, 0] = X0[i, 0];
            }

            //定义坐标近似值矩阵XA
            VBMatrix XA            = new VBMatrix(intUnknownXY, 1);
            int      intKnownCount = 0;

            for (int i = 0; i < intUnknownNum; i++)
            {
                if ((i + intKnownCount) != intKnownLocationLt[intKnownCount])  //当前遍历位置“i + intKnownCount”是否在intKnownLocationLt的位置“intKnownCount”中记录
                {
                    XA[i * 2, 0]     = X0[(i + intKnownCount) * 2, 0];
                    XA[i * 2 + 1, 0] = X0[(i + intKnownCount) * 2 + 1, 0];
                }
                else
                {
                    intKnownCount += 1;
                    i             -= 1;
                }
            }

            //定义系数矩阵(有关长度和角度的值将在循环中给定)
            VBMatrix A = new VBMatrix(intUnknownXYLengthAngle, intUnknownXY);

            for (int i = 0; i < intUnknownXY; i++)
            {
                A[i, i] = 1;
            }

            double dblJudge          = 0; //该值用于判断是否应该跳出循环
            double dblOldJudege      = 0;
            int    intIterativeCount = 0;

            double[] dblSubDis = new double[intSumNum - 1];
            VBMatrix matl      = new VBMatrix(intUnknownXYLengthAngle, 1);

            do
            {
                matl = new VBMatrix(intUnknownXYLengthAngle, 1);
                int intSumCount1 = 0;
                for (int i = 0; i < intUnknownNum; i++)
                {
                    if (pCorrCptsLt[intSumCount1].FrCpt.isCtrl == false)
                    {
                        matl[2 * i, 0]     = XA[2 * i, 0] - X0[intSumCount1 * 2, 0];
                        matl[2 * i + 1, 0] = XA[2 * i + 1, 0] - X0[intSumCount1 * 2 + 1, 0];
                    }
                    else
                    {
                        i -= 1;
                    }
                    intSumCount1 += 1;
                }

                //计算系数矩阵A第"intUnknownXY"行到"intUnknownXY+intUnknownLength-1"行的各元素,即线段长度对各未知数求偏导的值
                //先计算各分母值(注意:分母实际上是求偏导后的一部分值,但却恰好等于两点之间距离,因此其计算公式与距离计算公式相同
                dblSubDis = new double[intSumNum - 1];
                for (int i = 0; i < intSumNum - 1; i++)
                {
                    dblSubDis[i] = Math.Pow((Xmix[2 * i, 0] - Xmix[2 * i + 2, 0]) * (Xmix[2 * i, 0] - Xmix[2 * i + 2, 0]) + (Xmix[2 * i + 1, 0] - Xmix[2 * i + 3, 0]) * (Xmix[2 * i + 1, 0] - Xmix[2 * i + 3, 0]), 0.5);
                }
                //开始计算系数矩阵第"intUnknownXY"行到"intUnknownXY+intUnknownLength-1"行的各元素
                int intKnownCount2   = 0;
                int intUnKnownCount2 = 0;
                for (int j = 0; j < intUnknownLength; j++)
                {
                    try
                    {
                        int intSumCount = intKnownCount2 + intUnKnownCount2;
                        if (pCorrCptsLt[intSumCount].FrCpt.isCtrl == false && pCorrCptsLt[intSumCount + 1].FrCpt.isCtrl == false)
                        {
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 0] = (Xmix[2 * intSumCount, 0] - Xmix[2 * intSumCount + 2, 0]) / dblSubDis[intSumCount];
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 1] = (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0]) / dblSubDis[intSumCount];
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 2] = -A[intUnknownXY + j, 2 * intUnKnownCount2];
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 3] = -A[intUnknownXY + j, 2 * intUnKnownCount2 + 1];

                            matl[intUnknownXY + j, 0] = dblSubDis[intSumCount] - adblLength0[intSumCount];   //图方便,顺便计算matl

                            intUnKnownCount2 += 1;
                        }
                        else if (pCorrCptsLt[intSumCount].FrCpt.isCtrl == false && pCorrCptsLt[intSumCount + 1].FrCpt.isCtrl == true)
                        {
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 0] = (Xmix[2 * intSumCount, 0] - Xmix[2 * intSumCount + 2, 0]) / dblSubDis[intSumCount];
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 1] = (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0]) / dblSubDis[intSumCount];

                            matl[intUnknownXY + j, 0] = dblSubDis[intSumCount] - adblLength0[intSumCount];   //图方便,顺便计算matl

                            intUnKnownCount2 += 1;
                        }
                        else if (pCorrCptsLt[intSumCount].FrCpt.isCtrl == true && pCorrCptsLt[intSumCount + 1].FrCpt.isCtrl == false)
                        {
                            //注意这种情况,由于"pCorrCptsLt[intSumCount].FrCpt.isCtrl == true"不占位子(即不占列),因此列序号依然为" 2 * intUnKnownCount2 + 0"和" 2 * intUnKnownCount2 + 1",而不是+2,+3
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 0] = -(Xmix[2 * intSumCount, 0] - Xmix[2 * intSumCount + 2, 0]) / dblSubDis[intSumCount];
                            A[intUnknownXY + j, 2 * intUnKnownCount2 + 1] = -(Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0]) / dblSubDis[intSumCount];

                            matl[intUnknownXY + j, 0] = dblSubDis[intSumCount] - adblLength0[intSumCount];   //图方便,顺便计算matl

                            intKnownCount2 += 1;
                        }
                        else
                        {
                            intKnownCount2 += 1;
                            j -= 1;
                        }
                    }
                    catch (Exception e)
                    {
                        throw;
                    }
                }

                //计算系数矩阵A第"intUnknownXY+intUnknownLength"行到"intUnknownXY+intUnknownLength+intUnknownAngle"行的各元素,即角度对各未知数求偏导的值
                int intKnownCount3     = 0;
                int intUnKnownCount3   = 0;
                int intUnKnownXYLength = intUnknownXY + intUnknownLength;
                for (int j = 0; j < intUnknownAngle; j++)
                {
                    //真是太幸运了,虽然求两向量逆时针夹角时需分多种情况讨论,但各情况的导数形式却是一致的,节省了不少编程精力啊,哈哈
                    int intSumCount = intKnownCount3 + intUnKnownCount3;

                    //常用数据准备
                    double dblA2 = dblSubDis[intSumCount] * dblSubDis[intSumCount];
                    double dblB2 = dblSubDis[intSumCount + 1] * dblSubDis[intSumCount + 1];

                    //开始计算系数值,由于将以下三个情况排列组合将有八种情况,因此按如下方式计算
                    if (pCorrCptsLt[intUnKnownCount3 + intKnownCount3].FrCpt.isCtrl == true && pCorrCptsLt[intUnKnownCount3 + intKnownCount3 + 1].FrCpt.isCtrl == true && pCorrCptsLt[intUnKnownCount3 + intKnownCount3 + 2].FrCpt.isCtrl == true)
                    {
                        intKnownCount3 += 1;
                        j -= 1;
                    }
                    else
                    {
                        double dblNewAngle = CGeoFunc.CalAngle_Counterclockwise(Xmix[2 * intSumCount + 0, 0], Xmix[2 * intSumCount + 1, 0],
                                                                                Xmix[2 * intSumCount + 2, 0], Xmix[2 * intSumCount + 3, 0],
                                                                                Xmix[2 * intSumCount + 4, 0], Xmix[2 * intSumCount + 5, 0]);
                        matl[intUnKnownXYLength + j, 0] = dblNewAngle - adblAngle0[intSumCount];   //图方便,顺便计算matl

                        int intPreTrueNum           = 0;
                        int intUnKnownCount3orginal = intUnKnownCount3;
                        int intKnownCount3orginal   = intKnownCount3;
                        if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3 + 0].FrCpt.isCtrl == false)
                        {
                            A[intUnKnownXYLength + j, 2 * intUnKnownCount3orginal + 0] = -(Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0]) / dblA2;
                            A[intUnKnownXYLength + j, 2 * intUnKnownCount3orginal + 1] = (Xmix[2 * intSumCount + 0, 0] - Xmix[2 * intSumCount + 2, 0]) / dblA2;

                            intUnKnownCount3 += 1;
                        }
                        else
                        {
                            intPreTrueNum  += 1;
                            intKnownCount3 += 1;
                        }

                        if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3orginal + 1].FrCpt.isCtrl == false)  //注意:对中间点的X、Y求导时,其导数由两部分组成,且为第二部分和第一部分的差
                        {
                            A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 2] = (Xmix[2 * intSumCount + 5, 0] - Xmix[2 * intSumCount + 3, 0]) / dblB2 - (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0]) / dblA2;
                            A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 3] = -(Xmix[2 * intSumCount + 4, 0] - Xmix[2 * intSumCount + 2, 0]) / dblB2 + (Xmix[2 * intSumCount + 0, 0] - Xmix[2 * intSumCount + 2, 0]) / dblA2;
                        }
                        else
                        {
                            intPreTrueNum += 1;
                        }
                        if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3orginal + 2].FrCpt.isCtrl == false)
                        {
                            A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 4] = -(Xmix[2 * intSumCount + 5, 0] - Xmix[2 * intSumCount + 3, 0]) / dblB2;
                            A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 5] = (Xmix[2 * intSumCount + 4, 0] - Xmix[2 * intSumCount + 2, 0]) / dblB2;
                        }
                    }
                    #region 用余弦值求夹角,无法判定角度方向,效果不好
                    //int intSumCount = intKnownCount3 + intUnKnownCount3;

                    ////常用数据准备
                    //double dblA2 = dblSubDis[intSumCount] * dblSubDis[intSumCount];
                    //double dblB2 = dblSubDis[intSumCount + 1] * dblSubDis[intSumCount + 1];
                    //double dblAB = dblSubDis[intSumCount] * dblSubDis[intSumCount + 1];
                    //double dblC2 = (Xmix[2 * intSumCount, 0] - Xmix[2 * intSumCount + 4, 0]) * (Xmix[2 * intSumCount, 0] - Xmix[2 * intSumCount + 4, 0])
                    //             + (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 5, 0]) * (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 5, 0]);
                    //double dblA2B2mC2 = dblA2 + dblB2 - dblC2;
                    //double dblpart = 1 / Math.Sqrt(4 * dblA2 * dblB2 - dblA2B2mC2 * dblA2B2mC2);

                    ////开始计算系数值,由于将以下三个情况排列组合将有八种情况,因此按如下方式计算
                    //if (pCorrCptsLt[intUnKnownCount3 + intKnownCount3].FrCpt.isCtrl == true && pCorrCptsLt[intUnKnownCount3 + intKnownCount3 + 1].FrCpt.isCtrl == true && pCorrCptsLt[intUnKnownCount3 + intKnownCount3 + 2].FrCpt.isCtrl == true)
                    //{
                    //    intKnownCount3 += 1;
                    //    j -= 1;
                    //}
                    //else
                    //{
                    //    matl[intUnKnownXYLength + j, 0] = Math.Acos(dblA2B2mC2 / 2 / dblAB) - adblAngle0[intSumCount];   //图方便,顺便计算matl

                    //    int intPreTrueNum = 0;
                    //    int intUnKnownCount3orginal = intUnKnownCount3;
                    //    int intKnownCount3orginal = intKnownCount3;
                    //    if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3 + 0].FrCpt.isCtrl == false)
                    //    {
                    //        A[intUnKnownXYLength + j, 2 * intUnKnownCount3orginal + 0] = dblpart * (2 * dblA2 * (Xmix[2 * intSumCount + 2, 0] - Xmix[2 * intSumCount + 4, 0]) + dblA2B2mC2 * (Xmix[2 * intSumCount + 0, 0] - Xmix[2 * intSumCount + 2, 0])) / dblA2;
                    //        A[intUnKnownXYLength + j, 2 * intUnKnownCount3orginal + 1] = dblpart * (2 * dblA2 * (Xmix[2 * intSumCount + 3, 0] - Xmix[2 * intSumCount + 5, 0]) + dblA2B2mC2 * (Xmix[2 * intSumCount + 1, 0] - Xmix[2 * intSumCount + 3, 0])) / dblA2;
                    //        intUnKnownCount3 += 1;
                    //    }
                    //    else
                    //    {
                    //        intPreTrueNum += 1;
                    //        intKnownCount3 += 1;
                    //    }

                    //    if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3orginal + 1].FrCpt.isCtrl == false)
                    //    {
                    //        A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 2] = dblpart * (2 * dblAB * (Xmix[2 * intSumCount + 4, 0] + Xmix[2 * intSumCount + 0, 0] - 2 * Xmix[2 * intSumCount + 2, 0]) + dblA2B2mC2 * (dblB2 * (Xmix[2 * intSumCount + 2, 0] - Xmix[2 * intSumCount + 0, 0]) + dblA2 * (Xmix[2 * intSumCount + 2, 0] - Xmix[2 * intSumCount + 4, 0]))) / dblAB;
                    //        A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 3] = dblpart * (2 * dblAB * (Xmix[2 * intSumCount + 5, 0] + Xmix[2 * intSumCount + 1, 0] - 2 * Xmix[2 * intSumCount + 3, 0]) + dblA2B2mC2 * (dblB2 * (Xmix[2 * intSumCount + 3, 0] - Xmix[2 * intSumCount + 1, 0]) + dblA2 * (Xmix[2 * intSumCount + 3, 0] - Xmix[2 * intSumCount + 5, 0]))) / dblAB;
                    //    }
                    //    else
                    //    {
                    //        intPreTrueNum += 1;
                    //    }
                    //    if (pCorrCptsLt[intUnKnownCount3orginal + intKnownCount3orginal + 2].FrCpt.isCtrl == false)
                    //    {
                    //        A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 4] = dblpart * (2 * dblB2 * (Xmix[2 * intSumCount + 2, 0] - Xmix[2 * intSumCount + 0, 0]) + dblA2B2mC2 * (Xmix[2 * intSumCount + 4, 0] - Xmix[2 * intSumCount + 2, 0])) / dblB2;
                    //        A[intUnKnownXYLength + j, 2 * (intUnKnownCount3orginal - intPreTrueNum) + 5] = dblpart * (2 * dblA2 * (Xmix[2 * intSumCount + 3, 0] - Xmix[2 * intSumCount + 1, 0]) + dblA2B2mC2 * (Xmix[2 * intSumCount + 5, 0] - Xmix[2 * intSumCount + 3, 0])) / dblB2;
                    //    }
                    //}
                    #endregion
                }



                //记录一个值以协助判断是否可以退出循环
                double dblLast = XA[0, 0];

                ////计算新的近似值
                //SaveFileDialog SFD = new SaveFileDialog();
                //SFD.ShowDialog();
                //     CHelpFuncExcel.ExportDataToExcelA(A, "maxA", SFD.FileName);
                //CHelpFuncExcel.ExportDataToExcelP(P, "maxP", SFD.FileName);
                //CHelpFuncExcel.ExportDataToExcel2(matl, "maxmatl", SFD.FileName);



                //VBMatrix Temp =A.Trans ()  * P * A;
                //Temp.InvertGaussJordan();
                //XA -= Temp * A.Transpose() * P * matl;

                XA -= InvAtPAAtPmatl(A, P, matl);

                //更新Xmix和matl
                int intKnownCount4 = 0;
                for (int i = 0; i < intUnknownNum; i++)
                {
                    if ((i + intKnownCount4) != intKnownLocationLt[intKnownCount4])
                    {
                        Xmix[(i + intKnownCount4) * 2, 0]     = XA[i * 2, 0];
                        Xmix[(i + intKnownCount4) * 2 + 1, 0] = XA[i * 2 + 1, 0];
                    }
                    else
                    {
                        intKnownCount4 += 1;
                        i -= 1;
                    }
                }

                dblJudge           = Math.Abs(dblLast - XA[0, 0]);
                intIterativeCount += 1;
                if (intIterativeCount >= 10000)
                {
                    break;
                }
                if (dblOldJudege == dblJudge)
                {
                    break;
                }

                dblOldJudege = dblJudge;
            } while (dblJudge > dblTX);

            //生成目标线段
            List <CPoint> CTargetPtLt = new List <CPoint>();
            for (int i = 0; i < intSumNum; i++)
            {
                CPoint cpt = new CPoint(i);
                cpt.X = Xmix[2 * i, 0];
                cpt.Y = Xmix[2 * i + 1, 0];
                CTargetPtLt.Add(cpt);
            }
            CPolyline cpl = new CPolyline(0, CTargetPtLt);
            return(cpl);
        }