コード例 #1
0
        private void btnDivideByDP_Click(object sender, EventArgs e)
        {
            CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize;

            _pDPSimplify = new CDPSimplify(ParameterInitialize);
            isDivideByDP = true;
        }
コード例 #2
0
        //    public static Paths ClipOneComponent_BufferDilateErode_Paths(CPolygon cpg,
        //        double dblGrow, double dblDilation, double dblErosion,
        //        Paths clipPaths, double dblFclipper, string strBufferStyle = "Miter", double dblMiterLimit = 2)
        //    {
        //        var ExteriorOffsetPaths = clipperMethods.DilateErodeOffsetCpgExterior_Paths
        //(cpg, dblGrow, dblDilation, dblErosion, strBufferStyle, dblMiterLimit);
        //        var clippedPaths = clipperMethods.Clip_Paths(ExteriorOffsetPaths, true, clipPaths, true, ClipType.ctIntersection);

        //        return clippedPaths;
        //    }


        public static IEnumerable <CPolygon> DilateErodeOffsetSimplifyOneComponent(CPolygon cpg,
                                                                                   double dblGrow, double dblDilation, double dblErosion, double dblEpsilon,
                                                                                   string strSimplification, bool blnReverse, string strBufferStyle = "Miter", double dblMiterLimit = 2)
        {
            cpg.JudgeAndFormCEdgeLt();
            //cpg.FormCEdgeLt();

            var ExteriorOffsetPolyTree = clipperMethods.DilateErodeOffsetCpgExterior_PolyTree
                                             (cpg, dblGrow, dblDilation, dblErosion, strBufferStyle, dblMiterLimit);

            foreach (var OffsetCpg in clipperMethods.GenerateCpgEbByPolyTree(ExteriorOffsetPolyTree, cpg.ID, blnReverse))
            {
                var simplifiedcpg = CDPSimplify.SimplifyCpgAccordExistEdges(OffsetCpg,
                                                                            cpg.CEdgeLt, strSimplification, 1.5 * dblEpsilon);
                //var simplifiedcpg = OffsetCpg;
                yield return(simplifiedcpg);
            }
        }
