Esempio n. 1
0
        private void btnSimplify_Click(object sender, EventArgs e)
        {
            if (isDivideByDP == false)
            {
                MessageBox.Show("please press DivideByDP first!");
                return;
            }

            double dblParameter = Convert.ToDouble(txtParameter.Text);

            if (rdoDistance.Checked == true)
            {
                _pDPSimplify.DPSimplify(dblParameter, -1, -1, -1);
            }
            else if (rdoRemainRatio.Checked == true)
            {
                _pDPSimplify.DPSimplify(-1, dblParameter, -1, -1);
            }
            else if (rdoRemainNum.Checked == true)
            {
                _pDPSimplify.DPSimplify(-1, -1, dblParameter, -1);
            }

            else if (rdoDeleteNum.Checked == true)
            {
                _pDPSimplify.DPSimplify(-1, -1, -1, dblParameter);
            }


            //we are saving memory here, one can do better
            var CResultsPlLt = _pDPSimplify.ParameterResult.CResultPlLt;

            CSaveFeature.SaveCplEb(CResultsPlLt, "DPSimplify_" + dblParameter.ToString());
        }
Esempio n. 2
0
        public void DisplayAtBd(double dblProp)
        {
            var pParameterInitialize = _ParameterInitialize;
            var 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();

            int intRGB         = Convert.ToInt32(dblProp * 255);
            var pStopwatchSave = Stopwatch.StartNew();

            CSaveFeature.SaveCplEb(fadeddisplayCplLt, dblProp.ToString() + "_Lower", intRed: intRGB, intGreen: intRGB, intBlue: intRGB, dblWidth: 0.5);
            CSaveFeature.SaveCplEb(normaldisplayCplLt, dblProp.ToString() + "_Higher", dblWidth: 1.2);
            pStopwatchSave.Stop();

            CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds, "Generate", pStopwatchSave.ElapsedMilliseconds, "ToShape");
        }
        public void STS()
        {
            var pParameterInitialize = _ParameterInitialize;
            var pAxMapControl        = pParameterInitialize.pAxMapControl;


            pAxMapControl.Dock   = DockStyle.None;
            pAxMapControl.Width  = 310;
            pAxMapControl.Height = 310;
            double dblWHRation = pAxMapControl.Width / pAxMapControl.Height;

            double dblCenterX = 318;
            double dblCenterY = 345;
            //IPoint cptMC = new PointClass();
            //cptMC.PutCoords(170, 180);

            IEnvelope newEnvelope = new EnvelopeClass();
            double    dblRatio    = 1;

            newEnvelope.XMin = dblCenterX - pAxMapControl.Width / dblRatio;
            newEnvelope.XMax = dblCenterX + pAxMapControl.Width / dblRatio;
            newEnvelope.YMin = dblCenterY - pAxMapControl.Height / dblRatio;
            newEnvelope.YMax = dblCenterY + pAxMapControl.Height / dblRatio;
            //newEnvelope.XMin = dblCenterX - pAxMapControl.Width ;
            //newEnvelope.XMax = dblCenterX + pAxMapControl.Width ;
            //newEnvelope.YMin = dblCenterY - pAxMapControl.Height ;
            //newEnvelope.YMax = dblCenterY + pAxMapControl.Height;
            pAxMapControl.Extent = newEnvelope;

            //pAxMapControl.MapScale = 1 / 6000000;
            //pAxMapControl.CenterAt(cptMC);
            //Old Larger-scale, Old Smaller-scale, New Larger-scale, New Smaller-scale
            _OLCplLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList();
            _OSCplLt = this.ObjCGeoLtLt[1].Select(cgeo => cgeo as CPolyline).ToList();
            _NLCplLt = this.ObjCGeoLtLt[2].Select(cgeo => cgeo as CPolyline).ToList();
            _NSCplLt = this.ObjCGeoLtLt[3].Select(cgeo => cgeo as CPolyline).ToList();


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

            double dblXAxisStart = 50;
            double dblXAxisEnd   = 620;
            double dblYAxisStart = 70;
            double dblYAxisEnd   = 620;

            double dblScaleMidY = (olcpl.CptLt[0].Y + oscpl.CptLt[0].Y) / 2;
            double dblTimeMidX  = (olcpl.CptLt[4].X + nlcpl.CptLt[4].X) / 2;

            var strTS             = _ParameterInitialize.strTS;
            var LinkCplLt         = new List <CPolyline>();
            var SeparatorCplLt    = new List <CPolyline>();
            var scaleSeparatorCpl = new CPolyline(
                new CPoint(dblXAxisStart + 5, dblScaleMidY), new CPoint(dblXAxisEnd - 5, dblScaleMidY));
            var timeSeparatorCpl = new CPolyline(
                new CPoint(dblTimeMidX, dblYAxisStart + 5), new CPoint(dblTimeMidX, dblYAxisEnd - 5));

            if (strTS == "vario_vario")
            {
                //time transition
                LinkCplLt.AddRange(GenerateVarioLinkCplEb(olcpl, nlcpl, oscpl, nscpl, 4, 12));
                //scale transition
                LinkCplLt.AddRange(GenerateVarioLinkCplEb(olcpl, oscpl, nlcpl, nscpl, 0, 8));
            }
            else if (strTS == "vario_separate")
            {
                //time transition
                LinkCplLt.AddRange(GenerateVarioLinkCplEb(olcpl, nlcpl, oscpl, nscpl, 4, 12));
                //scale transition
                LinkCplLt.AddRange(GenerateSeparateLinkCplEb(olcpl, oscpl, nlcpl, nscpl, 0, 8, dblScaleMidY, "Scale"));

                SeparatorCplLt.Add(scaleSeparatorCpl);
            }
            else if (strTS == "separate_vario")
            {
                //time transition
                LinkCplLt.AddRange(GenerateSeparateLinkCplEb(olcpl, nlcpl, oscpl, nscpl, 4, 12, dblTimeMidX, "Time"));
                //scale transition
                LinkCplLt.AddRange(GenerateVarioLinkCplEb(olcpl, oscpl, nlcpl, nscpl, 0, 8));

                SeparatorCplLt.Add(timeSeparatorCpl);
            }
            else //if (strTS == "separate_separate")
            {
                //time transition
                LinkCplLt.AddRange(GenerateSeparateLinkCplEb(olcpl, nlcpl, oscpl, nscpl, 4, 12, dblTimeMidX, "Time"));
                //scale transition
                LinkCplLt.AddRange(GenerateSeparateLinkCplEb(olcpl, oscpl, nlcpl, nscpl, 0, 8, dblScaleMidY, "Scale"));

                SeparatorCplLt.Add(scaleSeparatorCpl);
                SeparatorCplLt.Add(timeSeparatorCpl);
            }


            CSaveFeature.SaveCplEb(SeparatorCplLt, strTS + "_Separator", intRed: 204, intGreen: 204, intBlue: 204,
                                   pesriSimpleLineStyle: esriSimpleLineStyle.esriSLSDot);
            //pesriSimpleLineStyle: esriSimpleLineStyle.esriSLSDash);
            CSaveFeature.SaveCplEb(LinkCplLt, strTS + "_Link", intRed: 150, intGreen: 150, intBlue: 150);



            double dblXExtra   = 400;
            double dblYExtra   = 400;
            var    olIRgbColor = CHelpFunc.GenerateIRgbColor(230, 97, 1);
            var    nlIRgbColor = CHelpFunc.GenerateIRgbColor(94, 60, 153);


            var cpllt00 = Output(0.00, 0.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt10 = Output(0.33, 0.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt20 = Output(0.67, 0.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt30 = Output(1.00, 0.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);

            var cpllt01 = Output(0.00, 0.33, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt11 = Output(0.33, 0.33, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt21 = Output(0.67, 0.33, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt31 = Output(1.00, 0.33, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);

            var cpllt02 = Output(0.00, 0.67, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt12 = Output(0.33, 0.67, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt22 = Output(0.67, 0.67, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt32 = Output(1.00, 0.67, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);

            var cpllt03 = Output(0.00, 1.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt13 = Output(0.33, 1.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt23 = Output(0.67, 1.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);
            var cpllt33 = Output(1.00, 1.00, olIRgbColor, nlIRgbColor, dblXExtra, dblYExtra);

            double dblMinY00 = cpllt00[0].CptLt.Min(cpt => cpt.Y);
            double dblMinY01 = cpllt01[0].CptLt.Min(cpt => cpt.Y);
            double dblMinY02 = cpllt02[0].CptLt.Min(cpt => cpt.Y);
            double dblMinY03 = cpllt03[0].CptLt.Min(cpt => cpt.Y);

            double dblMaxY00 = cpllt00[0].CptLt.Max(cpt => cpt.Y);
            double dblMaxY01 = cpllt01[0].CptLt.Max(cpt => cpt.Y);
            double dblMaxY02 = cpllt02[0].CptLt.Max(cpt => cpt.Y);
            double dblMaxY03 = cpllt03[0].CptLt.Max(cpt => cpt.Y);

            double dblMidY00 = (dblMinY00 + dblMaxY00) / 2;
            double dblMidY01 = (dblMinY01 + dblMaxY01) / 2;
            double dblMidY02 = (dblMinY02 + dblMaxY02) / 2;
            double dblMidY03 = (dblMinY03 + dblMaxY03) / 2;


            double dblMinX00 = cpllt00[0].CptLt.Min(cpt => cpt.X);
            double dblMinX10 = cpllt10[0].CptLt.Min(cpt => cpt.X);
            double dblMinX20 = cpllt20[0].CptLt.Min(cpt => cpt.X);
            double dblMinX30 = cpllt30[0].CptLt.Min(cpt => cpt.X);

            double dblMaxX00 = cpllt00[0].CptLt.Max(cpt => cpt.X);
            double dblMaxX10 = cpllt10[0].CptLt.Max(cpt => cpt.X);
            double dblMaxX20 = cpllt20[0].CptLt.Max(cpt => cpt.X);
            double dblMaxX30 = cpllt30[0].CptLt.Max(cpt => cpt.X);

            double dblMidX00 = (dblMinX00 + dblMaxX00) / 2;
            double dblMidX10 = (dblMinX10 + dblMaxX10) / 2;
            double dblMidX20 = (dblMinX20 + dblMaxX20) / 2;
            double dblMidX30 = (dblMinX30 + dblMaxX30) / 2;



            double dblTextSize = 8;

            CDrawInActiveView.DrawArrow(pAxMapControl.ActiveView,
                                        new CPoint(dblXAxisStart - 30, dblYAxisStart), new CPoint(dblXAxisEnd, dblYAxisStart), 6, 5); //x arrow; horizontal
            CDrawInActiveView.DrawArrow(pAxMapControl.ActiveView,
                                        new CPoint(dblXAxisStart, dblYAxisStart - 30), new CPoint(dblXAxisStart, dblYAxisEnd), 6, 5); //y arrow; vertical
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "Generalize", dblXAxisStart + 20, dblYAxisEnd + 10, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "Time", dblXAxisEnd - 20, dblYAxisStart - 25, dblTextSize);

            //scales
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "", dblXAxisStart - 40, dblMidY00 - dblTextSize / 2, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "", dblXAxisStart - 40, dblMidY01 - dblTextSize / 2, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "", dblXAxisStart - 40, dblMidY02 - dblTextSize / 2, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "", dblXAxisStart - 40, dblMidY03 - dblTextSize / 2, dblTextSize);

            //times
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "2015", dblMidX00, dblYAxisStart - 30, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "2016", dblMidX10, dblYAxisStart - 30, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "2017", dblMidX20, dblYAxisStart - 30, dblTextSize);
            CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "2018", dblMidX30, dblYAxisStart - 30, dblTextSize);

            var pExportActiveViewCS_Net = new MorphingClass.CCommon.ExportActiveViewCS_Net();

            pExportActiveViewCS_Net.ExportActiveViewParameterized(300, 1, "EMF",
                                                                  pParameterInitialize.strMxdPathBackSlash, strTS, true);


            ////inputs
            //CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "input", dblXAxisStart + 30, dblYAxisStart + 15, dblTextSize);
            //CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "input", dblXAxisStart + 30, oscpl.CptLt[0].Y + 40, dblTextSize);
            //CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "input", nlcpl.CptLt[5].X + 10, dblYAxisStart + 15, dblTextSize);
            //CDrawInActiveView.DrawTextMarker(pAxMapControl.ActiveView, "input", nlcpl.CptLt[5].X + 10, oscpl.CptLt[0].Y + 40, dblTextSize);



            //Output(0.3,0);
            //Output(0, 0.6);
            //Output(0.7, 0.2);
            //Output(0.6, 0.9);
        }