コード例 #3
0
        //Stopwatch _pstopwatch = new Stopwatch();
        #region Output
        public List <CPolyline> Output(double dblT, double dblS, IRgbColor olIRgbColor, IRgbColor nlIRgbColor, double dblExtraX = 300, double dblExtraY = 300)
        {
            var strTS = _ParameterInitialize.strTS;
            var dblt  = dblT;
            var dbls  = dblS;

            if (strTS == "vario_vario")
            {
            }
            else if (strTS == "vario_separate")
            {
                dbls = SetForSeparate(dblS, 0.5);
            }
            else if (strTS == "separate_vario")
            {
                dblt = SetForSeparate(dblT, 0.5);
            }
            else //if (strTS == "separate_separate")
            {
                dblt = SetForSeparate(dblT, 0.5);
                dbls = SetForSeparate(dblS, 0.5);
            }

            double dblRTime = CGeoFunc.GetInbetweenDbl(olIRgbColor.Red, nlIRgbColor.Red, dblt);
            double dblGTime = CGeoFunc.GetInbetweenDbl(olIRgbColor.Green, nlIRgbColor.Green, dblt);
            double dblBTime = CGeoFunc.GetInbetweenDbl(olIRgbColor.Blue, nlIRgbColor.Blue, dblt);
            int    intRTS   = Convert.ToInt32(CGeoFunc.GetInbetweenDbl(dblRTime, CGeoFunc.GetInbetweenDbl(dblRTime, 255, 0.8), dbls));
            int    intGTS   = Convert.ToInt32(CGeoFunc.GetInbetweenDbl(dblGTime, CGeoFunc.GetInbetweenDbl(dblGTime, 255, 0.8), dbls));
            int    intBTS   = Convert.ToInt32(CGeoFunc.GetInbetweenDbl(dblBTime, CGeoFunc.GetInbetweenDbl(dblBTime, 255, 0.8), dbls));

            var olcpl = _OLCplLt[0];
            var oscpl = _OSCplLt[0];
            var nlcpl = _NLCplLt[0];
            var nscpl = _NSCplLt[0];

            var olcplmoved = olcpl;
            var oscplmoved = oscpl.Move(0, -dblExtraY);
            var nlcplmoved = nlcpl.Move(-dblExtraX, 0);
            var nscplmoved = nscpl.Move(-dblExtraX, -dblExtraY);


            var InterLargerCpl  = CGeoFunc.GetInbetweenCpl(olcplmoved, nlcplmoved, dblt);
            var InterSmallerCpl = CGeoFunc.GetInbetweenCpl(oscplmoved, nscplmoved, dblt);
            var InterCpl        = CGeoFunc.GetInbetweenCpl(InterLargerCpl, InterSmallerCpl, dbls);

            //var simplifedcpllt = CDPSimplify.DPSimplify(CHelpFunc.MakeLt(InterCpl), dblThresholdDis: 300000 * CConstants.dblVerySmallCoord);
            int intPtNum       = olcpl.CptLt.Count - 1;
            var simplifedcpllt = CDPSimplify.DPSimplify(CHelpFunc.MakeLt(InterCpl), dblRemainPoints: intPtNum * ((1 - dbls) * 3 + 1) / 4);

            //var simplifedcptlt = CImaiIriSimplify.ImaiIriSimplify(InterCpl.CptLt, 100000 * CConstants.dblVerySmallCoord).ToList();
            //CDPSimplify.dp
            //CSaveFeature.SaveCpl(InterLargerCpl, "InterLargerCpl_" + dblT.ToString() + " " + dblS.ToString());
            //CSaveFeature.SaveCpl(InterSmallerCpl, "InterSmallerCpl_" + dblT.ToString() + " " + dblS.ToString());
            //CSaveFeature.SaveCpl(InterCpl, "InterCpl_" + dblT.ToString() + " " + dblS.ToString());


            var dblBaseX      = dblT * dblExtraX;
            var dblBaseY      = dblS * dblExtraY;
            var movedInterCpl = new CPolyline(0, CGeoFunc.MoveCptEb(simplifedcpllt[0].CptLt, dblBaseX, dblBaseY).ToList());

            //CSaveFeature.SaveCpl(movedInterCpl, dblT.ToString() + " " + dblS.ToString());
            var movedInterCpg = new CPolygon(movedInterCpl.CptLt);

            CSaveFeature.SaveCpg(movedInterCpg, dblT.ToString() + " " + dblS.ToString(), intRed: intRTS, intGreen: intGTS, intBlue: intBTS);


            var cpbLt = new List <CPolyBase>
            {
                movedInterCpl
            };

            CCreatePointLayer.SavePointLayer(cpbLt, dblT.ToString() + " " + dblS.ToString(), 3);

            return(CHelpFunc.MakeLt(movedInterCpl));



            //var a00 = (1 - x) * (1 - y);    //lower left
            //var a10 = x * (1 - y);          //lower right
            //var a01 = (1 - x) * y;          //upper left
            //var a11 = x * y;                //upper right

            ////var dblDiffX = _NSCplLt[0].CptLt[0].X - _OLCplLt[0].CptLt[0].X;
            ////var dblDiffY = _NSCplLt[0].CptLt[0].Y - _OLCplLt[0].CptLt[0].Y;

            //var dblDiffX = 300;
            //var dblDiffY = 400;

            ////var dblDiffXPlus= dblDiffX+

            //var dblBaseX = dblT * dblDiffX;
            //var dblBaseY = dblS * dblDiffY;
            //var newCplLt = new List<CPolyline>(_OLCplLt.Count);
            //for (int i = 0; i < _OLCplLt.Count; i++)
            //{
            //    var olcpl = _OLCplLt[i];
            //    var oscpl = _OSCplLt[i];
            //    var nlcpl = _NLCplLt[i];
            //    var nscpl = _NSCplLt[i];

            //    var newcptlt = new List<CPoint>(olcpl.CptLt.Count);
            //    for (int j = 0; j < olcpl.CptLt.Count; j++)
            //    {
            //        var dblX = BilinearInterpolateUnit(a00, a10, a01, a11,
            //            olcpl.CptLt[j].X - olcpl.CptLt[j].X, nlcpl.CptLt[j].X - olcpl.CptLt[j].X - dblDiffX,
            //            oscpl.CptLt[j].X - olcpl.CptLt[j].X, nscpl.CptLt[j].X - olcpl.CptLt[j].X - dblDiffX);
            //        var dblY = BilinearInterpolateUnit(a00, a10, a01, a11,
            //            olcpl.CptLt[j].Y - olcpl.CptLt[j].Y, nlcpl.CptLt[j].Y - olcpl.CptLt[j].Y,
            //            oscpl.CptLt[j].Y - olcpl.CptLt[j].Y - dblDiffY, nscpl.CptLt[j].Y - olcpl.CptLt[j].Y - dblDiffY);

            //        newcptlt.Add(new CPoint(j, dblX + dblBaseX + olcpl.CptLt[j].X, dblY + dblBaseY + olcpl.CptLt[j].Y));
            //    }

            //    CImaiIriSimplify.ImaiIriSimplify(newcptlt, CConstants.dblVerySmallCoord);

            //    newCplLt.Add(new CPolyline(i, newcptlt));
            //}

            //CSaveFeature.SaveCplEb(newCplLt, dblT.ToString() + " " + dblS.ToString());
        }